| @@ -1,26 +1,24 @@ | ||
| 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 | * 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.4 | |
| 15 | - * Stable tag: 1.0.4 | |
| 16 | - * Author: FirePlugins | |
| 14 | + * Version: 2.1.0 | |
| 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 | - * Requires PHP: 5.6.40 | |
| 20 | + * Requires PHP: 7.0 | |
| 23 | 21 | * License: GNU General Public License v2.0+ |
| 24 | 22 | * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 25 | 23 | */ |
| 26 | 24 | |
| @@ -30,11 +28,19 @@ | ||
| 30 | 28 | exit; // Exit if accessed directly. |
| 31 | 29 | } |
| 32 | 30 | |
| 33 | 31 | // Load Framework |
| 32 | +if (!file_exists(dirname(__FILE__) . '/Inc/Framework/init.php')) | |
| 33 | +{ | |
| 34 | + return; | |
| 35 | +} | |
| 34 | 36 | require_once dirname(__FILE__) . '/Inc/Framework/init.php'; |
| 35 | 37 | |
| 36 | 38 | // Plugin Autoloader |
| 39 | +if (!file_exists(dirname(__FILE__) . '/autoload.php')) | |
| 40 | +{ | |
| 41 | + return; | |
| 42 | +} | |
| 37 | 43 | require_once dirname(__FILE__) . '/autoload.php'; |
| 38 | 44 | |
| 39 | 45 | |
| 40 | 46 | |
| @@ -40,9 +46,9 @@ | ||
| 40 | 46 | |
| 41 | 47 | // Plugin version |
| 42 | 48 | if (!defined('FBOX_VERSION')) |
| 43 | 49 | { |
| 44 | - define('FBOX_VERSION', '1.0.4'); | |
| 50 | + define('FBOX_VERSION', '2.1.0'); | |
| 45 | 51 | } |
| 46 | 52 | |
| 47 | 53 | // Plugin License type (free/pro) |
| 48 | 54 | if (!defined('FBOX_LICENSE_TYPE')) |
| @@ -56,9 +62,9 @@ | ||
| 56 | 62 | |
| 57 | 63 | // PHP Minimm Version |
| 58 | 64 | if (!defined('FBOX_MINIMUM_PHP_VERSION')) |
| 59 | 65 | { |
| 60 | - define('FBOX_MINIMUM_PHP_VERSION', '5.6.40'); | |
| 66 | + define('FBOX_MINIMUM_PHP_VERSION', '7.0'); | |
| 61 | 67 | } |
| 62 | 68 | |
| 63 | 69 | |
| 64 | 70 | // Go Pro URL |
| @@ -63,9 +69,9 @@ | ||
| 63 | 69 | |
| 64 | 70 | // Go Pro URL |
| 65 | 71 | if (!defined('FBOX_GO_PRO_URL')) |
| 66 | 72 | { |
| 67 | - define('FBOX_GO_PRO_URL', 'https://www.fireplugins.com/firebox/upgrade'); | |
| 73 | + define('FBOX_GO_PRO_URL', 'https://www.fireplugins.com/firebox/upgrade?coupon=FREE2PRO&utm_source=Wordpress&utm_medium=upgradebutton&utm_campaign=freeversion'); | |
| 68 | 74 | } |
| 69 | 75 | |
| 70 | 76 | |
| 71 | 77 | // Plugin Documentation URL |
| @@ -70,10 +76,9 @@ | ||
| 70 | 76 | |
| 71 | 77 | // Plugin Documentation URL |
| 72 | 78 | if (!defined('FBOX_DOC_URL')) |
| 73 | 79 | { |
| 74 | - // TODO: define final URL | |
| 75 | - define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox'); | |
| 80 | + define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox/'); | |
| 76 | 81 | } |
| 77 | 82 | |
| 78 | 83 | // Plugin Folder Path |
| 79 | 84 | if (!defined('FBOX_PLUGIN_DIR')) |
| @@ -83,21 +88,21 @@ | ||
| 83 | 88 | |
| 84 | 89 | // Layouts Folder Path |
| 85 | 90 | if (!defined('FBOX_LAYOUTS_DIR')) |
| 86 | 91 | { |
| 87 | - define('FBOX_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/'); | |
| 92 | + define('FBOX_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/'); | |
| 88 | 93 | } |
| 89 | 94 | |
| 90 | 95 | // Admin Layouts Folder Path |
| 91 | 96 | if (!defined('FBOX_ADMIN_LAYOUTS_DIR')) |
| 92 | 97 | { |
| 93 | - define('FBOX_ADMIN_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/admin/'); | |
| 98 | + define('FBOX_ADMIN_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/admin/'); | |
| 94 | 99 | } |
| 95 | 100 | |
| 96 | 101 | // Public Layouts Folder Path |
| 97 | 102 | if (!defined('FBOX_PUBLIC_LAYOUTS_DIR')) |
| 98 | 103 | { |
| 99 | - define('FBOX_PUBLIC_LAYOUTS_DIR', plugin_dir_path(__FILE__) . 'Inc/Core/Layouts/public/'); | |
| 104 | + define('FBOX_PUBLIC_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/public/'); | |
| 100 | 105 | } |
| 101 | 106 | |
| 102 | 107 | // Plugin Folder URL |
| 103 | 108 | if (!defined('FBOX_PLUGIN_URL')) |
| @@ -134,8 +139,13 @@ | ||
| 134 | 139 | { |
| 135 | 140 | define('FBOX_BASE_FOLDER', dirname(__FILE__)); |
| 136 | 141 | } |
| 137 | 142 | |
| 143 | +if (!defined('FBOX_PLUGIN_BASENAME')) | |
| 144 | +{ | |
| 145 | + define('FBOX_PLUGIN_BASENAME', plugin_basename(__FILE__)); | |
| 146 | +} | |
| 147 | + | |
| 138 | 148 | // Minimum PHP version check |
| 139 | 149 | if (!version_compare(PHP_VERSION, FBOX_MINIMUM_PHP_VERSION, '>=')) |
| 140 | 150 | { |
| 141 | 151 | add_action('admin_notices', 'firebox_fail_php_version'); |
| @@ -141,11 +151,46 @@ | ||
| 141 | 151 | add_action('admin_notices', 'firebox_fail_php_version'); |
| 142 | 152 | } |
| 143 | 153 | else |
| 144 | 154 | { |
| 155 | + // Migrator | |
| 156 | + function firebox_upgrader_migrator_start($upgrader_object, $options) | |
| 157 | + { | |
| 158 | + if ($options['action'] === 'update' && $options['type'] === 'plugin' && isset($options['plugins'])) | |
| 159 | + { | |
| 160 | + foreach ($options['plugins'] as $plugin) | |
| 161 | + { | |
| 162 | + if ($plugin !== plugin_basename(__FILE__)) | |
| 163 | + { | |
| 164 | + continue; | |
| 165 | + } | |
| 166 | + | |
| 167 | + $migrator = new \FireBox\Core\Migrator(get_option('firebox_version', '1.0.0')); | |
| 168 | + $migrator->run(); | |
| 169 | + } | |
| 170 | + } | |
| 171 | + } | |
| 172 | + add_action('upgrader_process_complete', 'firebox_upgrader_migrator_start', 10, 2); | |
| 173 | + | |
| 174 | + function firebox_init_migrator_start() | |
| 175 | + { | |
| 176 | + add_action('fpf_init', function() { | |
| 177 | + $migrator = new \FireBox\Core\Migrator(get_option('firebox_version', '1.0.0')); | |
| 178 | + $migrator->run(); | |
| 179 | + }); | |
| 180 | + } | |
| 181 | + add_action('plugins_loaded', 'firebox_init_migrator_start', -1); | |
| 182 | + | |
| 145 | 183 | // Start Plugin |
| 146 | 184 | require_once dirname(__FILE__) . '/Inc/Core/Plugin.php'; |
| 147 | 185 | firebox(); |
| 186 | + | |
| 187 | + if (is_admin()) | |
| 188 | + { | |
| 189 | + // Run Activation/Deactivation procedures | |
| 190 | + $maintenance = new \FireBox\Core\Admin\Maintenance(firebox()->hook_data); | |
| 191 | + $maintenance->init(); | |
| 192 | + } | |
| 148 | 193 | } |
| 149 | 194 | |
| 150 | 195 | /** |
| 151 | 196 | * FireBox admin notice for minimum PHP version. |
| @@ -153,10 +198,13 @@ | ||
| 153 | 198 | * Warning when the site doesn't have the minimum required PHP version. |
| 154 | 199 | * |
| 155 | 200 | * @return void |
| 156 | 201 | */ |
| 157 | -function firebox_fail_php_version() | |
| 202 | +if (!function_exists('firebox_fail_php_version')) | |
| 158 | 203 | { |
| 159 | - $message = sprintf(fpframework()->_('FPF_PHP_VERSION_FAIL'), 'FireBox', FBOX_MINIMUM_PHP_VERSION); | |
| 160 | - $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); | |
| 161 | - echo wp_kses_post( $html_message ); | |
| 204 | + function firebox_fail_php_version() | |
| 205 | + { | |
| 206 | + $message = sprintf(fpframework()->_('FPF_PHP_VERSION_FAIL'), 'FireBox', FBOX_MINIMUM_PHP_VERSION); | |
| 207 | + $html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); | |
| 208 | + echo wp_kses_post( $html_message ); | |
| 209 | + } | |
| 162 | 210 | } |