PluginProbe
Booking Calendar / 10.15.6
Booking Calendar v10.15.6
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 10.11.2 All 203 releases
booking / includes / _functions / admin_top_bar.php

admin_top_bar.php in Booking Calendar 10.15.6, at includes/_functions/admin_top_bar.php

325 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar
5 * @subpackage Admin Top Bar
6 * @category Functions
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2024-09-03
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
17 // =====================================================================================================================
18 // == Admin Top Bar ==
19 // =====================================================================================================================
20
21
22
23 function wpbc_add__booking_menu__in__admin_top_bar(){
24
25 global $wp_admin_bar;
26
27 $current_user = wpbc_get_current_user();
28
29 $curr_user_role = get_bk_option( 'booking_user_role_booking' );
30 $level = 10;
31 if ($curr_user_role == 'administrator') $level = 10;
32 else if ($curr_user_role == 'editor') $level = 7;
33 else if ($curr_user_role == 'author') $level = 2;
34 else if ($curr_user_role == 'contributor') $level = 1;
35 else if ($curr_user_role == 'subscriber') $level = 0;
36
37 $is_super_admin = apply_bk_filter('multiuser_is_user_can_be_here', false, 'only_super_admin');
38 if ( ( ($current_user->user_level < $level) && (! $is_super_admin) ) || !is_admin_bar_showing() ) return;
39
40
41 $update_title = wpbc_get_svg_logo_for_html() . '&nbsp;' . 'Booking Calendar';
42
43 $is_user_activated = apply_bk_filter( 'multiuser_is_current_user_active', true ); // FixIn: 6.0.1.17.
44 $update_count = wpbc_db_get_number_new_bookings();
45 if ( ( $update_count > 0 ) && ( $is_user_activated ) ) {
46 $update_title .= "&nbsp;<span class='booking-count bk-update-count' style='background: #f0f0f1;color: #2c3338;display: inline;padding: 2px 5px;font-weight: 600;border-radius: 10px;'>" . number_format_i18n( $update_count ) . '</span>';
47 }
48
49 $link_bookings = wpbc_get_bookings_url();
50 $link_res = wpbc_get_resources_url();
51 $link_settings = wpbc_get_settings_url();
52
53 // FixIn: 9.8.15.9.
54 $wp_admin_bar->add_menu(
55 array(
56 'id' => 'wpbc_bar',
57 'title' => $update_title ,
58 'href' => wpbc_get_bookings_url()
59 )
60 );
61
62 $wp_admin_bar->add_menu(
63 array(
64 'id' => 'wpbc_bar_bookings',
65 'title' => __( 'Bookings', 'booking' ),
66 'href' => wpbc_get_bookings_url(),
67 'parent' => 'wpbc_bar',
68 )
69 );
70 $wp_admin_bar->add_menu(
71 array(
72 'id' => 'wpbc_bar_booking_listing',
73 'title' => __( 'Booking Listing', 'booking' ),
74 'href' => wpbc_get_bookings_url() . '&tab=vm_booking_listing',
75 'parent' => 'wpbc_bar_bookings',
76 )
77 );
78 $wp_admin_bar->add_menu(
79 array(
80 'id' => 'wpbc_bar_calendar_overview',
81 'title' => __( 'Timeline View', 'booking' ),
82 'href' => wpbc_get_bookings_url() . '&tab=vm_calendar',
83 'parent' => 'wpbc_bar_bookings',
84 )
85 );
86
87
88 $curr_user_role_settings = get_bk_option( 'booking_user_role_settings' );
89 $level = 10;
90 if ($curr_user_role_settings == 'administrator') $level = 10;
91 else if ($curr_user_role_settings == 'editor') $level = 7;
92 else if ($curr_user_role_settings == 'author') $level = 2;
93 else if ($curr_user_role_settings == 'contributor') $level = 1;
94 else if ($curr_user_role_settings == 'subscriber') $level = 0;
95
96 if ( ( ($current_user->user_level < $level) && (! $is_super_admin) ) || !is_admin_bar_showing() ) return;
97
98 // Booking > Add booking page
99 $wp_admin_bar->add_menu(
100 array(
101 'id' => 'wpbc_bar_new',
102 'title' => __( 'Add booking', 'booking' ),
103 'href' => wpbc_get_new_booking_url(),
104 'parent' => 'wpbc_bar',
105 )
106 );
107
108 // Booking > Availability page
109 $wp_admin_bar->add_menu(
110 array(
111 'id' => 'wpbc_bar_availability',
112 'title' => __( 'Availability', 'booking' ),
113 'href' => wpbc_get_availability_url(),
114 'parent' => 'wpbc_bar',
115 )
116 );
117 $wp_admin_bar->add_menu(
118 array(
119 'id' => 'wpbc_bar_days_availability',
120 'title' => __( 'Days Availability', 'booking' ),
121 'href' => wpbc_get_availability_url() ,
122 'parent' => 'wpbc_bar_availability'
123 )
124 );
125 if ( class_exists( 'wpdev_bk_biz_m' ) ){
126 $wp_admin_bar->add_menu(
127 array(
128 'id' => 'wpbc_bar_seasons_availability',
129 'title' => __( 'Season Availability', 'booking' ),
130 'href' => wpbc_get_availability_url() . '&tab=season_availability',
131 'parent' => 'wpbc_bar_availability'
132 )
133 );
134
135 $wp_admin_bar->add_menu(
136 array(
137 'id' => 'wpbc_bar_seasons_filters',
138 'title' => __( 'Seasons', 'booking' ),
139 'href' => wpbc_get_availability_url() . '',
140 'parent' => 'wpbc_bar_availability'
141 )
142 );
143 }
144 if ( wpbc_is_mu_user_can_be_here( 'only_super_admin' ) )
145 $wp_admin_bar->add_menu(
146 array(
147 'id' => 'wpbc_bar_general_availability',
148 'title' => __( 'General Availability', 'booking' ),
149 'href' => wpbc_get_settings_url() . '&scroll_to_section=wpbc_general_settings_availability_tab',
150 'parent' => 'wpbc_bar_availability'
151 )
152 );
153
154 // Booking > Prices page
155 if ( class_exists( 'wpdev_bk_biz_m' ) ){
156
157 $wp_admin_bar->add_menu(
158 array(
159 'id' => 'wpbc_bar_prices',
160 'title' => __( 'Prices', 'booking' ),
161 'href' => wpbc_get_price_url(),
162 'parent' => 'wpbc_bar',
163 )
164 );
165 $wp_admin_bar->add_menu(
166 array(
167 'id' => 'wpbc_bar_daily_costs',
168 'title' => __('Daily Costs','booking'),
169 'href' => wpbc_get_price_url() . '&tab=cost',
170 'parent' => 'wpbc_bar_prices',
171 )
172 );
173 $wp_admin_bar->add_menu(
174 array(
175 'id' => 'wpbc_bar_cost_advanced',
176 'title' => __('Form Options Costs','booking'),
177 'href' => wpbc_get_price_url() . '&tab=cost_advanced',
178 'parent' => 'wpbc_bar_prices',
179 )
180 );
181 if ( class_exists( 'wpdev_bk_biz_l' ) ){
182 $wp_admin_bar->add_menu(
183 array(
184 'id' => 'wpbc_bar_coupons',
185 'title' => __('Discount Coupons','booking'),
186 'href' => wpbc_get_price_url() . '&tab=coupons',
187 'parent' => 'wpbc_bar_prices',
188 )
189 );
190 }
191 $wp_admin_bar->add_menu(
192 array(
193 'id' => 'wpbc_bar_seasons_costs',
194 'title' => __( 'Seasons', 'booking' ),
195 'href' => wpbc_get_price_url() . '',
196 'parent' => 'wpbc_bar_prices'
197 )
198 );
199 $wp_admin_bar->add_menu(
200 array(
201 'id' => 'wpbc_bar_costs_payment_gateways',
202 'title' => __( 'Payment Setup', 'booking' ),
203 'href' => wpbc_get_settings_url() . '&tab=payment',
204 'parent' => 'wpbc_bar_prices'
205 )
206 );
207
208 }
209
210 //Booking > Resources page
211 $wp_admin_bar->add_menu(
212 array(
213 'id' => 'wpbc_bar_resources',
214 'title' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? __( 'Resources', 'booking' ) : __( 'Resource', 'booking' ) ),
215 'href' => $link_res,
216 'parent' => 'wpbc_bar',
217 )
218 );
219 $wp_admin_bar->add_menu(
220 array(
221 'id' => 'wpbc_bar_resources_general',
222 'title' => ( ( class_exists( 'wpdev_bk_personal' ) ) ? __( 'Resources', 'booking' ) : __( 'Resource', 'booking' ) ),
223 'href' => $link_res,
224 'parent' => 'wpbc_bar_resources',
225 )
226 );
227
228 if ( class_exists( 'wpdev_bk_biz_l' ) )
229 $wp_admin_bar->add_menu(
230 array(
231 'id' => 'wpbc_bar_resources_searchable',
232 'title' => __( 'Search Resources Setup', 'booking' ),//__( 'Searchable Resources', 'booking' ),//__( 'Search Availability', 'booking' ),
233 'href' => $link_res . '&tab=searchable_resources',
234 'parent' => 'wpbc_bar_resources'
235 )
236 );
237
238 // if ($is_super_admin)
239 // if ( class_exists( 'wpdev_bk_biz_l' ) )
240 // $wp_admin_bar->add_menu(
241 // array(
242 // 'id' => 'wpbc_bar_resources_search',
243 // 'title' => __( 'Search Form / Results', 'booking' ),
244 // 'href' => $link_settings . '&tab=search',
245 // 'parent' => 'wpbc_bar_resources'
246 // )
247 // );
248
249
250 //Booking > Settings General page
251
252 $wp_admin_bar->add_menu(
253 array(
254 'id' => 'wpbc_bar_settings',
255 'title' => __( 'Settings', 'booking' ),
256 'href' => wpbc_get_settings_url(),
257 'parent' => 'wpbc_bar',
258 )
259 );
260
261 if ($is_super_admin)
262 $wp_admin_bar->add_menu(
263 array(
264 'id' => 'wpbc_bar_settings_general',
265 'title' => __( 'General', 'booking' ),
266 'href' => $link_settings,
267 'parent' => 'wpbc_bar_settings'
268 )
269 );
270 $wp_admin_bar->add_menu(
271 array(
272 'id' => 'wpbc_bar_settings_form',
273 'title' => __( 'Booking Form', 'booking' ),
274 'href' => $link_settings . '&tab=form',
275 'parent' => 'wpbc_bar_settings'
276 )
277 );
278 $wp_admin_bar->add_menu(
279 array(
280 'id' => 'wpbc_bar_settings_email',
281 'title' => __( 'Emails', 'booking' ),
282 'href' => $link_settings . '&tab=email',
283 'parent' => 'wpbc_bar_settings'
284 )
285 );
286 $wp_admin_bar->add_menu(
287 array(
288 'id' => 'wpbc_bar_settings_sync',
289 'title' => __( 'Sync', 'booking' ), //FixIn: 8.0
290 'href' => $link_settings . '&tab=sync',
291 'parent' => 'wpbc_bar_settings'
292 )
293 );
294 if ( class_exists( 'wpdev_bk_biz_s' ) )
295 $wp_admin_bar->add_menu(
296 array(
297 'id' => 'wpbc_bar_settings_payment',
298 'title' => __( 'Payment Setup', 'booking' ),
299 'href' => $link_settings . '&tab=payment',
300 'parent' => 'wpbc_bar_settings'
301 )
302 );
303
304 if ( ( class_exists( 'wpdev_bk_biz_l' ) ) && ( wpbc_is_mu_user_can_be_here( 'only_super_admin' ) ) )
305 $wp_admin_bar->add_menu(
306 array(
307 'id' => 'wpbc_bar_settings_search',
308 'title' => __( 'Search Form / Results', 'booking' ),
309 'href' => $link_settings . '&tab=search',
310 'parent' => 'wpbc_bar_settings'
311 )
312 );
313 if ( class_exists( 'wpdev_bk_multiuser' ) )
314 if ($is_super_admin)
315 $wp_admin_bar->add_menu(
316 array(
317 'id' => 'wpbc_bar_settings_users',
318 'title' => __( 'Users', 'booking' ),
319 'href' => $link_settings . '&tab=users',
320 'parent' => 'wpbc_bar_settings'
321 )
322 );
323 }
324 add_action( 'admin_bar_menu', 'wpbc_add__booking_menu__in__admin_top_bar', 70 ); // Add - TOP Bar - in admin menu
325