| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 20 | 20 | // A J A X |
| 21 | 21 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 22 | 22 | |
| 23 | -//FixIn: 9.6.3.5 | |
| 23 | +// FixIn: 9.6.3.5. | |
| 24 | 24 | |
| 25 | 25 | function wpbc_silent_import_all_events() { |
| 26 | 26 | |
| 27 | 27 | |
| @@ -53,11 +53,12 @@ | ||
| 53 | 53 | $wpbc_Google_Calendar->setUrl( get_bk_option( 'booking_gcal_feed') ); |
| 54 | 54 | $import_result = $wpbc_Google_Calendar->run(); |
| 55 | 55 | |
| 56 | 56 | } else { |
| 57 | - | |
| 58 | - $types_list = $wpdb->get_results( "SELECT booking_type_id, import FROM {$wpdb->prefix}bookingtypes" ); | |
| 59 | 57 | |
| 58 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 59 | + $types_list = $wpdb->get_results( "SELECT booking_type_id, import FROM {$wpdb->prefix}bookingtypes" ); | |
| 60 | + | |
| 60 | 61 | foreach ($types_list as $wpbc_booking_resource) { |
| 61 | 62 | $wpbc_booking_resource_id = $wpbc_booking_resource->booking_type_id; |
| 62 | 63 | $wpbc_booking_resource_feed = $wpbc_booking_resource->import; |
| 63 | 64 | if ( (! empty($wpbc_booking_resource_feed) ) && ($wpbc_booking_resource_feed != NULL ) && ( $wpbc_booking_resource_feed != '/' ) ) { |
| @@ -64,9 +65,9 @@ | ||
| 64 | 65 | |
| 65 | 66 | $wpbc_Google_Calendar->setUrl($wpbc_booking_resource_feed); |
| 66 | 67 | $wpbc_Google_Calendar->setResource($wpbc_booking_resource_id); |
| 67 | 68 | |
| 68 | - //FixIn: 9.9.0.25 | |
| 69 | + // FixIn: 9.9.0.25. | |
| 69 | 70 | if ( function_exists( 'wpbm_delete_all_imported_bookings' ) ) { |
| 70 | 71 | wpbm_delete_all_imported_bookings( array( 'resource_id' => $wpbc_booking_resource_id ) ); |
| 71 | 72 | } |
| 72 | 73 | $import_result = $wpbc_Google_Calendar->run(); |
| @@ -88,9 +89,9 @@ | ||
| 88 | 89 | echo '<style type="text/css"> .booking_gcal_events_from .wpbc_offset_datetime { display:none; } </style>'; |
| 89 | 90 | } |
| 90 | 91 | ?> |
| 91 | 92 | <tr valign="top"> |
| 92 | - <th scope="row"><label for="booking_gcal_events_from" ><?php _e('From' ,'booking'); ?>:</label></th> | |
| 93 | + <th scope="row"><label for="booking_gcal_events_from" ><?php esc_html_e('From' ,'booking'); ?>:</label></th> | |
| 93 | 94 | <td class="booking_gcal_events_from"> |
| 94 | 95 | <select id="booking_gcal_events_from" name="booking_gcal_events_from" |
| 95 | 96 | onchange="javascript: if(this.value=='date') { |
| 96 | 97 | jQuery('.booking_gcal_events_from .wpbc_offset_value').hide(); |
| @@ -110,16 +111,20 @@ | ||
| 110 | 111 | , "any" => __('The start of time' ,'booking') |
| 111 | 112 | , "date" => __('Specific date / time' ,'booking') |
| 112 | 113 | ); |
| 113 | 114 | foreach ($wpbc_options as $key => $value) { |
| 114 | - ?><option <?php if( $booking_gcal_events_from == $key ) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $value; ?></option><?php | |
| 115 | + ?><option <?php if( $booking_gcal_events_from == $key ) echo "selected"; ?> value="<?php | |
| 116 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 117 | + echo $key; ?>"><?php echo esc_html( $value ); ?></option><?php | |
| 115 | 118 | } |
| 116 | 119 | ?> |
| 117 | 120 | </select> |
| 118 | - <span class="description"><?php _e('Select option, when to start retrieving events.' ,'booking');?></span> | |
| 121 | + <span class="description"><?php esc_html_e('Select option, when to start retrieving events.' ,'booking'); ?></span> | |
| 119 | 122 | <div class="booking_gcal_events_from_offset" style="margin:10px 0 0;"> |
| 120 | - <label for="booking_gcal_events_from_offset"> <span class="wpbc_offset_value"><?php _e('Offset' ,'booking'); ?></span><span class="wpbc_offset_datetime" ><?php _e('Enter date / time' ,'booking'); ?></span>: </label> | |
| 121 | - <input type="text" id="booking_gcal_events_from_offset" name="booking_gcal_events_from_offset" value="<?php echo $booking_gcal_events_from_offset; ?>" style="width:100px;text-align: right;" /> | |
| 123 | + <label for="booking_gcal_events_from_offset"> <span class="wpbc_offset_value"><?php esc_html_e('Offset' ,'booking'); ?></span><span class="wpbc_offset_datetime" ><?php esc_html_e('Enter date / time' ,'booking'); ?></span>: </label> | |
| 124 | + <input type="text" id="booking_gcal_events_from_offset" name="booking_gcal_events_from_offset" value="<?php | |
| 125 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 126 | + echo $booking_gcal_events_from_offset; ?>" style="width:100px;text-align: right;" /> | |
| 122 | 127 | <span class="wpbc_offset_value"> |
| 123 | 128 | <select id="booking_gcal_events_from_offset_type" name="booking_gcal_events_from_offset_type" style="margin-top: -2px;width: 99px;"> |
| 124 | 129 | <?php |
| 125 | 130 | $wpbc_options = array( |
| @@ -128,16 +133,20 @@ | ||
| 128 | 133 | , "hour" => __('hours' ,'booking') |
| 129 | 134 | , "day" => __('days' ,'booking') |
| 130 | 135 | ); |
| 131 | 136 | foreach ($wpbc_options as $key => $value) { |
| 132 | - ?><option <?php if( $booking_gcal_events_from_offset_type == $key ) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $value; ?></option><?php | |
| 137 | + ?><option <?php if( $booking_gcal_events_from_offset_type == $key ) echo "selected"; ?> value="<?php | |
| 138 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 139 | + echo $key; ?>"><?php echo esc_html( $value ); ?></option><?php | |
| 133 | 140 | } |
| 134 | 141 | ?> |
| 135 | 142 | </select> |
| 136 | - <span class="description"><?php _e('You can specify an additional offset from you chosen start point. The offset can be negative.' ,'booking');?></span> | |
| 143 | + <span class="description"><?php esc_html_e('You can specify an additional offset from you chosen start point. The offset can be negative.' ,'booking'); ?></span> | |
| 137 | 144 | </span> |
| 138 | 145 | <span class="wpbc_offset_datetime"> |
| 139 | - <em><?php printf(__('Type your date in format %s. Example: %s' ,'booking'),'Y-m-d','2014-08-01'); ?></em> | |
| 146 | + <em><?php | |
| 147 | + /* translators: 1: ... */ | |
| 148 | + echo wp_kses_post( sprintf( __( 'Type your date in format %1$s. Example: %2$s', 'booking' ), 'Y-m-d', '2014-08-01' ) ); ?></em> | |
| 140 | 149 | </span> |
| 141 | 150 | </div> |
| 142 | 151 | </td> |
| 143 | 152 | </tr> |
| @@ -152,9 +161,9 @@ | ||
| 152 | 161 | echo '<style type="text/css"> .booking_gcal_events_until .wpbc_offset_datetime { display:none; } </style>'; |
| 153 | 162 | } |
| 154 | 163 | ?> |
| 155 | 164 | <tr valign="top"> |
| 156 | - <th scope="row"><label for="booking_gcal_events_until" ><?php _e('Until' ,'booking'); ?>:</label></th> | |
| 165 | + <th scope="row"><label for="booking_gcal_events_until" ><?php esc_html_e('Until' ,'booking'); ?>:</label></th> | |
| 157 | 166 | <td class="booking_gcal_events_until"> |
| 158 | 167 | <select id="booking_gcal_events_until" name="booking_gcal_events_until" |
| 159 | 168 | onchange="javascript: if(this.value=='date') { |
| 160 | 169 | jQuery('.booking_gcal_events_until .wpbc_offset_value').hide(); |
| @@ -174,16 +183,20 @@ | ||
| 174 | 183 | , "any" => __('The end of time' ,'booking') |
| 175 | 184 | , "date" => __('Specific date / time' ,'booking') |
| 176 | 185 | ); |
| 177 | 186 | foreach ($wpbc_options as $key => $value) { |
| 178 | - ?><option <?php if( $booking_gcal_events_until == $key ) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $value; ?></option><?php | |
| 187 | + ?><option <?php if( $booking_gcal_events_until == $key ) echo "selected"; ?> value="<?php | |
| 188 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 189 | + echo $key; ?>"><?php echo esc_html( $value ); ?></option><?php | |
| 179 | 190 | } |
| 180 | 191 | ?> |
| 181 | 192 | </select> |
| 182 | - <span class="description"><?php _e('Select option, when to stop retrieving events.' ,'booking');?></span> | |
| 193 | + <span class="description"><?php esc_html_e('Select option, when to stop retrieving events.' ,'booking'); ?></span> | |
| 183 | 194 | <div class="booking_gcal_events_until_offset" style="margin:10px 0 0;"> |
| 184 | - <label for="booking_gcal_events_until_offset" > <span class="wpbc_offset_value"><?php _e('Offset' ,'booking'); ?></span><span class="wpbc_offset_datetime" ><?php _e('Enter date / time' ,'booking'); ?></span>: </label> | |
| 185 | - <input type="text" id="booking_gcal_events_until_offset" name="booking_gcal_events_until_offset" value="<?php echo $booking_gcal_events_until_offset; ?>" style="width:100px;text-align: right;" /> | |
| 195 | + <label for="booking_gcal_events_until_offset" > <span class="wpbc_offset_value"><?php esc_html_e('Offset' ,'booking'); ?></span><span class="wpbc_offset_datetime" ><?php esc_html_e('Enter date / time' ,'booking'); ?></span>: </label> | |
| 196 | + <input type="text" id="booking_gcal_events_until_offset" name="booking_gcal_events_until_offset" value="<?php | |
| 197 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 198 | + echo $booking_gcal_events_until_offset; ?>" style="width:100px;text-align: right;" /> | |
| 186 | 199 | <span class="wpbc_offset_value"> |
| 187 | 200 | <select id="booking_gcal_events_until_offset_type" name="booking_gcal_events_until_offset_type" style="margin-top: -2px;width: 99px;"> |
| 188 | 201 | <?php |
| 189 | 202 | $wpbc_options = array( |
| @@ -192,16 +205,20 @@ | ||
| 192 | 205 | , "hour" => __('hours' ,'booking') |
| 193 | 206 | , "day" => __('days' ,'booking') |
| 194 | 207 | ); |
| 195 | 208 | foreach ($wpbc_options as $key => $value) { |
| 196 | - ?><option <?php if( $booking_gcal_events_until_offset_type == $key ) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $value; ?></option><?php | |
| 209 | + ?><option <?php if( $booking_gcal_events_until_offset_type == $key ) echo "selected"; ?> value="<?php | |
| 210 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 211 | + echo $key; ?>"><?php echo esc_html( $value ); ?></option><?php | |
| 197 | 212 | } |
| 198 | 213 | ?> |
| 199 | 214 | </select> |
| 200 | - <span class="description"><?php _e('You can specify an additional offset from you chosen end point. The offset can be negative.' ,'booking');?></span> | |
| 215 | + <span class="description"><?php esc_html_e('You can specify an additional offset from you chosen end point. The offset can be negative.' ,'booking'); ?></span> | |
| 201 | 216 | </span> |
| 202 | 217 | <span class="wpbc_offset_datetime"> |
| 203 | - <em><?php printf(__('Type your date in format %s. Example: %s' ,'booking'),'Y-m-d','2014-08-30'); ?></em> | |
| 218 | + <em><?php | |
| 219 | + /* translators: 1: ... */ | |
| 220 | + echo wp_kses_post( sprintf( __( 'Type your date in format %1$s. Example: %2$s', 'booking' ),'Y-m-d','2014-08-30') ); ?></em> | |
| 204 | 221 | </span> |
| 205 | 222 | |
| 206 | 223 | </div> |
| 207 | 224 | </td> |
| @@ -212,12 +229,14 @@ | ||
| 212 | 229 | |
| 213 | 230 | function wpbc_gcal_settings_content_field_max_feeds($booking_gcal_events_max) { |
| 214 | 231 | ?> |
| 215 | 232 | <tr valign="top"> |
| 216 | - <th scope="row"><label for="booking_gcal_events_max" ><?php _e('Maximum number' ,'booking'); ?>:</label></th> | |
| 217 | - <td><input id="booking_gcal_events_max" name="booking_gcal_events_max" class="regular-text" type="text" value="<?php echo $booking_gcal_events_max; ?>" /> | |
| 233 | + <th scope="row"><label for="booking_gcal_events_max" ><?php esc_html_e('Maximum number' ,'booking'); ?>:</label></th> | |
| 234 | + <td><input id="booking_gcal_events_max" name="booking_gcal_events_max" class="regular-text" type="text" value="<?php | |
| 235 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 236 | + echo $booking_gcal_events_max; ?>" /> | |
| 218 | 237 | <span class="description"><?php |
| 219 | - _e('You can specify the maximum number of events to import during one session.' ,'booking'); | |
| 238 | + esc_html_e('You can specify the maximum number of events to import during one session.' ,'booking'); | |
| 220 | 239 | ?></span> |
| 221 | 240 | </td> |
| 222 | 241 | </tr> |
| 223 | 242 | <?php |
| @@ -226,9 +245,9 @@ | ||
| 226 | 245 | |
| 227 | 246 | function wpbc_gcal_settings_content_field_timezone($booking_gcal_timezone) { |
| 228 | 247 | ?> |
| 229 | 248 | <tr valign="top"> |
| 230 | - <th scope="row"><label for="booking_gcal_timezone" ><?php _e('Timezone' ,'booking'); ?>:</label></th> | |
| 249 | + <th scope="row"><label for="booking_gcal_timezone" ><?php esc_html_e('Timezone' ,'booking'); ?>:</label></th> | |
| 231 | 250 | <td> |
| 232 | 251 | <select id="booking_gcal_timezone" name="booking_gcal_timezone"> |
| 233 | 252 | <?php |
| 234 | 253 | $wpbc_options = array( |
| @@ -234,18 +253,20 @@ | ||
| 234 | 253 | $wpbc_options = array( |
| 235 | 254 | "" => __('Default' ,'booking') |
| 236 | 255 | ); |
| 237 | 256 | foreach ($wpbc_options as $key => $value) { |
| 238 | - ?><option <?php if( $booking_gcal_timezone == $key ) echo "selected"; ?> value="<?php echo $key; ?>"><?php echo $value; ?></option><?php | |
| 257 | + ?><option <?php if( $booking_gcal_timezone == $key ) echo "selected"; ?> value="<?php | |
| 258 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 259 | + echo $key; ?>"><?php echo esc_html( $value ); ?></option><?php | |
| 239 | 260 | } |
| 240 | 261 | |
| 241 | 262 | |
| 242 | 263 | // structure: $wpbc_booking_region_cities_list["Pacific"]["Fiji"] = "Fiji"; |
| 243 | - $wpbc_booking_region_cities_list = wpbc_get_booking_region_cities_list(); //FixIn: 8.9.4.9 | |
| 264 | + $wpbc_booking_region_cities_list = wpbc_get_booking_region_cities_list(); // FixIn: 8.9.4.9. | |
| 244 | 265 | |
| 245 | 266 | foreach ($wpbc_booking_region_cities_list as $region => $region_cities) { |
| 246 | 267 | |
| 247 | - echo '<optgroup label="'. $region .'">'; | |
| 268 | + echo '<optgroup label="'. esc_attr( $region ) .'">'; | |
| 248 | 269 | |
| 249 | 270 | foreach ($region_cities as $city_key => $city_title) { |
| 250 | 271 | |
| 251 | 272 | if( $booking_gcal_timezone == $region .'/'. $city_key ) |
| @@ -251,11 +272,12 @@ | ||
| 251 | 272 | if( $booking_gcal_timezone == $region .'/'. $city_key ) |
| 252 | 273 | $is_selected = 'selected'; |
| 253 | 274 | else |
| 254 | 275 | $is_selected = ''; |
| 276 | + | |
| 277 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 278 | + echo '<option ' . $is_selected . ' value="' . $region . '/' . $city_key . '">' . $city_title . '</option>'; | |
| 255 | 279 | |
| 256 | - echo '<option '.$is_selected.' value="'. $region .'/'. $city_key .'">' . $city_title . '</option>'; | |
| 257 | - | |
| 258 | 280 | } |
| 259 | 281 | echo '</optgroup>'; |
| 260 | 282 | } |
| 261 | 283 | |
| @@ -261,15 +283,15 @@ | ||
| 261 | 283 | |
| 262 | 284 | |
| 263 | 285 | ?> |
| 264 | 286 | </select> |
| 265 | - <span class="description"><?php _e('Select a city in your required timezone, if you are having problems with dates and times.' ,'booking');?></span> | |
| 287 | + <span class="description"><?php esc_html_e('Select a city in your required timezone, if you are having problems with dates and times.' ,'booking'); ?></span> | |
| 266 | 288 | </td> |
| 267 | 289 | </tr> |
| 268 | 290 | <?php |
| 269 | 291 | } |
| 270 | 292 | |
| 271 | -//FixIn: 9.6.3.5 | |
| 293 | +// FixIn: 9.6.3.5. | |
| 272 | 294 | |
| 273 | 295 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 274 | 296 | // Activation |
| 275 | 297 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |