PluginProbe
Booking Calendar / 11.0
Booking Calendar v11.0
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 10.11.3 All 202 releases
booking / includes / page-form-simple / form_simple__preview.php

form_simple__preview.php in Booking Calendar 11.0, at includes/page-form-simple/form_simple__preview.php

252 lines 8.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Form Preview
5 * @category WP Booking Calendar > Settings > Booking Form page
6 * @author wpdevelop
7 *
8 * @web-site https://wpbookingcalendar.com/
9 * @email info@wpbookingcalendar.com
10 *
11 * @modified 2024-06-02
12 *
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16
17
18 /**
19 * Show Preview of Booking form
20 * @return void
21 */
22 function wpbc_show_preview__form(){
23
24 wpbc_show_preview__css();
25
26 ?>
27 <div class="wpbc_settings_flex_container">
28 <!--div class="wpbc_settings_flex_container_left"></div-->
29 <div class="wpbc_settings_flex_container_right">
30 <div class="metabox-holder" style="margin-top:30px;"><?php
31
32 wpbc_open_meta_box_section__preview( 'wpbc_settings__form_preview', __( 'Preview', 'booking' ), array(
33 'is_section_visible_after_load' => true,
34 'is_show_minimize' => true,
35 'css_class' => 'postbox wpbc_container_always_hide__on_left_nav_click000'
36 ) );
37
38 wpbc_show_preview_help_notice();
39 $booking_form_theme = get_bk_option( 'booking_form_theme' );
40
41 // Center with padding
42 ?><div class="wpbc_center_preview <?php echo esc_attr( $booking_form_theme ); ?>"><?php
43
44 $resource_id = wpbc_get_default_resource();
45 if ( ! empty( $resource_id ) ){
46 echo do_shortcode( '[booking resource_id=' . $resource_id . ']' );
47 }
48
49 ?></div><?php
50
51 wpbc_close_meta_box_section();
52 ?>
53 </div>
54 </div>
55 </div><?php
56 }
57
58
59 /**
60 * CSS for Preview
61 *
62 * @return void
63 */
64 function wpbc_show_preview__css(){
65
66 ?>
67 <style type="text/css">
68 .wpbc_container_booking_form {
69 width:100%;
70 margin:0;
71 }
72 .wpbc_center_preview {
73 max-width: 80%;
74 min-width:200px;
75
76 margin-left: auto !important;
77 margin-right: auto !important;
78 box-shadow: 0 4px 19px #474747;
79 border: 2px solid #272727;
80 border-radius: 5px;
81 /*resize: both;*/
82 resize: horizontal;
83 overflow: auto;
84 padding: 20px 50px 40px;
85 }
86 @media (max-width: 782px) {
87 .wpbc_center_preview {
88 padding: 20px 20px;
89 }
90 }
91 @media (max-width: 399px) {
92 .wpbc_center_preview {
93 padding: 20px 10px;
94 }
95 }
96 .wpbc_center_preview.wpbc_theme_dark_1 {
97 /*Black Color*/
98 background: #272727;
99 color:#fff;
100 }
101 .wpbc_section_preview_container {
102 border-radius: 4px;
103 }
104 .wpbc_section_preview_header {
105 display: flex;
106 flex-flow: row nowrap;
107 border-bottom: 1px solid #ccd0d4;
108 background: #272727;
109 color: #fff;
110 box-shadow: 0 0 5px #868686;
111 height: 50px;
112 border-radius: 4px;
113 }
114 .wpbc_section_preview_header h3.hndle{
115 flex: 0 1 auto;
116 border: none;
117 color: #fff;
118 font-size: 16px;
119 font-weight: 600;
120 }
121 .wpbc_section_preview_mobile_btn_bar{
122 display: flex;
123 flex-flow: row wrap;
124 justify-content: space-between;
125 align-items: center;
126 width: auto;
127 }
128 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_a{
129 margin: 0 10px;
130 text-decoration: none;
131 outline: none;
132 box-shadow: none;
133 color: #999;
134 }
135 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_a.active{
136 color:#fff;
137 }
138 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_a:hover,
139 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_a:focus {
140 color:#fff;
141 text-decoration: none;
142 outline: none;
143 box-shadow: none;
144 }
145 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_icon::before{
146 font-size: 22px;
147 }
148 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_icon.wpbc-bi-display::before,
149 .wpbc_section_preview_mobile_btn_bar .wpbc_preview_icon.wpbc_icn_computer::before{
150 font-size: 28px;
151 }
152 </style>
153 <?php
154 }
155
156
157 /**
158 * Different Dark design of "Meta box" section open tag
159 *
160 * @param string $metabox_id HTML ID of section
161 * @param string $title Title in section
162 * @param array $params [
163 'is_section_visible_after_load' => true, // Default true - is this section Visible, after page loading or hidden - useful for Booking > Settings General page LEFT column sections
164 'is_show_minimize' => true // Default true - is show minimize button at top right section
165 ]
166 *
167 * @return void
168 */
169 function wpbc_open_meta_box_section__preview( $metabox_id, $title, $params = array() ) {
170
171 $defaults = array(
172 'is_section_visible_after_load' => true,
173 'is_show_minimize' => true,
174 'dismiss_button' => '',
175 'css_class' => 'postbox'
176 );
177 $params = wp_parse_args( $params, $defaults );
178
179 $my_close_open_win_id = $metabox_id . '_metabox';
180
181 ?>
182 <div class='meta-box'>
183 <div id="<?php echo esc_attr( $my_close_open_win_id ); ?>"
184 class="wpbc_section_preview_container <?php echo esc_attr( $params['css_class'] ); ?> <?php
185 if ( $params['is_show_minimize'] ) {
186 if ( '1' == get_user_option( 'booking_win_' . $my_close_open_win_id ) ) {
187 echo 'closed';
188 }
189 }
190 ?>"
191 style="<?php if ( ! $params['is_section_visible_after_load'] ) { echo 'display:none'; } ?>" >
192 <div class="wpbc_section_preview_header postbox-header">
193 <h3 class='hndle'>
194 <span><?php echo wp_kses_post( $title ); ?></span>
195 <?php
196 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
197 echo $params['dismiss_button']; ?>
198 </h3>
199 <div class="wpbc_section_preview_mobile_btn_bar">
200 <a class="wpbc_preview_a active" href="javascript:void(0)" onclick="javascript:jQuery( '.wpbc_center_preview').css({'max-width': '90%', 'width': 'auto'});jQuery('.wpbc_preview_a' ).removeClass('active');jQuery(this).addClass('active');">
201 <i class="wpbc_preview_icon menu_icon icon-1x wpbc-bi-display _icn_computer"></i>
202 </a>
203 <a class="wpbc_preview_a" href="javascript:void(0)" onclick="javascript:jQuery( '.wpbc_center_preview').css({'max-width': '750px', 'width': 'auto'});jQuery('.wpbc_preview_a' ).removeClass('active');jQuery(this).addClass('active');">
204 <i class="wpbc_preview_icon menu_icon icon-1x wpbc-bi-tablet _icn_tablet_mac"></i>
205 </a>
206 <a class="wpbc_preview_a" href="javascript:void(0)" onclick="javascript:jQuery( '.wpbc_center_preview').css({'max-width': '350px', 'width': 'auto'});jQuery('.wpbc_preview_a' ).removeClass('active');jQuery(this).addClass('active');">
207 <i class="wpbc_preview_icon menu_icon icon-1x wpbc-bi-phone _icn_phone_iphone"></i>
208 </a>
209 </div>
210 <?php if ( $params['is_show_minimize'] ) { ?>
211 <div title="<?php esc_attr_e('Click to toggle','booking'); ?>" class="handlediv"
212 onclick="javascript:wpbc_verify_window_opening(<?php echo esc_attr( wpbc_get_current_user_id() ); ?>, '<?php echo esc_attr( $my_close_open_win_id ); ?>');"
213 ><br/></div>
214 <?php } ?>
215 </div>
216 <div class="inside">
217 <?php
218 }
219
220
221 /**
222 * Show Help notice to Save changes
223 *
224 * @return void
225 */
226 function wpbc_show_preview_help_notice(){
227
228 $is_panel_visible = wpbc_is_dismissed_panel_visible( 'wpbc_show_preview_help_notice_id' ); // FixIn: 9.9.0.8.
229 if ( $is_panel_visible ) {
230 ?><div id="wpbc_show_preview_help_notice_id" class="wpbc-settings-notice notice-warning notice-helpful-info"
231 style="max-width: Min(400px, 100%);margin: auto;padding: 4px 20px 7px;font-size: 14px;line-height: 28px;margin-bottom: 25px;"
232 >
233 <a style="margin: 0 7px 0 0;" href="javascript:void(0)" onclick="javascript:jQuery('.wpbc_submit_button_trigger').trigger('click');"
234 data-original-title="<?php echo esc_attr(__('Update','booking')); ?>" class="tooltip_top "><i class="menu_icon icon-1x wpbc_icn_rotate_right wpbc_spin wpbc_animation_pause"></i><span></span></a>
235 <?php
236 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.I18n.MissingTranslatorsComment
237 echo sprintf( __( 'To update preview, please click on %1$sSave Changes%2$s button.', 'booking' ),
238 '<a href="javascript:void(0)" onclick="javascript:jQuery(\'.wpbc_submit_button_trigger\').trigger(\'click\');" style="font-weight:600;text-underline-offset: 3px;text-decoration-thickness: 0px;text-decoration-style: dashed;">',
239 '</a>' );
240
241 $is_panel_visible = wpbc_is_dismissed( 'wpbc_show_preview_help_notice_id', array(
242 'title' => '<i class="menu_icon icon-1x wpbc_icn_close"></i> ',
243 'hint' => __( 'Dismiss', 'booking' ),
244 'class' => 'wpbc_panel_get_started_dismiss',
245 'css' => 'background: #fff;border-radius: 7px;'
246 ));
247
248 ?></div><?php
249 }
250 }
251
252