PluginProbe
Booking Calendar / 10.15.6
Booking Calendar v10.15.6
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_top.php

ui__nav_top.php in Booking Calendar 10.15.6, at includes/ui_settings/parts/ui__nav_top.php

313 lines 10.5 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-02-15
14 */
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit; // Exit, if accessed directly.
18 }
19
20 /**
21 * Show Top Nav bar
22 *
23 * @param array $args - parameters.
24 *
25 * @return void
26 */
27 function wpbc_ui__top_nav( $args = array() ) {
28
29 $defaults = array(
30 'attr' => array(),
31 );
32 $params = wp_parse_args( $args, $defaults );
33
34 echo '<div class="wpbc_ui_el wpbc_ui_el__top_nav">';
35
36 wpbc_ui__vert_left_bar__do_toggle();
37 wpbc_ui_el__divider_vertical( array( 'class' => 'wpbc_ui_el__vertical_line wpbc_ui__top_nav__btn_show_left_vertical_nav_divider' ) );
38
39 wpbc_ui__top_nav__dropdown__wpbc();
40
41 do_action( 'wpbc_ui_el__top_nav__content_start', $params['page_tag'], $params['active_page_tab'], $params['active_page_subtab'] );
42
43
44 ?><div class="wpbc_ui_el__make_space"></div><?php // Spacer.
45
46 do_action( 'wpbc_ui_el__top_nav__content_center', $params['page_tag'], $params['active_page_tab'], $params['active_page_subtab'] );
47
48 // Load Top News Message and "Search by ID" fields.
49 echo '<style type="text/css"> .wpbc_message_wrapper { margin-left: 0px !important; } </style>';
50 make_bk_action( 'wpbc_h1_header_content_end', $params['page_tag'], $params['active_page_tab'], $params['active_page_subtab'] );
51
52 ?><div class="wpbc_ui_el__make_space"></div><?php // Spacer.
53
54 do_action( 'wpbc_ui_el__top_nav__content_end', $params['page_tag'], $params['active_page_tab'], $params['active_page_subtab'] );
55
56 wpbc_ui_el__divider_vertical();
57
58 // Right sidebar toggle button.
59 wpbc_ui__vert_right_bar__do_toggle();
60 wpbc_ui_el__divider_vertical( array( 'class' => 'wpbc_ui_el__vertical_line wpbc_ui__top_nav__btn_show_right_vertical_nav_divider' ) );
61
62
63 // Full Screen Buttons.
64 wpbc_ui__top_nav__btn_full_screen();
65 wpbc_ui__top_nav__btn_normal_screen();
66
67 echo '</div>';
68 }
69
70
71
72 /**
73 * Show element - "WPBC - Main Dropdown"
74 *
75 * @return void
76 */
77 function wpbc_ui__top_nav__dropdown__wpbc() {
78
79 $svg_size = '22px';
80 $svg_icon_style = 'margin:5px 5px 0 0;'; // 'background-position: 0 0;background-size: ' . $svg_size . ' ' . $svg_size . ';width: ' . $svg_size . ';height: ' . $svg_size . ';'; //.
81 $svg_icon = wpbc_get_svg_logo_for_background( '#555', '#e5e5e5', '1.0' );
82
83 $wpbc_starter_pages = function_exists( 'wpbc_get_published_activation_booking_pages' ) ? wpbc_get_published_activation_booking_pages() : array();
84 $wp_post_booking_absolute = false;
85
86 if (
87 empty( $wpbc_starter_pages ) &&
88 function_exists( 'wpbc_stp_wiz__is_exist_published_page_with_booking_form' )
89 ) {
90 $wp_post_booking_absolute = wpbc_stp_wiz__is_exist_published_page_with_booking_form();
91 }
92
93 $el_arr = array(
94 // 'title' => 'Booking Calendar',
95 // 'font_icon' => 'wpbc-bi-calendar2-range',
96 'title_html' => '<span class="nav-tab-text" style="margin: -3px 0 0 5px;font-size: 16px;padding: 0;"><span style="position: absolute;font-size: 7px;margin-top: 13px;margin-left: 1px;">WP</span>Booking Calendar</span>',
97 'svg_icon' => $svg_icon,
98 'svg_icon_style' => $svg_icon_style,
99 'style' => 'display: flex;flex-flow:row nowrap;align-items: center;justify-content: flex-start; ',
100 'container_style' => 'padding: 0 15px 0 10px;',
101 'position' => 'left',
102 'has_down_arrow' => true,
103 'items' => array(),
104 );
105
106 if ( ! empty( $wpbc_starter_pages ) && is_array( $wpbc_starter_pages ) ) {
107 $el_arr['items'][] = array(
108 'type' => 'header',
109 'title' => __( 'Visit Booking Pages', 'booking' ),
110 );
111
112 foreach ( $wpbc_starter_pages as $wpbc_starter_page ) {
113 if ( empty( $wpbc_starter_page['url'] ) ) {
114 continue;
115 }
116
117 $wpbc_starter_page_title = __( 'Go to page with booking form', 'booking' );
118 if ( ! empty( $wpbc_starter_page['button_title'] ) ) {
119 $wpbc_starter_page_title = $wpbc_starter_page['button_title'];
120 } elseif ( ! empty( $wpbc_starter_page['page_title'] ) ) {
121 $wpbc_starter_page_title = $wpbc_starter_page['page_title'];
122 }
123
124 $el_arr['items'][] = array(
125 'type' => 'link',
126 'title' => $wpbc_starter_page_title,
127 'url' => esc_url( $wpbc_starter_page['url'] ),
128 );
129 }
130 } elseif ( ! empty( $wp_post_booking_absolute ) ) {
131 $el_arr['items'][] = array(
132 'type' => 'header',
133 'title' => __( 'Visit Booking Page', 'booking' ),
134 );
135 $el_arr['items'][] = array(
136 'type' => 'link',
137 'title' => __( 'Go to page with booking form', 'booking' ),
138 'url' => esc_url( $wp_post_booking_absolute ),
139 );
140 }
141 $el_arr['items'][] = array(
142 'type' => 'header',
143 'title' => __( 'Help', 'booking' ),
144 );
145 $el_arr['items'][] = array(
146 'type' => 'link',
147 'title' => __( 'FAQ', 'booking' ),
148 'url' => 'https://wpbookingcalendar.com/faq/',
149 );
150 $el_arr['items'][] = array(
151 'type' => 'header',
152 'title' => __( 'Support', 'booking' ),
153 );
154 $el_arr['items'][] = array(
155 'type' => 'link',
156 'title' => __( 'Support Forum', 'booking' ),
157 'url' => 'https://wpbookingcalendar.com/support/',
158 );
159 $el_arr['items'][] = array(
160 'type' => 'link',
161 'title' => __( 'Contact Support', 'booking' ),
162 'url' => 'mailto:support@wpbookingcalendar.com',
163 'attr' => array( 'style' => 'font-weight: 600;' ),
164 );
165 $el_arr['items'][] = array( 'type' => 'divider' );
166 $el_arr['items'][] = array(
167 'type' => 'link',
168 'title' => __( 'Release History', 'booking' ),
169 'url' => 'https://wpbookingcalendar.com/wn/',
170 );
171 $el_arr['items'][] = array(
172 'type' => 'link',
173 'title' => __( 'What\'s New', 'booking' ) . ' <span style="float:right">' . wpbc_dashboard_info_get_version_number() . '</span>',
174 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ),
175 );
176 // $el_arr['items'][] = array(
177 // 'type' => 'link',
178 // 'title' => __( 'About', 'booking' ),
179 // 'url' => 'https://wpbookingcalendar.com/',
180 // );
181
182
183 $is_show_up = wpbc_is_show_up();
184
185 if ( $is_show_up ) {
186 $el_arr['items'][] = array( 'type' => 'divider' );
187 $el_arr['items'][] = array(
188 'type' => 'link',
189 'title' => ( class_exists( 'wpdev_bk_personal' ) )
190 ? __( 'View Upgrade Options', 'booking' )
191 : __( 'Upgrade to Pro', 'booking' ),
192 'url' => wpbc_up_link(),
193 'attr' => array(
194 'class' => 'wpbc_ui_el_upgrade_button wpbc_button_light wpbc_button_green',
195 'style' => 'color:#fff;font-weight: 600;',
196 ),
197 );
198 }
199
200 wpbc_ui_el__dropdown_menu( $el_arr );
201 }
202
203
204 /**
205 * Show element - "Full Screen"
206 *
207 * @return void
208 */
209 function wpbc_ui__top_nav__btn_full_screen() {
210
211 $el_arr = array();
212
213 $el_arr['onclick'] = "jQuery( '.wpbc_ui__top_nav__btn_full_screen,.wpbc_ui__top_nav__btn_normal_screen' ).toggleClass( 'wpbc_ui__hide' );";
214 $el_arr['onclick'] .= "jQuery('body').toggleClass('wpbc_admin_full_screen');wpbc_check_full_screen_mode();";
215
216 $el_arr['font_icon'] = 'wpbc-bi-arrows-fullscreen';
217 $el_arr['hint'] = array(
218 'title' => __( 'Full Screen', 'booking' ),
219 'position' => 'top',
220 );
221
222 $el_arr['container_class'] = 'wpbc_ui__top_nav__btn_full_screen';
223
224 if ( ! wpbc_is_setup_wizard_page() ) {
225
226 // Params for saving user option.
227 $user_cust_option = 'is_full_screen';
228 $nonce_action = $user_cust_option . '_nonce_act';
229
230 $el_arr['attr'] = array(
231 'data-wpbc-u-save-name' => $user_cust_option,
232 'data-wpbc-u-save-value' => 'On',
233 'data-wpbc-u-save-nonce' => wp_create_nonce( $nonce_action ), // do not need to make escaping the values because: wpbc_get_custom_attr() should handle escaping.
234 'data-wpbc-u-save-user-id' => wpbc_get_current_user_id(),
235 'data-wpbc-u-save-action' => $nonce_action,
236 );
237 $el_arr['onclick'] .= 'wpbc_save_custom_user_data_from_element(this);';
238
239 ?><script type="text/javascript"><?php
240
241 $is_full_screen = WPBC_User_Custom_Data_Saver::get_user_data_value( wpbc_get_current_user_id(), $user_cust_option );
242 $is_full_screen = ( 'On' === $is_full_screen );
243
244 echo wpbc_jq_ready_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
245
246 if ( $is_full_screen ) {
247 echo " jQuery( '.wpbc_ui__top_nav__btn_full_screen,.wpbc_ui__top_nav__btn_normal_screen' ).toggleClass( 'wpbc_ui__hide' ); ";
248 }
249 echo ' wpbc_check_full_screen_mode(); ';
250 echo wpbc_jq_ready_end(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
251
252 ?></script><?php
253 }
254 wpbc_ui_el__a( $el_arr );
255 }
256
257
258 /**
259 * Show element - "Normal Screen"
260 *
261 * @return void
262 */
263 function wpbc_ui__top_nav__btn_normal_screen() {
264
265 $el_arr = array();
266
267 $el_arr['onclick'] = "jQuery( '.wpbc_ui__top_nav__btn_full_screen,.wpbc_ui__top_nav__btn_normal_screen' ).toggleClass( 'wpbc_ui__hide' );";
268 $el_arr['onclick'] .= "jQuery('body').toggleClass('wpbc_admin_full_screen');wpbc_check_full_screen_mode();";
269
270 $el_arr['title'] = '';
271 $el_arr['font_icon'] = 'wpbc-bi-arrows-angle-contract';
272 $el_arr['hint'] = array(
273 'title' => __( 'Exit Full Screen', 'booking' ),
274 'position' => 'top',
275 );
276 $el_arr['container_class'] = 'wpbc_ui__top_nav__btn_normal_screen wpbc_ui__hide';
277
278 // Params for saving user option.
279 $user_cust_option = 'is_full_screen';
280 $nonce_action = $user_cust_option . '_nonce_act';
281 $el_arr['attr'] = array(
282 'data-wpbc-u-save-name' => $user_cust_option,
283 'data-wpbc-u-save-value' => 'Off',
284 'data-wpbc-u-save-nonce' => wp_create_nonce( $nonce_action ), // do not need to make escaping the values because: wpbc_get_custom_attr() should handle escaping.
285 'data-wpbc-u-save-user-id' => wpbc_get_current_user_id(),
286 'data-wpbc-u-save-action' => $nonce_action,
287 );
288 $el_arr['onclick'] .= 'wpbc_save_custom_user_data_from_element(this);';
289
290 wpbc_ui_el__a( $el_arr );
291 }
292
293
294 /**
295 * Set the admin full screen class
296 *
297 * @param bool $classes Body classes.
298 *
299 * @return array
300 */
301 function wpbc_check_full_screen_mode_on_loading( $classes ) {
302
303 $is_full_screen = WPBC_User_Custom_Data_Saver::get_user_data_value( wpbc_get_current_user_id(), 'is_full_screen' );
304 $is_full_screen = ( 'On' === $is_full_screen );
305
306 if ( ( wpbc_is_this_plugin_page() ) && ( $is_full_screen ) && ( ! wpbc_is_setup_wizard_page() ) ) {
307 $classes .= ' wpbc_admin_full_screen';
308 }
309
310 return $classes;
311 }
312 add_filter( 'admin_body_class', 'wpbc_check_full_screen_mode_on_loading' );
313