| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
?> |
| 4 |
<div class="wrap qdbp-wrap"> |
| 5 |
<div class="qdbp-page-header"> |
| 6 |
<h1><?php esc_html_e( 'Shortcode Builder', 'quick-download-button' ); ?></h1> |
| 7 |
<p class="qdbp-page-subtitle"><?php esc_html_e( 'Configure your download button and copy the shortcode.', 'quick-download-button' ); ?></p> |
| 8 |
</div> |
| 9 |
|
| 10 |
<div class="qdbp-builder-layout"> |
| 11 |
|
| 12 |
<!-- ── Left: form ───────────────────────────────────────── --> |
| 13 |
<div class="qdbp-builder-form"> |
| 14 |
|
| 15 |
<!-- File --> |
| 16 |
<div class="qdbp-builder-section"> |
| 17 |
<h2 class="qdbp-builder-section__title"><?php esc_html_e( 'File', 'quick-download-button' ); ?></h2> |
| 18 |
|
| 19 |
<div class="qdbp-builder-field"> |
| 20 |
<label for="qdbp-b-url"><?php esc_html_e( 'File URL', 'quick-download-button' ); ?></label> |
| 21 |
<div class="qdbp-builder-field-row"> |
| 22 |
<input type="url" id="qdbp-b-url" class="qdbp-b-input regular-text" |
| 23 |
data-sc-attr="url" data-sc-default="" |
| 24 |
placeholder="https://example.com/file.zip" /> |
| 25 |
<button type="button" class="button qdbp-media-pick" data-target="qdbp-b-url"> |
| 26 |
<?php esc_html_e( 'Choose file', 'quick-download-button' ); ?> |
| 27 |
</button> |
| 28 |
</div> |
| 29 |
</div> |
| 30 |
|
| 31 |
<div class="qdbp-builder-field"> |
| 32 |
<label for="qdbp-b-title"><?php esc_html_e( 'Button label', 'quick-download-button' ); ?></label> |
| 33 |
<input type="text" id="qdbp-b-title" class="qdbp-b-input regular-text" |
| 34 |
data-sc-attr="title" data-sc-default="Download" |
| 35 |
value="Download" /> |
| 36 |
</div> |
| 37 |
</div> |
| 38 |
|
| 39 |
<!-- Button Style --> |
| 40 |
<div class="qdbp-builder-section"> |
| 41 |
<h2 class="qdbp-builder-section__title"><?php esc_html_e( 'Button Style', 'quick-download-button' ); ?></h2> |
| 42 |
|
| 43 |
<div class="qdbp-builder-field"> |
| 44 |
<label><?php esc_html_e( 'Style', 'quick-download-button' ); ?></label> |
| 45 |
<div class="qdbp-style-picker"> |
| 46 |
<?php |
| 47 |
$styles = array( |
| 48 |
'large' => __( 'Large', 'quick-download-button' ), |
| 49 |
'mid' => __( 'Mid', 'quick-download-button' ), |
| 50 |
'small' => __( 'Small', 'quick-download-button' ), |
| 51 |
'basic' => __( 'Basic', 'quick-download-button' ), |
| 52 |
'pill' => __( 'Pill', 'quick-download-button' ), |
| 53 |
'card' => __( 'Card', 'quick-download-button' ), |
| 54 |
'ghost' => __( 'Ghost', 'quick-download-button' ), |
| 55 |
); |
| 56 |
foreach ( $styles as $val => $label ) : |
| 57 |
$checked = 'large' === $val ? ' checked' : ''; |
| 58 |
?> |
| 59 |
<label class="qdbp-style-option"> |
| 60 |
<input type="radio" name="qdbp-b-button_type" value="<?php echo esc_attr( $val ); ?>" |
| 61 |
class="qdbp-b-radio" data-sc-attr="button_type" data-sc-default="large"<?php echo $checked; ?> /> |
| 62 |
<span><?php echo esc_html( $label ); ?></span> |
| 63 |
</label> |
| 64 |
<?php endforeach; ?> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
|
| 68 |
<div class="qdbp-builder-field"> |
| 69 |
<label><?php esc_html_e( 'Alignment', 'quick-download-button' ); ?></label> |
| 70 |
<select id="qdbp-b-align" class="qdbp-b-input" data-sc-attr="align" data-sc-default=""> |
| 71 |
<option value=""><?php esc_html_e( '— Default —', 'quick-download-button' ); ?></option> |
| 72 |
<option value="left"><?php esc_html_e( 'Left', 'quick-download-button' ); ?></option> |
| 73 |
<option value="center"><?php esc_html_e( 'Center', 'quick-download-button' ); ?></option> |
| 74 |
<option value="right"><?php esc_html_e( 'Right', 'quick-download-button' ); ?></option> |
| 75 |
</select> |
| 76 |
</div> |
| 77 |
|
| 78 |
<div class="qdbp-builder-field"> |
| 79 |
<label for="qdbp-b-wait"><?php esc_html_e( 'Countdown (seconds)', 'quick-download-button' ); ?></label> |
| 80 |
<input type="number" id="qdbp-b-wait" class="qdbp-b-input small-text" |
| 81 |
data-sc-attr="wait" data-sc-default="0" |
| 82 |
value="0" min="0" max="60" /> |
| 83 |
<p class="description"><?php esc_html_e( '0 = no countdown', 'quick-download-button' ); ?></p> |
| 84 |
</div> |
| 85 |
|
| 86 |
<div class="qdbp-builder-field"> |
| 87 |
<label> |
| 88 |
<input type="checkbox" id="qdbp-b-open_new_window" class="qdbp-b-checkbox" |
| 89 |
data-sc-attr="open_new_window" data-sc-default="false" |
| 90 |
data-sc-on="true" data-sc-off="false" /> |
| 91 |
<?php esc_html_e( 'Open in new window', 'quick-download-button' ); ?> |
| 92 |
</label> |
| 93 |
</div> |
| 94 |
</div> |
| 95 |
|
| 96 |
<!-- Display / Counter --> |
| 97 |
<div class="qdbp-builder-section"> |
| 98 |
<h2 class="qdbp-builder-section__title"><?php esc_html_e( 'Display', 'quick-download-button' ); ?></h2> |
| 99 |
|
| 100 |
<div class="qdbp-builder-field"> |
| 101 |
<label> |
| 102 |
<input type="checkbox" id="qdbp-b-show_count" class="qdbp-b-checkbox" |
| 103 |
data-sc-attr="show_count" data-sc-default="0" |
| 104 |
data-sc-on="1" data-sc-off="0" /> |
| 105 |
<?php esc_html_e( 'Show download count', 'quick-download-button' ); ?> |
| 106 |
</label> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
|
| 110 |
<!-- Gates --> |
| 111 |
<div class="qdbp-builder-section"> |
| 112 |
<h2 class="qdbp-builder-section__title">⚡ <?php esc_html_e( 'Gates', 'quick-download-button' ); ?></h2> |
| 113 |
|
| 114 |
<!-- Email gate --> |
| 115 |
<div class="qdbp-builder-field"> |
| 116 |
<label> |
| 117 |
<input type="checkbox" id="qdbp-b-email_gate" class="qdbp-b-checkbox qdbp-b-toggle" |
| 118 |
data-sc-attr="email_gate" data-sc-default="0" |
| 119 |
data-sc-on="1" data-sc-off="0" |
| 120 |
data-toggle-target=".qdbp-email-gate-fields" /> |
| 121 |
<?php esc_html_e( 'Require email before download', 'quick-download-button' ); ?> |
| 122 |
</label> |
| 123 |
</div> |
| 124 |
|
| 125 |
<div class="qdbp-email-gate-fields qdbp-conditional-fields" hidden> |
| 126 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 127 |
<label for="qdbp-b-email_gate_label"><?php esc_html_e( 'Gate label', 'quick-download-button' ); ?></label> |
| 128 |
<input type="text" id="qdbp-b-email_gate_label" class="qdbp-b-input regular-text" |
| 129 |
data-sc-attr="email_gate_label" data-sc-default="Enter your email to download" |
| 130 |
value="Enter your email to download" /> |
| 131 |
</div> |
| 132 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 133 |
<label for="qdbp-b-email_gate_btn_txt"><?php esc_html_e( 'Submit button text', 'quick-download-button' ); ?></label> |
| 134 |
<input type="text" id="qdbp-b-email_gate_btn_txt" class="qdbp-b-input regular-text" |
| 135 |
data-sc-attr="email_gate_btn_txt" data-sc-default="Get Download Link" |
| 136 |
value="Get Download Link" /> |
| 137 |
</div> |
| 138 |
<div class="qdbp-builder-field qdbp-builder-field--sub" style="margin-top:10px"> |
| 139 |
<label> |
| 140 |
<input type="checkbox" id="qdbp-b-email_gate_always_show" class="qdbp-b-checkbox qdbp-b-toggle" |
| 141 |
data-sc-attr="email_gate_always_show" data-sc-default="0" |
| 142 |
data-sc-on="1" data-sc-off="0" |
| 143 |
data-toggle-target=".qdbp-email-gate-ty-fields" /> |
| 144 |
<?php esc_html_e( 'Always show gate (even for returning visitors)', 'quick-download-button' ); ?> |
| 145 |
</label> |
| 146 |
<p class="description"><?php esc_html_e( 'When enabled, the gate appears on every click. Returning visitors see a thank-you message instead of the email form.', 'quick-download-button' ); ?></p> |
| 147 |
</div> |
| 148 |
<div class="qdbp-email-gate-ty-fields qdbp-conditional-fields" hidden> |
| 149 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 150 |
<label for="qdbp-b-email_gate_ty_msg"><?php esc_html_e( 'Returning visitor message', 'quick-download-button' ); ?></label> |
| 151 |
<input type="text" id="qdbp-b-email_gate_ty_msg" class="qdbp-b-input regular-text" |
| 152 |
data-sc-attr="email_gate_ty_msg" data-sc-default="Welcome back! Click below to continue your download." |
| 153 |
value="Welcome back! Click below to continue your download." /> |
| 154 |
</div> |
| 155 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 156 |
<label for="qdbp-b-email_gate_ty_btn_txt"><?php esc_html_e( 'Continue button text', 'quick-download-button' ); ?></label> |
| 157 |
<input type="text" id="qdbp-b-email_gate_ty_btn_txt" class="qdbp-b-input regular-text" |
| 158 |
data-sc-attr="email_gate_ty_btn_txt" data-sc-default="Continue Download" |
| 159 |
value="Continue Download" /> |
| 160 |
</div> |
| 161 |
</div> |
| 162 |
</div> |
| 163 |
|
| 164 |
<div class="qdbp-builder-field" style="margin-top:12px"> |
| 165 |
<label for="qdbp-b-passcode"><?php esc_html_e( 'Passcode', 'quick-download-button' ); ?></label> |
| 166 |
<div class="qdbp-builder-field-row"> |
| 167 |
<input type="text" id="qdbp-b-passcode" class="qdbp-b-input regular-text qdbp-b-toggle" |
| 168 |
data-sc-attr="passcode" data-sc-default="" |
| 169 |
data-toggle-target=".qdbp-passcode-fields" |
| 170 |
placeholder="<?php esc_attr_e( 'Leave blank to disable', 'quick-download-button' ); ?>" /> |
| 171 |
</div> |
| 172 |
</div> |
| 173 |
|
| 174 |
<div class="qdbp-passcode-fields qdbp-conditional-fields" hidden> |
| 175 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 176 |
<label for="qdbp-b-passcode_label"><?php esc_html_e( 'Passcode label', 'quick-download-button' ); ?></label> |
| 177 |
<input type="text" id="qdbp-b-passcode_label" class="qdbp-b-input regular-text" |
| 178 |
data-sc-attr="passcode_label" data-sc-default="Enter passcode to download" |
| 179 |
value="Enter passcode to download" /> |
| 180 |
</div> |
| 181 |
</div> |
| 182 |
</div> |
| 183 |
|
| 184 |
<!-- Download Limit --> |
| 185 |
<div class="qdbp-builder-section"> |
| 186 |
<h2 class="qdbp-builder-section__title">⚡ <?php esc_html_e( 'Download Limit', 'quick-download-button' ); ?></h2> |
| 187 |
|
| 188 |
<div class="qdbp-builder-field"> |
| 189 |
<label for="qdbp-b-dl_limit"><?php esc_html_e( 'Max downloads per visitor', 'quick-download-button' ); ?></label> |
| 190 |
<input type="number" id="qdbp-b-dl_limit" class="qdbp-b-input small-text qdbp-b-toggle" |
| 191 |
data-sc-attr="dl_limit" data-sc-default="0" |
| 192 |
data-toggle-target=".qdbp-limit-fields" |
| 193 |
value="0" min="0" /> |
| 194 |
<p class="description"><?php esc_html_e( '0 = unlimited', 'quick-download-button' ); ?></p> |
| 195 |
</div> |
| 196 |
|
| 197 |
<div class="qdbp-limit-fields qdbp-conditional-fields" hidden> |
| 198 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 199 |
<label for="qdbp-b-dl_limit_window"><?php esc_html_e( 'Time window (hours)', 'quick-download-button' ); ?></label> |
| 200 |
<input type="number" id="qdbp-b-dl_limit_window" class="qdbp-b-input small-text" |
| 201 |
data-sc-attr="dl_limit_window" data-sc-default="24" |
| 202 |
value="24" min="1" /> |
| 203 |
</div> |
| 204 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 205 |
<label for="qdbp-b-dl_limit_msg"><?php esc_html_e( 'Limit message', 'quick-download-button' ); ?></label> |
| 206 |
<input type="text" id="qdbp-b-dl_limit_msg" class="qdbp-b-input regular-text" |
| 207 |
data-sc-attr="dl_limit_msg" data-sc-default="You have reached the download limit. Please try again later." |
| 208 |
value="You have reached the download limit. Please try again later." /> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
</div> |
| 212 |
|
| 213 |
<!-- Expiring Links --> |
| 214 |
<div class="qdbp-builder-section"> |
| 215 |
<h2 class="qdbp-builder-section__title">⚡ <?php esc_html_e( 'Expiring Links', 'quick-download-button' ); ?></h2> |
| 216 |
|
| 217 |
<div class="qdbp-builder-field"> |
| 218 |
<label for="qdbp-b-expiry_hours"><?php esc_html_e( 'Link expires after (hours)', 'quick-download-button' ); ?></label> |
| 219 |
<input type="number" id="qdbp-b-expiry_hours" class="qdbp-b-input small-text qdbp-b-toggle" |
| 220 |
data-sc-attr="expiry_hours" data-sc-default="0" |
| 221 |
data-toggle-target=".qdbp-expiry-msg-field" |
| 222 |
value="0" min="0" /> |
| 223 |
<p class="description"><?php esc_html_e( '0 = no time limit', 'quick-download-button' ); ?></p> |
| 224 |
</div> |
| 225 |
|
| 226 |
<div class="qdbp-builder-field"> |
| 227 |
<label for="qdbp-b-expiry_clicks"><?php esc_html_e( 'Max clicks per link', 'quick-download-button' ); ?></label> |
| 228 |
<input type="number" id="qdbp-b-expiry_clicks" class="qdbp-b-input small-text qdbp-b-toggle" |
| 229 |
data-sc-attr="expiry_clicks" data-sc-default="0" |
| 230 |
data-toggle-target=".qdbp-expiry-msg-field" |
| 231 |
value="0" min="0" /> |
| 232 |
<p class="description"><?php esc_html_e( '0 = unlimited', 'quick-download-button' ); ?></p> |
| 233 |
</div> |
| 234 |
|
| 235 |
<div class="qdbp-expiry-msg-field qdbp-conditional-fields" hidden> |
| 236 |
<div class="qdbp-builder-field qdbp-builder-field--sub"> |
| 237 |
<label for="qdbp-b-expiry_msg"><?php esc_html_e( 'Expiry message', 'quick-download-button' ); ?></label> |
| 238 |
<input type="text" id="qdbp-b-expiry_msg" class="qdbp-b-input regular-text" |
| 239 |
data-sc-attr="expiry_msg" data-sc-default="This download link has expired." |
| 240 |
value="This download link has expired." /> |
| 241 |
</div> |
| 242 |
</div> |
| 243 |
</div> |
| 244 |
|
| 245 |
</div><!-- /.qdbp-builder-form --> |
| 246 |
|
| 247 |
<!-- ── Right: output panel ──────────────────────────────── --> |
| 248 |
<div class="qdbp-builder-output-wrap"> |
| 249 |
<div class="qdbp-builder-output"> |
| 250 |
<h2 class="qdbp-builder-output__title"> |
| 251 |
<?php esc_html_e( 'Your Shortcode', 'quick-download-button' ); ?> |
| 252 |
</h2> |
| 253 |
<textarea id="qdbp-builder-result" class="qdbp-builder-result" rows="5" readonly></textarea> |
| 254 |
<button type="button" id="qdbp-copy-shortcode" class="button button-primary qdbp-copy-btn"> |
| 255 |
<?php esc_html_e( 'Copy shortcode', 'quick-download-button' ); ?> |
| 256 |
</button> |
| 257 |
<p class="qdbp-builder-output__hint"> |
| 258 |
<?php esc_html_e( 'Paste into any post, page, or widget.', 'quick-download-button' ); ?> |
| 259 |
</p> |
| 260 |
</div> |
| 261 |
</div> |
| 262 |
|
| 263 |
</div><!-- /.qdbp-builder-layout --> |
| 264 |
</div> |
| 265 |
|