| @@ -1,24 +1,23 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.9 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.9 | |
| 15 | - * Author: FirePlugins | |
| 14 | + * Version: 2.0.12 | |
| 15 | + * Author: FirePlugins Popup Plugin Team | |
| 16 | 16 | * Author URI: https://www.fireplugins.com/ |
| 17 | 17 | * Text Domain: firebox |
| 18 | 18 | * Domain Path: /languages |
| 19 | 19 | * Requires at least: 5.4 |
| 20 | - * Tested up to: 5.8 | |
| 21 | 20 | * Requires PHP: 5.6.40 |
| 22 | 21 | * License: GNU General Public License v2.0+ |
| 23 | 22 | * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 24 | 23 | */ |
| @@ -39,9 +38,9 @@ | ||
| 39 | 38 | |
| 40 | 39 | // Plugin version |
| 41 | 40 | if (!defined('FBOX_VERSION')) |
| 42 | 41 | { |
| 43 | - define('FBOX_VERSION', '1.0.9'); | |
| 42 | + define('FBOX_VERSION', '2.0.12'); | |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | // Plugin License type (free/pro) |
| 47 | 46 | if (!defined('FBOX_LICENSE_TYPE')) |
| @@ -69,10 +68,9 @@ | ||
| 69 | 68 | |
| 70 | 69 | // Plugin Documentation URL |
| 71 | 70 | if (!defined('FBOX_DOC_URL')) |
| 72 | 71 | { |
| 73 | - // TODO: define final URL | |
| 74 | - define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox'); | |
| 72 | + define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox/'); | |
| 75 | 73 | } |
| 76 | 74 | |
| 77 | 75 | // Plugin Folder Path |
| 78 | 76 | if (!defined('FBOX_PLUGIN_DIR')) |
| @@ -82,21 +80,21 @@ | ||
| 82 | 80 | |
| 83 | 81 | // Layouts Folder Path |
| 84 | 82 | if (!defined('FBOX_LAYOUTS_DIR')) |
| 85 | 83 | { |
| 86 | - define('FBOX_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/'); | |
| 84 | + define('FBOX_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/'); | |
| 87 | 85 | } |
| 88 | 86 | |
| 89 | 87 | // Admin Layouts Folder Path |
| 90 | 88 | if (!defined('FBOX_ADMIN_LAYOUTS_DIR')) |
| 91 | 89 | { |
| 92 | - 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/'); | |
| 93 | 91 | } |
| 94 | 92 | |
| 95 | 93 | // Public Layouts Folder Path |
| 96 | 94 | if (!defined('FBOX_PUBLIC_LAYOUTS_DIR')) |
| 97 | 95 | { |
| 98 | - 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/'); | |
| 99 | 97 | } |
| 100 | 98 | |
| 101 | 99 | // Plugin Folder URL |
| 102 | 100 | if (!defined('FBOX_PLUGIN_URL')) |
| @@ -133,8 +131,13 @@ | ||
| 133 | 131 | { |
| 134 | 132 | define('FBOX_BASE_FOLDER', dirname(__FILE__)); |
| 135 | 133 | } |
| 136 | 134 | |
| 135 | +if (!defined('FBOX_PLUGIN_BASENAME')) | |
| 136 | +{ | |
| 137 | + define('FBOX_PLUGIN_BASENAME', plugin_basename(__FILE__)); | |
| 138 | +} | |
| 139 | + | |
| 137 | 140 | // Minimum PHP version check |
| 138 | 141 | if (!version_compare(PHP_VERSION, FBOX_MINIMUM_PHP_VERSION, '>=')) |
| 139 | 142 | { |
| 140 | 143 | add_action('admin_notices', 'firebox_fail_php_version'); |
| @@ -140,11 +143,46 @@ | ||
| 140 | 143 | add_action('admin_notices', 'firebox_fail_php_version'); |
| 141 | 144 | } |
| 142 | 145 | else |
| 143 | 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 | + | |
| 144 | 175 | // Start Plugin |
| 145 | 176 | require_once dirname(__FILE__) . '/Inc/Core/Plugin.php'; |
| 146 | 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 | + } | |
| 147 | 185 | } |
| 148 | 186 | |
| 149 | 187 | /** |
| 150 | 188 | * FireBox admin notice for minimum PHP version. |