| @@ -1,78 +1,23 @@ | ||
| 1 | -<div id="sdevs_subscription_options" class="panel woocommerce_options_panel option_group sdevs-form sdevs_panel show_if_simple" style="padding: 10px;"> | |
| 2 | -<div class="show_if_subscription"> | |
| 3 | - <input name="_subscript_nonce" type="hidden" value="<?php echo esc_attr( wp_create_nonce( '_subscript_edit_product_nonce' ) ); ?>" /> | |
| 4 | - <strong style="margin: 10px;"><?php esc_html_e( 'Subscription Settings', 'sdevs_subscrpt' ); ?></strong> | |
| 5 | - <?php | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Subscription product edit form view (classic-only panel). | |
| 4 | + * | |
| 5 | + * Used for the classic Subscription tab where no plan view is mounted. The | |
| 6 | + * simple-product plan view (Admin/Product/Plans) renders its own panel and | |
| 7 | + * reuses the shared classic fields partial for its hidden "classic settings". | |
| 8 | + * | |
| 9 | + * @package SpringDevs\Subscription\Admin | |
| 10 | + */ | |
| 6 | 11 | |
| 7 | - woocommerce_wp_select( | |
| 8 | - array( | |
| 9 | - 'id' => 'subscrpt_timing', | |
| 10 | - 'label' => __( 'Users will pay', 'sdevs_subscrpt' ), | |
| 11 | - 'value' => $subscrpt_timing, | |
| 12 | - 'options' => $timing_types, | |
| 13 | - 'description' => __( 'Set the length of each recurring subscription period to daily, weekly, monthly or annually.', 'sdevs_subscrpt' ), | |
| 14 | - 'desc_tip' => true, | |
| 15 | - ) | |
| 16 | - ); | |
| 17 | - ?> | |
| 18 | -<p class="form-field subscrpt_field"> | |
| 19 | - <label for="subscrpt_trial_time"><?php esc_html_e( 'Offer a free trial of', 'sdevs_subscrpt' ); ?></label> | |
| 20 | - <input type="number" class="short" name="subscrpt_trial_time" id="subscrpt_trial_time" value="<?php echo esc_attr( $subscrpt_trial_time ); ?>" /> | |
| 21 | - <select name="subscrpt_trial_timing" id="subscrpt_trial_timing"> | |
| 22 | -<?php foreach ( $trial_timing_types as $timing_type ) : ?> | |
| 23 | - <option value="<?php echo esc_attr( $timing_type['value'] ); ?>" | |
| 24 | - <?php | |
| 25 | - if ( $subscrpt_trial_timing === $timing_type['value'] ) { | |
| 26 | - echo 'selected'; | |
| 27 | - } | |
| 28 | - ?> | |
| 29 | - ><?php echo esc_html( $timing_type['label'] ); ?></option> | |
| 30 | -<?php endforeach; ?> | |
| 31 | - </select> | |
| 32 | - <small class="description"><?php esc_html_e( 'You can offer a free trial of this subscription. In this way the user can purchase the subscription and will pay when the trial period expires.', 'sdevs_subscrpt' ); ?></small> | |
| 33 | -</p> | |
| 12 | +// Exit if accessed directly. | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 34 | 16 | |
| 35 | - <?php | |
| 36 | - | |
| 37 | - woocommerce_wp_text_input( | |
| 38 | - array( | |
| 39 | - 'id' => 'subscrpt_cart_txt', | |
| 40 | - 'label' => __( 'Add to Cart Text', 'sdevs_subscrpt' ), | |
| 41 | - 'type' => 'text', | |
| 42 | - 'value' => $subscrpt_cart_txt, | |
| 43 | - 'description' => __( 'change Add to Cart Text default is "subscribe"', 'sdevs_subscrpt' ), | |
| 44 | - 'desc_tip' => true, | |
| 45 | - ) | |
| 46 | - ); | |
| 47 | - | |
| 48 | - woocommerce_wp_select( | |
| 49 | - array( | |
| 50 | - 'id' => 'subscrpt_user_cancel', | |
| 51 | - 'label' => __( 'Can User Cancel', 'sdevs_subscrpt' ), | |
| 52 | - 'value' => $subscrpt_user_cancell, | |
| 53 | - 'options' => array( | |
| 54 | - 'yes' => __( 'Yes', 'sdevs_subscrpt' ), | |
| 55 | - 'no' => __( 'No', 'sdevs_subscrpt' ), | |
| 56 | - ), | |
| 57 | - 'description' => __( 'if "Yes",then user can be cancelled."No" means cannot do this !!', 'sdevs_subscrpt' ), | |
| 58 | - 'desc_tip' => true, | |
| 59 | - ) | |
| 60 | - ); | |
| 61 | - | |
| 62 | - woocommerce_wp_select( | |
| 63 | - array( | |
| 64 | - 'id' => 'subscrpt_limit', | |
| 65 | - 'label' => __( 'Limit subscription', 'sdevs_subscrpt' ), | |
| 66 | - 'options' => array( | |
| 67 | - 'unlimited' => __( 'Do not limit', 'sdevs_subscrpt' ), | |
| 68 | - 'one' => __( 'allow only one active subscription', 'sdevs_subscrpt' ), | |
| 69 | - 'only_one' => __( 'allow only one subscription of any status', 'sdevs_subscrpt' ), | |
| 70 | - ), | |
| 71 | - 'value' => $subscrpt_limit, | |
| 72 | - 'description' => __( 'Set optional limits for this product subscription.', 'sdevs_subscrpt' ), | |
| 73 | - 'desc_tip' => true, | |
| 74 | - ) | |
| 75 | - ); | |
| 76 | - ?> | |
| 77 | -</div> | |
| 17 | +?> | |
| 18 | +<div id="sdevs_subscription_options" | |
| 19 | + class="panel woocommerce_options_panel option_group sdevs-form sdevs_panel show_if_simple" style="padding: 10px;"> | |
| 20 | + <div class="show_if_subscription"> | |
| 21 | + <?php require __DIR__ . '/product-classic-fields.php'; ?> | |
| 22 | + </div> | |
| 78 | 23 | </div> |