/** * Render the settings table * * @since 1.0 * * @param \ITForm $form * @param array $settings */ function get_form_table($form, $settings = array()) { if (!empty($settings)) { foreach ($settings as $key => $var) { $form->set_option($key, $var); } } $erd_class = $form->get_option('enable-renewal-discounts') ? '' : 'hide-if-js'; $era_disabled = $form->get_option('sell-online-software') ? array() : array('disabled' => 'disabled'); $info = $this->get_key_info(); $activation = $form->get_option('activation'); if ($info) { if (!isset($info->activations->list->{$activation}) || $info->activations->list->{$activation}->status == 'deactivated') { $still_active = false; } else { $still_active = true; } } else { $still_active = true; } ?> <style type="text/css"> .description.active { color: #8cc53e; } .description.expired { color: #ffba00; } .description.disabled { color: #dd3d36; } </style> <div class="it-exchange-addon-settings it-exchange-itelic-addon-settings"> <label for="license"><?php _e("License Key", Plugin::SLUG); ?> </label> <?php $form->add_text_box('license'); ?> <?php if (empty($activation) || !$still_active) { ?> <?php submit_button(__("Activate", Plugin::SLUG), 'secondary large', 'activate', false, 'style="height:46px;padding:0 20px;"'); ?> <?php } else { ?> <?php submit_button(__("Deactivate", Plugin::SLUG), 'secondary large', 'deactivate', false, 'style="height:46px;padding:0 20px;"'); ?> <?php } ?> <?php if ($info && $still_active) { ?> <p class="description <?php echo $info->status; ?> "> <?php if ($info->status == 'active') { ?> <?php if ($info->expires) { ?> <?php printf(__("License is active and expires %s", Plugin::SLUG), date(get_option('date_format'), strtotime($info->expires))); ?> <?php } else { ?> <?php printf(__("License is active.", Plugin::SLUG)); ?> <?php } ?> <?php } elseif ($info->status == 'expired') { ?> <?php _e("License has expired.", Plugin::SLUG); ?> <?php } elseif ($info->status == 'disabled') { ?> <?php _e("License is disabled.", Plugin::SLUG); ?> <?php } ?> </p> <?php } elseif (!$still_active && $form->get_option('activation')) { ?> <p class="description expired"><?php _e("License deactivated remotely.", Plugin::SLUG); ?> </p> <?php } ?> <div class="it-exchange-addon-settings it-exchange-itelic-addon-settings"> <h3><?php _e("General", Plugin::SLUG); ?> </h3> <div class="sell-online-software-container"> <?php $form->add_check_box('sell-online-software'); ?> <label for="sell-online-software"><?php _e("Enable Online Software Tools?", Plugin::SLUG); ?> </label> <p class="description"> <?php _e("Check this if you sell at least one software product that is tied to URLs, such as WordPress plugins or themes.", Plugin::SLUG); ?> </p> </div> <div class="enable-remote-activation-container"> <?php $form->add_check_box('enable-remote-activation', $era_disabled); ?> <label for="enable-remote-activation"><?php _e("Enable Remote License Activation?", Plugin::SLUG); ?> </label> <p class="description"> <?php _e("Allow your customer's to activate a license key from your website. Requires Online Software Tools to be enabled.", Plugin::SLUG); ?> </p> </div> <div class="enable-remote-deactivation-container"> <?php $form->add_check_box('enable-remote-deactivation'); ?> <label for="enable-remote-deactivation"><?php _e("Enable Remote License Deactivation", Plugin::SLUG); ?> </label> <p class="description"><?php _e("Allow your customer's to remotely deactivate a license key.", Plugin::SLUG); ?> </p> </div> <h3><?php _e("Renewal Discounts", Plugin::SLUG); ?> </h3> <div class="enable-renewal-discounts-container"> <?php $form->add_check_box('enable-renewal-discounts'); ?> <label for="enable-renewal-discounts"><?php _e("Enable a Global Renewal Discount?", Plugin::SLUG); ?> </label> <p class="description"><?php _e("Don't worry, this can be overridden on a per-product basis.", Plugin::SLUG); ?> </p> </div> <div class="renewal-discount-type-container <?php echo esc_attr($erd_class); ?> "> <label for="renewal-discount-type"><?php _e("Discount Type", Plugin::SLUG); ?> </label> <?php $form->add_drop_down('renewal-discount-type', array(Renewal\Discount::TYPE_FLAT => __('Flat', Plugin::SLUG), Renewal\Discount::TYPE_PERCENT => __("Percent", Plugin::SLUG))); ?> </div> <div class="renewal-discount-amount-container <?php echo esc_attr($erd_class); ?> "> <label for="renewal-discount-amount"><?php _e("Discount Amount", Plugin::SLUG); ?> </label> <?php $form->add_text_box('renewal-discount-amount'); ?> </div> <div class="renewal-discount-expiry-container <?php echo esc_attr($erd_class); ?> "> <label for="renewal-discount-expiry"><?php _e("Valid Until", Plugin::SLUG); ?> </label> <?php $form->add_text_box('renewal-discount-expiry'); ?> <p class="description"><?php _e("For how many days after the license key expires should the renewal discount be applied.", Plugin::SLUG); ?> </p> </div> </div> <?php }