PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 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 All 205 releases
← All changes | includes/ui_settings/parts/ui__nav_vert.php +164 -49 11.7 → 11.9 View file →
@@ -92,13 +92,17 @@
92 92 'active_tab' => $args ['active_tab'], // calendar_appearance.
93 93 'active_subtab' => $args['active_subtab'], // calendar_appearance_skin.
94 94 );
95 95
96 + if ( function_exists( 'wpbc_booking_modes_v3_compile_sidebar_navigation' ) ) {
97 + $args['page_nav_tabs'] = wpbc_booking_modes_v3_compile_sidebar_navigation( $args['page_nav_tabs'] );
98 + }
99 +
96 100 // Available Main Menu - slug => titles.
97 101 $root_menu_arr = wpbc_ui__get_root_menu_arr();
98 102
99 - if ( function_exists( 'wpbc_booking_modes_resolve_root_navigation' ) ) {
100 - $root_menu_arr = wpbc_booking_modes_resolve_root_navigation( $root_menu_arr, $args['page_nav_tabs'] );
103 + if ( function_exists( 'wpbc_booking_modes_v3_compile_root_navigation' ) ) {
104 + $root_menu_arr = wpbc_booking_modes_v3_compile_root_navigation( $root_menu_arr, $args['page_nav_tabs'] );
101 105 }
102 106
103 107 // A mode may display an existing controller route below a different presentation group.
104 108 foreach ( $args['page_nav_tabs'] as $presentation_page_slug => $presentation_tabs ) {
@@ -139,15 +143,32 @@
139 143 continue;
140 144 }
141 145
142 146 $page_title = $root_menu_options_arr['title'];
143 - $is_expanded = ( $main_page_slug === $active_page_arr['active_page'] );
147 + $is_v3_standalone = ! empty( $root_menu_options_arr['mode_standalone'] );
148 + // Respect a V3 root's explicit initial state while retaining the original Settings behavior for V1.
149 + if ( $is_v3_standalone ) {
150 + $is_expanded = true;
151 + } elseif ( isset( $root_menu_options_arr['mode_expanded'] ) ) {
152 + $is_expanded = 'On' === $root_menu_options_arr['mode_expanded']
153 + || ( 'when_active' === $root_menu_options_arr['mode_expanded'] && $main_page_slug === $active_page_arr['active_page'] );
154 + } else {
155 + $is_expanded = ( 'wpbc-settings' !== $main_page_slug ) || ( $main_page_slug === $active_page_arr['active_page'] );
156 + }
144 157
145 158 if ( $is_show_all_menus ) {
146 - echo ' <div class="section_expanded wpbc_ui_el__vert_left_bar__root_section_element root_section_element_' . esc_attr( $main_page_slug ) . ' ' . ( ( $is_expanded ) ? 'section_expanded' : '' ) . '">';
159 + echo ' <div class="wpbc_ui_el__vert_left_bar__root_section_element root_section_element_' . esc_attr( $main_page_slug ) . ' ' . ( ( $is_expanded ) ? 'section_expanded' : '' ) . '">';
147 160
148 161 $mode_font_icon = isset( $root_menu_options_arr['mode_font_icon'] ) ? $root_menu_options_arr['mode_font_icon'] : '';
149 - wpbc_ui__vert_menu__show_root_section_header( $main_page_slug, $page_title, $mode_font_icon );
162 + if ( ! $is_v3_standalone ) {
163 + wpbc_ui__vert_menu__show_root_section_header(
164 + $main_page_slug,
165 + $page_title,
166 + $mode_font_icon,
167 + isset( $root_menu_options_arr['mode_expanded'] ),
168 + $is_expanded
169 + );
170 + }
150 171 }
151 172
152 173 echo ' <div class="wpbc_ui_el__vert_left_bar__section wpbc_ui_el__vert_left_bar__section_' .
153 174 esc_attr( $main_page_slug ) .
@@ -171,62 +192,74 @@
171 192 echo '</div>';
172 193 wpbc_ui_el__divider_horizontal();
173 194 }
174 195
175 - foreach ( $page_item_arr as $main_menu_slug => $menu_item_arr ) {
176 - $folder_style = ( ! empty( $menu_item_arr['folder_style'] ) ) ? esc_attr( $menu_item_arr['folder_style'] ) : '';
196 + if ( function_exists( 'wpbc_booking_modes_v3_compile_sidebar_navigation' ) ) {
197 + wpbc_ui__vert_menu__render_v3_nodes( $page_item_arr );
198 + } else {
199 + foreach ( $page_item_arr as $main_menu_slug => $menu_item_arr ) {
200 + $folder_style = ( ! empty( $menu_item_arr['folder_style'] ) ) ? esc_attr( $menu_item_arr['folder_style'] ) : '';
177 201
178 - $folder_css = '';
179 - if ( ( ! empty( $menu_item_arr['subtabs'] ) ) && ( ! empty( $menu_item_arr['is_active'] ) ) ) {
180 - $folder_css .= ' expanded';
181 - }
202 + $folder_css = '';
203 + $is_folder_expanded = ! empty( $menu_item_arr['subtabs'] ) && ! empty( $menu_item_arr['is_active'] );
204 + if ( isset( $menu_item_arr['_wpbc_v3_expanded'] ) ) {
205 + $is_folder_expanded = 'On' === $menu_item_arr['_wpbc_v3_expanded']
206 + || ( 'when_active' === $menu_item_arr['_wpbc_v3_expanded'] && $is_folder_expanded );
207 + }
208 + if ( $is_folder_expanded ) {
209 + $folder_css .= ' expanded';
210 + }
211 + if ( ! empty( $menu_item_arr['_wpbc_v3_branch_css_classes'] ) ) {
212 + $folder_css .= ' ' . $menu_item_arr['_wpbc_v3_branch_css_classes'];
213 + }
182 214
183 - echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">';
215 + echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">';
184 216
185 217
186 - if ( empty( $menu_item_arr['type'] ) ) {
187 - $menu_item_arr['type'] = 'main';
188 - }
218 + if ( empty( $menu_item_arr['type'] ) ) {
219 + $menu_item_arr['type'] = 'main';
220 + }
189 221
190 - switch ( $menu_item_arr['type'] ) {
222 + switch ( $menu_item_arr['type'] ) {
191 223
192 - case 'separator':
193 - wpbc_ui_el__divider_horizontal();
194 - break;
224 + case 'separator':
225 + wpbc_ui_el__divider_horizontal();
226 + break;
195 227
196 - case 'html':
197 - wpbc_ui__vert_menu__item_html( $main_menu_slug, $menu_item_arr );
198 - break;
228 + case 'html':
229 + wpbc_ui__vert_menu__item_html( $main_menu_slug, $menu_item_arr );
230 + break;
199 231
200 - default:
201 - wpbc_ui__vert_menu__item_main( $main_menu_slug, $menu_item_arr );
202 - }
232 + default:
233 + wpbc_ui__vert_menu__item_main( $main_menu_slug, $menu_item_arr );
234 + }
203 235
204 236
205 - foreach ( $menu_item_arr['subtabs'] as $main_submenu_slug => $submenu_item_arr ) {
237 + foreach ( $menu_item_arr['subtabs'] as $main_submenu_slug => $submenu_item_arr ) {
206 238
207 - if ( empty( $submenu_item_arr['type'] ) ) {
208 - $submenu_item_arr['type'] = 'subtab';
209 - }
239 + if ( empty( $submenu_item_arr['type'] ) ) {
240 + $submenu_item_arr['type'] = 'subtab';
241 + }
210 242
211 - switch ( $submenu_item_arr['type'] ) {
243 + switch ( $submenu_item_arr['type'] ) {
212 244
213 - case 'subtab':
214 - wpbc_ui__vert_menu__item_sub( $main_submenu_slug, $submenu_item_arr );
215 - break;
245 + case 'subtab':
246 + wpbc_ui__vert_menu__item_sub( $main_submenu_slug, $submenu_item_arr );
247 + break;
216 248
217 - case 'separator':
218 - wpbc_ui__vert_menu__item_separtor( $main_submenu_slug, $submenu_item_arr );
219 - break;
249 + case 'separator':
250 + wpbc_ui__vert_menu__item_separtor( $main_submenu_slug, $submenu_item_arr );
251 + break;
220 252
221 - case 'html':
222 - wpbc_ui__vert_menu__item_html( $main_submenu_slug, $submenu_item_arr );
223 - break;
253 + case 'html':
254 + wpbc_ui__vert_menu__item_html( $main_submenu_slug, $submenu_item_arr );
255 + break;
224 256
225 - default:
257 + default:
258 + }
226 259 }
260 + echo '</div><!-- wpbc_ui_el__level__folder -->';
227 261 }
228 - echo '</div><!-- wpbc_ui_el__level__folder -->';
229 262 }
230 263
231 264 if ( $is_show_all_menus ) {
232 265 echo ' </div><!-- wpbc_ui_el__vert_left_bar__root_section_element -->';
@@ -239,11 +272,9 @@
239 272 echo ' </div><!-- wpbc_ui_el__vert_left_bar__root_sections_container -->';
240 273 }
241 274
242 275
243 - $is_show_up = wpbc_is_show_up();
244 - // Show upgrade icon only for the Free version here.
245 - $is_show_up = ( $is_show_up && ( ! class_exists( 'wpdev_bk_personal' ) ) );
276 + $is_show_up = wpbc_is_show_free_upgrade();
246 277 if ( $is_show_up ) {
247 278 ?><div class="wpbc_ui_el__vert_left_bar__footer_compensator"></div><?php
248 279 }
249 280
@@ -250,9 +281,9 @@
250 281 echo ' </div><!-- wpbc_ui_el__vert_left_bar__content -->';
251 282 if ( $is_show_up ) {
252 283 $url = wpbc_up_link();
253 284 ?>
254 - <div class="wpbc_ui_el__vert_left_bar__footer_section">
285 + <div class="wpbc_ui_el__vert_left_bar__footer_section" style="visibility: hidden;">
255 286 <a class="wpbc_ui_el_upgrade_button wpbc_button_light wpbc_button_green" href="<?php echo esc_url( $url ); ?>">
256 287 <span class="hide_in_compact_mode"><?php esc_html_e( 'Upgrade to Pro', 'booking' ); ?></span>
257 288 <span class="hide_in_max_mode"><?php esc_html_e( 'Pro', 'booking' ); ?></span>
258 289 </a>
@@ -264,8 +295,80 @@
264 295 wpbc_start_element_scrollable__with_simplebar( '.wpbc_ui_el__vert_left_bar__content' );
265 296 }
266 297
267 298 /**
299 + * Render an arbitrarily nested V3 sidebar through the existing row functions.
300 + *
301 + * Top-level and disclosure nodes retain the existing main-row markup. Nested
302 + * leaves retain the existing subrow markup, so the recursive traversal adds no
303 + * new visual system or navigation-only asset.
304 + *
305 + * @param array $navigation_nodes Prepared V3 navigation nodes.
306 + * @param int $depth Zero-based sidebar depth.
307 + *
308 + * @return void
309 + */
310 +function wpbc_ui__vert_menu__render_v3_nodes( $navigation_nodes, $depth = 0 ) {
311 + foreach ( $navigation_nodes as $menu_slug => $menu_item_arr ) {
312 + if ( ! is_array( $menu_item_arr ) ) {
313 + continue;
314 + }
315 +
316 + $subtabs = isset( $menu_item_arr['subtabs'] ) && is_array( $menu_item_arr['subtabs'] ) ? $menu_item_arr['subtabs'] : array();
317 + $has_children = ! empty( $subtabs );
318 + $item_type = empty( $menu_item_arr['type'] ) ? ( 0 === $depth || $has_children ? 'main' : 'subtab' ) : $menu_item_arr['type'];
319 +
320 + if ( 0 < $depth && ! $has_children ) {
321 + switch ( $item_type ) {
322 + case 'separator':
323 + wpbc_ui__vert_menu__item_separtor( $menu_slug, $menu_item_arr );
324 + break;
325 +
326 + case 'html':
327 + wpbc_ui__vert_menu__item_html( $menu_slug, $menu_item_arr );
328 + break;
329 +
330 + default:
331 + wpbc_ui__vert_menu__item_sub( $menu_slug, $menu_item_arr );
332 + }
333 + continue;
334 + }
335 +
336 + $folder_style = ! empty( $menu_item_arr['folder_style'] ) ? $menu_item_arr['folder_style'] : '';
337 + $folder_css = '';
338 + $is_expanded = $has_children && ! empty( $menu_item_arr['is_active'] );
339 + if ( isset( $menu_item_arr['_wpbc_v3_expanded'] ) ) {
340 + $is_expanded = 'On' === $menu_item_arr['_wpbc_v3_expanded']
341 + || ( 'when_active' === $menu_item_arr['_wpbc_v3_expanded'] && $is_expanded );
342 + }
343 + if ( $is_expanded ) {
344 + $folder_css .= ' expanded';
345 + }
346 + if ( ! empty( $menu_item_arr['_wpbc_v3_branch_css_classes'] ) ) {
347 + $folder_css .= ' ' . $menu_item_arr['_wpbc_v3_branch_css_classes'];
348 + }
349 +
350 + echo '<div class="wpbc_ui_el__level__folder ' . esc_attr( $folder_css ) . '" style="' . esc_attr( $folder_style ) . '">';
351 + switch ( $item_type ) {
352 + case 'separator':
353 + wpbc_ui_el__divider_horizontal();
354 + break;
355 +
356 + case 'html':
357 + wpbc_ui__vert_menu__item_html( $menu_slug, $menu_item_arr );
358 + break;
359 +
360 + default:
361 + wpbc_ui__vert_menu__item_main( $menu_slug, $menu_item_arr );
362 + }
363 + if ( $has_children ) {
364 + wpbc_ui__vert_menu__render_v3_nodes( $subtabs, $depth + 1 );
365 + }
366 + echo '</div><!-- wpbc_ui_el__level__folder -->';
367 + }
368 +}
369 +
370 +/**
268 371 * Set Scrolable Element with Simplebar js library.
269 372 *
270 373 * @param string $jq_element - e.g. '.wpbc_ui_el__vert_left_bar__content'
271 374 * @param string $options - e.g. 'autoHide: false, scrollbarMinSize: 10' - options for the Simplebar. See more: https://www.npmjs.com/package/simplebar#1-documentation
@@ -487,12 +590,14 @@
487 590 *
488 591 * @param string $main_page_slug Slug of the submenu section.
489 592 * @param string $page_title Section title.
490 593 * @param string $font_icon Optional sanitized font-icon CSS classes supplied by the selected mode.
594 + * @param bool $is_v3_scoped Whether to use V3's nearest-branch disclosure behavior.
595 + * @param bool $is_expanded Whether the V3 branch is initially expanded.
491 596 *
492 597 * @return void
493 598 */
494 -function wpbc_ui__vert_menu__show_root_section_header( $main_page_slug, $page_title, $font_icon = '' ) {
599 +function wpbc_ui__vert_menu__show_root_section_header( $main_page_slug, $page_title, $font_icon = '', $is_v3_scoped = false, $is_expanded = false ) {
495 600
496 601 $css_section = '.root_section_element_' . $main_page_slug;
497 602
498 603 // Section Header.
@@ -497,13 +602,17 @@
497 602
498 603 // Section Header.
499 604 ?><a class="wpbc_ui_el__row100 wpbc_ui_el__root_section_header_a"
500 605 href="javascript:void(0)"
501 - <?php /**/ ?>
606 + <?php if ( $is_v3_scoped ) { ?>
607 + aria-expanded="<?php echo $is_expanded ? 'true' : 'false'; ?>"
608 + onkeydown="if ( ' ' === event.key ) { event.preventDefault(); this.click(); }"
609 + onclick="javascript:var wpbc_root=jQuery(this).closest('.wpbc_ui_el__vert_left_bar__root_section_element');var wpbc_open=wpbc_root.hasClass('section_expanded');wpbc_root.toggleClass('section_expanded',!wpbc_open);jQuery(this).attr('aria-expanded',wpbc_open?'false':'true');"
610 + <?php } else { ?>
502 611 onclick="javascript:var is_has_class = jQuery( '<?php echo esc_attr( $css_section ); ?>' ).hasClass('section_expanded'); <?php
503 612 /* ?> jQuery( '.wpbc_ui_el__vert_left_bar__root_section_element' ).removeClass('section_expanded'); <?php */
504 613 ?>if (is_has_class) { jQuery( '<?php echo esc_attr( $css_section ); ?>' ).removeClass('section_expanded'); } else {jQuery( '<?php echo esc_attr( $css_section ); ?>' ).addClass('section_expanded');}"
505 - <?php /**/ ?>
614 + <?php } ?>
506 615 >
507 616 <i class="wpbc_ui_el__vert_menu_root_section_icon menu_icon icon-1x wpbc-bi-chevron-right"></i><?php
508 617
509 618 if ( '' !== $font_icon ) {
@@ -592,9 +701,15 @@
592 701 if ( ! empty( $menu_item_arr['subtabs'] ) ) {
593 702 // Folder Item - expand / colapse. Previously: here was : wpbc_admin_ui__sidebar_left__do_max();
594 703 ?>
595 704 <a href="javascript:void(0)"
596 - onclick="javascript: if( ! jQuery( this ).parents('.wpbc_ui_el__level__folder').hasClass('expanded') ) { jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');jQuery( this ).parents('.wpbc_ui_el__level__folder').addClass('expanded'); } else {jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');} "
705 + <?php if ( isset( $menu_item_arr['_wpbc_v3_expanded'] ) ) { ?>
706 + aria-expanded="<?php echo ( 'On' === $menu_item_arr['_wpbc_v3_expanded'] || ( 'when_active' === $menu_item_arr['_wpbc_v3_expanded'] && ! empty( $menu_item_arr['is_active'] ) ) ) ? 'true' : 'false'; ?>"
707 + onkeydown="if ( ' ' === event.key ) { event.preventDefault(); this.click(); }"
708 + onclick="javascript:var wpbc_folder=jQuery(this).closest('.wpbc_ui_el__level__folder');var wpbc_open=wpbc_folder.hasClass('expanded');wpbc_folder.toggleClass('expanded',!wpbc_open);jQuery(this).attr('aria-expanded',wpbc_open?'false':'true');"
709 + <?php } else { ?>
710 + onclick="javascript: if( ! jQuery( this ).parents('.wpbc_ui_el__level__folder').hasClass('expanded') ) { jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');jQuery( this ).parents('.wpbc_ui_el__level__folder').addClass('expanded'); } else {jQuery( '.wpbc_ui_el__level__folder' ).removeClass('expanded');} "
711 + <?php } ?>
597 712 class="wpbc_ui_el__vert_nav_item__a wpbc_ui_el__vert_nav_item__folder">
598 713 <?php if ( ! empty( $menu_item_arr['font_icon'] ) ) { ?>
599 714 <?php // Show icon in max mode, without right tooltip, thanks to '.hide_in_compact_mode'. // FixIn: 10.11.5.8. ?>
600 715 <i class="wpbc_ui_el__vert_nav_icon hide_in_compact_mode menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon'] ); ?>"