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
booking / includes / ui_settings / class-settings-page-parts.php

class-settings-page-parts.php in Booking Calendar 11.8.4, at includes/ui_settings/class-settings-page-parts.php

355 lines 16.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Page Structure in Admin Panel
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 2024-12-23, 2015-11-02
14 */
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit; // Exit, if accessed directly.
18 }
19
20 // UI Parts.
21 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/elements/ui_el__dropdown_menu.php';
22 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/elements/ui_el__a.php';
23 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/elements/ui_el__divider.php';
24 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/parts/ui__nav_top.php';
25 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/parts/ui__nav_vert.php';
26 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/parts/ui__nav_horis.php';
27 require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/parts/ui__timeline_toolbar.php';
28
29
30 // FixIn: 11.0.0.1.
31
32 /**
33 * Define Settings Page Structure
34 */
35 class WPBC_Settings_Page_Parts {
36
37 private $page_structure_obj;
38 private $active_page;
39 private $active_tab;
40 private $active_subtab;
41
42 /**
43 * Constructor.
44 *
45 * @param array $template_params_arr - array(
46 * 'active_page' => $page_tag,
47 * 'active_tab' => $active_page_tab,
48 * 'active_subtab' => $active_page_subtab,
49 * 'page_structure_obj' => $this,
50 * ).
51 */
52 public function __construct( $template_params_arr ) {
53
54 $this->active_page = $template_params_arr['active_page'];
55 $this->active_tab = $template_params_arr['active_tab'];
56 $this->active_subtab = $template_params_arr['active_subtab'];
57 $this->page_structure_obj = $template_params_arr['page_structure_obj'];
58 }
59
60
61 /**
62 * Show Template Header
63 *
64 * @return void
65 */
66 public function template_header() {
67
68 $tabs_arr = $this->page_structure_obj->get_nav_tabs();
69 $current_page_params_arr = $this->page_structure_obj->get_current_page_params();
70
71 // -------------------------------------------------------------------------------------------------------------
72 // 'Left Sidebar' - By default it shoud be ''. Other options: '', 'min', 'compact', 'max'.
73 // -------------------------------------------------------------------------------------------------------------
74 $left_navigation__default_view_mode = strval( $this->page_structure_obj->get_left_navigation_default_view_mode() );
75 $left_navigation__is_user_mode_enabled = $this->page_structure_obj->is_left_navigation_user_mode_enabled();
76
77 if ( ! empty( $left_navigation__default_view_mode ) ) {
78 if ( 'none' === $left_navigation__default_view_mode ) {
79 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_hide ) { wpbc_admin_ui__sidebar_left__do_hide(); } } ); </script>';
80 }
81 if ( 'min' === $left_navigation__default_view_mode ) {
82 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_min ) { wpbc_admin_ui__sidebar_left__do_min(); } } ); </script>';
83 }
84 if ( 'compact' === $left_navigation__default_view_mode ) {
85 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_compact ) { wpbc_admin_ui__sidebar_left__do_compact(); } } ); </script>';
86 }
87 if ( 'max' === $left_navigation__default_view_mode ) {
88 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_left__do_max ) { wpbc_admin_ui__sidebar_left__do_max(); } } ); </script>';
89 }
90 }
91
92 // -------------------------------------------------------------------------------------------------------------
93 // 'Right Sidebar' - By default it shoud be ''. Other options: '', 'min', 'compact', 'max'.
94 // -------------------------------------------------------------------------------------------------------------
95 $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' );
96 $right_vertical_sidebar__default_view_mode = strval( $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__default_view_mode' ) );
97 $right_vertical_sidebar__default_view_mode = ( ! empty( $right_vertical_sidebar__default_view_mode ) ) ? $right_vertical_sidebar__default_view_mode . '_right' : $right_vertical_sidebar__default_view_mode;
98 $right_sidebar_content_click_collapse_mode = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__content_click_collapse_mode' );
99 $right_sidebar_content_click_collapse_mode = is_scalar( $right_sidebar_content_click_collapse_mode )
100 ? sanitize_key( (string) $right_sidebar_content_click_collapse_mode )
101 : '';
102 $right_sidebar_content_click_collapse_mode = in_array( $right_sidebar_content_click_collapse_mode, array( 'min', 'compact', 'none' ), true )
103 ? $right_sidebar_content_click_collapse_mode
104 : '';
105
106 if ( ! empty( $right_vertical_sidebar__default_view_mode ) ) {
107 if ( 'none_right' === $right_vertical_sidebar__default_view_mode ) {
108 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_hide ) { wpbc_admin_ui__sidebar_right__do_hide(); } } ); </script>';
109 }
110 if ( 'min_right' === $right_vertical_sidebar__default_view_mode ) {
111 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_min ) { wpbc_admin_ui__sidebar_right__do_min(); } } ); </script>';
112 }
113 if ( 'compact_right' === $right_vertical_sidebar__default_view_mode ) {
114 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_compact ) { wpbc_admin_ui__sidebar_right__do_compact(); } } ); </script>';
115 }
116 if ( 'max_right' === $right_vertical_sidebar__default_view_mode ) {
117 echo '<script type="text/javascript"> jQuery( document ).ready( function () { if ( "function" === typeof wpbc_admin_ui__sidebar_right__do_max ) { wpbc_admin_ui__sidebar_right__do_max(); } } ); </script>';
118 }
119 }
120 // -------------------------------------------------------------------------------------------------------------
121
122
123 // Top wrapper for admin pages.
124 echo '<div class="wpbc_admin wpbc_page' .
125 ( ( $right_vertical_sidebar__is_show ) ? ' right_vertical_sidebar_displayed ' : '' ) .
126 ' wpbc_admin_page__tab__' . esc_attr( $this->active_tab ) .
127 ' wpbc_admin_page__subtab__' . esc_attr( $this->active_subtab ) .
128 '">';
129
130 wpbc_ui__top_nav(
131 array(
132 'page_tag' => $this->active_page,
133 'active_page_tab' => $this->active_tab,
134 'active_page_subtab' => $this->active_subtab,
135 'is_full_screen_user_mode_enabled' => $this->page_structure_obj->is_full_screen_user_mode_enabled(),
136 )
137 );
138
139 // Fires Before showing settings Content page ( for example in setup Wizard for show_top_right_wizard_button ).
140 do_action( 'wpbc_after_wpbc_page_top__header_tabs', $this->active_page, $this->active_tab, $this->active_subtab );
141
142 echo '<div class="wpbc_settings_page_wrapper ' .
143 esc_attr( $left_navigation__default_view_mode ) . ' ' .
144 esc_attr( $right_vertical_sidebar__default_view_mode ) .
145 '" data-wpbc-left-sidebar-user-mode="' . esc_attr( $left_navigation__is_user_mode_enabled ? '1' : '0' ) . '"' .
146 ( $right_sidebar_content_click_collapse_mode
147 ? ' data-wpbc-right-sidebar-content-click-collapse-mode="' . esc_attr( $right_sidebar_content_click_collapse_mode ) . '"'
148 : '' ) .
149 '>';
150
151 if ( $left_navigation__is_user_mode_enabled ) {
152 $user_cust_option = 'left_sidebar_view_mode';
153 $nonce_action = $user_cust_option . '_nonce_act';
154
155 echo '<span id="wpbc_left_sidebar_view_mode_saver" style="display:none;"' .
156 ' data-wpbc-u-save-name="' . esc_attr( $user_cust_option ) . '"' .
157 ' data-wpbc-u-save-value="' . esc_attr( $left_navigation__default_view_mode ) . '"' .
158 ' data-wpbc-u-save-nonce="' . esc_attr( wp_create_nonce( $nonce_action ) ) . '"' .
159 ' data-wpbc-u-save-user-id="' . esc_attr( wpbc_get_current_user_id() ) . '"' .
160 ' data-wpbc-u-save-action="' . esc_attr( $nonce_action ) . '"' .
161 '></span>';
162 }
163
164 // Left vertical menu.
165 wpbc_ui__left_vertical_nav(
166 array(
167 'active_page' => $this->active_page, // wpbc-settings.
168 'active_tab' => $this->active_tab, // calendar_appearance.
169 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
170 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
171 )
172 );
173
174 ?>
175 <div class="wpbc_settings_page_content">
176 <?php
177 // Initialize shared sidebar and page-control tooltips once per request.
178 if ( function_exists( 'wpbc_bs_javascript_tooltips' ) ) {
179 wpbc_bs_javascript_tooltips();
180 }
181 ?>
182 <div id="<?php echo esc_attr( $this->active_page ); ?>-admin-page" class="wrap wpbc_page wpbc_page_tab__<?php echo esc_attr( $this->active_tab ); ?> wpbc_page_subtab__<?php echo esc_attr( $this->active_subtab ); ?>">
183 <div class="wpbc_admin_message"></div>
184 <div class="wpbc_admin_page">
185 <div id="ajax_working">
186 <?php
187 /**
188 * Fires inside the Booking Calendar floating admin-message container.
189 *
190 * Persistent or actionable messages rendered here use the same fixed
191 * top-right presentation as transient Booking Calendar AJAX notices.
192 *
193 * @param string $active_page Current Booking Calendar page slug.
194 * @param string $active_tab Current active tab slug.
195 * @param string $active_subtab Current active subtab slug.
196 */
197 do_action( 'wpbc_inside_ui__admin_messages', $this->active_page, $this->active_tab, $this->active_subtab );
198 ?>
199 </div>
200 <div class="clear wpbc_header_margin" style="height:0px;"></div>
201 <div id="ajax_respond" class="ajax_respond" style="display:none;"></div>
202 <div class="clear"></div>
203 <?php
204
205 $is_show_top_path = method_exists( $this->page_structure_obj, 'is_top_path_enabled' )
206 ? $this->page_structure_obj->is_top_path_enabled()
207 : $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_path' );
208 if ( $is_show_top_path ) {
209 wpbc_ui_settings__top_path( $this->page_structure_obj );
210 }
211
212 $is_show_top_navigation = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_navigation' );
213 if ( $is_show_top_navigation ) {
214 // Top horisonal menu.
215 wpbc_ui__top_horisontal_nav(
216 array(
217 'active_page' => $this->active_page, // wpbc-settings.
218 'active_tab' => $this->active_tab, // calendar_appearance.
219 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
220 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
221 )
222 );
223 }
224
225 $this->show_title_and_description();
226 }
227
228
229 /**
230 * Show Template Footer
231 *
232 * @return void
233 */
234 public function template_footer() {
235
236 echo '</div><!-- wpbc_admin_page -->';
237 echo '</div><!-- wpbc_page -->';
238 echo '</div><!-- .wpbc_settings_page_content -->';
239
240 // Right vertical sidebar.
241 $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' );
242 if ( $right_vertical_sidebar__is_show ) {
243
244 wpbc_ui__right_vertical_sidebar(
245 array(
246 'active_page' => $this->active_page, // wpbc-settings.
247 'active_tab' => $this->active_tab, // calendar_appearance.
248 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
249 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
250 )
251 );
252
253 $right_vertical_sidebar_compact__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar_compact__is_show' );
254 if ( $right_vertical_sidebar_compact__is_show ) {
255 wpbc_ui__right_vertical_sidebar_compact(
256 array(
257 'active_page' => $this->active_page, // wpbc-settings.
258 'active_tab' => $this->active_tab, // calendar_appearance.
259 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
260 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
261 )
262 );
263 }
264 }
265
266 echo '</div><!-- .wpbc_settings_page_wrapper -->';
267 echo '</div><!-- .wpbc_admin -->';
268
269
270 /**
271 * == Full Screen Mode Checking == Defined in -> public function add_loading_classes( $classes ) .
272 *
273 * If defined full screen ( checked by exists .wpbc_admin_full_screen in body),
274 * then this code, remove the 'wp-toolbar' class from html tag
275 * and set correct 'full screen' or 'normal' buttons in the rop right side!
276 */
277 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
278 echo '<script type="text/javascript">' . wpbc_jq_ready_start() . 'if ( "function" === typeof wpbc_check_full_screen_mode ) { wpbc_check_full_screen_mode(); }' . wpbc_jq_ready_end() . '</script>';
279 }
280
281
282 /**
283 * Show Header Title and Description
284 *
285 * @return void
286 */
287 private function show_title_and_description() {
288
289 $current_page_params_arr = $this->page_structure_obj->get_current_page_params();
290
291 if (
292 ( ! empty( $current_page_params_arr['subtab'] ) ) &&
293 ( ! empty( $current_page_params_arr['subtab']['tag'] ) ) &&
294 ( $current_page_params_arr['subtab']['tag'] === $this->active_subtab )
295 ) { // Active: Subtab.
296 // Header - Title.
297 if ( isset( $current_page_params_arr['subtab']['page_title'] ) ) {
298 $this->show_title( $current_page_params_arr['subtab']['page_title'] );
299 }
300 // Header - Title Description.
301 if ( isset( $current_page_params_arr['subtab']['page_description'] ) ) {
302 $this->show_title_description( $current_page_params_arr['subtab']['page_description'] );
303 } elseif ( isset( $current_page_params_arr['subtab']['hint'] ) ) {
304 $this->show_title_description( $current_page_params_arr['subtab']['hint'] );
305 }
306 } elseif ( ! empty( $current_page_params_arr['tab'] ) ) { // Active: Main tab.
307 // Header - Title.
308 if ( isset( $current_page_params_arr['tab']['page_title'] ) ) {
309 $this->show_title( $current_page_params_arr['tab']['page_title'] );
310 }
311 if ( isset( $current_page_params_arr['tab']['page_description'] ) ) {
312 $this->show_title_description( $current_page_params_arr['tab']['page_description'] );
313 } elseif ( isset( $current_page_params_arr['tab']['hint'] ) ) {
314 $this->show_title_description( $current_page_params_arr['tab']['hint'] );
315 }
316 }
317 }
318
319
320 /**
321 * Show Title
322 *
323 * @param string $value - title of the page.
324 *
325 * @return void
326 */
327 private function show_title( $value ) {
328 if ( ! empty( $value ) ) {
329 echo '<h1 class="wpbc_settings_page_header_title">' . wp_kses_post( $value ) . '</h1>';
330 }
331 }
332
333
334 /**
335 * Show Title Description
336 *
337 * @param string|array $value - Title Description of the page.
338 *
339 * @return void
340 */
341 private function show_title_description( $value ) {
342
343 if ( ! empty( $value ) ) {
344 if ( is_array( $value ) ) {
345
346 if ( ! empty( $value['title'] ) ) {
347 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value['title'] ) . '</p>';
348 }
349 } else {
350 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value ) . '</p>';
351 }
352 }
353 }
354 }
355