| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.22 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 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 | 12 | namespace FireBox\Core |
| @@ -16,12 +16,14 @@ | ||
| 16 | 16 | exit; // Exit if accessed directly. |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | use FPFramework\Framework; |
| 20 | + use FPFramework\Admin\Includes\MetaboxManager; | |
| 20 | 21 | use FPFramework\Base\Renderer; |
| 21 | 22 | |
| 22 | 23 | use FireBox\Core\Admin\Admin; |
| 23 | 24 | use FireBox\Core\Admin\Includes\Library; |
| 25 | + use FireBox\Core\Admin\Includes\Metaboxes as PluginMetaboxes; | |
| 24 | 26 | use FireBox\Core\Admin\Includes\Cpts\Cpts; |
| 25 | 27 | use FireBox\Core\Admin\Menu\PluginMenu; |
| 26 | 28 | use FireBox\Core\FB\Box; |
| 27 | 29 | use FireBox\Core\FB\Boxes; |
| @@ -72,8 +74,22 @@ | ||
| 72 | 74 | */ |
| 73 | 75 | public $renderer; |
| 74 | 76 | |
| 75 | 77 | /** |
| 78 | + * Plugin Metaboxes | |
| 79 | + * | |
| 80 | + * @var Metaboxes | |
| 81 | + */ | |
| 82 | + public $plugin_metaboxes; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * Metaboxes Manager | |
| 86 | + * | |
| 87 | + * @var MetaboxManager | |
| 88 | + */ | |
| 89 | + public $metaboxes_manager; | |
| 90 | + | |
| 91 | + /** | |
| 76 | 92 | * Box |
| 77 | 93 | * |
| 78 | 94 | * @var Box |
| 79 | 95 | */ |
| @@ -107,8 +123,15 @@ | ||
| 107 | 123 | */ |
| 108 | 124 | public $blocks; |
| 109 | 125 | |
| 110 | 126 | /** |
| 127 | + * Widgets | |
| 128 | + * | |
| 129 | + * @var Widgets | |
| 130 | + */ | |
| 131 | + public $widgets; | |
| 132 | + | |
| 133 | + /** | |
| 111 | 134 | * Shortcodes |
| 112 | 135 | * |
| 113 | 136 | * @var Shortcodes |
| 114 | 137 | */ |
| @@ -127,16 +150,22 @@ | ||
| 127 | 150 | * @var Log |
| 128 | 151 | */ |
| 129 | 152 | public $log; |
| 130 | 153 | |
| 131 | - | |
| 154 | + /** | |
| 155 | + * PHP Scripts | |
| 156 | + * | |
| 157 | + * @var PHPScripts | |
| 158 | + */ | |
| 159 | + public $phpscripts; | |
| 160 | + #PRO-END | |
| 132 | 161 | |
| 133 | 162 | /** |
| 134 | - * Translations cache | |
| 163 | + * Translations | |
| 135 | 164 | * |
| 136 | - * @var Libs\Translations | |
| 165 | + * @var Translations | |
| 137 | 166 | */ |
| 138 | - private $translations_cache; | |
| 167 | + public $translations; | |
| 139 | 168 | |
| 140 | 169 | /** |
| 141 | 170 | * Tables used by Hook |
| 142 | 171 | * |
| @@ -200,13 +229,11 @@ | ||
| 200 | 229 | * @return void |
| 201 | 230 | */ |
| 202 | 231 | public function admin_init() |
| 203 | 232 | { |
| 233 | + | |
| 204 | 234 | new \FPFramework\Admin\Includes\UpgradeProModal($this->plugin_slug, $this->plugin_name); |
| 205 | - | |
| 206 | 235 | |
| 207 | - new \FireBox\Core\Admin\Includes\UpgradeToPlanModal(); | |
| 208 | - | |
| 209 | 236 | |
| 210 | 237 | // Admin |
| 211 | 238 | $this->admin = new Admin(); |
| 212 | 239 | |
| @@ -211,8 +238,13 @@ | ||
| 211 | 238 | $this->admin = new Admin(); |
| 212 | 239 | |
| 213 | 240 | // Library |
| 214 | 241 | $this->library = new Library(); |
| 242 | + | |
| 243 | + // Metaboxes | |
| 244 | + $this->metaboxes_manager = new MetaboxManager(); | |
| 245 | + $this->plugin_metaboxes = new PluginMetaboxes(); | |
| 246 | + $this->metaboxes_manager->init(); | |
| 215 | 247 | } |
| 216 | 248 | |
| 217 | 249 | /** |
| 218 | 250 | * Runs at the start of the Plugin |
| @@ -220,12 +252,16 @@ | ||
| 220 | 252 | * @return void |
| 221 | 253 | */ |
| 222 | 254 | public function preFlight() |
| 223 | 255 | { |
| 256 | + // set translations | |
| 257 | + $this->translations = new Libs\Translations(); | |
| 258 | + | |
| 224 | 259 | // loads text domain |
| 225 | 260 | add_action('plugins_loaded', [$this, 'loadTextdomain'], 10); |
| 226 | 261 | |
| 227 | - | |
| 262 | + // Widgets | |
| 263 | + $this->widgets = new Widgets(); | |
| 228 | 264 | } |
| 229 | 265 | |
| 230 | 266 | /** |
| 231 | 267 | * Ensures only one instance of the plugin class is loaded or can be loaded |
| @@ -269,18 +305,16 @@ | ||
| 269 | 305 | |
| 270 | 306 | // Log |
| 271 | 307 | $this->log = new Log(); |
| 272 | 308 | |
| 273 | - new API\API(); | |
| 309 | + // REST API | |
| 310 | + new RESTAPI(); | |
| 274 | 311 | |
| 275 | 312 | |
| 276 | 313 | |
| 277 | - // Register Custom Post Type | |
| 278 | - new \FireBox\Core\Admin\Includes\Cpts\Firebox(); | |
| 279 | - | |
| 280 | - // Keep the campaign-derived caches (box list, "session conditions in use" | |
| 281 | - // flag) in sync with campaign writes | |
| 282 | - \FireBox\Core\Helpers\BoxHelper::registerCacheInvalidation(); | |
| 314 | + // Custom Post Types | |
| 315 | + $this->cpts = new Cpts(); | |
| 316 | + $this->cpts->init(); | |
| 283 | 317 | |
| 284 | 318 | // Renderer |
| 285 | 319 | $this->renderer = new Renderer(FBOX_LAYOUTS_DIR); |
| 286 | 320 | |
| @@ -303,16 +337,8 @@ | ||
| 303 | 337 | new \FireBox\Core\Analytics\Ajax(); |
| 304 | 338 | |
| 305 | 339 | // Track |
| 306 | 340 | $this->track = new Track(); |
| 307 | - | |
| 308 | - | |
| 309 | - | |
| 310 | - // Usage Tracking | |
| 311 | - $usageTracking = new \FireBox\Core\UsageTracking\SendUsage(); | |
| 312 | - $usageTracking->maybeStart(); | |
| 313 | - | |
| 314 | - new FB\Meta(); | |
| 315 | 341 | } |
| 316 | 342 | |
| 317 | 343 | /** |
| 318 | 344 | * Initializes FireBox Plugin with the required components |
| @@ -331,8 +357,29 @@ | ||
| 331 | 357 | new Frontend(); |
| 332 | 358 | } |
| 333 | 359 | |
| 334 | 360 | /** |
| 361 | + * Append our Plugin translation class to the set of translation classes of the Framework | |
| 362 | + * | |
| 363 | + * @param array | |
| 364 | + * | |
| 365 | + * @return array | |
| 366 | + */ | |
| 367 | + public function setTranslationsPaths($paths) | |
| 368 | + { | |
| 369 | + if (isset($paths['firebox'])) | |
| 370 | + { | |
| 371 | + return $paths; | |
| 372 | + } | |
| 373 | + | |
| 374 | + $paths['firebox'] = [ | |
| 375 | + 'prefix' => 'FB_' | |
| 376 | + ]; | |
| 377 | + | |
| 378 | + return $paths; | |
| 379 | + } | |
| 380 | + | |
| 381 | + /** | |
| 335 | 382 | * Retrieves the translation of $text |
| 336 | 383 | * |
| 337 | 384 | * @param string $text |
| 338 | 385 | * @param string $fallback |
| @@ -340,16 +387,9 @@ | ||
| 340 | 387 | * @return string |
| 341 | 388 | */ |
| 342 | 389 | public function _($text, $fallback = null) |
| 343 | 390 | { |
| 344 | - // check if translations instance exists | |
| 345 | - if (!isset($this->translations_cache)) | |
| 346 | - { | |
| 347 | - // set translations | |
| 348 | - $this->translations_cache = new Libs\Translations(); | |
| 349 | - } | |
| 350 | - | |
| 351 | - return $this->translations_cache->_($text, $fallback); | |
| 391 | + return $this->translations->_($text, $fallback); | |
| 352 | 392 | } |
| 353 | 393 | } |
| 354 | 394 | } |
| 355 | 395 | |