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 +113 -27 11.4.2 → 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,12 +1188,44 @@
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 - // <editor-fold defaultstate="collapsed" desc=" Advanced " >
1179 -
1180 -
1181 - $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 );
1182 1228 // FixIn: 10.10.1.2 $this->fields = apply_filters( 'wpbc_settings_resource_no_update__during_editing', $this->fields, $default_options_values );
1183 1229
1184 1230 // Show advanced settings of JavaScript loading
1185 1231
@@ -1498,9 +1544,9 @@
1498 1544 ?>
1499 1545 <div class="wpdvlp-sub-tabs wpbc_redirection_message"
1500 1546 style="margin: 20px 0;padding: 1em;font-size: 14px;">
1501 1547 <a href="<?php
1502 - 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
1503 1549 class="wpbc_countdown">1</span> second...
1504 1550 </div>
1505 1551 <?php
1506 1552
@@ -1529,22 +1575,13 @@
1529 1575 . 'Reset custom forms'
1530 1576 . '</a>';
1531 1577
1532 1578
1533 - $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1534 - . esc_url( wpbc_get_settings_url()
1535 - . '&wpbc_setup_wizard=reset&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1536 - . 'Reset Setup Wizard'
1537 - . '</a>';
1538 -// if ( ( isset( $_GET['wpbc_setup_wizard'] ) ) && ( 'reset' === $_GET['wpbc_setup_wizard'] ) ) {
1539 -// $my_system_buttons .= '<script type="text/javascript"> window.location.href = "' . esc_url( wpbc_get_setup_wizard_page_url() ) . '"; </script>';
1540 -// }
1541 - $my_system_buttons .= ' <a class="button button-secondary" style="background:#fff9e6;" href="'
1542 - . esc_url( wpbc_get_settings_url()
1543 - . '&wpbc_setup_wizard=completed&_wpnonce='. wp_create_nonce( 'wpbc_settings_url_nonce' ) ) .'">'
1544 - . 'Set Setup Wizard as Completed'
1545 - . '</a>';
1546 - }
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 + }
1547 1584
1548 1585 $this->fields['tools_section_buttons']['value'][] =
1549 1586 '<div class="wpbc_booking_system_info_buttons_align">'
1550 1587 . $my_system_buttons
@@ -1972,12 +2009,61 @@
1972 2009 } ); ";
1973 2010
1974 2011
1975 2012 // Enqueue JS to the footer of the page
1976 - wpbc_enqueue_js( $js_script );
1977 - }
1978 -
1979 -}
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 +}
1980 2066
1981 2067
1982 2068 /**
1983 2069 * Override VALIDATED fields BEFORE saving to DB