| @@ -1,103 +1,41 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +use TierPricingTable\TierPricingTablePlugin; | |
| 4 | + | |
| 3 | 5 | /** |
| 6 | + * | |
| 4 | 7 | * Plugin Name: WooCommerce Tiered Price Table |
| 5 | - * Requires Plugins: woocommerce | |
| 6 | - * Description: Quantity-based discounts with nice-looking reflection on the product page. | |
| 7 | - * Version: 7.1.7 | |
| 8 | - * Author: U2Code | |
| 9 | - * Author URI: https://tiered-pricing.com/ | |
| 10 | - * Plugin URI: https://tiered-pricing.com/ | |
| 8 | + * Description: Allow set price for certain quantity of product. Shows pricing table. Supports displaying pricing table in tooltip | |
| 9 | + * Version: 2.2.2 | |
| 10 | + * Author: bycrik | |
| 11 | 11 | * License: GPLv2 or later |
| 12 | 12 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 13 | 13 | * Text Domain: tier-pricing-table |
| 14 | 14 | * Domain Path: /languages/ |
| 15 | 15 | * |
| 16 | - * Requires PHP: 7.4 | |
| 16 | + * WC requires at least: 3.0 | |
| 17 | + * WC tested up to: 3.6.2 | |
| 17 | 18 | * |
| 18 | - * WC requires at least: 9.0 | |
| 19 | - * WC tested up to: 11.1 | |
| 20 | 19 | */ |
| 21 | -use TierPricingTable\TierPricingTablePlugin; | |
| 20 | + | |
| 22 | 21 | // If this file is called directly, abort. |
| 23 | -if ( !defined( 'WPINC' ) ) { | |
| 24 | - die; | |
| 22 | +if ( ! defined( 'WPINC' ) ) { | |
| 23 | + die; | |
| 25 | 24 | } |
| 26 | -if ( version_compare( phpversion(), '7.4.0', '<' ) ) { | |
| 27 | - add_action( 'admin_notices', function () { | |
| 28 | - ?> | |
| 29 | - <div class='notice notice-error'> | |
| 30 | - <p> | |
| 31 | - Tiered Pricing Table plugin requires PHP version to be <b>7.4 or higher</b>. You run PHP | |
| 32 | - version <?php | |
| 33 | - echo esc_attr( phpversion() ); | |
| 34 | - ?> | |
| 35 | - </p> | |
| 36 | - </div> | |
| 37 | - <?php | |
| 38 | - } ); | |
| 39 | - return; | |
| 40 | -} | |
| 41 | -if ( !function_exists( 'tpt_initFreemius' ) ) { | |
| 42 | - function tpt_initFreemius() { | |
| 43 | - // Create a helper function for easy SDK access. | |
| 44 | - function tpt_fs() { | |
| 45 | - global $tpt_fs; | |
| 46 | - if ( !isset( $tpt_fs ) ) { | |
| 47 | - // Include Freemius SDK. | |
| 48 | - require_once dirname( __FILE__ ) . '/freemius/start.php'; | |
| 49 | - $tpt_fs = fs_dynamic_init( array( | |
| 50 | - 'id' => '3433', | |
| 51 | - 'slug' => 'tier-pricing-table', | |
| 52 | - 'type' => 'plugin', | |
| 53 | - 'public_key' => 'pk_d9f80d20e4c964001b87a062cd2b7', | |
| 54 | - 'is_premium' => false, | |
| 55 | - 'premium_suffix' => 'Premium', | |
| 56 | - 'has_addons' => false, | |
| 57 | - 'has_paid_plans' => true, | |
| 58 | - 'trial' => array( | |
| 59 | - 'days' => 7, | |
| 60 | - 'is_require_payment' => true, | |
| 61 | - ), | |
| 62 | - 'menu' => array( | |
| 63 | - 'first-path' => 'admin.php?page=tiered-pricing-table-welcome', | |
| 64 | - 'contact' => false, | |
| 65 | - 'support' => false, | |
| 66 | - ), | |
| 67 | - 'is_org_compliant' => true, | |
| 68 | - 'is_live' => true, | |
| 69 | - ) ); | |
| 70 | - } | |
| 71 | - return $tpt_fs; | |
| 72 | - } | |
| 73 | 25 | |
| 74 | - // Init Freemius. | |
| 75 | - tpt_fs(); | |
| 76 | - // Signal that SDK was initiated. | |
| 77 | - do_action( 'tpt_fs_loaded' ); | |
| 78 | - } | |
| 26 | +require_once 'licence-init.php'; | |
| 79 | 27 | |
| 80 | -} | |
| 81 | -if ( !function_exists( 'tpt_fs_activation_url' ) ) { | |
| 82 | - function tpt_fs_activation_url() : ?string { | |
| 83 | - return ( tpt_fs()->is_activation_mode() ? tpt_fs()->get_activation_url() : tpt_fs()->get_upgrade_url() ); | |
| 84 | - } | |
| 28 | +call_user_func( function () { | |
| 85 | 29 | |
| 86 | -} | |
| 87 | -if ( function_exists( 'tpt_fs' ) ) { | |
| 88 | - tpt_fs()->set_basename( false, __FILE__ ); | |
| 89 | - return; | |
| 90 | -} else { | |
| 91 | - tpt_initFreemius(); | |
| 92 | - call_user_func( function () { | |
| 93 | - require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; | |
| 94 | - $plugin = new TierPricingTablePlugin(__FILE__); | |
| 95 | - if ( $plugin->checkRequirements() ) { | |
| 96 | - register_activation_hook( __FILE__, array($plugin, 'activate') ); | |
| 97 | - add_action( 'uninstall', array(TierPricingTablePlugin::class, 'uninstall') ); | |
| 98 | - tpt_fs()->add_action( 'after_uninstall', array(TierPricingTablePlugin::class, 'uninstall') ); | |
| 99 | - $plugin->run(); | |
| 100 | - } | |
| 101 | - } ); | |
| 102 | -} | |
| 103 | -define( 'TIERED_PRICING_PRODUCTION', true ); | |
| 30 | + require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; | |
| 31 | + | |
| 32 | + $main = new TierPricingTablePlugin( __FILE__ ); | |
| 33 | + | |
| 34 | + register_activation_hook( __FILE__, [ $main, 'activate' ] ); | |
| 35 | + | |
| 36 | + register_deactivation_hook( __FILE__, [ $main, 'deactivate' ] ); | |
| 37 | + | |
| 38 | + tpt_fs()->add_action( 'after_uninstall', [ TierPricingTablePlugin::class, 'uninstall' ] ); | |
| 39 | + | |
| 40 | + $main->run(); | |
| 41 | +} ); | |