fileManager = $fileManager; $this->settings = $settings; $this->licence = $licence; $this->initManagers(); add_action( 'admin_enqueue_scripts', [ $this, 'enqueueAssets' ] ); if ( get_transient( 'tier_pricing_table_activated' ) ) { add_action( 'admin_notices', [ $this, 'showActivationMessage' ] ); } if ( $this->licence->isFree() ) { add_action( 'woocommerce_settings_' . Settings::SETTINGS_PAGE, function () { $this->fileManager->includeTemplate( 'admin/upgrade-message.php', [ 'upgradeLink' => $this->licence->getUpgradeLink(), ] ); } ); } } public function initManagers() { $this->managers = [ SimpleProductManager::class => new SimpleProductManager( $this->fileManager, $this->settings, $this->licence ), VariationProductManager::class => new VariationProductManager( $this->fileManager, $this->settings, $this->licence ), ]; } /** * Show message about activation plugin and advise next step */ public function showActivationMessage() { $link = $this->settings->getLink(); $this->fileManager->includeTemplate( 'admin/activation-message.php', [ 'link' => $link, ] ); delete_transient( 'tiered_pricing_table_activated' ); } /** * Register assets on product create/update page * * @param $page */ public function enqueueAssets( $page ) { global $post ; if ( ($page == 'post.php' || ($page = 'post_new.php')) && $post && $post->post_type == 'product' ) { wp_enqueue_script( 'tier-pricing-table-admin-js', $this->fileManager->locateAsset( 'admin/main.js' ), 'jquery', TierPricingTablePlugin::VERSION ); wp_enqueue_style( 'tier-pricing-table-admin-css', $this->fileManager->locateAsset( 'admin/style.css' ), null, TierPricingTablePlugin::VERSION ); } } }