| @@ -105,8 +105,72 @@ | ||
| 105 | 105 | 'value' => '1', |
| 106 | 106 | 'checked' => '1' === get_option( 'subscrpt_early_renew', '1' ), |
| 107 | 107 | ], |
| 108 | 108 | ], |
| 109 | + [ | |
| 110 | + 'type' => 'select', | |
| 111 | + 'group' => 'renewals', | |
| 112 | + 'priority' => 9, | |
| 113 | + 'field_data' => [ | |
| 114 | + 'id' => 'subscrpt_early_renew_visibility', | |
| 115 | + 'title' => __( 'Early Renew Button Visibility', 'subscription' ), | |
| 116 | + 'description' => __( 'Choose when customers see the Early Renew button on an active subscription.', 'subscription' ), | |
| 117 | + 'options' => [ | |
| 118 | + 'always' => __( 'Always', 'subscription' ), | |
| 119 | + 'before_days' => __( 'Before X days of the next renewal', 'subscription' ), | |
| 120 | + 'day_of_month' => __( 'From a fixed day of the month', 'subscription' ), | |
| 121 | + 'cycle_left' => __( 'When a percentage of the billing cycle remains', 'subscription' ), | |
| 122 | + ], | |
| 123 | + 'selected' => esc_attr( get_option( 'subscrpt_early_renew_visibility', 'always' ) ), | |
| 124 | + ], | |
| 125 | + ], | |
| 126 | + [ | |
| 127 | + 'type' => 'input', | |
| 128 | + 'group' => 'renewals', | |
| 129 | + 'priority' => 10, | |
| 130 | + 'field_data' => [ | |
| 131 | + 'id' => 'subscrpt_early_renew_before_days', | |
| 132 | + 'title' => __( 'Early Renew: Days Before Renewal', 'subscription' ), | |
| 133 | + 'description' => __( 'Used with "Before X days". The button shows this many days before the next renewal date.', 'subscription' ), | |
| 134 | + 'value' => esc_attr( get_option( 'subscrpt_early_renew_before_days', '7' ) ), | |
| 135 | + 'type' => 'number', | |
| 136 | + 'attributes' => [ | |
| 137 | + 'min' => 1, | |
| 138 | + ], | |
| 139 | + ], | |
| 140 | + ], | |
| 141 | + [ | |
| 142 | + 'type' => 'input', | |
| 143 | + 'group' => 'renewals', | |
| 144 | + 'priority' => 11, | |
| 145 | + 'field_data' => [ | |
| 146 | + 'id' => 'subscrpt_early_renew_day_of_month', | |
| 147 | + 'title' => __( 'Early Renew: Day of Month', 'subscription' ), | |
| 148 | + 'description' => __( 'Used with "From a fixed day of the month". The button shows from this day until the end of each month. Short months use their last day.', 'subscription' ), | |
| 149 | + 'value' => esc_attr( get_option( 'subscrpt_early_renew_day_of_month', '25' ) ), | |
| 150 | + 'type' => 'number', | |
| 151 | + 'attributes' => [ | |
| 152 | + 'min' => 1, | |
| 153 | + 'max' => 31, | |
| 154 | + ], | |
| 155 | + ], | |
| 156 | + ], | |
| 157 | + [ | |
| 158 | + 'type' => 'input', | |
| 159 | + 'group' => 'renewals', | |
| 160 | + 'priority' => 12, | |
| 161 | + 'field_data' => [ | |
| 162 | + 'id' => 'subscrpt_early_renew_cycle_left', | |
| 163 | + 'title' => __( 'Early Renew: Cycle Remaining (%)', 'subscription' ), | |
| 164 | + 'description' => __( 'Used with "When a percentage of the billing cycle remains". The button shows once this percentage of the current cycle or less is left.', 'subscription' ), | |
| 165 | + 'value' => esc_attr( get_option( 'subscrpt_early_renew_cycle_left', '20' ) ), | |
| 166 | + 'type' => 'number', | |
| 167 | + 'attributes' => [ | |
| 168 | + 'min' => 1, | |
| 169 | + 'max' => 100, | |
| 170 | + ], | |
| 171 | + ], | |
| 172 | + ], | |
| 109 | 173 | ]; |
| 110 | 174 | } |
| 111 | 175 | |
| 112 | 176 | /** |