PluginProbe
Tiered Pricing Table for WooCommerce / 2.0
Tiered Pricing Table for WooCommerce v2.0
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
← All changes | src/Admin/Admin.php +9 -27 2.2.22.0 View file →
@@ -1,16 +1,14 @@
1 1 <?php
2 2
3 3 namespace TierPricingTable\Admin;
4 4
5 +use Premmerce\SDK\V2\FileManager\FileManager ;
6 +use TierPricingTable\Admin\ProductManagers\SimpleProductManager ;
7 +use TierPricingTable\Admin\ProductManagers\VariationProductManager ;
5 8 use TierPricingTable\Freemius ;
6 9 use TierPricingTable\Settings\Settings ;
7 10 use TierPricingTable\TierPricingTablePlugin ;
8 -use Premmerce\SDK\V2\FileManager\FileManager ;
9 -use TierPricingTable\Admin\ProductManagers\SimpleProductManager ;
10 -use TierPricingTable\Admin\ProductManagers\VariationProductManager ;
11 -use TierPricingTable\Admin\Export\Woocommerce as WooCommerceExport ;
12 -use TierPricingTable\Admin\Import\Woocommerce as WooCommerceImport ;
13 11 /**
14 12 * Class Admin
15 13 *
16 14 * @package TierPricingTable\Admin
@@ -51,38 +49,22 @@
51 49 add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ] );
52 50 if ( get_transient( 'tier_pricing_table_activated' ) ) {
53 51 add_action( 'admin_notices', [ $this, 'showActivationMessage' ] );
54 52 }
55 -
56 53 if ( $this->licence->isFree() ) {
57 -
58 - if ( tpt_fs()->is_anonymous() || !tpt_fs()->is_installed_on_site() ) {
59 - $template = 'opt-in-alert.php';
60 - } else {
61 - $template = 'upgrade-alert.php';
62 - }
63 -
64 - add_action( 'woocommerce_settings_' . Settings::SETTINGS_PAGE, function () use( $template ) {
65 - $this->fileManager->includeTemplate( 'admin/alerts/' . $template, [
66 - 'upgradeUrl' => $this->licence->getUpgradeLink(),
67 - 'contactUsUrl' => $this->licence->getContactUsPageUrl(),
54 + add_action( 'woocommerce_settings_' . Settings::SETTINGS_PAGE, function () {
55 + $this->fileManager->includeTemplate( 'admin/upgrade-message.php', [
56 + 'upgradeLink' => $this->licence->getUpgradeLink(),
68 57 ] );
69 - $this->fileManager->includeTemplate( 'admin/only-in-premium-script.php' );
70 58 } );
71 59 }
72 -
73 60 }
74 61
75 - /**
76 - * Init Managers
77 - */
78 62 public function initManagers()
79 63 {
80 64 $this->managers = [
81 65 SimpleProductManager::class => new SimpleProductManager( $this->fileManager, $this->settings, $this->licence ),
82 66 VariationProductManager::class => new VariationProductManager( $this->fileManager, $this->settings, $this->licence ),
83 - WooCommerceExport::class => new WooCommerceExport(),
84 - WooCommerceImport::class => new WooCommerceImport(),
85 67 ];
86 68 }
87 69
88 70 /**
@@ -90,9 +72,9 @@
90 72 */
91 73 public function showActivationMessage()
92 74 {
93 75 $link = $this->settings->getLink();
94 - $this->fileManager->includeTemplate( 'admin/alerts/activation-alert.php', [
76 + $this->fileManager->includeTemplate( 'admin/activation-message.php', [
95 77 'link' => $link,
96 78 ] );
97 79 delete_transient( 'tiered_pricing_table_activated' );
98 80 }
@@ -103,11 +85,11 @@
103 85 * @param $page
104 86 */
105 87 public function enqueueAssets( $page )
106 88 {
107 - global $post, $page ;
89 + global $post ;
108 90
109 - if ( isset( $_GET['tab'] ) && $_GET['tab'] == Settings::SETTINGS_PAGE || ($page == 'post.php' || ($page = 'post_new.php')) && $post && $post->post_type == 'product' ) {
91 + if ( ($page == 'post.php' || ($page = 'post_new.php')) && $post && $post->post_type == 'product' ) {
110 92 wp_enqueue_script(
111 93 'tier-pricing-table-admin-js',
112 94 $this->fileManager->locateAsset( 'admin/main.js' ),
113 95 'jquery',