PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 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 All 205 releases
← All changes | includes/page-resource-free/page-resource-free.php +110 -79 10.1.3 → 11.9 View file →
@@ -1,4 +1,4 @@
1 1 <?php /**
2 2 * @version 1.0
3 3 * @package Booking > Resource page
4 4 * @category Settings page
@@ -10,9 +10,9 @@
10 10 * @modified 2023-12-29
11 11 *
12 12 */
13 13
14 -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly //FixIn: 9.8.15.7
14 +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.8.15.7.
15 15
16 16
17 17 /**
18 18 * Show Content
@@ -19,11 +19,17 @@
19 19 * Update Content
20 20 * Define Slug
21 21 * Define where to show
22 22 */
23 -class WPBC_Page_Settings__bresources extends WPBC_Page_Structure {
23 +class WPBC_Page_Settings__bresource extends WPBC_Page_Structure {
24 24
25 - public function in_page() {
25 + public function in_page() {
26 + if (
27 + class_exists( 'wpdev_bk_personal' )
28 + || ( function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' ) && wpbc_booking_resources_catalog_should_use_new_renderer() )
29 + ) {
30 + return (string) wp_rand( 100000, 1000000 );
31 + }
26 32 return 'wpbc-resources';
27 33 }
28 34
29 35 public function tabs() {
@@ -31,16 +37,16 @@
31 37 $tabs = array();
32 38
33 39 $tabs[ 'resources' ] = array(
34 40 'title' => __('Resource','booking') // Title of TAB
35 - , 'hint' => __('Customization of booking resource', 'booking') // Hint
41 + , 'hint' => __('Create unique calendars with individual availability.', 'booking') // Hint
36 42 , 'page_title' => ucwords( __('Booking resource','booking') ) // Title of Page
37 43 //, 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be external link
38 44 //, 'position' => 'left' // 'left' || 'right' || ''
39 45 //, 'css_classes'=> '' // CSS class(es)
40 46 //, 'icon' => '' // Icon - link to the real PNG img
41 - , 'font_icon' => 'wpbc_icn_checklist' // CSS definition of font Icon
42 - , 'default' => true // Is this tab activated by default or not: true || false.
47 + , 'font_icon' => 'wpbc-bi-list 0wpbc_icn_checklist' // CSS definition of font Icon
48 + , 'default' => ( ! class_exists( 'wpdev_bk_personal' ) ) // Is this tab activated by default or not: true || false.
43 49 //, 'disabled' => false // Is this tab disabled: true || false.
44 50 , 'hided' => true // Is this tab hided: true || false.
45 51 , 'subtabs' => array()
46 52 );
@@ -47,13 +53,16 @@
47 53 return $tabs;
48 54 }
49 55
50 56
51 - /** Show Content of Settings page */
52 - public function content() {
57 + /** Show Content of Settings page */
58 + public function content() {
59 + if ( function_exists( 'wpbc_booking_resources_catalog_get_request_renderer' ) && 'legacy' !== wpbc_booking_resources_catalog_get_request_renderer() ) {
60 + return false;
61 + }
62 +
63 + $this->css();
53 64
54 - $this->css();
55 -
56 65 ////////////////////////////////////////////////////////////////////////
57 66 // Checking
58 67 ////////////////////////////////////////////////////////////////////////
59 68
@@ -64,8 +73,9 @@
64 73 ////////////////////////////////////////////////////////////////////////
65 74
66 75 $submit_form_name = 'wpbc_bresources'; // Define form name
67 76 /*
77 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
68 78 if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) {
69 79 // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. }
70 80 $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page
71 81
@@ -96,9 +106,9 @@
96 106 if (0) {
97 107 ?>
98 108 <div class="wpdvlp-sub-tabs" style="background:none;border:none;box-shadow: none;padding:0;">
99 109 <span class="nav-tabs" style="text-align:right;">
100 - <a href="javascript:void(0);" onclick="javascript:wpbc_scroll_to('#wpbc_booking_resource_table' );" original-title="" class="nav-tab go-to-link"><span><?php _e('Resource' ,'booking'); ?></span></a>
110 + <a href="javascript:void(0);" onclick="javascript:wpbc_scroll_to('#wpbc_booking_resource_table' );" original-title="" class="nav-tab go-to-link"><span><?php esc_html_e('Resource' ,'booking'); ?></span></a>
101 111 </span>
102 112 </div>
103 113 <div class="clear"></div>
104 114 <?php
@@ -110,13 +120,13 @@
110 120 // Content ////////////////////////////////////////////////////////////
111 121 ?>
112 122 <div class="clear"></div>
113 123 <span class="metabox-holder">
114 - <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post" autocomplete="off">
124 + <form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post" autocomplete="off">
115 125 <?php
116 126 // N o n c e field, and key for checking S u b m i t
117 127 wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name );
118 - ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" /><?php
128 + ?><input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1" /><?php
119 129 ?><div class="clear" style="margin-top:20px;"></div>
120 130 <div id="wpbc_booking_resource_table" class="wpbc_settings_row wpbc_settings_row_rightNO">
121 131 <?php
122 132 $this->wpbc_resources_table__show();
@@ -125,11 +135,9 @@
125 135 <div class="clear"></div>
126 136 </span>
127 137 <?php
128 138
129 - do_action( 'wpbc_hook_settings_page_footer', 'resources' );
130 -
131 - $this->enqueue_js();
139 + do_action( 'wpbc_hook_settings_page_footer', 'resources' );
132 140 }
133 141
134 142
135 143 // <editor-fold defaultstate="collapsed" desc=" CSS & JS " >
@@ -168,45 +176,14 @@
168 176 }
169 177 </style>
170 178 <?php
171 179 }
172 -
173 -
174 -
175 - /**
176 - * Add Custom JavaScript - for some specific settings options
177 - * Executed After post content, after initial definition of settings, and possible definition after POST request.
178 - *
179 - * @param type $menu_slug
180 - */
181 - private function enqueue_js(){
182 -
183 - // JavaScript //////////////////////////////////////////////////////////////
184 -
185 - $js_script = '';
186 -
187 - /*
188 - // Hide|Show on Click Checkbox
189 - $js_script .= " jQuery('#bresources_booking_gcal_auto_import_is_active').on( 'change', function(){
190 - if ( this.checked ) {
191 - jQuery('.wpbc_tr_auto_import').removeClass('hidden_items');
192 - } else {
193 - jQuery('.wpbc_tr_auto_import').addClass('hidden_items');
194 - }
195 - } ); ";
196 - */
197 -
198 - // Enqueue JS to the footer of the page
199 - wpbc_enqueue_js( $js_script );
200 - }
180 + // </editor-fold>
201 181
202 - // </editor-fold>
203 182
204 -
205 - ////////////////////////////////////////////////////////////////////////////
183 + // -----------------------------------------------------------------------------------------------------------------
206 184 // Toolbar
207 - ////////////////////////////////////////////////////////////////////////////
208 -
185 + // -----------------------------------------------------------------------------------------------------------------
209 186 /** Show Toolbar - Add new booking resources */
210 187 private function toolbar() {
211 188
212 189 $wpbc_hidded_element_id = 'toolbar_booking_resources';
@@ -216,26 +193,27 @@
216 193 'hint' => __( 'Dismiss', 'booking' ),
217 194 'class' => 'wpbc_panel_get_started_dismiss',
218 195 'css' => 'background: #fff;border-radius: 7px;margin-bottom: -100%;z-index: 4;position: relative;top: 12px;right: 13px;'
219 196 ));
220 - ?><script type="text/javascript"> jQuery('#<?php echo $wpbc_hidded_element_id; ?>').hide(); </script><?php
197 + ?><script type="text/javascript"> jQuery('#<?php echo esc_attr( $wpbc_hidded_element_id ); ?>').hide(); </script><?php
221 198 $dismiss_button_content = ob_get_clean();
222 199
200 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
223 201 echo $dismiss_button_content;
224 202
225 203 if ( $is_panel_visible ) {
226 204 ?>
227 - <div id="toolbar_booking_resources" style="position:relative;margin-bottom:5em;">
205 + <div id="toolbar_booking_resources" style="position:relative;margin-bottom: 5em;padding:1px;border:5px solid #fff;border-radius:5px;box-shadow: 0 3px 15px 0px #d4d4d4;">
228 206 <div class="wpdvlp-top-tabs wpbc_blur">
229 207 <div class="wpdvlp-tabs-wrapper">
230 208 <div class="nav-tabs">
231 209 <a href="javascript:void(0);" class="nav-tab nav-tab-active ">
232 - <i class="menu_icon icon-1x wpbc_icn_add_circle_outline"></i>
233 - <span class="nav-tab-text">&nbsp;&nbsp;<?php echo __('Add Resource', 'booking') . ' ( ' . __('Calendar', 'booking') . ' )'; ?></span>
210 + <i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i>
211 + <span class="nav-tab-text">&nbsp;&nbsp;<?php echo esc_html__('Add Resource', 'booking') . ' ( ' . esc_html__('Calendar', 'booking') . ' )'; ?></span>
234 212 </a>
235 213 <a href="javascript:void(0);" class="nav-tab ">
236 214 <i class="menu_icon icon-1x wpbc_icn_tune"></i>
237 - <span class="nav-tab-text">&nbsp;&nbsp;<?php echo __('Options', 'booking'); ?></span>
215 + <span class="nav-tab-text">&nbsp;&nbsp;<?php echo esc_html__('Options', 'booking'); ?></span>
238 216 </a>
239 217 </div><!-- nav-tabs -->
240 218 </div><!-- wpdvlp-tabs-wrapper -->
241 219 </div><!-- wpdvlp-top-tabs -->
@@ -252,15 +230,15 @@
252 230 </div>
253 231 <div class="ui_element">
254 232 <a class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary tooltip_top " id="ui_btn_erase_availability"
255 233 href="javascript:void(0);"
256 - data-original-title="<?php esc_attr_e( 'Add New Booking Resource(s)' ,'booking'); ?>>"><span><?php _e('Add New', 'booking'); ?>&nbsp;&nbsp;&nbsp;</span><i
257 - class="menu_icon icon-1x wpbc_icn_add_circle_outline"></i></a>
234 + data-original-title="<?php esc_attr_e( 'Add New Booking Resource(s)' ,'booking'); ?>>"><span><?php esc_html_e('Add New', 'booking'); ?>&nbsp;&nbsp;&nbsp;</span><i
235 + class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a>
258 236 </div>
259 237 <div class="ui_element" style="margin-left:15px;">
260 238 <label for="resources_count"
261 239 class="wpbc_ui_control_label "
262 - style=""><span style="font-weight:400"><?php _e('Resources count', 'booking'); ?> </span></label>
240 + style=""><span style="font-weight:400"><?php esc_html_e('Resources count', 'booking'); ?> </span></label>
263 241 <select id="resources_count" name="resources_count" class="wpbc_ui_control wpbc_ui_select " style="max-width: 69px;" autocomplete="off">
264 242 <option value="1" class="" style="">1</option>
265 243 </select>
266 244 </div>
@@ -295,12 +273,11 @@
295 273 }
296 274
297 275 }
298 276
299 - ////////////////////////////////////////////////////////////////////////////
277 + // -----------------------------------------------------------------------------------------------------------------
300 278 // B o o k i n g R e s o u r c e s T a b l e
301 - ////////////////////////////////////////////////////////////////////////////
302 -
279 + // -----------------------------------------------------------------------------------------------------------------
303 280 /** Show booking resources table */
304 281 public function wpbc_resources_table__show() {
305 282
306 283 ?>
@@ -308,27 +285,30 @@
308 285 <div class="wpdevelop wpbc_selectable_table wpbc_resources_table">
309 286 <table class="table table-striped widefat " cellspacing="0" cellpadding="0">
310 287 <thead class="wpbc_selectable_head">
311 288 <tr>
312 - <th class="check-column"><input type="checkbox" value="" id="br-select-all" name="resource_id_all"></th>
313 - <th class="wpbc_hide_mobile" style="width:5em;"><a href="javascript:void(0);">ID <span class="wpbc_icn_swap_vert" aria-hidden="true"></span></a></th>
314 - <th style=""><a href="javascript:void(0);"><?php _e( 'Resource Name', 'booking' ); ?> <span aria-hidden="true" class="glyphicon wpbc_icn_vertical_align_top"></span></a></th>
315 - <th class="wpbc_hide_mobile" style="text-align:center;"><?php _e( 'Shortcode for page', 'booking' ); ?></th>
316 - <th class="" style="text-align:center;"><?php _e( 'Actions', 'booking' ); ?></th>
289 + <th class="" style="width:5em;text-align: center;"><span href="javascript:void(0);">ID </span></th>
290 + <th class="wpbc_hide_mobile"><span href="javascript:void(0);"><?php esc_html_e( 'Resource Name', 'booking' ); ?> </span></th>
291 + <th class="" style="text-align:center;"><?php esc_html_e( 'Shortcode for page', 'booking' ); ?></th>
292 + <th class="" style="text-align:center;"><?php esc_html_e( 'Actions', 'booking' ); ?></th>
317 293 </tr>
318 294 </thead>
319 295 <tbody class="wpbc_selectable_body">
320 296 <tr class="wpbc_row wpbc_resource_row" id="resource_1">
321 - <th class="check-column">
322 - <label class="screen-reader-text" for="br-select-1"><?php _e( 'Select Booking Resource', 'booking' ); ?></label>
323 - <input type="checkbox" id="br-select-1" name="br-select-1" value="resource_1">
324 - </th>
325 - <td class="wpbc_hide_mobile">1</td>
326 - <td>
297 + <td style="background: transparent;border: none;box-shadow: none;margin: 16px 0 0;padding: 0;display: flex;flex-flow: column;justify-content: center;align-items: center;width: 100%;"
298 + class="wpbc_hide_mobile wpbc_flextable">
299 + <div class="wpbc_flextable_col wpbc_flextable_col_id">
300 + <div class="wpbc_listing_col wpbc_col_booking_labels wpbc_col_labels wpbc_label_resource_id_container">
301 + <span class="wpbc_label wpbc_label_booking_id wpbc_label_resource_id">1</span>
302 + </div>
303 + </div>
304 + </td>
305 + <td class="wpbc_hide_mobile">
327 306 <input type="text" value="Default" id="booking_resource_1" name="booking_resource_1"
328 - style="float:right;width:100%;font-weight:600;color: #aaa;" disabled="disabled"
307 + style="float:right;width:100%;font-weight:600;color: #aaa;height: 32px;" disabled="disabled"
329 308 class="large-text disabled">
330 309 </td>
310 + <?php /* ?>
331 311 <td class="wpbc_hide_mobile">
332 312 <div class="wpbc_ajx_toolbar" style="display: flex;flex-flow: row wrap;justify-content: center;align-items: center;margin: 0;">
333 313 <div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_actions_row_1"
334 314 style="border: none;background: none;padding: 0;">
@@ -345,9 +325,9 @@
345 325 <!--div class="ui_element">
346 326 <a href="javascript:void(0)" onclick="javascript:wpbc_resource_page_btn_click(1);"
347 327 id="ui_btn_erase_availability" class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger0 tooltip_top "
348 328 title="<?php esc_attr_e( 'Customize Booking Calendar shortcode','booking'); ?>" >
349 - <span style="display: none;"><?php _e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
329 + <span style="display: none;"><?php esc_html_e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
350 330 <i class="menu_icon icon-1x wpbc_icn_tune"></i>
351 331 </a>
352 332 </div-->
353 333 </div>
@@ -354,14 +334,64 @@
354 334 </div>
355 335 </div>
356 336 </td>
357 337 <td class="" style="text-align: center;">
338 + <div class="ui_element" style="margin: 0 15px 0 0;">
339 + <a href="javascript:void(0)" onclick="javascript:wpbc_resource_page_btn_click(1);"
340 + id="ui_btn_erase_availability" class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger0 tooltip_top "
341 + title="<?php esc_attr_e( 'Customize Booking Calendar shortcode','booking'); ?>" >
342 + <span style="display: none;"><?php esc_html_e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
343 + <i class="menu_icon icon-1x wpbc_icn_tune"></i>
344 + </a>
345 + </div>
358 346 <a href="javascript:void(0);"
359 347 onclick="javascript: wpbc_modal_dialog__show__resource_publish( 1 );"
360 348 class="button button-primary tooltip_top"
361 349 title="<?php esc_attr_e('Embed your booking form into the page', 'booking'); ?>"
362 - ><?php _e( 'Publish', 'booking' ); ?></a>
350 + ><?php esc_html_e( 'Publish', 'booking' ); ?></a>
363 351 </td>
352 + <?php */
353 + // FixIn: 10.3.0.8.
354 + ?>
355 + <td colspan="2" class="wpbc_flextable_col">
356 + <div class="wpbc_ajx_toolbar">
357 + <div class="ui_container ui_container_small">
358 + <div class="ui_group ui_group__shortcode">
359 + <div class="ui_element" style="flex: 1 1 auto;margin: 0;">
360 + <div id="div_booking_resource_shortcode_1" name="div_booking_resource_shortcode_1" class="shortcode_text_field large-text put-in">
361 + [booking resource_id=1]
362 + </div>
363 + <input type="hidden" value="[booking resource_id=1]" id="booking_resource_shortcode_1" name="booking_resource_shortcode_1">
364 + </div>
365 + <div class="ui_element" style="margin-left: 0px;margin-right: 0px;">
366 + <a href="https://wpbookingcalendar.com/faq/#shortcodes"
367 + class="tooltip_top wpbc-bi-question-circle"
368 + data-original-title="<?php echo esc_attr( __('Learn how to integrate the booking form into a page using the shortcode.','booking') ); ?>"></a>
369 + </div>
370 + </div>
371 + <div class="ui_group ui_group__publish_btn">
372 + <div class="ui_element" style="margin: 0 15px 0 0;">
373 + <a href="javascript:void(0)" onclick="javascript:wpbc_resource_page_btn_click(1);"
374 + id="ui_btn_erase_availability"
375 + class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger0 tooltip_top "
376 + data-original-title="<?php echo esc_attr( __('Customize Booking Calendar shortcode','booking') ); ?>">
377 + <span style="display: none;"><?php esc_html_e('Customize','booking'); ?>&nbsp;&nbsp;&nbsp;</span>
378 + <i class="menu_icon icon-1x wpbc_icn_tune"></i>
379 + </a>
380 + </div>
381 + <div class="ui_element" style="margin: 0 2px 0 0;">
382 + <a class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary tooltip_top "
383 + href="javascript:void(0);"
384 + onclick="javascript: wpbc_modal_dialog__show__resource_publish( 1 );"
385 + data-original-title="<?php echo esc_attr( __('Embed your booking form into the page','booking') ); ?>">
386 + <span><?php esc_html_e('Publish','booking'); ?></span>
387 + <i class="menu_icon icon-1x wpbc_icn_tune" style="display: none;"></i>
388 + </a>
389 + </div>
390 + </div>
391 + </div>
392 + </div>
393 + </td>
364 394 </tr>
365 395 </tbody>
366 396 <tfoot class="wpbc_selectable_foot">
367 397 <tr>
@@ -371,11 +401,10 @@
371 401 </table>
372 402 </div>
373 403 <div class="clear"></div>
374 404 <?php
375 - echo '<a style="margin:0;" class="button button" href="' . wpbc_get_settings_url()
376 - . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) .'&restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox">'
377 - . __('Restore all dismissed windows' ,'booking')
405 + echo '<a style="margin:0;" class="button button" href="' . esc_url( wpbc_get_settings_url() . '&system_info=show&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'&restore_dismissed=On#wpbc_general_settings_restore_dismissed_metabox">' .
406 + esc_html__( 'Restore all dismissed windows', 'booking' )
378 407 . '</a>';
379 408 ?>
380 409 </div>
381 410 <?php
@@ -382,5 +411,7 @@
382 411 }
383 412
384 413 }
385 414
386 -add_action('wpbc_menu_created', array( new WPBC_Page_Settings__bresources() , '__construct') ); // Executed after creation of Menu
415 +if ( ! function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' ) || ! wpbc_booking_resources_catalog_should_use_new_renderer() ) {
416 + add_action( 'wpbc_menu_created', array( new WPBC_Page_Settings__bresource(), '__construct' ) ); // Executed after creation of Menu.
417 +}