PluginProbe
Booking Calendar / 11.5
Booking Calendar v11.5
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.5, at includes/ui_settings/class-settings-page-parts.php

338 lines 15.1 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
99 if ( ! empty( $right_vertical_sidebar__default_view_mode ) ) {
100 if ( 'none_right' === $right_vertical_sidebar__default_view_mode ) {
101 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>';
102 }
103 if ( 'min_right' === $right_vertical_sidebar__default_view_mode ) {
104 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>';
105 }
106 if ( 'compact_right' === $right_vertical_sidebar__default_view_mode ) {
107 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>';
108 }
109 if ( 'max_right' === $right_vertical_sidebar__default_view_mode ) {
110 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>';
111 }
112 }
113 // -------------------------------------------------------------------------------------------------------------
114
115
116 // Top wrapper for admin pages.
117 echo '<div class="wpbc_admin wpbc_page' .
118 ( ( $right_vertical_sidebar__is_show ) ? ' right_vertical_sidebar_displayed ' : '' ) .
119 ' wpbc_admin_page__tab__' . esc_attr( $this->active_tab ) .
120 ' wpbc_admin_page__subtab__' . esc_attr( $this->active_subtab ) .
121 '">';
122
123 wpbc_ui__top_nav(
124 array(
125 'page_tag' => $this->active_page,
126 'active_page_tab' => $this->active_tab,
127 'active_page_subtab' => $this->active_subtab,
128 'is_full_screen_user_mode_enabled' => $this->page_structure_obj->is_full_screen_user_mode_enabled(),
129 )
130 );
131
132 // Fires Before showing settings Content page ( for example in setup Wizard for show_top_right_wizard_button ).
133 do_action( 'wpbc_after_wpbc_page_top__header_tabs', $this->active_page, $this->active_tab, $this->active_subtab );
134
135 echo '<div class="wpbc_settings_page_wrapper ' .
136 esc_attr( $left_navigation__default_view_mode ) . ' ' .
137 esc_attr( $right_vertical_sidebar__default_view_mode ) .
138 '" data-wpbc-left-sidebar-user-mode="' . esc_attr( $left_navigation__is_user_mode_enabled ? '1' : '0' ) . '">';
139
140 if ( $left_navigation__is_user_mode_enabled ) {
141 $user_cust_option = 'left_sidebar_view_mode';
142 $nonce_action = $user_cust_option . '_nonce_act';
143
144 echo '<span id="wpbc_left_sidebar_view_mode_saver" style="display:none;"' .
145 ' data-wpbc-u-save-name="' . esc_attr( $user_cust_option ) . '"' .
146 ' data-wpbc-u-save-value="' . esc_attr( $left_navigation__default_view_mode ) . '"' .
147 ' data-wpbc-u-save-nonce="' . esc_attr( wp_create_nonce( $nonce_action ) ) . '"' .
148 ' data-wpbc-u-save-user-id="' . esc_attr( wpbc_get_current_user_id() ) . '"' .
149 ' data-wpbc-u-save-action="' . esc_attr( $nonce_action ) . '"' .
150 '></span>';
151 }
152
153 // Left vertical menu.
154 wpbc_ui__left_vertical_nav(
155 array(
156 'active_page' => $this->active_page, // wpbc-settings.
157 'active_tab' => $this->active_tab, // calendar_appearance.
158 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
159 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
160 )
161 );
162
163 ?>
164 <div class="wpbc_settings_page_content">
165 <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 ); ?>">
166 <div class="wpbc_admin_message"></div>
167 <div class="wpbc_admin_page">
168 <div id="ajax_working">
169 <?php
170 /**
171 * Fires inside the Booking Calendar floating admin-message container.
172 *
173 * Persistent or actionable messages rendered here use the same fixed
174 * top-right presentation as transient Booking Calendar AJAX notices.
175 *
176 * @param string $active_page Current Booking Calendar page slug.
177 * @param string $active_tab Current active tab slug.
178 * @param string $active_subtab Current active subtab slug.
179 */
180 do_action( 'wpbc_inside_ui__admin_messages', $this->active_page, $this->active_tab, $this->active_subtab );
181 ?>
182 </div>
183 <div class="clear wpbc_header_margin" style="height:0px;"></div>
184 <div id="ajax_respond" class="ajax_respond" style="display:none;"></div>
185 <div class="clear"></div>
186 <?php
187
188 $is_show_top_path = method_exists( $this->page_structure_obj, 'is_top_path_enabled' )
189 ? $this->page_structure_obj->is_top_path_enabled()
190 : $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_path' );
191 if ( $is_show_top_path ) {
192 wpbc_ui_settings__top_path( $this->page_structure_obj );
193 }
194
195 $is_show_top_navigation = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_navigation' );
196 if ( $is_show_top_navigation ) {
197 // Top horisonal menu.
198 wpbc_ui__top_horisontal_nav(
199 array(
200 'active_page' => $this->active_page, // wpbc-settings.
201 'active_tab' => $this->active_tab, // calendar_appearance.
202 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
203 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
204 )
205 );
206 }
207
208 $this->show_title_and_description();
209 }
210
211
212 /**
213 * Show Template Footer
214 *
215 * @return void
216 */
217 public function template_footer() {
218
219 echo '</div><!-- wpbc_admin_page -->';
220 echo '</div><!-- wpbc_page -->';
221 echo '</div><!-- .wpbc_settings_page_content -->';
222
223 // Right vertical sidebar.
224 $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' );
225 if ( $right_vertical_sidebar__is_show ) {
226
227 wpbc_ui__right_vertical_sidebar(
228 array(
229 'active_page' => $this->active_page, // wpbc-settings.
230 'active_tab' => $this->active_tab, // calendar_appearance.
231 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
232 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
233 )
234 );
235
236 $right_vertical_sidebar_compact__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar_compact__is_show' );
237 if ( $right_vertical_sidebar_compact__is_show ) {
238 wpbc_ui__right_vertical_sidebar_compact(
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 }
248
249 echo '</div><!-- .wpbc_settings_page_wrapper -->';
250 echo '</div><!-- .wpbc_admin -->';
251
252
253 /**
254 * == Full Screen Mode Checking == Defined in -> public function add_loading_classes( $classes ) .
255 *
256 * If defined full screen ( checked by exists .wpbc_admin_full_screen in body),
257 * then this code, remove the 'wp-toolbar' class from html tag
258 * and set correct 'full screen' or 'normal' buttons in the rop right side!
259 */
260 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
261 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>';
262 }
263
264
265 /**
266 * Show Header Title and Description
267 *
268 * @return void
269 */
270 private function show_title_and_description() {
271
272 $current_page_params_arr = $this->page_structure_obj->get_current_page_params();
273
274 if (
275 ( ! empty( $current_page_params_arr['subtab'] ) ) &&
276 ( ! empty( $current_page_params_arr['subtab']['tag'] ) ) &&
277 ( $current_page_params_arr['subtab']['tag'] === $this->active_subtab )
278 ) { // Active: Subtab.
279 // Header - Title.
280 if ( isset( $current_page_params_arr['subtab']['page_title'] ) ) {
281 $this->show_title( $current_page_params_arr['subtab']['page_title'] );
282 }
283 // Header - Title Description.
284 if ( isset( $current_page_params_arr['subtab']['page_description'] ) ) {
285 $this->show_title_description( $current_page_params_arr['subtab']['page_description'] );
286 } elseif ( isset( $current_page_params_arr['subtab']['hint'] ) ) {
287 $this->show_title_description( $current_page_params_arr['subtab']['hint'] );
288 }
289 } elseif ( ! empty( $current_page_params_arr['tab'] ) ) { // Active: Main tab.
290 // Header - Title.
291 if ( isset( $current_page_params_arr['tab']['page_title'] ) ) {
292 $this->show_title( $current_page_params_arr['tab']['page_title'] );
293 }
294 if ( isset( $current_page_params_arr['tab']['page_description'] ) ) {
295 $this->show_title_description( $current_page_params_arr['tab']['page_description'] );
296 } elseif ( isset( $current_page_params_arr['tab']['hint'] ) ) {
297 $this->show_title_description( $current_page_params_arr['tab']['hint'] );
298 }
299 }
300 }
301
302
303 /**
304 * Show Title
305 *
306 * @param string $value - title of the page.
307 *
308 * @return void
309 */
310 private function show_title( $value ) {
311 if ( ! empty( $value ) ) {
312 echo '<h1 class="wpbc_settings_page_header_title">' . wp_kses_post( $value ) . '</h1>';
313 }
314 }
315
316
317 /**
318 * Show Title Description
319 *
320 * @param string|array $value - Title Description of the page.
321 *
322 * @return void
323 */
324 private function show_title_description( $value ) {
325
326 if ( ! empty( $value ) ) {
327 if ( is_array( $value ) ) {
328
329 if ( ! empty( $value['title'] ) ) {
330 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value['title'] ) . '</p>';
331 }
332 } else {
333 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value ) . '</p>';
334 }
335 }
336 }
337 }
338