| @@ -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'); |
| @@ -572,9 +586,14 @@ | ||
| 572 | 586 | } |
| 573 | 587 | else |
| 574 | 588 | { |
| 575 | 589 | add_filter( 'eli/ajax-handler/filter_output', function($filter_output) { |
| 576 | - $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'.esc_html__('Server can\'t send emails, please use SMTP mail configuration.', 'wpdirectorykit').'</div>'; | |
| 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. */ | |
| 592 | + esc_html__('Server can\'t send emails, please use SMTP mail configuration. Check %1$sGuide%2$s', 'wpdirectorykit'), | |
| 593 | + '<a href="https://wpdirectorykit.com/e-mail-sending-issues-smtp-mail-configuration/" target="_blank" style="text-decoration: underline">', | |
| 594 | + '</a>' | |
| 595 | + ).'</div>'; | |
| 577 | 596 | $filter_output['no_clear_from'] = true; |
| 578 | 597 | return $filter_output; |
| 579 | 598 | } ); |
| 580 | 599 | } |
| @@ -660,9 +679,9 @@ | ||
| 660 | 679 | $ret = wdk_mail( $owner_email, __('New Reservation Waiting For Approvement', 'wpdirectorykit'), $data_message, 'reservation_waiting_for_approve_owner'); |
| 661 | 680 | |
| 662 | 681 | /* waiting approve to client */ |
| 663 | 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'); |
| 664 | - | |
| 683 | + | |
| 665 | 684 | if( $ret) { |
| 666 | 685 | add_filter( 'eli/ajax-handler/filter_output', function($filter_output){ |
| 667 | 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>'; |
| 668 | 687 | return $filter_output; |
| @@ -670,9 +689,14 @@ | ||
| 670 | 689 | } |
| 671 | 690 | else |
| 672 | 691 | { |
| 673 | 692 | add_filter( 'eli/ajax-handler/filter_output', function($filter_output) { |
| 674 | - $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'.esc_html__('Server can\'t send emails, please use SMTP mail configuration.', 'wpdirectorykit').'</div>'; | |
| 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. */ | |
| 695 | + esc_html__('Server can\'t send emails, please use SMTP mail configuration. Check %1$sGuide%2$s', 'wpdirectorykit'), | |
| 696 | + '<a href="https://wpdirectorykit.com/e-mail-sending-issues-smtp-mail-configuration/" target="_blank" style="text-decoration: underline">', | |
| 697 | + '</a>' | |
| 698 | + ).'</div>'; | |
| 675 | 699 | $filter_output['no_clear_from'] = true; |
| 676 | 700 | return $filter_output; |
| 677 | 701 | } ); |
| 678 | 702 | } |
| @@ -707,10 +731,14 @@ | ||
| 707 | 731 | |
| 708 | 732 | if(empty($value)) continue; |
| 709 | 733 | |
| 710 | 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 | |
| 711 | 737 | $data_mess []= '<p><strong>'.__(str_replace('_',' ', ucfirst($key)), 'wpdirectorykit').':</strong> <a href="'.esc_url($value).'">'.$value.'</a></p>'; |
| 712 | 738 | } else { |
| 739 | + // Dynamic field values are registered in the translation catalog separately. | |
| 740 | +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 713 | 741 | $data_mess []= '<p><strong>'.__(str_replace('_',' ', ucfirst($key)), 'wpdirectorykit').':</strong> '.$value.'</p>'; |
| 714 | 742 | } |
| 715 | 743 | } |
| 716 | 744 | |
| @@ -777,8 +805,9 @@ | ||
| 777 | 805 | $owner_email = $user_owner->user_email; |
| 778 | 806 | } |
| 779 | 807 | |
| 780 | 808 | $ret = wdk_mail($owner_email, $message_title, $data_message, 'new_message', '', NULL, $email); |
| 809 | + | |
| 781 | 810 | if( $ret) { |
| 782 | 811 | add_filter( 'eli/ajax-handler/filter_output', function($filter_output){ |
| 783 | 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>'; |
| 784 | 813 | return $filter_output; |
| @@ -792,9 +821,18 @@ | ||
| 792 | 821 | } |
| 793 | 822 | else |
| 794 | 823 | { |
| 795 | 824 | add_filter( 'eli/ajax-handler/filter_output', function($filter_output) { |
| 796 | - $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'.esc_html__('Server can\'t send emails, please use SMTP mail configuration.', 'wpdirectorykit').'</div>'; | |
| 825 | + $filter_output['message'] = '<div class="elementinvader_addons_for_elementor_alert elementinvader_addons_for_elementor_alert-danger" role="alert">'. | |
| 826 | + sprintf( | |
| 827 | + /* translators: 1: Tag with link open, 2: close link tag. */ | |
| 828 | + esc_html__('Server can\'t send emails, please use SMTP mail configuration. Check %1$sGuide%2$s', 'wpdirectorykit'), | |
| 829 | + '<a href="https://wpdirectorykit.com/e-mail-sending-issues-smtp-mail-configuration/" target="_blank" style="text-decoration: underline">', | |
| 830 | + '</a>' | |
| 831 | + ) | |
| 832 | + .'</div>'; | |
| 833 | + | |
| 834 | + | |
| 797 | 835 | $filter_output['success'] = false; |
| 798 | 836 | $filter_output['no_clear_from'] = true; |
| 799 | 837 | return $filter_output; |
| 800 | 838 | } ); |