PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | elementor-extensions/class-ajax-handler.php +35 -14 1.5.6 → 1.5.9 View file →
@@ -29,8 +29,9 @@
29 29 add_action( 'init', array( $this, 'helper_transalte_strings' ) );
30 30 add_action( 'eli/ajax-handler/after', array( $this, 'after' ) );
31 31 add_filter( 'eli/ajax-handler/filter_from_data', array( $this, 'filter_from_data' ) );
32 32 }
33 +
33 34
34 35 public function filter_output ($filter_output = array()) {
35 36 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-primary" role="alert">The form was sent successfully.</div>';
36 37 return $filter_output;
@@ -69,9 +70,9 @@
69 70 if (stripos($key, 'wdk_widget') !== false) {
70 71 $wdk_widget = sanitize_text_field($value);
71 72 }
72 73 if (stripos($key, 'listing_id') !== false) {
73 - $post_id = sanitize_text_field($value);
74 + $post_id = (int)sanitize_text_field($value);
74 75 }
75 76 }
76 77
77 78 if(function_exists('run_wdk_bookings') && (
@@ -176,10 +177,14 @@
176 177 if(in_array($key, array('eli_page_id', 'g-recaptcha-response','eli_id', 'eli_type','ID','filter','action','send_action_type','Phone','Message','Email','Name','pets_allowed','сhildrens_allowed','guests_number','guests_number_childs','guests_number_adults'))) continue;
177 178 if(in_array($key, array('listing_link','date_from','date_to','listing_id','wdk_widget', 'function','page','eli_nonce','eli_token','_wp_http_referer'))) continue;
178 179
179 180 if(filter_var($value, FILTER_VALIDATE_URL ) || strpos( $value, 'http' ) !== FALSE) {
181 + // Dynamic field values are registered in the translation catalog separately.
182 +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
180 183 $note .= '<b> '.__(str_replace('_',' ', ucfirst($key)), 'wpdirectorykit').':</b> <a href="'.esc_url($value).'">'.$value.'</a><br>';
181 184 } else {
185 + // Dynamic field values are registered in the translation catalog separately.
186 +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
182 187 $note .= '<b> '.__(str_replace('_',' ', ucfirst($key)), 'wpdirectorykit').':</b> '.$value.'<br>';
183 188 }
184 189 }
185 190
@@ -217,9 +222,9 @@
217 222 wp_update_user( array ('ID' => $user_id, 'display_name' => esc_html( $username ) ) );
218 223
219 224 $userdata = get_userdata($user_id);
220 225
221 - $subject = __('New user on our website!', 'wdk-membership');
226 + $subject = __('New user on our website!', 'wpdirectorykit');
222 227 $data_message = array();
223 228 $data_message['login'] = $userlogin;
224 229 $data_message['password'] = $password;
225 230 $data_message['user'] = $userdata;
@@ -234,8 +239,9 @@
234 239 wp_set_auth_cookie($user_id);
235 240
236 241 } elseif($user = get_user_by( 'email', $email_address)) {
237 242 $user_id = $user->ID;
243 + /* translators: 1: User email address. */
238 244 $errors .= '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'.wdk_sprintf(__( 'For Booking required login, user with email %1$s already exists, please first try login', 'wpdirectorykit' ), $email_address).' <a href="'.wdk_login_url().'" target="_blank" style="text-decoration: underline;">'.esc_html__('here', 'wpdirectorykit').'</a></div>';
239 245 } else {
240 246 $errors .= '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'.esc_html__('For Booking please login', 'wpdirectorykit').' <a href="'.wdk_login_url().'" target="_blank" style="text-decoration: underline;">'.esc_html__('here', 'wpdirectorykit').'</div>';
241 247 }
@@ -295,10 +301,10 @@
295 301 '6'=>__('Saturday', 'wpdirectorykit'),
296 302 '7'=>__('Sunday', 'wpdirectorykit'),
297 303 );
298 304
299 - $day_num_from = date('N', strtotime($date_from));
300 - $day_num_to = date('N', strtotime($date_to));
305 + $day_num_from = gmdate('N', strtotime($date_from));
306 + $day_num_to = gmdate('N', strtotime($date_to));
301 307
302 308 if(wmvc_show_data('changeover_day', $price_reservation, false, TRUE, TRUE) && (
303 309 wmvc_show_data('changeover_day', $price_reservation, false, TRUE, TRUE) != $day_num_from
304 310 || wmvc_show_data('changeover_day', $price_reservation, false, TRUE, TRUE) != $day_num_to
@@ -313,9 +319,11 @@
313 319 $period = '';
314 320 $min_hours = intval(wmvc_show_data('min_hours', $price_reservation, false, TRUE, TRUE));
315 321 if((int)($min_hours/24) >= 1) {
316 322 $days = (int)($min_hours/24);
317 - $period .= esc_html(sprintf(_nx(
323 + $period .= esc_html(sprintf(
324 + /* translators: 1: Number of days. */
325 + _nx(
318 326 '%1$s day',
319 327 '%1$s days',
320 328 $days,
321 329 'days',
@@ -325,9 +333,11 @@
325 333 $min_hours -= $days * 24;
326 334 }
327 335
328 336 if(!empty($min_hours)) {
329 - $period .= ' '.esc_html(sprintf(_nx(
337 + $period .= ' '.esc_html(sprintf(
338 + /* translators: 1: Number of hours. */
339 + _nx(
330 340 '%1$s hour',
331 341 '%1$s hours',
332 342 (int)($min_hours),
333 343 'hours',
@@ -342,9 +352,11 @@
342 352 $period = '';
343 353 $max_hours = intval(wmvc_show_data('max_hours', $price_reservation, false, TRUE, TRUE));
344 354 if((int)($max_hours/24) >= 1) {
345 355 $days = (int)($max_hours/24);
346 - $period .= esc_html(sprintf(_nx(
356 + $period .= esc_html(sprintf(
357 + /* translators: 1: Number of days. */
358 + _nx(
347 359 '%1$s day',
348 360 '%1$s days',
349 361 $days,
350 362 'days',
@@ -354,9 +366,11 @@
354 366 $max_hours -= $days * 24;
355 367 }
356 368
357 369 if(!empty($max_hours)) {
358 - $period .= ' '.esc_html(sprintf(_nx(
370 + $period .= ' '.esc_html(sprintf(
371 + /* translators: 1: Number of hours. */
372 + _nx(
359 373 '%1$s hour',
360 374 '%1$s hours',
361 375 (int)($max_hours),
362 376 'hours',
@@ -384,10 +398,10 @@
384 398 } );
385 399 } else {
386 400
387 401 if(wmvc_show_data('is_hour_enabled', $calendar, false) && !empty($data['date_from']) && !empty($data['date_to'])) {
388 - $data['date_from'] = date('Y-m-d 00:00:00', strtotime($data['date_from']));
389 - $data['date_to'] = date('Y-m-d 00:00:00', strtotime($data['date_to']));
402 + $data['date_from'] = gmdate('Y-m-d 00:00:00', strtotime($data['date_from']));
403 + $data['date_to'] = gmdate('Y-m-d 00:00:00', strtotime($data['date_to']));
390 404 }
391 405 $insert_id = $Winter_MVC_wdk_bookings->reservation_m->insert($data, NULL);
392 406
393 407 /* auto is_enable_noapprovements enabled */
@@ -490,9 +504,9 @@
490 504 if(wdk_get_option(('wdk_bookings_time_for_payment'))) {
491 505 $data_message['hours_for_payment'] = intval(wdk_get_option(('wdk_bookings_time_for_payment')));
492 506
493 507 /* set date_expire for reservation */
494 - $update_data = array('date_expire'=>esc_sql(date("Y-m-d H:i:s", strtotime("+".intval(wdk_get_option(('wdk_bookings_time_for_payment')))." hours"))));
508 + $update_data = array('date_expire'=>esc_sql(gmdate("Y-m-d H:i:s", strtotime("+".intval(wdk_get_option(('wdk_bookings_time_for_payment')))." hours"))));
495 509 $Winter_MVC_wdk_bookings->reservation_m->insert($update_data, $insert_id);
496 510 }
497 511
498 512 wdk_mail(wdk_show_data('user_email', $data_message['user'], '' , TRUE, TRUE), __('Reservation waiting for payment', 'wpdirectorykit'), $data_message, 'reservation_user_payment_notify');
@@ -562,9 +576,9 @@
562 576
563 577 $ret = wdk_mail(wdk_show_data('user_email', $data_message['user'], '' , TRUE, TRUE), __('Reservation approved, waiting for payment', 'wpdirectorykit'), $data_message, 'reservation_approved_visitor');
564 578
565 579 $ret = wdk_mail(wdk_show_data('user_email', $data_message['user_owner'], '' , TRUE, TRUE), __('New Reservation approved, please confirm as paid when you receive payment', 'wpdirectorykit'), $data_message, 'reservation_approved_owner');
566 - $ret =false;
580 +
567 581 if( $ret) {
568 582 add_filter( 'eli/ajax-handler/filter_output', function($filter_output) {
569 583 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-success" role="alert">'.esc_html__('Reservation sent, please check your email with payment details', 'wpdirectorykit').'</div>';
570 584 return $filter_output;
@@ -573,8 +587,9 @@
573 587 else
574 588 {
575 589 add_filter( 'eli/ajax-handler/filter_output', function($filter_output) {
576 590 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'. sprintf(
591 + /* translators: 1: Tag with link open, 2: close link tag. */
577 592 esc_html__('Server can\'t send emails, please use SMTP mail configuration. Check %1$sGuide%2$s', 'wpdirectorykit'),
578 593 '<a href="https://wpdirectorykit.com/e-mail-sending-issues-smtp-mail-configuration/" target="_blank" style="text-decoration: underline">',
579 594 '</a>'
580 595 ).'</div>';
@@ -664,9 +679,9 @@
664 679 $ret = wdk_mail( $owner_email, __('New Reservation Waiting For Approvement', 'wpdirectorykit'), $data_message, 'reservation_waiting_for_approve_owner');
665 680
666 681 /* waiting approve to client */
667 682 $ret = wdk_mail(wdk_show_data('user_email', $user_client, '' , TRUE, TRUE), __('Your reservation waiting approvement by owner', 'wpdirectorykit'), $data_message, 'reservation_waiting_for_approve_visitor');
668 - $ret =false;
683 +
669 684 if( $ret) {
670 685 add_filter( 'eli/ajax-handler/filter_output', function($filter_output){
671 686 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-success" role="alert">'.esc_html__('Thanks on reservation, after owner approvement you will receive details for payment', 'wpdirectorykit').'</div>';
672 687 return $filter_output;
@@ -675,8 +690,9 @@
675 690 else
676 691 {
677 692 add_filter( 'eli/ajax-handler/filter_output', function($filter_output) {
678 693 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'. sprintf(
694 + /* translators: 1: Tag with link open, 2: close link tag. */
679 695 esc_html__('Server can\'t send emails, please use SMTP mail configuration. Check %1$sGuide%2$s', 'wpdirectorykit'),
680 696 '<a href="https://wpdirectorykit.com/e-mail-sending-issues-smtp-mail-configuration/" target="_blank" style="text-decoration: underline">',
681 697 '</a>'
682 698 ).'</div>';
@@ -715,10 +731,14 @@
715 731
716 732 if(empty($value)) continue;
717 733
718 734 if(filter_var($value, FILTER_VALIDATE_URL ) || strpos( $value, 'http' ) !== FALSE) {
735 + // Dynamic field values are registered in the translation catalog separately.
736 +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
719 737 $data_mess []= '<p><strong>'.__(str_replace('_',' ', ucfirst($key)), 'wpdirectorykit').':</strong> <a href="'.esc_url($value).'">'.$value.'</a></p>';
720 738 } else {
739 + // Dynamic field values are registered in the translation catalog separately.
740 +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
721 741 $data_mess []= '<p><strong>'.__(str_replace('_',' ', ucfirst($key)), 'wpdirectorykit').':</strong> '.$value.'</p>';
722 742 }
723 743 }
724 744
@@ -785,9 +805,9 @@
785 805 $owner_email = $user_owner->user_email;
786 806 }
787 807
788 808 $ret = wdk_mail($owner_email, $message_title, $data_message, 'new_message', '', NULL, $email);
789 - $ret =false;
809 +
790 810 if( $ret) {
791 811 add_filter( 'eli/ajax-handler/filter_output', function($filter_output){
792 812 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-success" role="alert">'.esc_html__('Thanks for the message.', 'wpdirectorykit').'</div>';
793 813 return $filter_output;
@@ -803,8 +823,9 @@
803 823 {
804 824 add_filter( 'eli/ajax-handler/filter_output', function($filter_output) {
805 825 $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'.
806 826 sprintf(
827 + /* translators: 1: Tag with link open, 2: close link tag. */
807 828 esc_html__('Server can\'t send emails, please use SMTP mail configuration. Check %1$sGuide%2$s', 'wpdirectorykit'),
808 829 '<a href="https://wpdirectorykit.com/e-mail-sending-issues-smtp-mail-configuration/" target="_blank" style="text-decoration: underline">',
809 830 '</a>'
810 831 )