| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FireBox |
| 4 |
* @version 2.0.10 Free |
| 5 |
* |
| 6 |
* @author FirePlugins <info@fireplugins.com> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2023 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
* |
| 11 |
* Plugin Name: FireBox |
| 12 |
* Plugin URI: https://www.fireplugins.com/firebox |
| 13 |
* Description: WordPress Popup and leads generation plugin that converts visitors into subscribers & customers. |
| 14 |
* Version: 2.0.10 |
| 15 |
* Author: FirePlugins Popup Plugin Team |
| 16 |
* Author URI: https://www.fireplugins.com/ |
| 17 |
* Text Domain: firebox |
| 18 |
* Domain Path: /languages |
| 19 |
* Requires at least: 5.4 |
| 20 |
* Requires PHP: 5.6.40 |
| 21 |
* License: GNU General Public License v2.0+ |
| 22 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 23 |
*/ |
| 24 |
|
| 25 |
// If this file is called directly, abort. |
| 26 |
if (!defined('ABSPATH')) |
| 27 |
{ |
| 28 |
exit; // Exit if accessed directly. |
| 29 |
} |
| 30 |
|
| 31 |
// Load Framework |
| 32 |
require_once dirname(__FILE__) . '/Inc/Framework/init.php'; |
| 33 |
|
| 34 |
// Plugin Autoloader |
| 35 |
require_once dirname(__FILE__) . '/autoload.php'; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
// Plugin version |
| 40 |
if (!defined('FBOX_VERSION')) |
| 41 |
{ |
| 42 |
define('FBOX_VERSION', '2.0.10'); |
| 43 |
} |
| 44 |
|
| 45 |
// Plugin License type (free/pro) |
| 46 |
if (!defined('FBOX_LICENSE_TYPE')) |
| 47 |
{ |
| 48 |
|
| 49 |
$type = 'lite'; |
| 50 |
|
| 51 |
|
| 52 |
define('FBOX_LICENSE_TYPE', $type); |
| 53 |
} |
| 54 |
|
| 55 |
// PHP Minimm Version |
| 56 |
if (!defined('FBOX_MINIMUM_PHP_VERSION')) |
| 57 |
{ |
| 58 |
define('FBOX_MINIMUM_PHP_VERSION', '5.6.40'); |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
// Go Pro URL |
| 63 |
if (!defined('FBOX_GO_PRO_URL')) |
| 64 |
{ |
| 65 |
define('FBOX_GO_PRO_URL', 'https://www.fireplugins.com/firebox/upgrade'); |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
// Plugin Documentation URL |
| 70 |
if (!defined('FBOX_DOC_URL')) |
| 71 |
{ |
| 72 |
define('FBOX_DOC_URL', 'https://www.fireplugins.com/docs/firebox/'); |
| 73 |
} |
| 74 |
|
| 75 |
// Plugin Folder Path |
| 76 |
if (!defined('FBOX_PLUGIN_DIR')) |
| 77 |
{ |
| 78 |
define('FBOX_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 79 |
} |
| 80 |
|
| 81 |
// Layouts Folder Path |
| 82 |
if (!defined('FBOX_LAYOUTS_DIR')) |
| 83 |
{ |
| 84 |
define('FBOX_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/'); |
| 85 |
} |
| 86 |
|
| 87 |
// Admin Layouts Folder Path |
| 88 |
if (!defined('FBOX_ADMIN_LAYOUTS_DIR')) |
| 89 |
{ |
| 90 |
define('FBOX_ADMIN_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/admin/'); |
| 91 |
} |
| 92 |
|
| 93 |
// Public Layouts Folder Path |
| 94 |
if (!defined('FBOX_PUBLIC_LAYOUTS_DIR')) |
| 95 |
{ |
| 96 |
define('FBOX_PUBLIC_LAYOUTS_DIR', FBOX_PLUGIN_DIR . 'Inc/Core/Layouts/public/'); |
| 97 |
} |
| 98 |
|
| 99 |
// Plugin Folder URL |
| 100 |
if (!defined('FBOX_PLUGIN_URL')) |
| 101 |
{ |
| 102 |
define('FBOX_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 103 |
} |
| 104 |
|
| 105 |
// Media Plugin Folder URL |
| 106 |
if (!defined('FBOX_MEDIA_URL')) |
| 107 |
{ |
| 108 |
define('FBOX_MEDIA_URL', plugin_dir_url(__FILE__) . 'media/'); |
| 109 |
} |
| 110 |
|
| 111 |
// Admin Media Plugin Folder URL |
| 112 |
if (!defined('FBOX_MEDIA_ADMIN_URL')) |
| 113 |
{ |
| 114 |
define('FBOX_MEDIA_ADMIN_URL', plugin_dir_url(__FILE__) . 'media/admin/'); |
| 115 |
} |
| 116 |
|
| 117 |
// Public Media Plugin Folder URL |
| 118 |
if (!defined('FBOX_MEDIA_PUBLIC_URL')) |
| 119 |
{ |
| 120 |
define('FBOX_MEDIA_PUBLIC_URL', plugin_dir_url(__FILE__) . 'media/public/'); |
| 121 |
} |
| 122 |
|
| 123 |
// Plugin Root File |
| 124 |
if (!defined('FBOX_PLUGIN_BASE_FILE')) |
| 125 |
{ |
| 126 |
define('FBOX_PLUGIN_BASE_FILE', __FILE__); |
| 127 |
} |
| 128 |
|
| 129 |
// Plugin Root Folder |
| 130 |
if (!defined('FBOX_BASE_FOLDER')) |
| 131 |
{ |
| 132 |
define('FBOX_BASE_FOLDER', dirname(__FILE__)); |
| 133 |
} |
| 134 |
|
| 135 |
if (!defined('FBOX_PLUGIN_BASENAME')) |
| 136 |
{ |
| 137 |
define('FBOX_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 138 |
} |
| 139 |
|
| 140 |
// Minimum PHP version check |
| 141 |
if (!version_compare(PHP_VERSION, FBOX_MINIMUM_PHP_VERSION, '>=')) |
| 142 |
{ |
| 143 |
add_action('admin_notices', 'firebox_fail_php_version'); |
| 144 |
} |
| 145 |
else |
| 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 |
|
| 175 |
// Start Plugin |
| 176 |
require_once dirname(__FILE__) . '/Inc/Core/Plugin.php'; |
| 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 |
} |
| 185 |
} |
| 186 |
|
| 187 |
/** |
| 188 |
* FireBox admin notice for minimum PHP version. |
| 189 |
* |
| 190 |
* Warning when the site doesn't have the minimum required PHP version. |
| 191 |
* |
| 192 |
* @return void |
| 193 |
*/ |
| 194 |
function firebox_fail_php_version() |
| 195 |
{ |
| 196 |
$message = sprintf(fpframework()->_('FPF_PHP_VERSION_FAIL'), 'FireBox', FBOX_MINIMUM_PHP_VERSION); |
| 197 |
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) ); |
| 198 |
echo wp_kses_post( $html_message ); |
| 199 |
} |