| @@ -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" |
| @@ -1693,18 +1645,18 @@ | ||
| 1693 | 1645 | , 'description_tag' => 'p' |
| 1694 | 1646 | ); |
| 1695 | 1647 | // </editor-fold> |
| 1696 | 1648 | |
| 1697 | - } | |
| 1698 | - | |
| 1649 | + } | |
| 1699 | 1650 | |
| 1651 | + | |
| 1700 | 1652 | /** |
| 1701 | 1653 | * Add Custon JavaScript - for some specific settings options |
| 1702 | 1654 | * Need to executes after showing of entire settings page (on hook: wpbc_after_settings_content). |
| 1703 | 1655 | * After initial definition of settings, and possible definition after POST request. |
| 1704 | - * | |
| 1656 | + * | |
| 1705 | 1657 | * @param type $menu_slug |
| 1706 | - * | |
| 1658 | + * | |
| 1707 | 1659 | */ |
| 1708 | 1660 | public function enqueue_js( $menu_slug, $active_page_tab, $active_page_subtab ) { |
| 1709 | 1661 | |
| 1710 | 1662 | $js_script = ''; |
| @@ -1730,9 +1682,9 @@ | ||
| 1730 | 1682 | $js_script .= " |
| 1731 | 1683 | if ( ! jQuery('#set_gen_booking_is_show_legend').is(':checked') ) { |
| 1732 | 1684 | jQuery('.wpbc_calendar_legend_items').addClass('hidden_items'); |
| 1733 | 1685 | } |
| 1734 | - "; | |
| 1686 | + "; | |
| 1735 | 1687 | // Hide or Show Legend items on click checkbox |
| 1736 | 1688 | $js_script .= " jQuery('#set_gen_booking_is_show_legend').on( 'change', function(){ |
| 1737 | 1689 | if ( this.checked ) { |
| 1738 | 1690 | jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items'); |
| @@ -1738,9 +1690,9 @@ | ||
| 1738 | 1690 | jQuery('.wpbc_calendar_legend_items').removeClass('hidden_items'); |
| 1739 | 1691 | } else { |
| 1740 | 1692 | jQuery('.wpbc_calendar_legend_items').addClass('hidden_items'); |
| 1741 | 1693 | } |
| 1742 | - } ); "; | |
| 1694 | + } ); "; | |
| 1743 | 1695 | // Thank you Message or Page |
| 1744 | 1696 | $js_script .= " |
| 1745 | 1697 | if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) { |
| 1746 | 1698 | jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items'); |
| @@ -1747,9 +1699,9 @@ | ||
| 1747 | 1699 | } |
| 1748 | 1700 | if ( jQuery('#type_of_thank_you_message_page').is(':checked') ) { |
| 1749 | 1701 | jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items'); |
| 1750 | 1702 | } |
| 1751 | - "; | |
| 1703 | + "; | |
| 1752 | 1704 | $js_script .= " jQuery('input[name=\"set_gen_booking_type_of_thank_you_message\"]').on( 'change', function(){ |
| 1753 | 1705 | if ( jQuery('#type_of_thank_you_message_message').is(':checked') ) { |
| 1754 | 1706 | jQuery('.wpbc_calendar_thank_you_message').removeClass('hidden_items'); |
| 1755 | 1707 | jQuery('.wpbc_calendar_thank_you_page').addClass('hidden_items'); |
| @@ -1756,10 +1708,10 @@ | ||
| 1756 | 1708 | } else { |
| 1757 | 1709 | jQuery('.wpbc_calendar_thank_you_message').addClass('hidden_items'); |
| 1758 | 1710 | jQuery('.wpbc_calendar_thank_you_page').removeClass('hidden_items'); |
| 1759 | 1711 | } |
| 1760 | - } ); "; | |
| 1761 | - | |
| 1712 | + } ); "; | |
| 1713 | + | |
| 1762 | 1714 | // Default calendar view mode (Booking Listing) - set active / inctive options depend from resource selection. |
| 1763 | 1715 | $js_script .= " jQuery('#set_gen_booking_view_days_num').on( 'focus', function(){ |
| 1764 | 1716 | if ( jQuery('#set_gen_booking_default_booking_resource').length > 0 ) { |
| 1765 | 1717 | jQuery('#set_gen_booking_default_booking_resource').on('change', function() { |
| @@ -1780,10 +1732,10 @@ | ||
| 1780 | 1732 | jQuery('#set_gen_booking_view_days_num option:eq(4)').prop('disabled', false); |
| 1781 | 1733 | jQuery('#set_gen_booking_view_days_num option:eq(5)').prop('disabled', false); |
| 1782 | 1734 | } |
| 1783 | 1735 | } |
| 1784 | - } ); "; | |
| 1785 | - | |
| 1736 | + } ); "; | |
| 1737 | + | |
| 1786 | 1738 | //////////////////////////////////////////////////////////////////////// |
| 1787 | 1739 | // Set correct value for dates format, depend on from selection of radio buttons |
| 1788 | 1740 | $booking_date_format = esc_js( get_bk_option( 'booking_date_format') ); // FixIn: 10.6.1.2. |
| 1789 | 1741 | // On initial Load set correct text value and correct radio button |
| @@ -1812,14 +1764,14 @@ | ||
| 1812 | 1764 | return '&#'+i.charCodeAt(0)+';'; |
| 1813 | 1765 | }) |
| 1814 | 1766 | ); |
| 1815 | 1767 | } |
| 1816 | - } ); "; | |
| 1817 | - // If we edit custom "Date Format" Text field - select Custom Radio button. | |
| 1768 | + } ); "; | |
| 1769 | + // If we edit custom "Date Format" Text field - select Custom Radio button. | |
| 1818 | 1770 | $js_script .= " jQuery('#set_gen_booking_date_format').on( 'change', function(){ |
| 1819 | 1771 | jQuery( '#date_format_selection_custom' ).prop('checked', true); |
| 1820 | - } ); "; | |
| 1821 | - | |
| 1772 | + } ); "; | |
| 1773 | + | |
| 1822 | 1774 | //////////////////////////////////////////////////////////////////////// |
| 1823 | 1775 | // Set correct value for Time Format, depend on from selection of radio buttons |
| 1824 | 1776 | $booking_time_format = esc_js( get_bk_option( 'booking_time_format') ); // FixIn: 10.6.1.2. |
| 1825 | 1777 | // Function to load on initial stage of page loading, set correct value of text and select correct radio button. |
| @@ -1854,42 +1806,8 @@ | ||
| 1854 | 1806 | $js_script .= " jQuery('#set_gen_booking_time_format').on( 'change', function(){ |
| 1855 | 1807 | jQuery( '#time_format_selection_custom' ).prop('checked', true); |
| 1856 | 1808 | } ); "; |
| 1857 | 1809 | |
| 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 | 1810 | // Click on Show Advanced JavaScript section link |
| 1893 | 1811 | $js_script .= " jQuery('#wpbc_show_advanced_section_link_show').on( 'click', function(){ |
| 1894 | 1812 | jQuery('#wpbc_show_advanced_section_link_show').toggle(200); |
| 1895 | 1813 | jQuery('#wpbc_show_advanced_section_link_hide').animate( {opacity: 1}, 200 ).toggle(200); |
| @@ -1897,19 +1815,19 @@ | ||
| 1897 | 1815 | |
| 1898 | 1816 | if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) { |
| 1899 | 1817 | jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items'); |
| 1900 | 1818 | } |
| 1901 | - } ); "; | |
| 1819 | + } ); "; | |
| 1902 | 1820 | $js_script .= " jQuery('#wpbc_show_advanced_section_link_hide').on( 'click', function(){ |
| 1903 | 1821 | jQuery('#wpbc_show_advanced_section_link_hide').toggle(200); |
| 1904 | 1822 | jQuery('#wpbc_show_advanced_section_link_show').animate( {opacity: 1}, 200 ).toggle(200); |
| 1905 | 1823 | jQuery('.wpbc_advanced_js_loading_settings').addClass('hidden_items'); |
| 1906 | - } ); "; | |
| 1824 | + } ); "; | |
| 1907 | 1825 | $js_script .= " jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').on( 'change', function(){ |
| 1908 | 1826 | if ( this.checked ) { |
| 1909 | - var answer = confirm('" | |
| 1827 | + var answer = confirm('" | |
| 1910 | 1828 | . 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' ) ) | |
| 1829 | + . 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 | 1830 | . "' ); |
| 1913 | 1831 | if ( answer) { |
| 1914 | 1832 | this.checked = true; |
| 1915 | 1833 | jQuery('.wpbc_is_load_js_css_on_specific_pages').removeClass('hidden_items'); |
| @@ -1923,30 +1841,30 @@ | ||
| 1923 | 1841 | if ( ! jQuery('#set_gen_booking_is_load_js_css_on_specific_pages').is(':checked') ) { |
| 1924 | 1842 | jQuery('.wpbc_is_load_js_css_on_specific_pages').addClass('hidden_items'); |
| 1925 | 1843 | } |
| 1926 | 1844 | |
| 1927 | - "; | |
| 1928 | - | |
| 1929 | - | |
| 1845 | + "; | |
| 1846 | + | |
| 1847 | + | |
| 1930 | 1848 | // Click on Powered by links |
| 1931 | 1849 | $js_script .= " jQuery('#wpbc_powered_by_link_show').on( 'click', function(){ |
| 1932 | 1850 | jQuery('#wpbc_powered_by_link_show').toggle(200); |
| 1933 | 1851 | jQuery('#wpbc_powered_by_link_hide').animate( {opacity: 1}, 200 ).toggle(200); |
| 1934 | 1852 | jQuery('.wpbc_is_show_powered_by_notice').removeClass('hidden_items'); |
| 1935 | - } ); "; | |
| 1853 | + } ); "; | |
| 1936 | 1854 | $js_script .= " jQuery('#wpbc_powered_by_link_hide').on( 'click', function(){ |
| 1937 | 1855 | jQuery('#wpbc_powered_by_link_hide').toggle(200); |
| 1938 | 1856 | jQuery('#wpbc_powered_by_link_show').animate( {opacity: 1}, 200 ).toggle(200); |
| 1939 | 1857 | jQuery('.wpbc_is_show_powered_by_notice').addClass('hidden_items'); |
| 1940 | - } ); "; | |
| 1858 | + } ); "; | |
| 1941 | 1859 | |
| 1942 | - | |
| 1860 | + | |
| 1943 | 1861 | // Show confirmation window, if user activate this checkbox |
| 1944 | 1862 | $js_script .= " jQuery('#set_gen_booking_is_delete_if_deactive').on( 'change', function(){ |
| 1945 | 1863 | if ( this.checked ) { |
| 1946 | - var answer = confirm('" | |
| 1864 | + var answer = confirm('" | |
| 1947 | 1865 | . 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' ) ) | |
| 1866 | + . 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 | 1867 | . "' ); |
| 1950 | 1868 | if ( answer) { |
| 1951 | 1869 | this.checked = true; |
| 1952 | 1870 | } else { |
| @@ -1953,9 +1871,9 @@ | ||
| 1953 | 1871 | this.checked = false; |
| 1954 | 1872 | } |
| 1955 | 1873 | } |
| 1956 | 1874 | } ); |
| 1957 | - "; | |
| 1875 | + "; | |
| 1958 | 1876 | |
| 1959 | 1877 | |
| 1960 | 1878 | |
| 1961 | 1879 | |
| @@ -2100,12 +2018,61 @@ | ||
| 2100 | 2018 | } ); "; |
| 2101 | 2019 | |
| 2102 | 2020 | |
| 2103 | 2021 | // Enqueue JS to the footer of the page |
| 2104 | - wpbc_enqueue_js( $js_script ); | |
| 2105 | - } | |
| 2106 | - | |
| 2107 | -} | |
| 2022 | + wpbc_enqueue_js( $js_script ); | |
| 2023 | + } | |
| 2024 | + | |
| 2025 | + /** | |
| 2026 | + * Validate the temporary shared 11.6 catalog renderer preference. | |
| 2027 | + * | |
| 2028 | + * The General Settings form verifies its nonce before invoking the Settings | |
| 2029 | + * API. This field adds an explicit capability boundary and allow list. When | |
| 2030 | + * compatibility forces disabled legacy views, the existing Resources-named | |
| 2031 | + * storage key is preserved instead of being overwritten by a derived value. | |
| 2032 | + * | |
| 2033 | + * @param string $post_key Full Settings API POST key. | |
| 2034 | + * | |
| 2035 | + * @return string Allow-listed stored renderer preference. | |
| 2036 | + */ | |
| 2037 | + public function validate_booking_resources_catalog_renderer_post( $post_key ) { | |
| 2038 | + $stored_renderer = wpbc_booking_resources_catalog_get_stored_renderer(); | |
| 2039 | + | |
| 2040 | + if ( ! wpbc_booking_resources_catalog_can_manage_settings() || ! wpbc_booking_resources_catalog_is_pro_compatible() ) { | |
| 2041 | + return $stored_renderer; | |
| 2042 | + } | |
| 2043 | + | |
| 2044 | + $submitted_renderer = self::validate_select_post_static( $post_key ); | |
| 2045 | + if ( ! is_string( $submitted_renderer ) || ! in_array( $submitted_renderer, array( 'new', 'legacy' ), true ) ) { | |
| 2046 | + return $stored_renderer; | |
| 2047 | + } | |
| 2048 | + | |
| 2049 | + return $submitted_renderer; | |
| 2050 | + } | |
| 2051 | + | |
| 2052 | + /** | |
| 2053 | + * Validate the administrator edit-booking destination. | |
| 2054 | + * | |
| 2055 | + * The General Settings page owns nonce and capability checks. This method | |
| 2056 | + * adds an explicit allow list and preserves the current normalized setting | |
| 2057 | + * when a malformed value is submitted. | |
| 2058 | + * | |
| 2059 | + * @param string $post_key Full Settings API POST key. | |
| 2060 | + * | |
| 2061 | + * @return string Allow-listed edit destination. | |
| 2062 | + */ | |
| 2063 | + public function validate_booking_admin_edit_booking_mode_post( $post_key ) { | |
| 2064 | + $stored_mode = wpbc_get_booking_admin_edit_mode(); | |
| 2065 | + $submitted_mode = self::validate_select_post_static( $post_key ); | |
| 2066 | + | |
| 2067 | + if ( ! is_string( $submitted_mode ) || ! in_array( $submitted_mode, array( 'popup', 'add_booking_page' ), true ) ) { | |
| 2068 | + return $stored_mode; | |
| 2069 | + } | |
| 2070 | + | |
| 2071 | + return $submitted_mode; | |
| 2072 | + } | |
| 2073 | + | |
| 2074 | +} | |
| 2108 | 2075 | |
| 2109 | 2076 | |
| 2110 | 2077 | /** |
| 2111 | 2078 | * Override VALIDATED fields BEFORE saving to DB |
| @@ -2117,9 +2084,9 @@ | ||
| 2117 | 2084 | function wpbc_settings_validate_fields_before_saving__all( $validated_fields ) { |
| 2118 | 2085 | |
| 2119 | 2086 | |
| 2120 | 2087 | $validated_fields['booking_thank_you_page_URL'] = wpbc_make_link_relative( $validated_fields['booking_thank_you_page_URL'] ); |
| 2121 | - | |
| 2088 | + | |
| 2122 | 2089 | unset( $validated_fields[ 'booking_date_format_selection' ] ); // We do not need to this field, because saving to DB only: "date_format" field |
| 2123 | 2090 | unset( $validated_fields[ 'booking_time_format_selection' ] ); // We do not need to this field, because saving to DB only: "time_format" field |
| 2124 | 2091 | |
| 2125 | 2092 | // Unset promote fields |
| @@ -2161,5 +2128,5 @@ | ||
| 2161 | 2128 | ) ); |
| 2162 | 2129 | |
| 2163 | 2130 | } |
| 2164 | 2131 | } |
| 2165 | - //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' ); | |
| 2132 | + //add_action( 'wpbc_hook_settings_page_footer', 'wpbc_hook_settings_page_footer__define_code_mirror' ); | |