PluginProbe
Booking Calendar / 11.8.3
Booking Calendar v11.8.3
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 10.11 10.11.2 All 203 releases
← All changes | core/lib/wpdev-booking-widget.php +42 -33 10.10.111.8.3 View file →
@@ -19,35 +19,25 @@
19 19 parent::__construct( false, $name = 'Booking Calendar' );
20 20 }
21 21
22 22 /** @see WP_Widget::widget */
23 - function widget($args, $instance) {
23 + function widget( $args, $instance ) {
24 24
25 - extract( $args );
25 + extract( $args );
26 26
27 - // FixIn: 6.1.1.11.
28 - $booking_widget_title = ( isset( $instance['booking_widget_title'] ) )
29 - ? apply_filters( 'widget_title', $instance['booking_widget_title'] )
30 - : __( 'Booking Calendar', 'booking' );
31 - if ( function_exists( 'icl_translate' ) ) {
32 - $booking_widget_title = icl_translate( 'wpml_custom', 'wpbc_custom_widget_booking_title1', $booking_widget_title );
33 - }
27 + // FixIn: 6.1.1.11.
28 + $booking_widget_title = ( isset( $instance['booking_widget_title'] ) ) ? apply_filters( 'widget_title', $instance['booking_widget_title'] ) : __( 'Booking Calendar', 'booking' );
29 + if ( function_exists( 'icl_translate' ) ) {
30 + $booking_widget_title = icl_translate( 'wpml_custom', 'wpbc_custom_widget_booking_title1', $booking_widget_title );
31 + }
34 32
35 - $booking_widget_show = ( isset( $instance['booking_widget_show'] ) )
36 - ? $instance['booking_widget_show']
37 - : 'booking_form';
33 + $booking_widget_show = ( isset( $instance['booking_widget_show'] ) ) ? $instance['booking_widget_show'] : 'booking_form';
38 34
39 - $resource_id = ( isset( $instance['booking_widget_type'] ) )
40 - ? intval( $instance['booking_widget_type'] )
41 - : 1;
42 - $resource_id = ( empty( $resource_id ) ) ? 1 : $resource_id;
35 + $resource_id = ( isset( $instance['booking_widget_type'] ) ) ? intval( $instance['booking_widget_type'] ) : 1;
36 + $resource_id = ( empty( $resource_id ) ) ? 1 : $resource_id;
43 37
44 - $booking_widget_calendar_count = ( isset( $instance['booking_widget_calendar_count'] ) )
45 - ? intval( $instance['booking_widget_calendar_count'] )
46 - : 1;
47 - $booking_widget_last_field = ( isset( $instance['booking_widget_last_field'] ) )
48 - ? $instance['booking_widget_last_field']
49 - : '';
38 + $booking_widget_calendar_count = ( isset( $instance['booking_widget_calendar_count'] ) ) ? intval( $instance['booking_widget_calendar_count'] ) : 1;
39 + $booking_widget_last_field = ( isset( $instance['booking_widget_last_field'] ) ) ? $instance['booking_widget_last_field'] : '';
50 40 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
51 41 echo $before_widget ;
52 42
53 43 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
@@ -64,19 +54,37 @@
64 54 }
65 55
66 56 echo "<div class='widget_wpdev_booking wpdevelop months_num_in_row_1'>"; // FixIn: 8.4.2.3.
67 57
68 - if ( $booking_widget_show == 'booking_form' ) {
69 - $my_booking_form_name = apply_bk_filter( 'wpbc_get_default_custom_form', 'standard', $resource_id );
70 - make_bk_action( 'wpdevbk_add_form', $resource_id, $booking_widget_calendar_count, true, $my_booking_form_name );
58 + if ( 'booking_form' === $booking_widget_show ) {
71 59
72 - } else {
73 - echo "<div class='wpbc_only_calendar wpbc_container'>"; // FixIn: 8.0.1.2.
74 - echo "<div id='calendar_booking_unselectable" . esc_attr( $resource_id ) . "'></div>"; // FixIn: 6.1.1.13.
75 - do_action( 'wpdev_bk_add_calendar', $resource_id, $booking_widget_calendar_count );
76 - echo '</div>';
77 - }
60 + $my_booking_form_name = apply_bk_filter( 'wpbc_get_default_custom_form', 'standard', $resource_id );
78 61
62 + // Parse, sanitize and normilize shortcode paramaters.
63 + $shortcode_params = array(
64 + 'is_echo' => 1,
65 + 'resource_id' => $resource_id,
66 + 'cal_count' => $booking_widget_calendar_count,
67 + 'custom_booking_form' => $my_booking_form_name,
68 + );
69 +
70 + $shortcode_result = WPBC_FE_Render::render_booking_form( $shortcode_params );
71 +
72 + } else {
73 + echo "<div class='wpbc_only_calendar wpbc_container'>"; // FixIn: 8.0.1.2.
74 + echo "<div id='calendar_booking_unselectable" . esc_attr( $resource_id ) . "'></div>"; // FixIn: 6.1.1.13.
75 +
76 + WPBC_FE_Render::render_calendar_only(
77 + array(
78 + 'resource_id' => $resource_id,
79 + 'cal_count' => $booking_widget_calendar_count,
80 + 'is_echo' => 1,
81 + )
82 + );
83 +
84 + echo '</div>';
85 + }
86 +
79 87 if ( $booking_widget_last_field !== '' ) {
80 88 echo '<br/>' . esc_js( $booking_widget_last_field );
81 89 }
82 90 echo "</div>";
@@ -209,9 +217,10 @@
209 217 }
210 218 }
211 219
212 220
213 -function register_wpbc_widget() {
221 +function wpbc_register_wpbc_widget() {
214 222 // FixIn: 8.1.3.18.
223 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
215 224 register_widget( "BookingWidget" );
216 225 }
217 -add_action( 'widgets_init', 'register_wpbc_widget' );
226 +add_action( 'widgets_init', 'wpbc_register_wpbc_widget' );