| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | -// removeIf(pro) | |
| 2 | + // removeIf(pro) | |
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * The plugin bootstrap file |
| 6 | 6 | * |
| @@ -11,64 +11,54 @@ | ||
| 11 | 11 | * @wordpress-plugin |
| 12 | 12 | * Plugin Name: HurryTimer |
| 13 | 13 | * Plugin URI: https://hurrytimer.com |
| 14 | 14 | * Description: A Scarcity and Urgency Countdown Timer for WordPress & WooCommerce with recurring and evergreen mode. |
| 15 | - * Version: 2.15.0 | |
| 15 | + * Version: 2.2.16 | |
| 16 | 16 | * Author: Nabil Lemsieh |
| 17 | - * Author URI: https://hurrytimer.com | |
| 17 | + * Author URI: http://nabillemsieh.com | |
| 18 | 18 | * License: GPLv3 |
| 19 | 19 | * License URI: http://www.gnu.org/licenses/gpl.html |
| 20 | 20 | * Text Domain: hurrytimer |
| 21 | 21 | * Domain Path: /languages |
| 22 | - * WC requires at least: 3.0.0 | |
| 23 | - * WC tested up to: 11.0 | |
| 24 | 22 | */ |
| 23 | + // endRemoveIf(pro) | |
| 25 | 24 | |
| 25 | + namespace Hurrytimer; | |
| 26 | 26 | |
| 27 | -// endRemoveIf(pro) | |
| 28 | - | |
| 29 | 27 | // If this file is called directly, abort. |
| 28 | +use Hurrytimer\Utils\Helpers; | |
| 30 | 29 | |
| 31 | 30 | if (!defined('WPINC')) { |
| 32 | 31 | die; |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | -if(!(defined( 'WP_CLI' ) && WP_CLI) && function_exists('\is_plugin_active') && function_exists('\deactivate_plugins')): | |
| 36 | - | |
| 37 | -// removeIf(pro) | |
| 38 | -if ( defined( 'HURRYT_IS_PRO' ) ) { | |
| 39 | - if ( is_plugin_active( 'hurrytimer-pro/hurrytimer.php' ) ) { | |
| 40 | - deactivate_plugins( 'hurrytimer-pro/hurrytimer.php' ); | |
| 41 | - } | |
| 42 | - | |
| 43 | - wp_safe_redirect( esc_url_raw( $_SERVER['REQUEST_URI'] ) ); | |
| 44 | - exit; | |
| 45 | -} | |
| 46 | -// endRemoveIf(pro) | |
| 47 | - | |
| 48 | -endif; | |
| 49 | - | |
| 50 | -define('HURRYT_VERSION', '2.15.0'); | |
| 51 | - | |
| 34 | +define('HURRYT_VERSION', '2.2.16'); | |
| 35 | +define('HURRYT_DB_VERSION', '1.0.0'); | |
| 36 | +define('HURRYT_SLUG', 'hurrytimer'); | |
| 52 | 37 | define('HURRYT_DIR', plugin_dir_path(__FILE__)); |
| 53 | 38 | define('HURRYT_URL', plugin_dir_url(__FILE__)); |
| 54 | 39 | define('HURRYT_BASENAME', plugin_basename(__FILE__)); |
| 55 | 40 | define('HURRYT_POST_TYPE', 'hurrytimer_countdown'); |
| 41 | +define('HURRYT_OPTION_VERSION_KEY', 'hurrytimer_version'); | |
| 56 | 42 | |
| 57 | -// Declare compatibility with custom order tables for WooCommerce. | |
| 58 | -add_action( | |
| 59 | - 'before_woocommerce_init', | |
| 60 | - function () { | |
| 61 | - if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { | |
| 62 | - \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); | |
| 63 | - } | |
| 64 | - } | |
| 65 | -); | |
| 66 | 43 | |
| 67 | -require_once __DIR__ . '/vendor/autoload.php'; | |
| 44 | +require plugin_dir_path(__FILE__) . 'includes/Bootstrap.php'; | |
| 68 | 45 | |
| 69 | -register_activation_hook(__FILE__, [Hurrytimer\Installer::get_instance(), 'activate']); | |
| 46 | +function activate() | |
| 47 | +{ | |
| 48 | + require_once HURRYT_DIR . 'includes/Activator.php'; | |
| 49 | + Activator::activate(); | |
| 50 | +} | |
| 70 | 51 | |
| 71 | -add_action('plugins_loaded', function () { | |
| 72 | - (new \Hurrytimer\Bootstrap())->run(); | |
| 73 | - do_action('hurrytimer_init'); | |
| 74 | -}); | |
| 52 | +function deactivate() | |
| 53 | +{ | |
| 54 | + require_once HURRYT_DIR . 'includes/Deactivator.php'; | |
| 55 | + Deactivator::deactivate(); | |
| 56 | +} | |
| 57 | + | |
| 58 | +register_activation_hook(__FILE__, 'Hurrytimer\activate'); | |
| 59 | +register_deactivation_hook(__FILE__, 'Hurrytimer\deactivate'); | |
| 60 | + | |
| 61 | +do_action('before_hurrytimer_init'); | |
| 62 | + (new Bootstrap())->run(); | |
| 63 | +do_action('hurrytimer_init'); | |
| 64 | + | |