| @@ -1,113 +1,156 @@ | ||
| 1 | -<?php | |
| 1 | +<?php /** | |
| 2 | + * @version 1.0 | |
| 3 | + * @package Booking Calendar | |
| 4 | + * @category Booking Calendar Widgets | |
| 5 | + * @author wpdevelop | |
| 6 | + * | |
| 7 | + * @web-site https://wpbookingcalendar.com/ | |
| 8 | + * @email info@wpbookingcalendar.com | |
| 9 | + * | |
| 10 | + * @modified 2024-10-08 | |
| 11 | + */ | |
| 2 | 12 | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly // FixIn: 10.6.2.1. | |
| 14 | + | |
| 3 | 15 | // BookingWidget Class |
| 4 | 16 | class BookingWidget extends WP_Widget { |
| 5 | - /** constructor */ | |
| 6 | - function __construct() { | |
| 7 | - parent::__construct(false, $name = 'Booking Calendar'); | |
| 8 | - } | |
| 9 | 17 | |
| 18 | + function __construct() { | |
| 19 | + parent::__construct( false, $name = 'Booking Calendar' ); | |
| 20 | + } | |
| 21 | + | |
| 10 | 22 | /** @see WP_Widget::widget */ |
| 11 | - function widget($args, $instance) { | |
| 12 | - extract( $args ); | |
| 13 | - | |
| 14 | - $booking_widget_title = __('Booking Calendar', 'booking'); //FixIn: 6.1.1.11 | |
| 15 | - $booking_widget_show = 'booking_form'; | |
| 16 | - $booking_widget_type = 1; | |
| 17 | - $booking_widget_calendar_count = 1; | |
| 18 | - $booking_widget_last_field = ''; | |
| 19 | - | |
| 20 | - | |
| 21 | - if ( isset( $instance['booking_widget_title'] ) ) //FixIn: 6.1.1.11 | |
| 22 | - $booking_widget_title = apply_filters('widget_title', $instance['booking_widget_title']); | |
| 23 | - if (function_exists('icl_translate')) | |
| 24 | - $booking_widget_title = icl_translate( 'wpml_custom', 'wpbc_custom_widget_booking_title1', $booking_widget_title); | |
| 25 | - | |
| 26 | - if ( isset( $instance['booking_widget_show'] ) ) //FixIn: 6.1.1.11 | |
| 27 | - $booking_widget_show = $instance['booking_widget_show']; | |
| 28 | - if ( isset( $instance['booking_widget_type'] ) ) //FixIn: 6.1.1.11 | |
| 29 | - $booking_widget_type = $instance['booking_widget_type']; | |
| 30 | - if (empty($booking_widget_type)) $booking_widget_type=1; | |
| 31 | - if ( isset( $instance['booking_widget_calendar_count'] ) ) //FixIn: 6.1.1.11 | |
| 32 | - $booking_widget_calendar_count = $instance['booking_widget_calendar_count']; | |
| 33 | - if ( isset( $instance['booking_widget_last_field'] ) ) //FixIn: 6.1.1.11 | |
| 34 | - $booking_widget_last_field = $instance['booking_widget_last_field']; | |
| 23 | + function widget( $args, $instance ) { | |
| 35 | 24 | |
| 36 | - | |
| 25 | + extract( $args ); | |
| 37 | 26 | |
| 38 | - echo $before_widget; | |
| 39 | - if (isset($_GET['booking_hash'])) { | |
| 40 | - _e('You need to use special shortcode [bookingedit] for booking editing.' ,'booking'); | |
| 41 | - echo $after_widget; | |
| 42 | - return; | |
| 43 | - } | |
| 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 | + } | |
| 44 | 32 | |
| 45 | - if ($booking_widget_title != '') echo $before_title . htmlspecialchars_decode($booking_widget_title) . $after_title; | |
| 33 | + $booking_widget_show = ( isset( $instance['booking_widget_show'] ) ) ? $instance['booking_widget_show'] : 'booking_form'; | |
| 46 | 34 | |
| 47 | - echo "<div class='widget_wpdev_booking wpdevelop months_num_in_row_1'>"; //FixIn: 8.4.2.3 | |
| 48 | - if ($booking_widget_show == 'booking_form') { | |
| 49 | - // do_action('wpdev_bk_add_form', $booking_widget_type , $booking_widget_calendar_count); | |
| 50 | - $my_booking_form_name = apply_bk_filter('wpbc_get_default_custom_form', 'standard', $booking_widget_type); | |
| 51 | - make_bk_action('wpdevbk_add_form', $booking_widget_type , $booking_widget_calendar_count, true, $my_booking_form_name ); | |
| 52 | - | |
| 53 | - } else { | |
| 54 | - echo "<div class='wpbc_only_calendar wpbc_container'>"; //FixIn: 8.0.1.2 | |
| 55 | - echo "<div id='calendar_booking_unselectable" . $booking_widget_type . "'></div>"; //FixIn: 6.1.1.13 | |
| 56 | - do_action( 'wpdev_bk_add_calendar', $booking_widget_type, $booking_widget_calendar_count ); | |
| 57 | - echo '</div>'; | |
| 58 | - } | |
| 35 | + $resource_id = ( isset( $instance['booking_widget_type'] ) ) ? intval( $instance['booking_widget_type'] ) : 1; | |
| 36 | + $resource_id = ( empty( $resource_id ) ) ? 1 : $resource_id; | |
| 59 | 37 | |
| 60 | - if ($booking_widget_last_field !== '') echo '<br/>' . htmlspecialchars_decode($booking_widget_last_field); | |
| 61 | - echo "</div>"; | |
| 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'] : ''; | |
| 40 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 41 | + echo $before_widget ; | |
| 62 | 42 | |
| 63 | - echo $after_widget; | |
| 43 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 44 | + if ( isset( $_GET['booking_hash'] ) ) { | |
| 45 | + esc_html_e( 'You need to use special shortcode [bookingedit] for booking editing.', 'booking' ); | |
| 46 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 47 | + echo $after_widget ; | |
| 48 | + return; | |
| 49 | + } | |
| 64 | 50 | |
| 51 | + if ( $booking_widget_title != '' ) { | |
| 52 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 53 | + echo $before_title . wp_kses_post( $booking_widget_title ) . $after_title ; | |
| 54 | + } | |
| 65 | 55 | |
| 56 | + echo "<div class='widget_wpdev_booking wpdevelop months_num_in_row_1'>"; // FixIn: 8.4.2.3. | |
| 57 | + | |
| 58 | + if ( 'booking_form' === $booking_widget_show ) { | |
| 59 | + | |
| 60 | + $my_booking_form_name = apply_bk_filter( 'wpbc_get_default_custom_form', 'standard', $resource_id ); | |
| 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 | + | |
| 87 | + if ( $booking_widget_last_field !== '' ) { | |
| 88 | + echo '<br/>' . esc_js( $booking_widget_last_field ); | |
| 89 | + } | |
| 90 | + echo "</div>"; | |
| 91 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 92 | + echo $after_widget; | |
| 66 | 93 | } |
| 67 | 94 | |
| 68 | 95 | /** @see WP_Widget::update */ |
| 69 | - function update($new_instance, $old_instance) { | |
| 70 | - $instance = $old_instance; | |
| 96 | + function update( $new_instance, $old_instance ) { | |
| 97 | + $instance = $old_instance; | |
| 71 | 98 | |
| 72 | - $instance['booking_widget_title'] = strip_tags($new_instance['booking_widget_title']); | |
| 73 | - $instance['booking_widget_show'] = strip_tags($new_instance['booking_widget_show']); | |
| 74 | - $instance['booking_widget_type'] = ( empty( $new_instance['booking_widget_type'] ) ? 1 : strip_tags( $new_instance['booking_widget_type'] ) ); | |
| 75 | - $instance['booking_widget_calendar_count'] = strip_tags($new_instance['booking_widget_calendar_count']); | |
| 76 | - $instance['booking_widget_last_field'] = $new_instance['booking_widget_last_field']; | |
| 77 | - return $instance; | |
| 78 | - } | |
| 99 | + $instance['booking_widget_title'] = sanitize_textarea_field( $new_instance['booking_widget_title'] ); | |
| 100 | + $instance['booking_widget_show'] = sanitize_textarea_field( $new_instance['booking_widget_show'] ); | |
| 101 | + $instance['booking_widget_type'] = ( empty( $new_instance['booking_widget_type'] ) ? 1 : intval( $new_instance['booking_widget_type'] ) ); | |
| 102 | + $instance['booking_widget_calendar_count'] = intval( $new_instance['booking_widget_calendar_count'] ); | |
| 103 | + $instance['booking_widget_last_field'] = $new_instance['booking_widget_last_field']; | |
| 79 | 104 | |
| 105 | + return $instance; | |
| 106 | + } | |
| 107 | + | |
| 80 | 108 | /** @see WP_Widget::form */ |
| 81 | 109 | function form($instance) { |
| 82 | - if ( isset($instance['booking_widget_title']) ) $booking_widget_title = esc_attr($instance['booking_widget_title']); | |
| 83 | - else $booking_widget_title = ''; | |
| 84 | - if ( isset($instance['booking_widget_show']) ) $booking_widget_show = esc_attr($instance['booking_widget_show']); | |
| 85 | - else $booking_widget_show = ''; | |
| 86 | - if ( ( class_exists('wpdev_bk_personal') ) && ( isset($instance['booking_widget_type']) ) ) { | |
| 87 | - $booking_widget_type = esc_attr($instance['booking_widget_type']); | |
| 88 | - } else $booking_widget_type=1; | |
| 89 | - if ( isset($instance['booking_widget_calendar_count']) ) $booking_widget_calendar_count = esc_attr($instance['booking_widget_calendar_count']); | |
| 90 | - else $booking_widget_calendar_count = 1; | |
| 91 | - if ( isset($instance['booking_widget_last_field']) ) $booking_widget_last_field = esc_attr($instance['booking_widget_last_field']); | |
| 92 | - else $booking_widget_last_field = ''; | |
| 93 | - ?> | |
| 94 | 110 | |
| 111 | + if ( isset( $instance['booking_widget_title'] ) ) { | |
| 112 | + $booking_widget_title = esc_attr( $instance['booking_widget_title'] ); | |
| 113 | + } else { | |
| 114 | + $booking_widget_title = ''; | |
| 115 | + } | |
| 116 | + if ( isset( $instance['booking_widget_show'] ) ) { | |
| 117 | + $booking_widget_show = esc_attr( $instance['booking_widget_show'] ); | |
| 118 | + } else { | |
| 119 | + $booking_widget_show = ''; | |
| 120 | + } | |
| 121 | + if ( ( class_exists( 'wpdev_bk_personal' ) ) && ( isset( $instance['booking_widget_type'] ) ) ) { | |
| 122 | + $resource_id = intval( $instance['booking_widget_type'] ); | |
| 123 | + } else { | |
| 124 | + $resource_id = 1; | |
| 125 | + } | |
| 126 | + if ( isset( $instance['booking_widget_calendar_count'] ) ) { | |
| 127 | + $booking_widget_calendar_count = esc_attr( $instance['booking_widget_calendar_count'] ); | |
| 128 | + } else { | |
| 129 | + $booking_widget_calendar_count = 1; | |
| 130 | + } | |
| 131 | + if ( isset( $instance['booking_widget_last_field'] ) ) { | |
| 132 | + $booking_widget_last_field = esc_attr( $instance['booking_widget_last_field'] ); | |
| 133 | + } else { | |
| 134 | + $booking_widget_last_field = ''; | |
| 135 | + } | |
| 136 | + ?> | |
| 137 | + | |
| 95 | 138 | <p> |
| 96 | - <label for="<?php echo $this->get_field_id('booking_widget_title'); ?>"><?php _e('Title' ,'booking'); ?>:</label><br/> | |
| 97 | - <input value="<?php echo $booking_widget_title; ?>" | |
| 98 | - name="<?php echo $this->get_field_name('booking_widget_title'); ?>" | |
| 99 | - id="<?php echo $this->get_field_id('booking_widget_title'); ?>" | |
| 139 | + <label for="<?php echo esc_attr( $this->get_field_id('booking_widget_title') ); ?>"><?php esc_html_e('Title' ,'booking'); ?>:</label><br/> | |
| 140 | + <input value="<?php echo esc_attr( $booking_widget_title ); ?>" | |
| 141 | + name="<?php echo esc_attr( $this->get_field_name('booking_widget_title') ); ?>" | |
| 142 | + id="<?php echo esc_attr( $this->get_field_id('booking_widget_title') ); ?>" | |
| 100 | 143 | type="text" class="widefat" style="width:100%;line-height: 1.5em;" /> |
| 101 | 144 | </p> |
| 102 | 145 | |
| 103 | 146 | <p> |
| 104 | - <label for="<?php echo $this->get_field_id('booking_widget_show'); ?>"><?php _e('Show' ,'booking'); ?>:</label><br/> | |
| 147 | + <label for="<?php echo esc_attr( $this->get_field_id('booking_widget_show') ); ?>"><?php esc_html_e('Show' ,'booking'); ?>:</label><br/> | |
| 105 | 148 | <select |
| 106 | - name="<?php echo $this->get_field_name('booking_widget_show'); ?>" | |
| 107 | - id="<?php echo $this->get_field_id('booking_widget_show'); ?>" style="width:100%;line-height: 1.5em;"> | |
| 108 | - <option <?php if($booking_widget_show == 'booking_form') echo "selected"; ?> value="booking_form"><?php _e('Booking form with calendar' ,'booking'); ?></option> | |
| 109 | - <option <?php if($booking_widget_show == 'booking_calendar') echo "selected"; ?> value="booking_calendar"><?php _e('Only availability calendar' ,'booking'); ?></option> | |
| 149 | + name="<?php echo esc_attr( $this->get_field_name('booking_widget_show') ); ?>" | |
| 150 | + id="<?php echo esc_attr( $this->get_field_id('booking_widget_show') ); ?>" style="width:100%;line-height: 1.5em;"> | |
| 151 | + <option <?php if($booking_widget_show == 'booking_form') echo "selected"; ?> value="booking_form"><?php esc_html_e('Booking form with calendar' ,'booking'); ?></option> | |
| 152 | + <option <?php if($booking_widget_show == 'booking_calendar') echo "selected"; ?> value="booking_calendar"><?php esc_html_e('Only availability calendar' ,'booking'); ?></option> | |
| 110 | 153 | </select> |
| 111 | 154 | </p> |
| 112 | 155 | |
| 113 | 156 | |
| @@ -114,18 +157,18 @@ | ||
| 114 | 157 | <?php |
| 115 | 158 | if ( class_exists('wpdev_bk_personal')) { |
| 116 | 159 | $types_list = wpbc_get_br_as_objects(); ?> |
| 117 | 160 | <p> |
| 118 | - <label for="<?php echo $this->get_field_id('booking_widget_type'); ?>"><?php _e('Booking resource' ,'booking'); ?>:</label><br/> | |
| 161 | + <label for="<?php echo esc_attr( $this->get_field_id('booking_widget_type') ); ?>"><?php esc_html_e('Booking resource' ,'booking'); ?>:</label><br/> | |
| 119 | 162 | <!--input id="calendar_type" name="calendar_type" class="input" type="text" --> |
| 120 | 163 | <select |
| 121 | - name="<?php echo $this->get_field_name('booking_widget_type'); ?>" | |
| 122 | - id="<?php echo $this->get_field_id('booking_widget_type'); ?>" | |
| 164 | + name="<?php echo esc_attr( $this->get_field_name('booking_widget_type') ); ?>" | |
| 165 | + id="<?php echo esc_attr( $this->get_field_id('booking_widget_type') ); ?>" | |
| 123 | 166 | style="width:100%;line-height: 1.5em;"> |
| 124 | 167 | <?php foreach ($types_list as $tl) { ?> |
| 125 | - <option <?php if($booking_widget_type == $tl->id ) echo "selected"; ?> | |
| 168 | + <option <?php if($resource_id == $tl->id ) echo "selected"; ?> | |
| 126 | 169 | style="<?php if (isset($tl->parent)) if ($tl->parent == 0 ) { echo 'font-weight:600;'; } else { echo 'font-size:11px;padding-left:20px;'; } ?>" |
| 127 | - value="<?php echo $tl->id; ?>"><?php echo $tl->title; ?></option> | |
| 170 | + value="<?php echo esc_attr( $tl->id ); ?>"><?php echo esc_html( $tl->title ); ?></option> | |
| 128 | 171 | <?php } ?> |
| 129 | 172 | </select> |
| 130 | 173 | |
| 131 | 174 | </p> |
| @@ -131,48 +174,53 @@ | ||
| 131 | 174 | </p> |
| 132 | 175 | <?php } ?> |
| 133 | 176 | |
| 134 | 177 | <p> |
| 135 | - <label for="<?php echo $this->get_field_id('booking_widget_calendar_count'); ?>"><?php _e('Visible months' ,'booking'); ?>:</label><br/> | |
| 178 | + <label for="<?php echo esc_attr( $this->get_field_id('booking_widget_calendar_count') ); ?>"><?php esc_html_e('Visible months' ,'booking'); ?>:</label><br/> | |
| 136 | 179 | |
| 137 | 180 | <select style="width:100%;line-height: 1.5em;" |
| 138 | - name="<?php echo $this->get_field_name('booking_widget_calendar_count'); ?>" | |
| 139 | - id="<?php echo $this->get_field_id('booking_widget_calendar_count'); ?>" | |
| 181 | + name="<?php echo esc_attr( $this->get_field_name('booking_widget_calendar_count') ); ?>" | |
| 182 | + id="<?php echo esc_attr( $this->get_field_id('booking_widget_calendar_count') ); ?>" | |
| 140 | 183 | > |
| 141 | - <?php foreach ( array(1,2,3,4,5,6,7,8,9,10,11,12) as $tl) { ?> | |
| 142 | - <option <?php if($booking_widget_calendar_count == $tl ) echo "selected"; ?> | |
| 143 | - style="font-weight:600;" | |
| 144 | - value="<?php echo $tl; ?>"><?php echo $tl; ?></option> | |
| 145 | - <?php } ?> | |
| 146 | - </select> | |
| 147 | - </p> | |
| 184 | + <?php foreach ( array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ) as $tl ) { ?> | |
| 185 | + <option | |
| 186 | + <?php if ( $booking_widget_calendar_count == $tl ) { echo "selected"; } ?> | |
| 187 | + style="font-weight:600;" | |
| 188 | + value="<?php echo esc_attr( $tl ); ?>"><?php echo esc_html( $tl ); ?></option> | |
| 189 | + <?php } ?> | |
| 190 | + </select> | |
| 191 | + </p> | |
| 148 | 192 | |
| 149 | 193 | <p> |
| 150 | - <label for="<?php echo $this->get_field_id('booking_widget_last_field'); ?>"><?php _e('Footer' ,'booking'); ?>:</label><br/> | |
| 151 | - <input value="<?php echo $booking_widget_last_field; ?>" | |
| 152 | - name="<?php echo $this->get_field_name('booking_widget_last_field'); ?>" | |
| 153 | - id="<?php echo $this->get_field_id('booking_widget_last_field'); ?>" | |
| 194 | + <label for="<?php echo esc_attr( $this->get_field_id('booking_widget_last_field') ); ?>"><?php esc_html_e('Footer' ,'booking'); ?>:</label><br/> | |
| 195 | + <input value="<?php echo esc_attr( $booking_widget_last_field ); ?>" | |
| 196 | + name="<?php echo esc_attr( $this->get_field_name('booking_widget_last_field') ); ?>" | |
| 197 | + id="<?php echo esc_attr( $this->get_field_id('booking_widget_last_field') ); ?>" | |
| 154 | 198 | type="text" style="width:100%;line-height: 1.5em;" /><br/> |
| 155 | - <em style="font-size:11px;"><?php printf(__("Example: %sMake booking here%s" ,'booking'),"<code><a href='". get_site_url() ."'>",'</a></code>'); ?></em> | |
| 156 | - </p> | |
| 199 | + <em style="font-size:11px;"><?php | |
| 200 | + /* translators: 1: ... */ | |
| 201 | + echo wp_kses_post( sprintf( __( 'Example: %1$sMake booking here%2$s', 'booking' ), "<code><a href='" . get_site_url() . "'>", '</a></code>' ) ); ?></em> | |
| 202 | + </p> | |
| 157 | 203 | |
| 158 | - <p style="font-size:10px;" > | |
| 159 | - <?php printf(__("%sImportant!!!%s Please note, if you show booking calendar (inserted into post/page) with widget at the same page, then the last will not be visible." ,'booking'),'<strong>','</strong>'); ?> | |
| 204 | + <p style="font-size:10px;"><?php | |
| 160 | 205 | |
| 161 | - <?php if (!class_exists('wpdev_bk_personal')) { ?> | |
| 206 | + /* translators: 1: ... */ | |
| 207 | + echo wp_kses_post( sprintf( __( '%1$sImportant!!!%2$s Please note, if you show booking calendar (inserted into post/page) with widget at the same page, then the last will not be visible.', 'booking' ), '<strong>', '</strong>' ) ); | |
| 162 | 208 | |
| 163 | - <em><?php printf(__("%sSeveral widgets are supported at %spaid versions%s." ,'booking'),'<span style="">','<a href="https://wpbookingcalendar.com/" target="_blank" style="text-decoration:none;color:#3A5670;">','</a>','</span>'); ?></em> | |
| 209 | + if ( ! class_exists( 'wpdev_bk_personal' ) ) { | |
| 164 | 210 | |
| 165 | - <?php | |
| 166 | - } | |
| 167 | -?></p><?php | |
| 211 | + ?><em><?php | |
| 212 | + /* translators: 1: ... */ | |
| 213 | + echo wp_kses_post( sprintf( __( '%1$sSeveral widgets are supported at %2$spaid versions%3$s.', 'booking' ), '<span style="">', '<a href="https://wpbookingcalendar.com/" target="_blank" style="text-decoration:none;color:#3A5670;">', '</a>', '</span>' ) ); | |
| 214 | + ?></em> <?php | |
| 215 | + } | |
| 216 | + ?></p><?php | |
| 168 | 217 | } |
| 218 | +} | |
| 169 | 219 | |
| 170 | -} // class BookingWidget | |
| 171 | 220 | |
| 172 | -// register widget - New, since WordPress - 2.8 | |
| 173 | -//add_action('widgets_init', create_function('', 'return register_widget("BookingWidget");')); | |
| 174 | -//FixIn: 8.1.3.18 | |
| 175 | -function register_wpbc_widget() { | |
| 176 | - register_widget("BookingWidget"); | |
| 221 | +function wpbc_register_wpbc_widget() { | |
| 222 | + // FixIn: 8.1.3.18. | |
| 223 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound | |
| 224 | + register_widget( "BookingWidget" ); | |
| 177 | 225 | } |
| 178 | -add_action( 'widgets_init', 'register_wpbc_widget' ); | |
| 226 | +add_action( 'widgets_init', 'wpbc_register_wpbc_widget' ); | |