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

307 lines 13.3 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->is_use_option__in_subtabs_or_tabs( 'left_navigation__default_view_mode' ) );
75
76 if ( ! empty( $left_navigation__default_view_mode ) ) {
77 if ( 'none' === $left_navigation__default_view_mode ) {
78 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>';
79 }
80 if ( 'min' === $left_navigation__default_view_mode ) {
81 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>';
82 }
83 if ( 'compact' === $left_navigation__default_view_mode ) {
84 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>';
85 }
86 if ( 'max' === $left_navigation__default_view_mode ) {
87 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>';
88 }
89 }
90
91 // -------------------------------------------------------------------------------------------------------------
92 // 'Right Sidebar' - By default it shoud be ''. Other options: '', 'min', 'compact', 'max'.
93 // -------------------------------------------------------------------------------------------------------------
94 $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' );
95 $right_vertical_sidebar__default_view_mode = strval( $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__default_view_mode' ) );
96 $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;
97
98 if ( ! empty( $right_vertical_sidebar__default_view_mode ) ) {
99 if ( 'none_right' === $right_vertical_sidebar__default_view_mode ) {
100 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>';
101 }
102 if ( 'min_right' === $right_vertical_sidebar__default_view_mode ) {
103 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>';
104 }
105 if ( 'compact_right' === $right_vertical_sidebar__default_view_mode ) {
106 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>';
107 }
108 if ( 'max_right' === $right_vertical_sidebar__default_view_mode ) {
109 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>';
110 }
111 }
112 // -------------------------------------------------------------------------------------------------------------
113
114
115 // Top wrapper for admin pages.
116 echo '<div class="wpbc_admin wpbc_page' .
117 ( ( $right_vertical_sidebar__is_show ) ? ' right_vertical_sidebar_displayed ' : '' ) .
118 ' wpbc_admin_page__tab__' . esc_attr( $this->active_tab ) .
119 ' wpbc_admin_page__subtab__' . esc_attr( $this->active_subtab ) .
120 '">';
121
122 wpbc_ui__top_nav(
123 array(
124 'page_tag' => $this->active_page,
125 'active_page_tab' => $this->active_tab,
126 'active_page_subtab' => $this->active_subtab,
127 )
128 );
129
130 // Fires Before showing settings Content page ( for example in setup Wizard for show_top_right_wizard_button ).
131 do_action( 'wpbc_after_wpbc_page_top__header_tabs', $this->active_page, $this->active_tab, $this->active_subtab );
132
133 echo '<div class="wpbc_settings_page_wrapper ' .
134 esc_attr( $left_navigation__default_view_mode ) . ' ' .
135 esc_attr( $right_vertical_sidebar__default_view_mode ) .
136 '">';
137
138 // Left vertical menu.
139 wpbc_ui__left_vertical_nav(
140 array(
141 'active_page' => $this->active_page, // wpbc-settings.
142 'active_tab' => $this->active_tab, // calendar_appearance.
143 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
144 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
145 )
146 );
147
148 ?>
149 <div class="wpbc_settings_page_content">
150 <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 ); ?>">
151 <div class="wpbc_admin_message"></div>
152 <div class="wpbc_admin_page">
153 <div id="ajax_working"></div>
154 <div class="clear wpbc_header_margin" style="height:0px;"></div>
155 <div id="ajax_respond" class="ajax_respond" style="display:none;"></div>
156 <div class="clear"></div>
157 <?php
158
159 $is_show_top_path = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_path' );
160 if ( $is_show_top_path ) {
161 wpbc_ui_settings__top_path();
162 }
163
164 $is_show_top_navigation = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'is_show_top_navigation' );
165 if ( $is_show_top_navigation ) {
166 // Top horisonal menu.
167 wpbc_ui__top_horisontal_nav(
168 array(
169 'active_page' => $this->active_page, // wpbc-settings.
170 'active_tab' => $this->active_tab, // calendar_appearance.
171 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
172 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
173 )
174 );
175 }
176
177 $this->show_title_and_description();
178 }
179
180
181 /**
182 * Show Template Footer
183 *
184 * @return void
185 */
186 public function template_footer() {
187
188 echo '</div><!-- wpbc_admin_page -->';
189 echo '</div><!-- wpbc_page -->';
190 echo '</div><!-- .wpbc_settings_page_content -->';
191
192 // Right vertical sidebar.
193 $right_vertical_sidebar__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar__is_show' );
194 if ( $right_vertical_sidebar__is_show ) {
195
196 wpbc_ui__right_vertical_sidebar(
197 array(
198 'active_page' => $this->active_page, // wpbc-settings.
199 'active_tab' => $this->active_tab, // calendar_appearance.
200 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
201 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
202 )
203 );
204
205 $right_vertical_sidebar_compact__is_show = $this->page_structure_obj->is_use_option__in_subtabs_or_tabs( 'right_vertical_sidebar_compact__is_show' );
206 if ( $right_vertical_sidebar_compact__is_show ) {
207 wpbc_ui__right_vertical_sidebar_compact(
208 array(
209 'active_page' => $this->active_page, // wpbc-settings.
210 'active_tab' => $this->active_tab, // calendar_appearance.
211 'active_subtab' => $this->active_subtab, // calendar_appearance_skin.
212 'page_nav_tabs' => $this->page_structure_obj->get_nav_tabs(),
213 )
214 );
215 }
216 }
217
218 echo '</div><!-- .wpbc_settings_page_wrapper -->';
219 echo '</div><!-- .wpbc_admin -->';
220
221
222 /**
223 * == Full Screen Mode Checking == Defined in -> public function add_loading_classes( $classes ) .
224 *
225 * If defined full screen ( checked by exists .wpbc_admin_full_screen in body),
226 * then this code, remove the 'wp-toolbar' class from html tag
227 * and set correct 'full screen' or 'normal' buttons in the rop right side!
228 */
229 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
230 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>';
231 }
232
233
234 /**
235 * Show Header Title and Description
236 *
237 * @return void
238 */
239 private function show_title_and_description() {
240
241 $current_page_params_arr = $this->page_structure_obj->get_current_page_params();
242
243 if (
244 ( ! empty( $current_page_params_arr['subtab'] ) ) &&
245 ( ! empty( $current_page_params_arr['subtab']['tag'] ) ) &&
246 ( $current_page_params_arr['subtab']['tag'] === $this->active_subtab )
247 ) { // Active: Subtab.
248 // Header - Title.
249 if ( isset( $current_page_params_arr['subtab']['page_title'] ) ) {
250 $this->show_title( $current_page_params_arr['subtab']['page_title'] );
251 }
252 // Header - Title Description.
253 if ( isset( $current_page_params_arr['subtab']['page_description'] ) ) {
254 $this->show_title_description( $current_page_params_arr['subtab']['page_description'] );
255 } elseif ( isset( $current_page_params_arr['subtab']['hint'] ) ) {
256 $this->show_title_description( $current_page_params_arr['subtab']['hint'] );
257 }
258 } elseif ( ! empty( $current_page_params_arr['tab'] ) ) { // Active: Main tab.
259 // Header - Title.
260 if ( isset( $current_page_params_arr['tab']['page_title'] ) ) {
261 $this->show_title( $current_page_params_arr['tab']['page_title'] );
262 }
263 if ( isset( $current_page_params_arr['tab']['page_description'] ) ) {
264 $this->show_title_description( $current_page_params_arr['tab']['page_description'] );
265 } elseif ( isset( $current_page_params_arr['tab']['hint'] ) ) {
266 $this->show_title_description( $current_page_params_arr['tab']['hint'] );
267 }
268 }
269 }
270
271
272 /**
273 * Show Title
274 *
275 * @param string $value - title of the page.
276 *
277 * @return void
278 */
279 private function show_title( $value ) {
280 if ( ! empty( $value ) ) {
281 echo '<h1 class="wpbc_settings_page_header_title">' . wp_kses_post( $value ) . '</h1>';
282 }
283 }
284
285
286 /**
287 * Show Title Description
288 *
289 * @param string|array $value - Title Description of the page.
290 *
291 * @return void
292 */
293 private function show_title_description( $value ) {
294
295 if ( ! empty( $value ) ) {
296 if ( is_array( $value ) ) {
297
298 if ( ! empty( $value['title'] ) ) {
299 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value['title'] ) . '</p>';
300 }
301 } else {
302 echo '<p class="wpbc_settings_page_header_title_description">' . wp_kses_post( $value ) . '</p>';
303 }
304 }
305 }
306 }
307