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/booking-resource-selector/booking-resource-selector__catalog.php +27 -3 11.5 → 11.9 View file →
@@ -65,8 +65,19 @@
65 65 * @return array<int,array<string,mixed>> Resources keyed by resource ID.
66 66 */
67 67 function wpbc_booking_resource_selector_get_catalog( $config ) {
68 68 $config = wpbc_booking_resource_selector_normalize_config( $config );
69 + if ( function_exists( 'wpbc_booking_resource_catalog_query_service' ) ) {
70 + $resources = wpbc_booking_resource_catalog_query_service()->get_resources(
71 + array(
72 + 'resource_ids' => $config['resource_ids'],
73 + 'include_summaries' => true,
74 + )
75 + );
76 +
77 + return (array) apply_filters( 'wpbc_booking_resource_selector_public_catalog', $resources, $config );
78 + }
79 +
69 80 $raw_resources = (array) apply_bk_filter( 'wpdebk_get_keyed_all_bk_resources', array() );
70 81 $search_options = array();
71 82 if ( function_exists( 'wpbc_searchable_resources__get_all_options' ) ) {
72 83 $search_options = (array) wpbc_searchable_resources__get_all_options();
@@ -83,8 +94,16 @@
83 94 $resource_options = array();
84 95 if ( isset( $search_options[ $normalized_resource_id ] ) && is_array( $search_options[ $normalized_resource_id ] ) ) {
85 96 $resource_options = $search_options[ $normalized_resource_id ];
86 97 }
98 + if ( function_exists( 'wpbc_booking_resource_content_repository' ) ) {
99 + $raw_resource_array = is_object( $resource_record ) ? get_object_vars( $resource_record ) : (array) $resource_record;
100 + $raw_title = isset( $raw_resource_array['title'] ) ? (string) $raw_resource_array['title'] : '';
101 + $shared_content = wpbc_booking_resource_content_repository()->get( $normalized_resource_id, $raw_title, true );
102 + $raw_resource_array['description'] = $shared_content['description'];
103 + $raw_resource_array['image_url'] = $shared_content['picture_url'];
104 + $resource_record = $raw_resource_array;
105 + }
87 106 $resource = wpbc_booking_resource_selector_normalize_resource( $resource_record, $resource_key, $resource_options );
88 107 if ( $resource ) {
89 108 $resources[ $resource['resource_id'] ] = $resource;
90 109 }
@@ -91,14 +110,19 @@
91 110 }
92 111
93 112 if ( empty( $resources ) && ! class_exists( 'wpdev_bk_personal' ) ) {
94 113 $resource_id = class_exists( 'WPBC_FE_Attr_Postprocessor' ) ? WPBC_FE_Attr_Postprocessor::get_default_booking_resource_id() : 1;
95 - $resource_title = function_exists( 'wpbc_get_resource_title' ) ? wpbc_get_resource_title( $resource_id ) : '';
114 + $shared_content = function_exists( 'wpbc_booking_resource_content_repository' )
115 + ? wpbc_booking_resource_content_repository()->get( $resource_id )
116 + : array();
117 + $resource_title = ! empty( $shared_content['title'] )
118 + ? wpbc_lang( $shared_content['title'] )
119 + : ( function_exists( 'wpbc_get_resource_title' ) ? wpbc_get_resource_title( $resource_id ) : '' );
96 120 $resources[ $resource_id ] = array(
97 121 'resource_id' => absint( $resource_id ),
98 122 'title' => $resource_title ? wp_strip_all_tags( wpbc_lang( $resource_title ) ) : __( 'Default Booking Resource', 'booking' ),
99 - 'description' => '',
100 - 'image_url' => '',
123 + 'description' => ! empty( $shared_content['description'] ) ? wp_strip_all_tags( wpbc_lang( $shared_content['description'] ) ) : '',
124 + 'image_url' => ! empty( $shared_content['picture_url'] ) ? esc_url_raw( wpbc_lang( $shared_content['picture_url'] ) ) : '',
101 125 'parent_id' => 0,
102 126 'count' => 0,
103 127 );
104 128 }