| 1 |
<?php |
| 2 |
/** |
| 3 |
* Dates, times, and website-language editor. |
| 4 |
* |
| 5 |
* @package Booking Calendar |
| 6 |
* @var array<string,mixed> $template_context Authorized step context. |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$step_data = $template_context['step_data']; |
| 14 |
$values = $step_data['values']; |
| 15 |
$site_language = $step_data['site_language']; |
| 16 |
$language_status = 'wpbc_setup_wizard__language-status wpbc_setup_wizard__language-status--' . sanitize_html_class( $site_language['status'] ); |
| 17 |
$translation_action_class = 'button button-secondary wpbc_setup_wizard__translation-action'; |
| 18 |
if ( ! empty( $site_language['is_local_source_recommended'] ) ) { |
| 19 |
$translation_action_class .= ' wpbc_setup_wizard__translation-action--recommended'; |
| 20 |
} |
| 21 |
?> |
| 22 |
<section class="wpbc_setup_wizard__step-content" aria-labelledby="wpbc-setup-wizard-step-title" data-wpbc-date-time-formats-editor> |
| 23 |
<header class="wpbc_setup_wizard__step-heading"> |
| 24 |
<h1 id="wpbc-setup-wizard-step-title"><?php esc_html_e( 'Dates, times and language', 'booking' ); ?></h1> |
| 25 |
<p class="wpbc_setup_wizard__lead"><?php esc_html_e( 'Choose how dates and times are displayed, and manage the Booking Calendar translation for your site language.', 'booking' ); ?></p> |
| 26 |
</header> |
| 27 |
|
| 28 |
<form class="wpbc_setup_wizard__content-panel" id="wpbc-setup-wizard-step-form" data-wpbc-setup-wizard-fields novalidate> |
| 29 |
<div class="wpbc_setup_wizard__field-grid"> |
| 30 |
<div class="wpbc_setup_wizard__field"> |
| 31 |
<label for="wpbc-setup-wizard-date-format"><?php esc_html_e( 'Date Format', 'booking' ); ?></label> |
| 32 |
<select id="wpbc-setup-wizard-date-format" name="date_format" required data-wpbc-setup-wizard-field aria-describedby="wpbc-setup-wizard-date-format-error"> |
| 33 |
<?php foreach ( $step_data['date_formats'] as $date_format ) : ?> |
| 34 |
<option value="<?php echo esc_attr( $date_format['value'] ); ?>"<?php selected( $values['date_format'], $date_format['value'] ); ?>><?php echo esc_html( $date_format['label'] ); ?></option> |
| 35 |
<?php endforeach; ?> |
| 36 |
</select> |
| 37 |
<span class="wpbc_setup_wizard__field-error" id="wpbc-setup-wizard-date-format-error" data-wpbc-setup-wizard-error-for="date_format"></span> |
| 38 |
</div> |
| 39 |
|
| 40 |
<div class="wpbc_setup_wizard__field"> |
| 41 |
<label for="wpbc-setup-wizard-time-format"><?php esc_html_e( 'Time Format', 'booking' ); ?></label> |
| 42 |
<select id="wpbc-setup-wizard-time-format" name="time_format" required data-wpbc-setup-wizard-field aria-describedby="wpbc-setup-wizard-time-format-error"> |
| 43 |
<?php foreach ( $step_data['time_formats'] as $time_format ) : ?> |
| 44 |
<option value="<?php echo esc_attr( $time_format['value'] ); ?>"<?php selected( $values['time_format'], $time_format['value'] ); ?>><?php echo esc_html( $time_format['label'] ); ?></option> |
| 45 |
<?php endforeach; ?> |
| 46 |
</select> |
| 47 |
<span class="wpbc_setup_wizard__field-error" id="wpbc-setup-wizard-time-format-error" data-wpbc-setup-wizard-error-for="time_format"></span> |
| 48 |
</div> |
| 49 |
|
| 50 |
<div class="wpbc_setup_wizard__field"> |
| 51 |
<label for="wpbc-setup-wizard-week-start"><?php esc_html_e( 'Start day of the week', 'booking' ); ?></label> |
| 52 |
<select id="wpbc-setup-wizard-week-start" name="start_day_of_week" required data-wpbc-setup-wizard-field aria-describedby="wpbc-setup-wizard-week-start-help wpbc-setup-wizard-week-start-error"> |
| 53 |
<?php foreach ( $step_data['week_start_days'] as $weekday_id => $weekday_label ) : ?> |
| 54 |
<option value="<?php echo esc_attr( $weekday_id ); ?>"<?php selected( $values['start_day_of_week'], $weekday_id ); ?>><?php echo esc_html( $weekday_label ); ?></option> |
| 55 |
<?php endforeach; ?> |
| 56 |
</select> |
| 57 |
<span class="wpbc_setup_wizard__field-help" id="wpbc-setup-wizard-week-start-help"><?php esc_html_e( 'Select which day the week starts on.', 'booking' ); ?></span> |
| 58 |
<span class="wpbc_setup_wizard__field-error" id="wpbc-setup-wizard-week-start-error" data-wpbc-setup-wizard-error-for="start_day_of_week"></span> |
| 59 |
</div> |
| 60 |
|
| 61 |
<div class="wpbc_setup_wizard__field wpbc_setup_wizard__language-field"> |
| 62 |
<label for="wpbc-setup-wizard-site-language"><?php esc_html_e( 'Booking Calendar language', 'booking' ); ?></label> |
| 63 |
<select id="wpbc-setup-wizard-site-language" disabled aria-describedby="wpbc-setup-wizard-site-language-source wpbc-setup-wizard-site-language-help wpbc-setup-wizard-site-language-status wpbc-setup-wizard-site-language-local-source-recommendation wpbc-setup-wizard-site-language-updated wpbc-setup-wizard-site-language-update-recommendation"> |
| 64 |
<option selected><?php echo esc_html( $site_language['label'] ); ?></option> |
| 65 |
</select> |
| 66 |
<span class="wpbc_setup_wizard__translation-source" id="wpbc-setup-wizard-site-language-source" data-wpbc-local-translation-source="<?php echo esc_attr( $site_language['translation_source'] ); ?>"> |
| 67 |
<span><?php esc_html_e( 'Translation source:', 'booking' ); ?></span> |
| 68 |
<strong data-wpbc-local-translation-source-label><?php echo esc_html( $site_language['translation_source_label'] ); ?></strong> |
| 69 |
</span> |
| 70 |
<span class="<?php echo esc_attr( $language_status ); ?>" id="wpbc-setup-wizard-site-language-status" data-wpbc-local-translation-status> |
| 71 |
<?php echo esc_html( $site_language['status_label'] ); ?> |
| 72 |
</span> |
| 73 |
<span class="wpbc_setup_wizard__field-help" id="wpbc-setup-wizard-site-language-help" data-wpbc-local-translation-help> |
| 74 |
<?php echo esc_html( $site_language['help'] ); ?> |
| 75 |
</span> |
| 76 |
<span class="wpbc_setup_wizard__translation-source-recommendation" id="wpbc-setup-wizard-site-language-local-source-recommendation" data-wpbc-local-source-recommendation<?php if ( empty( $site_language['is_local_source_recommended'] ) ) : ?> hidden<?php endif; ?>> |
| 77 |
<?php echo esc_html( $site_language['local_source_recommendation'] ); ?> |
| 78 |
</span> |
| 79 |
<span class="wpbc_setup_wizard__translation-updated" id="wpbc-setup-wizard-site-language-updated" data-wpbc-local-translation-updated<?php if ( empty( $site_language['updated_label'] ) ) : ?> hidden<?php endif; ?>> |
| 80 |
<?php echo esc_html( $site_language['updated_label'] ); ?> |
| 81 |
</span> |
| 82 |
<span class="wpbc_setup_wizard__translation-recommendation" id="wpbc-setup-wizard-site-language-update-recommendation" data-wpbc-local-translation-recommendation<?php if ( empty( $site_language['is_update_recommended'] ) ) : ?> hidden<?php endif; ?>> |
| 83 |
<?php echo esc_html( $site_language['update_recommendation'] ); ?> |
| 84 |
</span> |
| 85 |
|
| 86 |
<?php if ( $site_language['can_install'] ) : ?> |
| 87 |
<button type="button" class="<?php echo esc_attr( $translation_action_class ); ?>" data-wpbc-install-local-translation aria-controls="wpbc-setup-wizard-local-translation-console"> |
| 88 |
<i class="menu_icon icon-1x wpbc_icn_download" aria-hidden="true"></i> |
| 89 |
<span data-wpbc-install-local-translation-label><?php echo esc_html( $site_language['action_label'] ); ?></span> |
| 90 |
</button> |
| 91 |
<?php endif; ?> |
| 92 |
|
| 93 |
<?php if ( ! $site_language['is_demo'] && ! $site_language['can_manage'] ) : ?> |
| 94 |
<span class="wpbc_setup_wizard__field-help"><?php esc_html_e( 'An administrator who can install plugins must update and select the Local translation source.', 'booking' ); ?></span> |
| 95 |
<?php endif; ?> |
| 96 |
|
| 97 |
<div class="wpbc_setup_wizard__translation-feedback" data-wpbc-local-translation-feedback role="status" aria-live="polite"></div> |
| 98 |
</div> |
| 99 |
</div> |
| 100 |
|
| 101 |
<section id="wpbc-setup-wizard-local-translation-console" class="wpbc_setup_wizard__translation-console" data-wpbc-local-translation-console aria-labelledby="wpbc-setup-wizard-local-translation-console-title" aria-busy="false" hidden> |
| 102 |
<header class="wpbc_setup_wizard__translation-console-header"> |
| 103 |
<h2 id="wpbc-setup-wizard-local-translation-console-title"><?php esc_html_e( 'Local translation update log', 'booking' ); ?></h2> |
| 104 |
<span data-wpbc-local-translation-console-state><?php esc_html_e( 'Waiting', 'booking' ); ?></span> |
| 105 |
</header> |
| 106 |
<ol class="wpbc_setup_wizard__translation-console-log" data-wpbc-local-translation-console-log role="log" aria-live="polite" aria-relevant="additions text"></ol> |
| 107 |
</section> |
| 108 |
|
| 109 |
<div class="wpbc_setup_wizard__divider"></div> |
| 110 |
<p class="wpbc_setup_wizard__settings-note"> |
| 111 |
<?php esc_html_e( 'You can always change these settings later', 'booking' ); ?> |
| 112 |
— |
| 113 |
<a href="<?php echo esc_url( $step_data['date_time_settings_url'] ); ?>"><?php esc_html_e( 'Settings', 'booking' ); ?> > <?php esc_html_e( 'Date / Time Formats', 'booking' ); ?></a> |
| 114 |
<span aria-hidden="true">·</span> |
| 115 |
<a href="<?php echo esc_url( $step_data['translation_settings_url'] ); ?>"><?php esc_html_e( 'Settings', 'booking' ); ?> > <?php esc_html_e( 'Admin Panel', 'booking' ); ?> > <?php esc_html_e( 'Translations', 'booking' ); ?></a> |
| 116 |
</p> |
| 117 |
</form> |
| 118 |
</section> |
| 119 |
|