| @@ -1,40 +1,103 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use TierPricingTable\TierPricingTablePlugin; | |
| 4 | - | |
| 5 | 3 | /** |
| 6 | - * | |
| 7 | 4 | * Plugin Name: WooCommerce Tiered Price Table |
| 8 | - * Description: Allow set price for certain quantity of product. Shows pricing table. Supports displaying pricing table in tooltip | |
| 9 | - * Version: 2.0.2 | |
| 10 | - * Author: bycrik | |
| 5 | + * Requires Plugins: woocommerce | |
| 6 | + * Description: Quantity-based discounts with nice-looking reflection on the product page. | |
| 7 | + * Version: 8.0.2 | |
| 8 | + * Author: U2Code | |
| 9 | + * Author URI: https://tiered-pricing.com/ | |
| 10 | + * Plugin URI: https://tiered-pricing.com/ | |
| 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 | - * WC requires at least: 3.0 | |
| 16 | + * Requires PHP: 7.4 | |
| 17 | 17 | * |
| 18 | + * WC requires at least: 9.0 | |
| 19 | + * WC tested up to: 11.1 | |
| 18 | 20 | */ |
| 19 | - | |
| 21 | +use TierPricingTable\TierPricingTablePlugin; | |
| 20 | 22 | // If this file is called directly, abort. |
| 21 | -if ( ! defined( 'WPINC' ) ) { | |
| 22 | - die; | |
| 23 | +if ( !defined( 'WPINC' ) ) { | |
| 24 | + die; | |
| 23 | 25 | } |
| 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 | + } | |
| 24 | 73 | |
| 25 | -require_once 'licence-init.php'; | |
| 74 | + // Init Freemius. | |
| 75 | + tpt_fs(); | |
| 76 | + // Signal that SDK was initiated. | |
| 77 | + do_action( 'tpt_fs_loaded' ); | |
| 78 | + } | |
| 26 | 79 | |
| 27 | -call_user_func( function () { | |
| 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 | 85 | |
| 29 | - require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; | |
| 30 | - | |
| 31 | - $main = new TierPricingTablePlugin( __FILE__ ); | |
| 32 | - | |
| 33 | - register_activation_hook( __FILE__, [ $main, 'activate' ] ); | |
| 34 | - | |
| 35 | - register_deactivation_hook( __FILE__, [ $main, 'deactivate' ] ); | |
| 36 | - | |
| 37 | - tpt_fs()->add_action( 'after_uninstall', [ TierPricingTablePlugin::class, 'uninstall' ] ); | |
| 38 | - | |
| 39 | - $main->run(); | |
| 40 | -} ); | |
| 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 ); | |