public static function setup($pluginFile) { if (!isset(self::$instance)) { $upgrader = new self($pluginFile); $upgrader->onLoad(); self::$instance = $upgrader; } }
public function load() { if (!$this->woocommerceAvailable()) { return; } $this->loadLanguage(); $this->loadFunctions(); $this->loadClasses(); WBS_Profile_Manager::setup(); WBS_Upgrader::setup($this->pluginFile); }
public function admin_options() { if (WBS_Upgrader::instance()->removeUpgradeNotices()) { $this->refresh(); } $manager = WBS_Profile_Manager::instance(true); $profiles = $manager->profiles(); $profile = $manager->profile(); if (!empty($_GET['delete'])) { if (isset($profile)) { delete_option($profile->get_wp_option_name()); } $this->refresh(); } if (!isset($profile)) { $profile = new self(); $profile->_stub = true; $profiles[] = $profile; } if ($profile->_stub && ($sourceProfileId = @$_GET['duplicate']) != null && ($sourceProfile = $manager->profile($sourceProfileId)) != null) { $duplicate = clone $sourceProfile; $duplicate->id = $profile->id; $duplicate->profile_id = $profile->profile_id; $profiles[array_search($profile, $profiles, true)] = $duplicate; $profile = $duplicate; } $create_profile_link_html = '<a class="add-new-h2" href="' . esc_html(WbsRuleUrls::create()) . '">' . esc_html__('Add New', 'woowbs') . '</a>'; ?> <h3><?php esc_html_e('Weight-based shipping', 'woowbs'); ?> </h3> <p><?php esc_html_e('Lets you calculate shipping based on total weight of the cart. You can have multiple rules active.', 'woowbs'); ?> </p> <?php echo $this->settingsHelper->trsPromotionHtml(); ?> <table class="form-table"> <tr class="wbs-title"> <th colspan="2"> <h4><?php esc_html_e('Rules', 'woowbs'); echo $create_profile_link_html; ?> </h4> </th> </tr> <tr class="wbs-profiles"> <td colspan="2"> <?php self::listProfiles($profiles); ?> </td> </tr> <?php $profile->generate_settings_html(); ?> </table> <?php }