PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | includes/page-availability-general/availability_general__page.php +102 -79 11.111.8.4 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * General availability admin page.
4 4 *
@@ -217,9 +217,9 @@
217 217
218 218 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
219 219 $open_section = isset( $_REQUEST['wpbc_ag_open'] ) ? sanitize_key( wp_unslash( $_REQUEST['wpbc_ag_open'] ) ) : '';
220 220
221 - return in_array( $open_section, array( 'working_time' ), true ) ? $open_section : '';
221 + return in_array( $open_section, array( 'weekdays', 'from_today', 'buffer', 'working_time' ), true ) ? $open_section : '';
222 222 }
223 223
224 224 /**
225 225 * Validate preview resource ID.
@@ -890,17 +890,17 @@
890 890
891 891 $tabs = array();
892 892
893 893 $tabs['general_availability'] = array(
894 - 'is_show_top_path' => false,
894 + 'is_show_top_path' => true,
895 895 'right_vertical_sidebar__is_show' => true,
896 896 'right_vertical_sidebar__default_view_mode' => '',
897 897 'right_vertical_sidebar_compact__is_show' => true,
898 - 'left_navigation__default_view_mode' => 'compact',
899 - 'title' => __( 'General Availability', 'booking' ) .
900 - '<span class="wpbc_new_label" style="margin-left: auto;">' . esc_html__( 'New', 'booking' ) . '</span>',
898 + 'left_navigation__default_view_mode' => '', // FixIn:11.7.1.1: 'compact',
899 + 'top_path_title' => __( 'Schedule & Rules', 'booking' ),
900 + 'title' => __( 'Schedule & Rules', 'booking' ),
901 901 'hint' => __( 'Define global front-end availability rules for all calendars, including unavailable weekdays, booking buffers, and availability limits.', 'booking' ),
902 - 'page_title' => __( 'General Availability', 'booking' ),
902 + 'page_title' => __( 'Schedule & Rules', 'booking' ),
903 903 'link' => '',
904 904 'position' => '',
905 905 'css_classes' => 'wpbc_top_tab__general_availability',
906 906 'icon' => '',
@@ -910,8 +910,9 @@
910 910 'disabled' => false,
911 911 'hided' => false,
912 912 'subtabs' => array(),
913 913 'folder_style' => 'order:93;',
914 + 'is_show_top_navigation' => true,
914 915 );
915 916
916 917 return $tabs;
917 918 }
@@ -965,9 +966,9 @@
965 966 'icon' => 'wpbc-bi-info-circle',
966 967 ),
967 968 ),
968 969 array(
969 - 'aria_label' => __( 'General Availability Panels', 'booking' ),
970 + 'aria_label' => __( 'Schedule & Rules Panels', 'booking' ),
970 971 'context' => 'general_availability',
971 972 'class' => 'wpbc_ag_rightbar_tabs',
972 973 )
973 974 );
@@ -1034,9 +1035,9 @@
1034 1035 $unavailable_weekdays[] = $i;
1035 1036 }
1036 1037 }
1037 1038
1038 - WPBC_UI_Sidebar_Panels::render_inspector_header( __( 'General Availability', 'booking' ), __( 'Global front-end availability rules for all calendars.', 'booking' ) );
1039 + WPBC_UI_Sidebar_Panels::render_inspector_header( __( 'Schedule & Rules', 'booking' ), __( 'Availability rules for all calendars.', 'booking' ) );
1039 1040 ?>
1040 1041 <form method="post" id="<?php echo esc_attr( $form_name ); ?>" class="wpbc_ag_settings_form" data-wpbc-ag-settings-form="1">
1041 1042 <?php wp_nonce_field( 'wpbc_settings_page_' . $form_name ); ?>
1042 1043 <input type="hidden" name="is_form_submitted_<?php echo esc_attr( $form_name ); ?>" value="1" />
@@ -1047,40 +1048,102 @@
1047 1048 'id' => 'wpbc_ag_weekdays_group',
1048 1049 'group' => 'general-availability-weekdays',
1049 1050 'title' => __( 'Unavailable Weekdays', 'booking' ),
1050 1051 'open' => ( 'working_time' !== $open_section ),
1051 - ),
1052 - function () use ( $unavailable_weekdays ) {
1053 - $days = array(
1054 - 0 => __( 'Sunday', 'booking' ),
1055 - 1 => __( 'Monday', 'booking' ),
1056 - 2 => __( 'Tuesday', 'booking' ),
1057 - 3 => __( 'Wednesday', 'booking' ),
1058 - 4 => __( 'Thursday', 'booking' ),
1059 - 5 => __( 'Friday', 'booking' ),
1060 - 6 => __( 'Saturday', 'booking' ),
1061 - );
1062 - $start_week_day = absint( get_bk_option( 'booking_start_day_weeek' ) );
1063 - if ( $start_week_day > 6 ) {
1064 - $start_week_day = 0;
1065 - }
1066 - $days_ordered = array_slice( $days, $start_week_day, null, true ) + array_slice( $days, 0, $start_week_day, true );
1067 - ?>
1068 - <div class="wpbc_ag_weekday_grid">
1069 - <?php foreach ( $days_ordered as $day_num => $day_title ) : ?>
1070 - <label class="wpbc_ag_switch">
1071 - <input type="checkbox" name="booking_unavailable_days[]" value="<?php echo esc_attr( $day_num ); ?>" <?php checked( in_array( $day_num, $unavailable_weekdays, true ) ); ?> />
1072 - <span class="wpbc_ag_switch_control" aria-hidden="true"><span class="wpbc_ag_switch_knob"></span></span>
1073 - <span class="wpbc_ag_switch_label"><?php echo esc_html( $day_title ); ?></span>
1074 - </label>
1075 - <?php endforeach; ?>
1076 - </div>
1052 + ),
1053 + function () use ( $unavailable_weekdays ) {
1054 + $days_ordered = array(
1055 + 1 => array(
1056 + 'short' => _x( 'Mo', 'Short weekday label', 'booking' ),
1057 + 'full' => __( 'Monday', 'booking' ),
1058 + ),
1059 + 2 => array(
1060 + 'short' => _x( 'Tu', 'Short weekday label', 'booking' ),
1061 + 'full' => __( 'Tuesday', 'booking' ),
1062 + ),
1063 + 3 => array(
1064 + 'short' => _x( 'We', 'Short weekday label', 'booking' ),
1065 + 'full' => __( 'Wednesday', 'booking' ),
1066 + ),
1067 + 4 => array(
1068 + 'short' => _x( 'Th', 'Short weekday label', 'booking' ),
1069 + 'full' => __( 'Thursday', 'booking' ),
1070 + ),
1071 + 5 => array(
1072 + 'short' => _x( 'Fr', 'Short weekday label', 'booking' ),
1073 + 'full' => __( 'Friday', 'booking' ),
1074 + ),
1075 + 6 => array(
1076 + 'short' => _x( 'Sa', 'Short weekday label', 'booking' ),
1077 + 'full' => __( 'Saturday', 'booking' ),
1078 + ),
1079 + 0 => array(
1080 + 'short' => _x( 'Su', 'Short weekday label', 'booking' ),
1081 + 'full' => __( 'Sunday', 'booking' ),
1082 + ),
1083 + );
1084 + ?>
1085 + <div class="wpbc_ag_weekday_grid">
1086 + <?php foreach ( $days_ordered as $day_num => $day_labels ) : ?>
1087 + <?php
1088 + $unavailable_day_aria_label = sprintf(
1089 + /* translators: %s: Full weekday name. */
1090 + __( 'Set %s as unavailable', 'booking' ),
1091 + $day_labels['full']
1092 + );
1093 + ?>
1094 + <label class="wpbc_ag_switch wpbc_ag_weekday_switch">
1095 + <input type="checkbox" name="booking_unavailable_days[]" value="<?php echo esc_attr( $day_num ); ?>" aria-label="<?php echo esc_attr( $unavailable_day_aria_label ); ?>" <?php checked( in_array( $day_num, $unavailable_weekdays, true ) ); ?> />
1096 + <span class="wpbc_ag_switch_control" aria-hidden="true"><span class="wpbc_ag_switch_knob"></span></span>
1097 + <span class="wpbc_ag_switch_label"><?php echo esc_html( $day_labels['short'] ); ?></span>
1098 + </label>
1099 + <?php endforeach; ?>
1100 + </div>
1077 1101 <p class="wpbc_ag_description"><?php esc_html_e( 'Selected weekdays will be unavailable in calendars and override other availability settings.', 'booking' ); ?></p>
1078 1102 <?php
1079 - }
1080 - );
1081 -
1082 - WPBC_UI_Sidebar_Panels::render_collapsible_group(
1103 + }
1104 + );
1105 +
1106 + WPBC_UI_Sidebar_Panels::render_collapsible_group(
1107 + array(
1108 + 'id' => 'wpbc_ag_working_time_group',
1109 + 'group' => 'general-availability-working-time',
1110 + 'title' => __( 'Working Time', 'booking' ),
1111 + 'open' => ( 'working_time' === $open_section ),
1112 + ),
1113 + function () use ( $working_time_settings, $working_time_resource_id, $working_time_resource ) {
1114 + ?>
1115 + <div class="wpbc_ag_notice wpbc_ag_working_time_notice"><?php esc_html_e( 'Working Time restricts only time-based bookings, such as rangetime, start/end time, or start/duration time fields.', 'booking' ); ?></div>
1116 + <input type="hidden" name="booking_working_time_resource_id" data-wpbc-working-time-resource-id="1" value="<?php echo esc_attr( $working_time_resource_id ); ?>" />
1117 + <label class="wpbc_ag_switch wpbc_ag_switch_card">
1118 + <input type="checkbox" name="booking_working_time_enabled" value="On" <?php checked( $working_time_settings['enabled'], 'On' ); ?> />
1119 + <span class="wpbc_ag_switch_control" aria-hidden="true"><span class="wpbc_ag_switch_knob"></span></span>
1120 + <span class="wpbc_ag_switch_label"><?php esc_html_e( 'Restrict time-based bookings to working time', 'booking' ); ?></span>
1121 + </label>
1122 +
1123 + <div class="wpbc_ag_working_time_block">
1124 + <div class="wpbc_ag_scope_title"><?php esc_html_e( 'Default working time', 'booking' ); ?></div>
1125 + <p class="wpbc_ag_description"><?php esc_html_e( 'Used by all booking resources unless a resource override is configured below.', 'booking' ); ?></p>
1126 + <?php wpbc_availability_general__render_working_time_weekdays( 'booking_working_time_default', $working_time_settings['default']['weekdays'] ); ?>
1127 + </div>
1128 +
1129 + <div class="wpbc_ag_working_time_block wpbc_ag_working_time_resource_block" data-wpbc-working-time-resource-block="1">
1130 + <div class="wpbc_ag_scope_title"><?php esc_html_e( 'Selected resource override', 'booking' ); ?></div>
1131 + <p class="wpbc_ag_description"><?php esc_html_e( 'This override follows the booking resource selected in the page toolbar.', 'booking' ); ?></p>
1132 + <div class="wpbc_ag_radio_stack wpbc_ag_working_time_mode">
1133 + <label><input type="radio" name="booking_working_time_resource_mode" value="inherit" <?php checked( $working_time_resource['mode'], 'inherit' ); ?> /> <?php esc_html_e( 'Inherit default working time', 'booking' ); ?></label>
1134 + <label><input type="radio" name="booking_working_time_resource_mode" value="custom" <?php checked( $working_time_resource['mode'], 'custom' ); ?> /> <?php esc_html_e( 'Use custom working time', 'booking' ); ?></label>
1135 + <label><input type="radio" name="booking_working_time_resource_mode" value="disabled" <?php checked( $working_time_resource['mode'], 'disabled' ); ?> /> <?php esc_html_e( 'Do not restrict this resource by working time', 'booking' ); ?></label>
1136 + </div>
1137 + <div class="wpbc_ag_working_time_custom" data-wpbc-working-time-resource-custom="1">
1138 + <?php wpbc_availability_general__render_working_time_weekdays( 'booking_working_time_resource', $working_time_resource['weekdays'] ); ?>
1139 + </div>
1140 + </div>
1141 + <?php
1142 + }
1143 + );
1144 +
1145 + WPBC_UI_Sidebar_Panels::render_collapsible_group(
1083 1146 array(
1084 1147 'id' => 'wpbc_ag_today_group',
1085 1148 'group' => 'general-availability-from-today',
1086 1149 'title' => __( 'Availability From Today', 'booking' ),
@@ -1169,49 +1232,9 @@
1169 1232 </div>
1170 1233 <?php
1171 1234 }
1172 1235 );
1173 -
1174 - WPBC_UI_Sidebar_Panels::render_collapsible_group(
1175 - array(
1176 - 'id' => 'wpbc_ag_working_time_group',
1177 - 'group' => 'general-availability-working-time',
1178 - 'title' => __( 'Working Time', 'booking' ),
1179 - 'open' => ( 'working_time' === $open_section ),
1180 - ),
1181 - function () use ( $working_time_settings, $working_time_resource_id, $working_time_resource ) {
1182 - ?>
1183 - <div class="wpbc_ag_notice wpbc_ag_working_time_notice"><?php esc_html_e( 'Working Time restricts only time-based bookings, such as rangetime, start/end time, or start/duration time fields.', 'booking' ); ?></div>
1184 - <input type="hidden" name="booking_working_time_resource_id" data-wpbc-working-time-resource-id="1" value="<?php echo esc_attr( $working_time_resource_id ); ?>" />
1185 - <label class="wpbc_ag_switch wpbc_ag_switch_card">
1186 - <input type="checkbox" name="booking_working_time_enabled" value="On" <?php checked( $working_time_settings['enabled'], 'On' ); ?> />
1187 - <span class="wpbc_ag_switch_control" aria-hidden="true"><span class="wpbc_ag_switch_knob"></span></span>
1188 - <span class="wpbc_ag_switch_label"><?php esc_html_e( 'Restrict time-based bookings to working time', 'booking' ); ?></span>
1189 - </label>
1190 -
1191 - <div class="wpbc_ag_working_time_block">
1192 - <div class="wpbc_ag_scope_title"><?php esc_html_e( 'Default working time', 'booking' ); ?></div>
1193 - <p class="wpbc_ag_description"><?php esc_html_e( 'Used by all booking resources unless a resource override is configured below.', 'booking' ); ?></p>
1194 - <?php wpbc_availability_general__render_working_time_weekdays( 'booking_working_time_default', $working_time_settings['default']['weekdays'] ); ?>
1195 - </div>
1196 -
1197 - <div class="wpbc_ag_working_time_block wpbc_ag_working_time_resource_block" data-wpbc-working-time-resource-block="1">
1198 - <div class="wpbc_ag_scope_title"><?php esc_html_e( 'Selected resource override', 'booking' ); ?></div>
1199 - <p class="wpbc_ag_description"><?php esc_html_e( 'This override follows the booking resource selected in the page toolbar.', 'booking' ); ?></p>
1200 - <div class="wpbc_ag_radio_stack wpbc_ag_working_time_mode">
1201 - <label><input type="radio" name="booking_working_time_resource_mode" value="inherit" <?php checked( $working_time_resource['mode'], 'inherit' ); ?> /> <?php esc_html_e( 'Inherit default working time', 'booking' ); ?></label>
1202 - <label><input type="radio" name="booking_working_time_resource_mode" value="custom" <?php checked( $working_time_resource['mode'], 'custom' ); ?> /> <?php esc_html_e( 'Use custom working time', 'booking' ); ?></label>
1203 - <label><input type="radio" name="booking_working_time_resource_mode" value="disabled" <?php checked( $working_time_resource['mode'], 'disabled' ); ?> /> <?php esc_html_e( 'Do not restrict this resource by working time', 'booking' ); ?></label>
1204 - </div>
1205 - <div class="wpbc_ag_working_time_custom" data-wpbc-working-time-resource-custom="1">
1206 - <?php wpbc_availability_general__render_working_time_weekdays( 'booking_working_time_resource', $working_time_resource['weekdays'] ); ?>
1207 - </div>
1208 - </div>
1209 - <?php
1210 - }
1211 - );
1212 -
1213 - ?>
1236 + ?>
1214 1237 </div>
1215 1238 </form>
1216 1239 <?php
1217 1240 }