filters.php
3 months ago
info-bottom.php
3 months ago
info-top.php
1 year ago
submitbox-meta.php
10 months ago
submitbox-meta.php
64 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Render schedule options in the publish meta box on the ad edit screen |
| 4 | * |
| 5 | * @package AdvancedAds |
| 6 | * @author Advanced Ads <info@wpadvancedads.com> |
| 7 | * @since 1.48.2 |
| 8 | * |
| 9 | * @var int $curr_year Current year. |
| 10 | * @var int $curr_month Current month index. |
| 11 | * @var int $curr_day Current day. |
| 12 | * @var int $curr_hour Current hour. |
| 13 | * @var int $curr_minute Current minute. |
| 14 | * @var int $enabled Whether expiry date is enabled (1) or not (0). |
| 15 | * @var WP_Locale $wp_locale WordPress locale object for month names. |
| 16 | */ |
| 17 | |
| 18 | ?> |
| 19 | <div id="advanced-ads-expiry-date" class="misc-pub-section curtime misc-pub-curtime"> |
| 20 | <label onclick="advads_toggle_box('#advanced-ads-expiry-date-enable', '#advanced-ads-expiry-date .inner')"> |
| 21 | <input type="checkbox" id="advanced-ads-expiry-date-enable" name="advanced_ad[expiry_date][enabled]" value="1" <?php checked( $enabled, 1 ); ?>/> |
| 22 | <?php esc_html_e( 'Set expiry date', 'advanced-ads' ); ?> |
| 23 | </label> |
| 24 | <br/> |
| 25 | <div class="inner"<?php echo ( ! $enabled ) ? ' style="display:none;"' : ''; ?>> |
| 26 | <?php |
| 27 | $month_field = '<label><span class="screen-reader-text">' . __( 'Month', 'advanced-ads' ) . '</span><select class="advads-mm" name="advanced_ad[expiry_date][month]"' . ">\n"; |
| 28 | for ( $i = 1; $i < 13; $i = ++$i ) { |
| 29 | $month_num = zeroise( $i, 2 ); |
| 30 | $month_field .= "\t\t\t" . '<option value="' . $month_num . '" ' . selected( $curr_month, $month_num, false ) . '>'; |
| 31 | $month_field .= sprintf( |
| 32 | /* translators: %1$s is the month number, %2$s is the month shortname. */ |
| 33 | _x( '%1$s-%2$s', '1: month number (01, 02, etc.), 2: month abbreviation', 'advanced-ads' ), |
| 34 | $month_num, |
| 35 | $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) |
| 36 | ) . "</option>\n"; |
| 37 | } |
| 38 | $month_field .= '</select></label>'; |
| 39 | |
| 40 | $day_field = '<label><span class="screen-reader-text">' . __( 'Day', 'advanced-ads' ) . '</span><input type="text" class="advads-jj" name="advanced_ad[expiry_date][day]" value="' . $curr_day . '" size="2" maxlength="2" autocomplete="off" /></label>'; |
| 41 | $year_field = '<label><span class="screen-reader-text">' . __( 'Year', 'advanced-ads' ) . '</span><input type="text" class="advads-aa" name="advanced_ad[expiry_date][year]" value="' . $curr_year . '" size="4" maxlength="4" autocomplete="off" /></label>'; |
| 42 | $hour_field = '<label><span class="screen-reader-text">' . __( 'Hour', 'advanced-ads' ) . '</span><input type="text" class="advads-hh" name="advanced_ad[expiry_date][hour]" value="' . $curr_hour . '" size="2" maxlength="2" autocomplete="off" /></label>'; |
| 43 | $minute_field = '<label><span class="screen-reader-text">' . __( 'Minute', 'advanced-ads' ) . '</span><input type="text" class="advads-mn" name="advanced_ad[expiry_date][minute]" value="' . $curr_minute . '" size="2" maxlength="2" autocomplete="off" /></label>'; |
| 44 | |
| 45 | ?> |
| 46 | <fieldset class="advads-timestamp"> |
| 47 | <?php |
| 48 | // phpcs:disable |
| 49 | printf( |
| 50 | /* translators: %1$s month, %2$s day, %3$s year, %4$s hour, %5$s minute. */ |
| 51 | _x( '%1$s %2$s, %3$s @ %4$s %5$s', 'order of expiry date fields 1: month, 2: day, 3: year, 4: hour, 5: minute', 'advanced-ads' ), |
| 52 | $month_field, |
| 53 | $day_field, |
| 54 | $year_field, |
| 55 | $hour_field, |
| 56 | $minute_field |
| 57 | ); |
| 58 | // phpcs:enable |
| 59 | ?> |
| 60 | </fieldset> |
| 61 | (<?php echo esc_html( Advanced_Ads_Utils::get_timezone_name() ); ?>) |
| 62 | </div> |
| 63 | </div> |
| 64 |