PluginProbe
Booking Calendar / 11.4.3
Booking Calendar v11.4.3
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
booking / includes / ui_settings / parts / ui__nav_horis.php

ui__nav_horis.php in Booking Calendar 11.4.3, at includes/ui_settings/parts/ui__nav_horis.php

183 lines 7.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Panel UI - Parts
4 *
5 * @version 1.2
6 * @package Any
7 * @category Page Structure in Admin Panel
8 * @author wpdevelop
9 *
10 * @web-site https://wpbookingcalendar.com/
11 * @email info@wpbookingcalendar.com
12 *
13 * @modified 2025-03-20
14 */
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit; // Exit, if accessed directly.
18 }
19
20 /**
21 * Show Top Horisontal Navigation Bar
22 *
23 * @param array $args - parameters.
24 *
25 * @return void
26 */
27 function wpbc_ui__top_horisontal_nav( $args =array() ) {
28
29 $defaults = array(
30 'attr' => array(),
31 );
32 $params = wp_parse_args( $args, $defaults );
33
34 $active_page_arr = array(
35 'active_page' => $args['active_page'], // wpbc-settings.
36 'active_tab' => $args ['active_tab'], // calendar_appearance.
37 'active_subtab' => $args['active_subtab'], // calendar_appearance_skin.
38 );
39
40 // Available Main Menu - slug => titles.
41 $show_these_pages_arr = array(
42 'wpbc' => __( 'Bookings', 'booking' ),
43 'wpbc-availability' => __( 'Availability', 'booking' ),
44 'wpbc-prices' => __( 'Prices', 'booking' ),
45 'wpbc-resources' => __( 'Resources', 'booking' ),
46 'wpbc-settings' => __( 'Settings', 'booking' ),
47 'wpbc-setup' => __( 'Setup', 'booking' ),
48 );
49
50
51 // Ability to click on panel, only if there 'min' class - panel minimized!
52 echo '<div class="wpbc_ui_el__horis_top_bar__wrapper">';
53
54 echo ' <div class="wpbc_ui_el__horis_top_bar__content">';
55
56 $main_page_slug = $active_page_arr['active_page'];
57 $page_title = $show_these_pages_arr[ $main_page_slug ];
58
59 // Loop to show all main sections in horisontal menu.
60 foreach ( $show_these_pages_arr as $main_page_slug => $page_title ) {
61
62 // Show only active page settings list.
63 if ( $main_page_slug !== $active_page_arr['active_page'] ) {
64 continue;
65 }
66 $page_item_arr = $args['page_nav_tabs'][ $main_page_slug ];
67
68 do_action( 'hook__wpbc_ui__top_horisontal_nav__start', $active_page_arr['active_page'], $active_page_arr['active_tab'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
69
70 foreach ( $page_item_arr as $main_menu_slug => $menu_item_arr ) {
71 do_action( 'hook__wpbc_ui__top_horisontal_nav__item_start', $active_page_arr['active_page'], $active_page_arr['active_tab'], $main_menu_slug ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
72
73 wpbc_ui__horis_menu__item_main( $main_menu_slug, $menu_item_arr );
74
75 do_action( 'hook__wpbc_ui__top_horisontal_nav__item_end', $active_page_arr['active_page'], $active_page_arr['active_tab'], $main_menu_slug ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
76 }
77 do_action( 'hook__wpbc_ui__top_horisontal_nav__end', $active_page_arr['active_page'], $active_page_arr['active_tab'] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
78
79 // wpbc_ui_el__divider_vertical();
80 } // Loop to show all main sections in horisontal menu.
81 echo ' </div><!-- wpbc_ui_el__horis_top_bar__content -->';
82
83 echo '</div><!-- wpbc_ui_el__horis_top_bar__wrapper -->';
84 }
85
86
87 /**
88 * Remove New labels from titles rendered in the top horizontal navigation.
89 *
90 * @param string $title Horizontal navigation title.
91 *
92 * @return string
93 */
94 function wpbc_ui__horis_menu__item_main__remove_new_label( $title ) {
95
96 if ( ! is_string( $title ) || '' === $title ) {
97 return $title;
98 }
99
100 $filtered_title = preg_replace(
101 '/<span\b[^>]*\bclass\s*=\s*(["\'])[^"\']*\bwpbc_new_label\b[^"\']*\1[^>]*>.*?<\/span>(?:\s|&nbsp;)*/is',
102 '',
103 $title
104 );
105
106 return ( null === $filtered_title ) ? $title : $filtered_title;
107 }
108 add_filter( 'wpbc_ui__horis_menu__item_main__title', 'wpbc_ui__horis_menu__item_main__remove_new_label', PHP_INT_MAX );
109
110
111 /**
112 * Show Horisontal - "Menu Item".
113 *
114 * @param string $menu_slug - 'calendar_appearance'.
115 * @param array $menu_item_arr - [ [title] => Skin
116 * [page_title] => Calendar General Settings 3
117 * [hint] => Calendar General Settings 2
118 * [link] =>
119 * [position] =>
120 * [css_classes] =>
121 * [folder_style] => order:93;
122 * [icon] =>
123 * [font_icon] => wpbc-bi-calendar2-range
124 * [default] =>
125 * [disabled] =>
126 * [hided] =>
127 * [is_active] => 1
128 * [url] => http://beta/wp-admin/admin.php?page=wpbc-settings&#038;tab=calendar_appearance
129 * [subtabs] => [....]
130 * ]
131 *
132 * @return void
133 */
134 function wpbc_ui__horis_menu__item_main( $menu_slug, $menu_item_arr ) {
135
136 $defaults = array(
137 'title' => '',
138 'page_title' => '',
139 'hint' => '',
140 'link' => '',
141 'position' => '',
142 'css_classes' => '',
143 'folder_style' => '',
144 'icon' => '',
145 'font_icon' => '',
146 'default' => false,
147 'disabled' => false,
148 'hided' => false,
149 'is_active' => 0,
150 'url' => '',
151 'subtabs' => array(),
152 );
153 $menu_item_arr = wp_parse_args( $menu_item_arr, $defaults );
154 $folder_style = ( ! empty( $menu_item_arr['folder_style'] ) ) ? esc_attr( $menu_item_arr['folder_style'] ) : ''; // FixIn: 11.4.2.
155
156 /**
157 * Filter the title displayed in the top horizontal navigation.
158 *
159 * @param string $title Horizontal navigation title.
160 * @param string $menu_slug Menu item slug.
161 * @param array $menu_item_arr Complete menu item configuration.
162 */
163 $menu_item_arr['title'] = apply_filters( 'wpbc_ui__horis_menu__item_main__title', $menu_item_arr['title'], $menu_slug, $menu_item_arr );
164
165 ?><div class="wpbc_ui_el__horis_nav_item wpbc_ui_el__horis_nav_item__<?php echo esc_attr( $menu_slug ); ?> <?php echo ( ! empty( $menu_item_arr['is_active'] ) ) ? ' active ' : ''; ?>"
166 style="<?php echo esc_attr( $folder_style ); ?>">
167 <?php
168 // Single Item.
169 ?>
170 <a href="<?php echo esc_url( $menu_item_arr['url'] ); ?>"
171 class="wpbc_ui_el__horis_nav_item__a wpbc_ui_el__horis_nav_item__single">
172 <?php if ( ! empty( $menu_item_arr['font_icon'] ) ) { ?>
173 <i class="wpbc_ui_el__horis_nav_icon tooltip_top menu_icon icon-1x <?php echo esc_attr( $menu_item_arr['font_icon'] ); ?>"
174 data-original-title="<?php echo esc_attr( $menu_item_arr['title'] ); ?>"></i>
175 <?php } ?>
176 <span class="wpbc_ui_el__horis_nav_title"><?php
177 echo wp_kses_post( $menu_item_arr['title'] );
178 ?></span>
179 </a>
180 </div>
181 <?php
182 }
183