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 | core/admin/api-settings.php +187 -229 11.1 → 11.9 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * @version 1.0
4 4 * @package General Settings API - Saving different options
@@ -914,16 +914,30 @@
914 914 $field_options = array(
915 915 'vm_booking_listing' => __('Bookings Listing' ,'booking') // FixIn: 9.6.3.5.
916 916 , 'vm_calendar' => __('Timeline View' ,'booking')
917 917 );
918 - $this->fields['booking_listing_default_view_mode'] = array(
919 - 'type' => 'select'
918 + $this->fields['booking_listing_default_view_mode'] = array(
919 + 'type' => 'select'
920 920 , 'default' => $default_options_values['booking_listing_default_view_mode'] //'vm_calendar'
921 921 , 'title' => __('Default booking admin page', 'booking')
922 922 , 'description' => __('Select your default view mode of bookings at the booking listing page' ,'booking')
923 923 , 'options' => $field_options
924 - , 'group' => 'booking_listing'
925 - );
924 + , 'group' => 'booking_listing'
925 + );
926 +
927 + if ( class_exists( 'wpdev_bk_personal' ) ) {
928 + $this->fields['booking_admin_edit_booking_mode'] = array(
929 + 'type' => 'select',
930 + 'default' => $default_options_values['booking_admin_edit_booking_mode'],
931 + 'title' => __( 'Edit booking in', 'booking' ),
932 + 'description' => __( 'Choose whether Edit booking opens in a popup or on the dedicated Add Booking page.', 'booking' ),
933 + 'options' => array(
934 + 'popup' => __( 'Popup window (default)', 'booking' ),
935 + 'add_booking_page' => __( 'Add Booking page', 'booking' ),
936 + ),
937 + 'group' => 'booking_listing',
938 + );
939 + }
926 940
927 941 // Default booking resources.
928 942 $this->fields = apply_filters( 'wpbc_settings_booking_listing_br_default_count', $this->fields, $default_options_values );
929 943
@@ -1174,111 +1188,49 @@
1174 1188 // auto_cancelation_approval
1175 1189 $this->fields = apply_filters( 'wpbc_settings_auto_cancelation_approval_section', $this->fields, $default_options_values );
1176 1190 // </editor-fold>
1177 1191
1178 -
1179 - // <editor-fold defaultstate="collapsed" desc=" Capacity " >
1180 -
1181 - $this->fields = apply_filters( 'wpbc_settings_capacity_based_on_visitors', $this->fields, $default_options_values );
1182 -
1183 - $this->fields['booking_is_days_always_available'] = array(
1184 - 'type' => 'checkbox'
1185 - , 'default' => $default_options_values['booking_is_days_always_available'] //'On'
1186 - , 'title' => __('Allow unlimited bookings per same day(s)' ,'booking')
1187 - /* translators: 1: ... */
1188 - , 'label' => sprintf( __( 'Check this box, if you want to %1$sset any days as available%2$s in calendar. Your visitors will be able to make %3$sunlimited bookings per same date(s) in calendar and do not see any booked date(s)%4$s of other visitors.', 'booking' ), '<strong>', '</strong>' , '<strong>', '</strong>' )
1189 - , 'description' => ''
1190 - , 'group' => 'capacity'
1191 - );
1192 -
1193 -
1194 - // FixIn: 8.3.2.2.
1195 - if ( ! class_exists('wpdev_bk_biz_l') )
1196 - $this->fields['booking_is_show_pending_days_as_available'] = array(
1197 - 'type' => 'checkbox'
1198 - , 'default' => $default_options_values['booking_is_show_pending_days_as_available'] //_'Off'
1199 - , 'title' => __('Use pending days as available' ,'booking')
1200 - , 'label' => sprintf(__('Check this box if you want to show the pending days as available in calendars' ,'booking') )
1201 - , 'description' => ''
1202 - , 'group' => 'capacity'
1203 - , 'tr_class' => ''
1204 - );
1205 -
1206 - $this->fields = apply_filters( 'wpbc_settings_pending_days_as_available', $this->fields, $default_options_values );
1207 -
1208 -
1209 -
1210 - // </editor-fold>
1211 -
1212 - // <editor-fold defaultstate="collapsed" desc=" Capacity Free example " >
1213 - if ( ! class_exists('wpdev_bk_personal') ){
1214 -
1215 - // Showing availability in tooltip
1216 - $this->fields['booking_quantity_control__promote_upgrade'] = array(
1217 - 'type' => 'checkbox'
1218 - , 'default' => 'On'
1219 - , 'value' => 'On'
1220 - , 'title' => __('Booking Quantity Control' ,'booking')
1221 - , 'label' => __('Enable this option to allow visitors to define the number of items they can book for specific dates or times within a single reservation. ' ,'booking')
1222 - , 'description' => __('If disabled, visitors can book only one slot within a single reservation.' ,'booking')
1223 - , 'description_tag' => 'p'
1224 - , 'group' => 'capacity_upgrade'
1225 - , 'tr_class' => 'wpbc_blur'
1226 - );
1227 - $this->fields['booking_capacity_field__promote_upgrade'] = array(
1228 - 'type' => 'select'
1229 - , 'default' => 'items'
1230 - , 'value' => 'items'
1231 - , 'title' => __('Quantity field name', 'booking')
1232 - , 'description' => sprintf( __( 'Select the field that will control how many slots visitors can book during the reservation process.' ,'booking'), '<b>', '</b>' )
1233 - , 'description_tag' => 'span'
1234 - , 'css' => ''
1235 - , 'tr_class' => 'wpbc_booking_capacity_field_settings wpbc_sub_settings_grayed'
1236 - , 'options' => array( 'items' => __('Items' ,'booking') )
1237 - , 'group' => 'capacity_upgrade'
1238 - , 'tr_class' => 'wpbc_blur'
1239 - );
1240 - $this->fields['booking_is_dissbale_booking_for_different_sub_resources__promote_upgrade'] = array(
1241 - 'type' => 'checkbox'
1242 - , 'default' => 'On'
1243 - , 'value' => 'On'
1244 - , 'title' => __('Disable bookings in different booking resources' ,'booking')
1245 - , 'label' => __('Check this box to disable reservations, which can be stored in different booking resources.' ,'booking')
1246 - , 'description' => '<strong>' . esc_html__('Note' ,'booking') . '!</strong> ' . __('When checked, all reserved days must be at same booking resource otherwise error message will show.' ,'booking')
1247 - , 'group' => 'capacity_upgrade'
1248 - , 'tr_class' => 'wpbc_blur'
1249 - );
1250 - $this->fields['capacity_upgrade__promote_upgrade'] = array(
1251 - 'type' => 'pure_html'
1252 - , 'group' => 'capacity_upgrade'
1253 - , 'html' => '<tr><td colspan="2">
1254 - <div class="wpbc_widget_content" style="transform: translate(0) translateY(-10em);">
1255 - <div class="ui_container ui_container_toolbar ui_container_small" style="background: #fff;position: relative;">
1256 - <div class="ui_group ui_group__upgrade">
1257 - <div class="wpbc_upgrade_note wpbc_upgrade_theme_green">
1258 - <div>This <a target="_blank" href="https://wpbookingcalendar.com/features/#capacity">feature</a>
1259 - is available in the <strong>Business Large or MultiUser version</strong>.
1260 - <a target="_blank" href="https://wpbookingcalendar.com/prices/#bk_news_section">Upgrade to Pro</a>.
1261 - </div>
1262 - </div>
1263 - </div>
1264 - </div>
1265 - </div>
1266 - </td> </tr>'
1267 - );
1268 - }
1269 - // </editor-fold>
1270 -
1271 -
1272 - // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1273 -
1274 -
1275 - $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1192 + // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1193 +
1194 + if ( wpbc_is_11_6_features_enabled() && wpbc_booking_resources_catalog_can_manage_settings() ) {
1195 + $is_pro_compatible = wpbc_booking_resources_catalog_is_pro_compatible();
1196 + $description = __( 'Choose the new or legacy pages for upgraded administration catalogs, including Seasonal Availability and Searchable Resources when their new catalogs are enabled. Legacy pages remain available for compatibility.', 'booking' );
1197 +
1198 + if ( ! $is_pro_compatible ) {
1199 + $pro_version = wpbc_booking_resources_catalog_get_pro_version();
1200 + if ( '' === $pro_version ) {
1201 + $pro_version = __( 'Unknown', 'booking' );
1202 + }
1203 +
1204 + /* translators: 1: Detected Booking Calendar Pro version, 2: Minimum compatible Pro version. */
1205 + $description = sprintf( __( 'Legacy catalog mode is required because Booking Calendar Pro %1$s is active. Update Pro to %2$s or newer to use the new catalogs. Legacy pages remain available for compatibility.', 'booking' ), esc_html( $pro_version ), esc_html( wpbc_booking_resources_catalog_get_minimum_pro_version() ) );
1206 + }
1207 +
1208 + $this->fields['booking_resources_catalog_renderer'] = array(
1209 + 'type' => 'select',
1210 + 'default' => 'new',
1211 + 'title' => __( 'Use legacy catalog pages', 'booking' ),
1212 + 'description' => $description,
1213 + 'options' => array(
1214 + 'new' => __( 'No — use the new catalogs', 'booking' ),
1215 + 'legacy' => __( 'Yes — use legacy catalog pages (Deprecated)', 'booking' ),
1216 + ),
1217 + 'group' => 'advanced',
1218 + 'disabled' => ! $is_pro_compatible,
1219 + );
1220 +
1221 + if ( ! $is_pro_compatible ) {
1222 + $this->fields['booking_resources_catalog_renderer']['value'] = 'legacy';
1223 + }
1224 + }
1225 +
1226 +
1227 + $this->fields = apply_filters( 'wpbc_settings_edit_url_hash', $this->fields, $default_options_values );
1276 1228 // FixIn: 10.10.1.2 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1277 1229
1278 1230 // Show advanced settings of JavaScript loading
1279 -
1280 1231
1232 +
1281 1233 // //Show | Hide links for Advanced JavaScript section
1282 1234 // $this->fields['booking_advanced_js_loading_settings'] = array(
1283 1235 // 'type' => 'html'
1284 1236 // , 'html' =>
@@ -1307,9 +1259,9 @@
1307 1259
1308 1260
1309 1261 $this->fields['booking_is_load_js_css_on_specific_pages'] = array(
1310 1262 'type' => 'checkbox'
1311 - , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1263 + , 'default' => $default_options_values['booking_is_load_js_css_on_specific_pages'] //'Off'
1312 1264 , 'title' => __('Load JS and CSS files only on specific pages' ,'booking')
1313 1265 , 'label' => __('Activate loading of CSS and JavaScript files of plugin only at specific pages.' ,'booking')
1314 1266 , 'description' => ''
1315 1267 , 'group' => 'advanced'
@@ -1314,10 +1266,10 @@
1314 1266 , 'description' => ''
1315 1267 , 'group' => 'advanced'
1316 1268 , 'tr_class' => 'wpbc_advanced_js_loading_settings'//wpbc_advanced_js_loading_settings wpbc_sub_settings_grayed hidden_items'
1317 1269 , 'is_demo_safe' => wpbc_is_this_demo()
1318 - );
1319 - $this->fields['booking_pages_for_load_js_css'] = array(
1270 + );
1271 + $this->fields['booking_pages_for_load_js_css'] = array(
1320 1272 'type' => 'textarea'
1321 1273 , 'default' => $default_options_values['booking_pages_for_load_js_css'] //''
1322 1274 , 'placeholder' => '/booking-form/'
1323 1275 , 'title' => __('Relative URLs of pages, where to load plugin CSS and JS files' ,'booking')
@@ -1342,11 +1294,11 @@
1342 1294 );
1343 1295
1344 1296 //$this->fields['hr_booking_is_show_system_debug_log'] = array( 'type' => 'hr', 'group' => 'advanced', 'tr_class' => 'wpbc_advanced_js_loading_settings' ); // wpbc_sub_settings_grayed hidden_items' );
1345 1297 // FixIn: 7.2.1.15.
1346 - $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1298 + $this->fields[ 'booking_is_show_system_debug_log' ] = array(
1347 1299 'type' => 'checkbox'
1348 - , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1300 + , 'default' => $default_options_values['booking_is_show_system_debug_log'] //'Off'
1349 1301 , 'title' => __('Show system debugging log for beta features' ,'booking')
1350 1302 , 'label' => __('Activate this option only for testing beta features' ,'booking')
1351 1303 , 'description' => ''
1352 1304 , 'group' => 'advanced'
@@ -1374,33 +1326,33 @@
1374 1326 'cols' => 2,
1375 1327 'tr_class' => 'wpbc_advanced_js_loading_settings'// wpbc_sub_settings_grayed hidden_items'
1376 1328 );
1377 1329 }
1378 -
1330 +
1379 1331 // Divider ///////////////////////////////////////////////////////////////
1380 1332 $this->fields['hr_calendar_before_advanced_js_loading_settings'] = array( 'type' => 'hr', 'group' => 'advanced' );
1381 1333
1382 1334 // Show settings of powered by notice
1383 - $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1335 + $this->fields['booking_advanced_powered_by_notice_settings'] = array(
1384 1336 'type' => 'html'
1385 - , 'html' =>
1337 + , 'html' =>
1386 1338 '<a id="wpbc_powered_by_link_show" class="wpbc_expand_section_link" href="javascript:void(0)">+ ' . __('Show settings of powered by notice' ,'booking') . '</a>'
1387 1339 . '<a id="wpbc_powered_by_link_hide" class="wpbc_expand_section_link" href="javascript:void(0)" style="display:none;">- ' . __('Hide settings of powered by notice' ,'booking') . '</a>'
1388 1340 , 'cols' => 2
1389 1341 , 'group' => 'advanced'
1390 1342 );
1391 - $this->fields['booking_is_show_powered_by_notice'] = array(
1343 + $this->fields['booking_is_show_powered_by_notice'] = array(
1392 1344 'type' => 'checkbox'
1393 - , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1345 + , 'default' => $default_options_values['booking_is_show_powered_by_notice'] //'On'
1394 1346 , 'title' => __('Powered by notice' ,'booking')
1395 1347 , 'label' => sprintf(__(' Turn On/Off powered by "Booking Calendar" notice under the calendar.' ,'booking'),'wpbookingcalendar.com')
1396 1348 , 'description' => ''
1397 1349 , 'group' => 'advanced'
1398 1350 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1399 - );
1400 - $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1351 + );
1352 + $this->fields['booking_wpdev_copyright_adminpanel'] = array(
1401 1353 'type' => 'checkbox'
1402 - , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1354 + , 'default' => $default_options_values['booking_wpdev_copyright_adminpanel'] //'On'
1403 1355 , 'title' => __('Help and info notices' ,'booking')
1404 1356 , 'label' => sprintf(__(' Turn On/Off version notice and help info links at booking admin panel.' ,'booking'),'wpbookingcalendar.com')
1405 1357 , 'description' => ''
1406 1358 , 'group' => 'advanced'
@@ -1405,31 +1357,31 @@
1405 1357 , 'description' => ''
1406 1358 , 'group' => 'advanced'
1407 1359 , 'tr_class' => 'wpbc_is_show_powered_by_notice wpbc_sub_settings_grayed hidden_items'
1408 1360 , 'is_demo_safe' => wpbc_is_this_demo() // FixIn: 8.1.3.9.
1409 - );
1410 -
1361 + );
1362 +
1411 1363 // </editor-fold>
1412 -
1413 -
1364 +
1365 +
1414 1366 // <editor-fold defaultstate="collapsed" desc=" Information " >
1415 1367 if(1){
1416 1368 if ( function_exists( 'wpbc_get_dashboard_info' ) ) {
1417 - $this->fields['booking_information'] = array(
1369 + $this->fields['booking_information'] = array(
1418 1370 'type' => 'html'
1419 1371 , 'html' => wpbc_get_dashboard_info()
1420 1372 , 'cols' => 2
1421 1373 , 'group' => 'information'
1422 - );
1374 + );
1423 1375 }
1424 1376 }
1425 1377 // </editor-fold>
1426 1378
1427 -
1379 +
1428 1380 // <editor-fold defaultstate="collapsed" desc=" User permissions for plugin menu pages " >
1429 -
1430 -
1431 - $this->fields['booking_menu_position'] = array(
1381 +
1382 +
1383 + $this->fields['booking_menu_position'] = array(
1432 1384 'type' => 'select'
1433 1385 , 'default' => 'top'
1434 1386 , 'title' => __('Plugin menu position', 'booking')
1435 1387 , 'description' => ''
@@ -1440,10 +1392,10 @@
1440 1392 )
1441 1393 , 'group' => 'permissions'
1442 1394 , 'is_demo_safe' => wpbc_is_this_demo()
1443 1395 );
1444 -
1445 - $this->fields['booking_user_role_booking_header'] = array(
1396 +
1397 + $this->fields['booking_user_role_booking_header'] = array(
1446 1398 'type' => 'pure_html'
1447 1399 , 'group' => 'permissions'
1448 1400 , 'html' => '<tr valign="top">
1449 1401 <th scope="row" colspan="2">
@@ -1449,10 +1401,10 @@
1449 1401 <th scope="row" colspan="2">
1450 1402 <hr/><p><strong>' . wp_kses_post( __('User permissions for plugin menu pages' ,'booking') ) . ':</strong></p>
1451 1403 </th>
1452 1404 </tr>'
1453 - );
1454 -
1405 + );
1406 +
1455 1407 $field_options = array();
1456 1408 $field_options['subscriber'] = translate_user_role('Subscriber');
1457 1409 $field_options['contributor'] = translate_user_role('Contributor');
1458 1410 $field_options['author'] = translate_user_role('Author');
@@ -1457,12 +1409,12 @@
1457 1409 $field_options['contributor'] = translate_user_role('Contributor');
1458 1410 $field_options['author'] = translate_user_role('Author');
1459 1411 $field_options['editor'] = translate_user_role('Editor');
1460 1412 $field_options['administrator'] = translate_user_role('Administrator');
1461 -
1462 - $this->fields['booking_user_role_booking'] = array(
1413 +
1414 + $this->fields['booking_user_role_booking'] = array(
1463 1415 'type' => 'select'
1464 - , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1416 + , 'default' => $default_options_values['booking_user_role_booking'] //'editor'
1465 1417 , 'title' => __('Bookings', 'booking')
1466 1418 , 'description' => ''
1467 1419 , 'options' => $field_options
1468 1420 , 'group' => 'permissions'
@@ -1498,11 +1450,11 @@
1498 1450 , 'group' => 'permissions'
1499 1451 , 'is_demo_safe' => wpbc_is_this_demo()
1500 1452 );
1501 1453 if ( class_exists( 'wpdev_bk_personal' ) )
1502 - $this->fields['booking_user_role_resources'] = array(
1454 + $this->fields['booking_user_role_resources'] = array(
1503 1455 'type' => 'select'
1504 - , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1456 + , 'default' => $default_options_values['booking_user_role_resources'] //'editor'
1505 1457 , 'title' => __('Resources', 'booking')
1506 1458 , 'description' => ''
1507 1459 , 'options' => $field_options
1508 1460 , 'group' => 'permissions'
@@ -1535,27 +1487,27 @@
1535 1487 , 'is_demo_safe' => wpbc_is_this_demo()
1536 1488 );
1537 1489
1538 1490 if ( wpbc_is_this_demo() )
1539 - $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1540 -
1541 -
1491 + $this->fields['booking_user_role_settings_demo'] = array( 'group' => 'permissions', 'type' => 'html', 'html' => wpbc_get_warning_text_in_demo_mode(), 'cols' => 2 );
1492 +
1493 +
1542 1494 // </editor-fold>
1543 -
1544 -
1495 +
1496 +
1545 1497 // <editor-fold defaultstate="collapsed" desc=" Uninstall " >
1546 - $this->fields['booking_is_delete_if_deactive'] = array(
1498 + $this->fields['booking_is_delete_if_deactive'] = array(
1547 1499 'type' => 'checkbox'
1548 - , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1500 + , 'default' => $default_options_values['booking_is_delete_if_deactive'] //'Off'
1549 1501 , 'title' => __('Delete booking data, when plugin deactivated' ,'booking')
1550 1502 , 'label' => __('Turn on to delete all booking data when you uninstall this plugin.' ,'booking')
1551 1503 , 'description' => ''
1552 1504 , 'group' => 'uninstall'
1553 1505 , 'toggle_class' => 'wpbc_toggle_danger'
1554 - );
1506 + );
1555 1507 // </editor-fold>
1556 -
1557 -
1508 +
1509 +
1558 1510 // <editor-fold defaultstate="collapsed" desc=" Tools " >
1559 1511
1560 1512 if ( ( ! wpbc_is_this_demo() ) && ( current_user_can( 'activate_plugins' ) ) ) {
1561 1513
@@ -1585,9 +1537,9 @@
1585 1537 . 'Find Lost Bookings'
1586 1538 . '</a>'; // FixIn: 8.5.2.19.
1587 1539
1588 1540
1589 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1541 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1590 1542 if ( ( ! empty( $_REQUEST['booking_version_num'] ) ) && ( 'reset' == $_REQUEST['booking_version_num'] ) ) { // FixIn: 8.5.2.19.
1591 1543 delete_bk_option('booking_version_num');
1592 1544 ?>
1593 1545 <div class="wpdvlp-sub-tabs wpbc_redirection_message"
@@ -1592,9 +1544,9 @@
1592 1544 ?>
1593 1545 <div class="wpdvlp-sub-tabs wpbc_redirection_message"
1594 1546 style="margin: 20px 0;padding: 1em;font-size: 14px;">
1595 1547 <a href="<?php
1596 - echo esc_url( wpbc_get_setup_wizard_page_url() ); ?>">Redirect</a> after <span
1548 + echo esc_url( wpbc_get_settings_url() ); ?>">Redirect</a> after <span
1597 1549 class="wpbc_countdown">1</span> second...
1598 1550 </div>
1599 1551 <?php
1600 1552
@@ -1623,22 +1575,13 @@
1623 1575 . 'Reset custom forms'
1624 1576 . '</a>';
1625 1577
1626 1578
1627 - $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1628 - . esc_url( wpbc_get_settings_url()
1629 - . '&wpbc_setup_wizard=reset&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1630 - . 'Reset Setup Wizard'
1631 - . '</a>';
1632 -// if ( ( isset( $_GET['wpbc_setup_wizard'] ) ) && ( 'reset' === $_GET['wpbc_setup_wizard'] ) ) {
1633 -// $my_system_buttons .= '<script type="text/javascript"> window.location.href = "' . esc_url( wpbc_get_setup_wizard_page_url() ) . '"; </script>';
1634 -// }
1635 - $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1636 - . esc_url( wpbc_get_settings_url()
1637 - . '&wpbc_setup_wizard=completed&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1638 - . 'Set Setup Wizard as Completed'
1639 - . '</a>';
1640 - }
1579 + $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1580 + . esc_url( wpbc_get_setup_wizard_page_url() ) . '">'
1581 + . 'Open Setup Wizard'
1582 + . '</a>';
1583 + }
1641 1584
1642 1585 $this->fields['tools_section_buttons']['value'][] =
1643 1586 '<div class="wpbc_booking_system_info_buttons_align">'
1644 1587 . $my_system_buttons
@@ -1693,18 +1636,18 @@
1693 1636 , 'description_tag' => 'p'
1694 1637 );
1695 1638 // </editor-fold>
1696 1639
1697 - }
1698 -
1640 + }
1699 1641
1642 +
1700 1643 /**
1701 1644 * Add Custon JavaScript - for some specific settings options
1702 1645 * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content).
1703 1646 * After initial definition of settings, and possible definition after POST request.
1704 - *
1647 + *
1705 1648 * @param type $menu_slug
1706 - *
1649 + *
1707 1650 */
1708 1651 public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) {
1709 1652
1710 1653 $js_script = '';
@@ -1730,9 +1673,9 @@
1730 1673 $js_script .= "
1731 1674 if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) {
1732 1675 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1733 1676 }
1734 - ";
1677 + ";
1735 1678 // Hide or Show Legend items on click checkbox
1736 1679 $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){
1737 1680 if ( this.checked ) {
1738 1681 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
@@ -1738,9 +1681,9 @@
1738 1681 jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items');
1739 1682 } else {
1740 1683 jQuery('.wpbc_calendar_legend_items').addClass('hidden_items');
1741 1684 }
1742 - } ); ";
1685 + } ); ";
1743 1686 // Thank you Message or Page
1744 1687 $js_script .= "
1745 1688 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1746 1689 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
@@ -1747,9 +1690,9 @@
1747 1690 }
1748 1691 if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) {
1749 1692 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1750 1693 }
1751 - ";
1694 + ";
1752 1695 $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){
1753 1696 if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) {
1754 1697 jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items');
1755 1698 jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items');
@@ -1756,10 +1699,10 @@
1756 1699 } else {
1757 1700 jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items');
1758 1701 jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items');
1759 1702 }
1760 - } ); ";
1761 -
1703 + } ); ";
1704 +
1762 1705 // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection.
1763 1706 $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){
1764 1707 if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) {
1765 1708 jQuery('#set_gen_booking_default_booking_resource').on('change', function() {
@@ -1780,10 +1723,10 @@
1780 1723 jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false);
1781 1724 jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false);
1782 1725 }
1783 1726 }
1784 - } ); ";
1785 -
1727 + } ); ";
1728 +
1786 1729 ////////////////////////////////////////////////////////////////////////
1787 1730 // Set correct value for dates format, depend on from selection of radio buttons
1788 1731 $booking_date_format = esc_js( get_bk_option( 'booking_date_format') ); // FixIn: 10.6.1.2.
1789 1732 // On initial Load set correct text value and correct radio button
@@ -1812,14 +1755,14 @@
1812 1755 return '&#'+i.charCodeAt(0)+';';
1813 1756 })
1814 1757 );
1815 1758 }
1816 - } ); ";
1817 - // If we edit custom "Date Format" Text field - select Custom Radio button.
1759 + } ); ";
1760 + // If we edit custom "Date Format" Text field - select Custom Radio button.
1818 1761 $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){
1819 1762 jQuery( '#date_format_selection_custom' ).prop('checked', true);
1820 - } ); ";
1821 -
1763 + } ); ";
1764 +
1822 1765 ////////////////////////////////////////////////////////////////////////
1823 1766 // Set correct value for Time Format, depend on from selection of radio buttons
1824 1767 $booking_time_format = esc_js( get_bk_option( 'booking_time_format') ); // FixIn: 10.6.1.2.
1825 1768 // Function to load on initial stage of page loading, set correct value of text and select correct radio button.
@@ -1854,42 +1797,8 @@
1854 1797 $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){
1855 1798 jQuery( '#time_format_selection_custom' ).prop('checked', true);
1856 1799 } ); ";
1857 1800
1858 - ////////////////////////////////////////////////////////////////////////
1859 - // Advanced section
1860 - ////////////////////////////////////////////////////////////////////////
1861 -
1862 - // Click on "Always available "
1863 - $js_script .= " jQuery('#set_gen_booking_is_days_always_available').on( 'change', function(){
1864 - if ( this.checked ) {
1865 - var answer = confirm('"
1866 - . esc_js( __( 'Warning', 'booking' ) ) . '! '
1867 - . esc_js( __( 'You allow unlimited number of bookings per same dates, its can be a reason of double bookings on the same date. Do you really want to do this?', 'booking' ) )
1868 - . "' );
1869 - if ( answer) {
1870 - this.checked = true;
1871 - jQuery('#set_gen_booking_quantity_control').prop('checked', false ).trigger('change');
1872 - jQuery('#set_gen_booking_is_show_pending_days_as_available').prop('checked', false );
1873 - jQuery('.wpbc_pending_days_as_available_sub_settings').addClass('hidden_items');
1874 - } else {
1875 - this.checked = false;
1876 - }
1877 - }
1878 - } ); ";
1879 -
1880 - // FixIn: 8.3.2.2.
1881 - if ( ! class_exists('wpdev_bk_biz_l') ) {
1882 - // Click on "Use pending days as available"
1883 - $js_script .= " jQuery('#set_gen_booking_is_show_pending_days_as_available').on( 'change', function(){
1884 - if ( this.checked ) {
1885 - jQuery('#set_gen_booking_is_days_always_available').prop('checked', false );
1886 - } else {
1887 -
1888 - }
1889 - } ); ";
1890 - }
1891 -
1892 1801 // Click on Show Advanced JavaScript section link
1893 1802 $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){
1894 1803 jQuery('#wpbc_show_advanced_section_link_show').toggle(200);
1895 1804 jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
@@ -1897,19 +1806,19 @@
1897 1806
1898 1807 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1899 1808 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1900 1809 }
1901 - } ); ";
1810 + } ); ";
1902 1811 $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){
1903 1812 jQuery('#wpbc_show_advanced_section_link_hide').toggle(200);
1904 1813 jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1905 1814 jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items');
1906 - } ); ";
1815 + } ); ";
1907 1816 $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){
1908 1817 if ( this.checked ) {
1909 - var answer = confirm('"
1818 + var answer = confirm('"
1910 1819 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1911 - . esc_js( __( 'You are need to be sure what you are doing. You are disable of loading some JavaScripts Do you really want to do this?', 'booking' ) )
1820 + . esc_js( __( 'You are need to be sure what you are doing. You are disable of loading some JavaScripts Do you really want to do this?', 'booking' ) )
1912 1821 . "' );
1913 1822 if ( answer) {
1914 1823 this.checked = true;
1915 1824 jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items');
@@ -1923,30 +1832,30 @@
1923 1832 if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) {
1924 1833 jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items');
1925 1834 }
1926 1835
1927 - ";
1928 -
1929 -
1836 + ";
1837 +
1838 +
1930 1839 // Click on Powered by links
1931 1840 $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){
1932 1841 jQuery('#wpbc_powered_by_link_show').toggle(200);
1933 1842 jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200);
1934 1843 jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items');
1935 - } ); ";
1844 + } ); ";
1936 1845 $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){
1937 1846 jQuery('#wpbc_powered_by_link_hide').toggle(200);
1938 1847 jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200);
1939 1848 jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items');
1940 - } ); ";
1849 + } ); ";
1941 1850
1942 -
1851 +
1943 1852 // Show confirmation window, if user activate this checkbox
1944 1853 $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){
1945 1854 if ( this.checked ) {
1946 - var answer = confirm('"
1855 + var answer = confirm('"
1947 1856 . esc_js( __( 'Warning', 'booking' ) ) . '! '
1948 - . esc_js( __( 'If you check this option, all booking data will be deleted when you uninstall this plugin. Do you really want to do this?', 'booking' ) )
1857 + . esc_js( __( 'If you check this option, all booking data will be deleted when you uninstall this plugin. Do you really want to do this?', 'booking' ) )
1949 1858 . "' );
1950 1859 if ( answer) {
1951 1860 this.checked = true;
1952 1861 } else {
@@ -1953,9 +1862,9 @@
1953 1862 this.checked = false;
1954 1863 }
1955 1864 }
1956 1865 } );
1957 - ";
1866 + ";
1958 1867
1959 1868
1960 1869
1961 1870
@@ -2100,12 +2009,61 @@
2100 2009 } ); ";
2101 2010
2102 2011
2103 2012 // Enqueue JS to the footer of the page
2104 - wpbc_enqueue_js( $js_script );
2105 - }
2106 -
2107 -}
2013 + wpbc_enqueue_js( $js_script );
2014 + }
2015 +
2016 + /**
2017 + * Validate the temporary shared 11.6 catalog renderer preference.
2018 + *
2019 + * The General Settings form verifies its nonce before invoking the Settings
2020 + * API. This field adds an explicit capability boundary and allow list. When
2021 + * compatibility forces disabled legacy views, the existing Resources-named
2022 + * storage key is preserved instead of being overwritten by a derived value.
2023 + *
2024 + * @param string $post_key Full Settings API POST key.
2025 + *
2026 + * @return string Allow-listed stored renderer preference.
2027 + */
2028 + public function validate_booking_resources_catalog_renderer_post( $post_key ) {
2029 + $stored_renderer = wpbc_booking_resources_catalog_get_stored_renderer();
2030 +
2031 + if ( ! wpbc_booking_resources_catalog_can_manage_settings() || ! wpbc_booking_resources_catalog_is_pro_compatible() ) {
2032 + return $stored_renderer;
2033 + }
2034 +
2035 + $submitted_renderer = self::validate_select_post_static( $post_key );
2036 + if ( ! is_string( $submitted_renderer ) || ! in_array( $submitted_renderer, array( 'new', 'legacy' ), true ) ) {
2037 + return $stored_renderer;
2038 + }
2039 +
2040 + return $submitted_renderer;
2041 + }
2042 +
2043 + /**
2044 + * Validate the administrator edit-booking destination.
2045 + *
2046 + * The General Settings page owns nonce and capability checks. This method
2047 + * adds an explicit allow list and preserves the current normalized setting
2048 + * when a malformed value is submitted.
2049 + *
2050 + * @param string $post_key Full Settings API POST key.
2051 + *
2052 + * @return string Allow-listed edit destination.
2053 + */
2054 + public function validate_booking_admin_edit_booking_mode_post( $post_key ) {
2055 + $stored_mode = wpbc_get_booking_admin_edit_mode();
2056 + $submitted_mode = self::validate_select_post_static( $post_key );
2057 +
2058 + if ( ! is_string( $submitted_mode ) || ! in_array( $submitted_mode, array( 'popup', 'add_booking_page' ), true ) ) {
2059 + return $stored_mode;
2060 + }
2061 +
2062 + return $submitted_mode;
2063 + }
2064 +
2065 +}
2108 2066
2109 2067
2110 2068 /**
2111 2069 * Override VALIDATED fields BEFORE saving to DB
@@ -2117,9 +2075,9 @@
2117 2075 function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) {
2118 2076
2119 2077
2120 2078 $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] );
2121 -
2079 +
2122 2080 unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field
2123 2081 unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field
2124 2082
2125 2083 // Unset promote fields
@@ -2161,5 +2119,5 @@
2161 2119 ) );
2162 2120
2163 2121 }
2164 2122 }
2165 - //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' );
2123 + //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' );