| @@ -1,25 +1,23 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.2 Free | |
| 4 | + * @version 2.0.12 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 | * Plugin Name: FireBox |
| 12 | 12 | * Plugin URI: https://www.fireplugins.com/firebox |
| 13 | 13 | * Description: WordPress Popup and leads generation plugin that converts visitors into subscribers & customers. |
| 14 | - * Version: 1.0.2 | |
| 15 | - * Stable tag: 1.0.2 | |
| 16 | - * Author: FirePlugins | |
| 14 | + * Version: 2.0.12 | |
| 15 | + * Author: FirePlugins Popup Plugin Team | |
| 17 | 16 | * Author URI: https://www.fireplugins.com/ |
| 18 | 17 | * Text Domain: firebox |
| 19 | 18 | * Domain Path: /languages |
| 20 | 19 | * Requires at least: 5.4 |
| 21 | - * Tested up to: 5.7 | |
| 22 | 20 | * Requires PHP: 5.6.40 |
| 23 | 21 | * License: GNU General Public License v2.0+ |
| 24 | 22 | * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 25 | 23 | */ |
| @@ -29,13 +27,8 @@ | ||
| 29 | 27 | { |
| 30 | 28 | exit; // Exit if accessed directly. |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | -if (!session_id() && !headers_sent()) | |
| 34 | -{ | |
| 35 | - session_start(); | |
| 36 | -} | |
| 37 | - | |
| 38 | 31 | // Load Framework |
| 39 | 32 | require_once dirname(__FILE__) . '/Inc/Framework/init.php'; |
| 40 | 33 | |
| 41 | 34 | // Plugin Autoloader |
| @@ -45,9 +38,9 @@ | ||
| 45 | 38 | |
| 46 | 39 | // Plugin version |
| 47 | 40 | if (!defined('FBOX_VERSION')) |
| 48 | 41 | { |
| 49 | - define('FBOX_VERSION', '1.0.2'); | |
| 42 | + define('FBOX_VERSION', '2.0.12'); | |
| 50 | 43 | } |
| 51 | 44 | |
| 52 | 45 | // Plugin License type (free/pro) |
| 53 | 46 | if (!defined('FBOX_LICENSE_TYPE')) |
| @@ -75,10 +68,9 @@ | ||
| 75 | 68 | |
| 76 | 69 | // Plugin Documentation URL |
| 77 | 70 | if (!defined('FBOX_DOC_URL')) |
| 78 | 71 | { |
| 79 | - // TODO: define final URL | |
| 80 | - define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox'); | |
| 72 | + define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox/'); | |
| 81 | 73 | } |
| 82 | 74 | |
| 83 | 75 | // Plugin Folder Path |
| 84 | 76 | if (!defined('FBOX_PLUGIN_DIR')) |
| @@ -88,21 +80,21 @@ | ||
| 88 | 80 | |
| 89 | 81 | // Layouts Folder Path |
| 90 | 82 | if (!defined('FBOX_LAYOUTS_DIR')) |
| 91 | 83 | { |
| 92 | - define('FBOX_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/'); | |
| 84 | + define('FBOX_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/'); | |
| 93 | 85 | } |
| 94 | 86 | |
| 95 | 87 | // Admin Layouts Folder Path |
| 96 | 88 | if (!defined('FBOX_ADMIN_LAYOUTS_DIR')) |
| 97 | 89 | { |
| 98 | - define('FBOX_ADMIN_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/admin/'); | |
| 90 | + define('FBOX_ADMIN_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/admin/'); | |
| 99 | 91 | } |
| 100 | 92 | |
| 101 | 93 | // Public Layouts Folder Path |
| 102 | 94 | if (!defined('FBOX_PUBLIC_LAYOUTS_DIR')) |
| 103 | 95 | { |
| 104 | - define('FBOX_PUBLIC_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/public/'); | |
| 96 | + define('FBOX_PUBLIC_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/public/'); | |
| 105 | 97 | } |
| 106 | 98 | |
| 107 | 99 | // Plugin Folder URL |
| 108 | 100 | if (!defined('FBOX_PLUGIN_URL')) |
| @@ -139,8 +131,13 @@ | ||
| 139 | 131 | { |
| 140 | 132 | define('FBOX_BASE_FOLDER', dirname(__FILE__)); |
| 141 | 133 | } |
| 142 | 134 | |
| 135 | +if (!defined('FBOX_PLUGIN_BASENAME')) | |
| 136 | +{ | |
| 137 | + define('FBOX_PLUGIN_BASENAME', plugin_basename(__FILE__)); | |
| 138 | +} | |
| 139 | + | |
| 143 | 140 | // Minimum PHP version check |
| 144 | 141 | if (!version_compare(PHP_VERSION, FBOX_MINIMUM_PHP_VERSION, '>=')) |
| 145 | 142 | { |
| 146 | 143 | add_action('admin_notices', 'firebox_fail_php_version'); |
| @@ -146,11 +143,46 @@ | ||
| 146 | 143 | add_action('admin_notices', 'firebox_fail_php_version'); |
| 147 | 144 | } |
| 148 | 145 | else |
| 149 | 146 | { |
| 147 | + // Migrator | |
| 148 | + function firebox_upgrader_migrator_start($upgrader_object, $options) | |
| 149 | + { | |
| 150 | + if ($options['action'] === 'update' && $options['type'] === 'plugin' && isset($options['plugins'])) | |
| 151 | + { | |
| 152 | + foreach ($options['plugins'] as $plugin) | |
| 153 | + { | |
| 154 | + if ($plugin !== plugin_basename(__FILE__)) | |
| 155 | + { | |
| 156 | + continue; | |
| 157 | + } | |
| 158 | + | |
| 159 | + $migrator = new \FireBox\Core\Migrator(get_option('firebox_version', '1.0.0')); | |
| 160 | + $migrator->run(); | |
| 161 | + } | |
| 162 | + } | |
| 163 | + } | |
| 164 | + add_action('upgrader_process_complete', 'firebox_upgrader_migrator_start', 10, 2); | |
| 165 | + | |
| 166 | + function firebox_init_migrator_start() | |
| 167 | + { | |
| 168 | + add_action('fpf_init', function() { | |
| 169 | + $migrator = new \FireBox\Core\Migrator(get_option('firebox_version', '1.0.0')); | |
| 170 | + $migrator->run(); | |
| 171 | + }); | |
| 172 | + } | |
| 173 | + add_action('plugins_loaded', 'firebox_init_migrator_start', -1); | |
| 174 | + | |
| 150 | 175 | // Start Plugin |
| 151 | 176 | require_once dirname(__FILE__) . '/Inc/Core/Plugin.php'; |
| 152 | 177 | firebox(); |
| 178 | + | |
| 179 | + if (is_admin()) | |
| 180 | + { | |
| 181 | + // Run Activation/Deactivation procedures | |
| 182 | + $maintenance = new \FireBox\Core\Admin\Maintenance(firebox()->hook_data); | |
| 183 | + $maintenance->init(); | |
| 184 | + } | |
| 153 | 185 | } |
| 154 | 186 | |
| 155 | 187 | /** |
| 156 | 188 | * FireBox admin notice for minimum PHP version. |