PluginProbe
Booking Calendar / 11.6
Booking Calendar v11.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 / ui_settings / class-settings-page-parts.php

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

349 lines 15.8 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 <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 ); ?>">
177 <div class="wpbc_admin_message"></div>
178 <div class="wpbc_admin_page">
179 <div id="ajax_working">
180 <?php
181 /**
182 * Fires inside the Booking Calendar floating admin-message container.
183 *
184 * Persistent or actionable messages rendered here use the same fixed
185 * top-right presentation as transient Booking Calendar AJAX notices.
186 *
187 * @param string $active_page Current Booking Calendar page slug.
188 * @param string $active_tab Current active tab slug.
189 * @param string $active_subtab Current active subtab slug.
190 */
191 do_action( 'wpbc_inside_ui__admin_messages', $this->active_page, $this->active_tab, $this->active_subtab );
192 ?>
193 </div>
194 <div class="clear wpbc_header_margin" style="height:0px;"></div>
195 <div id="ajax_respond" class="ajax_respond" style="display:none;"></div>
196 <div class="clear"></div>
197 <?php
198
199 $is_show_top_path = method_exists( $this->page_structure_obj, 'is_top_path_enabled' )
200 ? $this->page_structure_obj->is_top_path_enabled()
201 : $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_path' );
202 if ( $is_show_top_path ) {
203 wpbc_ui_settings__top_path( $this->page_structure_obj );
204 }
205
206 $is_show_top_navigation = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_navigation' );
207 if ( $is_show_top_navigation ) {
208 // Top horisonal menu.
209 wpbc_ui__top_horisontal_nav(
210 array(
211 'active_page' => $this->active_page, // wpbc-settings.
212 'active_tab' => $this->active_tab, // calendar_appearance.
213 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
214 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
215 )
216 );
217 }
218
219 $this->show_title_and_description();
220 }
221
222
223 /**
224 * Show Template Footer
225 *
226 * @return void
227 */
228 public function template_footer() {
229
230 echo '</div><!-- wpbc_admin_page -->';
231 echo '</div><!-- wpbc_page -->';
232 echo '</div><!-- .wpbc_settings_page_content -->';
233
234 // Right vertical sidebar.
235 $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' );
236 if ( $right_vertical_sidebar__is_show ) {
237
238 wpbc_ui__right_vertical_sidebar(
239 array(
240 'active_page' => $this->active_page, // wpbc-settings.
241 'active_tab' => $this->active_tab, // calendar_appearance.
242 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
243 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
244 )
245 );
246
247 $right_vertical_sidebar_compact__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar_compact__is_show' );
248 if ( $right_vertical_sidebar_compact__is_show ) {
249 wpbc_ui__right_vertical_sidebar_compact(
250 array(
251 'active_page' => $this->active_page, // wpbc-settings.
252 'active_tab' => $this->active_tab, // calendar_appearance.
253 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
254 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
255 )
256 );
257 }
258 }
259
260 echo '</div><!-- .wpbc_settings_page_wrapper -->';
261 echo '</div><!-- .wpbc_admin -->';
262
263
264 /**
265 * == Full Screen Mode Checking == Defined in -> public function add_loading_classes( $classes ) .
266 *
267 * If defined full screen ( checked by exists .wpbc_admin_full_screen in body),
268 * then this code, remove the 'wp-toolbar' class from html tag
269 * and set correct 'full screen' or 'normal' buttons in the rop right side!
270 */
271 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
272 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>';
273 }
274
275
276 /**
277 * Show Header Title and Description
278 *
279 * @return void
280 */
281 private function show_title_and_description() {
282
283 $current_page_params_arr = $this->page_structure_obj->get_current_page_params();
284
285 if (
286 ( ! empty( $current_page_params_arr['subtab'] ) ) &&
287 ( ! empty( $current_page_params_arr['subtab']['tag'] ) ) &&
288 ( $current_page_params_arr['subtab']['tag'] === $this->active_subtab )
289 ) { // Active: Subtab.
290 // Header - Title.
291 if ( isset( $current_page_params_arr['subtab']['page_title'] ) ) {
292 $this->show_title( $current_page_params_arr['subtab']['page_title'] );
293 }
294 // Header - Title Description.
295 if ( isset( $current_page_params_arr['subtab']['page_description'] ) ) {
296 $this->show_title_description( $current_page_params_arr['subtab']['page_description'] );
297 } elseif ( isset( $current_page_params_arr['subtab']['hint'] ) ) {
298 $this->show_title_description( $current_page_params_arr['subtab']['hint'] );
299 }
300 } elseif ( ! empty( $current_page_params_arr['tab'] ) ) { // Active: Main tab.
301 // Header - Title.
302 if ( isset( $current_page_params_arr['tab']['page_title'] ) ) {
303 $this->show_title( $current_page_params_arr['tab']['page_title'] );
304 }
305 if ( isset( $current_page_params_arr['tab']['page_description'] ) ) {
306 $this->show_title_description( $current_page_params_arr['tab']['page_description'] );
307 } elseif ( isset( $current_page_params_arr['tab']['hint'] ) ) {
308 $this->show_title_description( $current_page_params_arr['tab']['hint'] );
309 }
310 }
311 }
312
313
314 /**
315 * Show Title
316 *
317 * @param string $value - title of the page.
318 *
319 * @return void
320 */
321 private function show_title( $value ) {
322 if ( ! empty( $value ) ) {
323 echo '<h1 class="wpbc_settings_page_header_title">' . wp_kses_post( $value ) . '</h1>';
324 }
325 }
326
327
328 /**
329 * Show Title Description
330 *
331 * @param string|array $value - Title Description of the page.
332 *
333 * @return void
334 */
335 private function show_title_description( $value ) {
336
337 if ( ! empty( $value ) ) {
338 if ( is_array( $value ) ) {
339
340 if ( ! empty( $value['title'] ) ) {
341 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value['title'] ) . '</p>';
342 }
343 } else {
344 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value ) . '</p>';
345 }
346 }
347 }
348 }
349