| @@ -5,10 +5,10 @@ | ||
| 5 | 5 | * @category Menu |
| 6 | 6 | * @author wpdevelop |
| 7 | 7 | * |
| 8 | 8 | * @web-site https://wpbookingcalendar.com/ |
| 9 | - * @email info@wpbookingcalendar.com | |
| 10 | - * | |
| 9 | + * @email info@wpbookingcalendar.com | |
| 10 | + * | |
| 11 | 11 | * @modified 2015-04-09 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | - 'modification' |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | |
| 32 | -require_once( WPBC_PLUGIN_DIR . '/core/any/api-emails.php' ); // API | |
| 32 | +require_once WPBC_PLUGIN_DIR . '/core/any/api-emails.php'; // API | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | // <editor-fold defaultstate="collapsed" desc=" Import Old Data " > |
| @@ -171,20 +171,17 @@ | ||
| 171 | 171 | public function init_settings_fields() { |
| 172 | 172 | |
| 173 | 173 | $this->fields = array(); |
| 174 | 174 | |
| 175 | - $this->fields['enabled'] = array( | |
| 176 | - 'type' => 'checkbox' | |
| 177 | - , 'default' => 'On' | |
| 178 | - , 'title' => __('Enable / Disable', 'booking') | |
| 179 | - , 'label' => __('Enable this email notification', 'booking') | |
| 180 | - , 'description' => '' | |
| 181 | - , 'group' => 'general' | |
| 175 | + $this->fields['enabled'] = array( | |
| 176 | + 'type' => 'checkbox', | |
| 177 | + 'default' => 'On', | |
| 178 | + 'title' => __( 'Enable / Disable', 'booking' ), | |
| 179 | + 'label' => __( 'Enable this email notification', 'booking' ), | |
| 180 | + 'description' => '', | |
| 181 | + 'group' => 'general' | |
| 182 | + ); | |
| 182 | 183 | |
| 183 | - ); | |
| 184 | - | |
| 185 | - | |
| 186 | - | |
| 187 | 184 | $this->fields['copy_to_admin'] = array( |
| 188 | 185 | 'type' => 'checkbox' |
| 189 | 186 | , 'default' => 'Off' |
| 190 | 187 | , 'title' => __('Copy(ies)', 'booking') //FixIn: 8.1.2.17.1 |
| @@ -193,9 +190,9 @@ | ||
| 193 | 190 | , 'group' => 'general' |
| 194 | 191 | |
| 195 | 192 | ); |
| 196 | 193 | |
| 197 | -//FixIn: 8.1.2.17 | |
| 194 | +// FixIn: 8.1.2.17. | |
| 198 | 195 | $this->fields['to_html_prefix'] = array( |
| 199 | 196 | 'type' => 'pure_html' |
| 200 | 197 | , 'group' => 'general' |
| 201 | 198 | , 'html' => '<tr valign="top" class="wpbc_tr_copy_to_admin_to"> |
| @@ -329,15 +326,17 @@ | ||
| 329 | 326 | , 'only_field' => true |
| 330 | 327 | ); |
| 331 | 328 | $this->fields['subject_after'] = array( 'type' => 'pure_html', 'group' => 'general_content', |
| 332 | 329 | 'html' => '<p style="text-align: right;font-size:12px;">' |
| 333 | - . sprintf(__('Type your email %ssubject%s for the booking confirmation message.' ,'booking'),'<b>','</b>') . ' ' . __('Required', 'booking') | |
| 330 | + /* translators: 1: ... */ | |
| 331 | + . sprintf( __( 'Type your email %1$ssubject%2$s for the booking confirmation message.', 'booking' ),'<b>','</b>') . ' ' . __('Required', 'booking') | |
| 334 | 332 | . '.</p>' . '</td></tr>' ); |
| 335 | 333 | |
| 336 | 334 | $blg_title = get_option( 'blogname' ); |
| 337 | 335 | $blg_title = str_replace( array( '"', "'" ), '', $blg_title ); |
| 338 | 336 | |
| 339 | - $email_content = sprintf( __( 'Your booking %s for: %s has been canceled. %sThank you, %s', 'booking' ), '[bookingtype]', '[dates]', '<br/>[denyreason]<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]' ); | |
| 337 | + /* translators: 1: ... */ | |
| 338 | + $email_content = sprintf( __( 'Your booking %1$s for: %2$s has been canceled. %3$sThank you, %4$s', 'booking' ), '[bookingtype]', '[dates]', '<br/>[denyreason]<br/><br/>[content]<br/><br/>', $blg_title . '<br/>[siteurl]' ); | |
| 340 | 339 | |
| 341 | 340 | $this->fields['content_before'] = array( |
| 342 | 341 | 'type' => 'pure_html', |
| 343 | 342 | 'group' => 'general_content', |
| @@ -408,9 +407,10 @@ | ||
| 408 | 407 | ); |
| 409 | 408 | |
| 410 | 409 | $this->fields['template_file_help'] = array( |
| 411 | 410 | 'type' => 'help' |
| 412 | - , 'value' => array( sprintf( __('You can override this email template in this folder %s', 'booking') | |
| 411 | + /* translators: 1: ... */ | |
| 412 | + , 'value' => array( sprintf( __( 'You can override this email template in this folder %s', 'booking') | |
| 413 | 413 | , '<code>' . realpath( dirname(__FILE__) . '/../any/emails_tpl/' ) . '</code>' ) |
| 414 | 414 | ) |
| 415 | 415 | , 'cols' => 2 |
| 416 | 416 | , 'group' => 'style' |
| @@ -502,11 +502,12 @@ | ||
| 502 | 502 | , 'visitorbookingediturl' |
| 503 | 503 | //, 'visitorbookingslisting' //FixIn: 8.1.3.5.1 |
| 504 | 504 | , 'visitorbookingcancelurl' |
| 505 | 505 | , 'visitorbookingpayurl' |
| 506 | - , 'add_to_google_cal_button' //FixIn: 9.6.3.8 | |
| 506 | + , 'add_to_google_cal_button' // FixIn: 9.6.3.8. | |
| 507 | 507 | ); |
| 508 | - $email_example = sprintf(__('For example: "You have a new reservation %s on the following date(s): %s Contact information: %s You can approve or cancel this booking at: %s Thank you, Reservation service."' ,'booking'),'','[dates]<br/><br/>','<br/> [content]<br/><br/>', htmlentities( ' <a href="[moderatelink]">'.__('here' ,'booking').'</a> ') . '<br/><br/> '); | |
| 508 | + /* translators: 1: ... */ | |
| 509 | + $email_example = sprintf( __( 'For example: "You have a new reservation %1$s on the following date(s): %2$s Contact information: %3$s You can approve or cancel this booking at: %4$s Thank you, Reservation service."', 'booking' ),'','[dates]<br/><br/>','<br/> [content]<br/><br/>', htmlentities( ' <a href="[moderatelink]">'.__('here' ,'booking').'</a> ') . '<br/><br/> '); | |
| 509 | 510 | |
| 510 | 511 | $help_fields = wpbc_get_email_help_shortcodes( $skip_shortcodes, $email_example ); |
| 511 | 512 | |
| 512 | 513 | foreach ( $help_fields as $help_fields_key => $help_fields_value ) { |
| @@ -577,10 +578,10 @@ | ||
| 577 | 578 | |
| 578 | 579 | |
| 579 | 580 | $subtabs['deleted'] = array( |
| 580 | 581 | 'type' => 'subtab' // Required| Possible values: 'subtab' | 'separator' | 'button' | 'goto-link' | 'html' |
| 581 | - , 'title' => '<span>' . __( 'Deleted', 'booking' ) . $sufix . '</span>' // Title of TAB | |
| 582 | - , 'page_title' => __('Emails Settings', 'booking') // Title of Page | |
| 582 | + , 'title' => '<span>' . esc_html__( 'Deleted', 'booking' ) . $sufix . '</span>' // Title of TAB | |
| 583 | + , 'page_title' => __('Emails Settings', 'booking') . ' - <span>' . esc_html__( 'Deleted', 'booking' ) . $sufix . '</span>' // Title of Page. | |
| 583 | 584 | , 'hint' => __('Customization of email template, which is sent to Visitor after Cancellation of booking' ,'booking') //FixIn: 8.1.2.17.1 |
| 584 | 585 | , 'link' => '' // link |
| 585 | 586 | , 'position' => '' // 'left' || 'right' || '' |
| 586 | 587 | , 'css_classes' => '' // CSS class(es) |
| @@ -585,14 +586,13 @@ | ||
| 585 | 586 | , 'position' => '' // 'left' || 'right' || '' |
| 586 | 587 | , 'css_classes' => '' // CSS class(es) |
| 587 | 588 | //, 'icon' => 'http://.../icon.png' // Icon - link to the real PNG img |
| 588 | 589 | //, 'font_icon' => 'wpbc_icn_mail_outline' // CSS definition of Font Icon |
| 589 | - , 'header_font_icon' => 'wpbc_icn_mail_outline' // CSS definition of Font Icon //FixIn: 9.6.1.4 | |
| 590 | - , 'default' => false // Is this sub tab activated by default or not: true || false. | |
| 590 | + , 'default' => false // Is this sub tab activated by default or not: true || false. | |
| 591 | 591 | , 'disabled' => false // Is this sub tab deactivated: true || false. |
| 592 | 592 | , 'checkbox' => false // or definition array for specific checkbox: array( 'checked' => true, 'name' => 'feature1_active_status' ) //, 'checkbox' => array( 'checked' => $is_checked, 'name' => 'enabled_active_status' ) |
| 593 | 593 | , 'content' => 'content' // Function to load as conten of this TAB |
| 594 | - , 'is_use_left_navigation' => true | |
| 594 | + , 'font_icon' => 'wpbc_icn_close' | |
| 595 | 595 | , 'show_checked_icon' => true |
| 596 | 596 | , 'checked_data' => WPBC_EMAIL_NEW_ADMIN_PREFIX . WPBC_EMAIL_DELETED_ID // This is where we get content |
| 597 | 597 | ); |
| 598 | 598 | |
| @@ -640,13 +640,13 @@ | ||
| 640 | 640 | <div class="clear"></div> |
| 641 | 641 | |
| 642 | 642 | <span class="metabox-holder"> |
| 643 | 643 | |
| 644 | - <form name="<?php echo $submit_form_name; ?>" id="<?php echo $submit_form_name; ?>" action="" method="post" autocomplete="off"> | |
| 644 | + <form name="<?php echo esc_attr( $submit_form_name ); ?>" id="<?php echo esc_attr( $submit_form_name ); ?>" action="" method="post" autocomplete="off"> | |
| 645 | 645 | <?php |
| 646 | 646 | // N o n c e field, and key for checking S u b m i t |
| 647 | 647 | wp_nonce_field( 'wpbc_settings_page_' . $submit_form_name ); |
| 648 | - ?><input type="hidden" name="is_form_sbmitted_<?php echo $submit_form_name; ?>" id="is_form_sbmitted_<?php echo $submit_form_name; ?>" value="1" /> | |
| 648 | + ?><input type="hidden" name="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" id="is_form_sbmitted_<?php echo esc_attr( $submit_form_name ); ?>" value="1" /> | |
| 649 | 649 | |
| 650 | 650 | <div class="clear"></div> |
| 651 | 651 | <?php |
| 652 | 652 | |
| @@ -730,9 +730,9 @@ | ||
| 730 | 730 | |
| 731 | 731 | $init_fields_values = wpbc_import6_email__deleted__get_fields_array_for_activation(); |
| 732 | 732 | |
| 733 | 733 | // Get Value of first element - array of default or imported OLD data, because need only array of values without key - name of options for wp_options table |
| 734 | - $init_fields_values_temp = array_values( $init_fields_values ); //FixIn: 7.0.1.32 | |
| 734 | + $init_fields_values_temp = array_values( $init_fields_values ); // FixIn: 7.0.1.32. | |
| 735 | 735 | $init_fields_values = array_shift( $init_fields_values_temp ); |
| 736 | 736 | |
| 737 | 737 | |
| 738 | 738 | $this->mail_api( WPBC_EMAIL_DELETED_ID, $init_fields_values ); |
| @@ -741,16 +741,18 @@ | ||
| 741 | 741 | // ------------------------------------------------------------------------------------------------------------- |
| 742 | 742 | // Maybe Update Data |
| 743 | 743 | // ------------------------------------------------------------------------------------------------------------- |
| 744 | 744 | |
| 745 | - $submit_form_name = 'wpbc_emails_template'; // Define form name | |
| 745 | + // Define form name. | |
| 746 | + $submit_form_name = 'wpbc_emails_template'; | |
| 746 | 747 | |
| 747 | 748 | $this->mail_api()->validated_form_id = $submit_form_name; // Define ID of Form for ability to validate fields before submit. |
| 748 | 749 | |
| 750 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 749 | 751 | if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) { |
| 750 | 752 | |
| 751 | 753 | // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } |
| 752 | - $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page | |
| 754 | + $nonce_gen_time = check_admin_referer( 'wpbc_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page | |
| 753 | 755 | |
| 754 | 756 | // Save Changes |
| 755 | 757 | $this->update(); |
| 756 | 758 | } |
| @@ -819,9 +821,9 @@ | ||
| 819 | 821 | $js_script .= " jQuery('#deleted_from_name').parent().append('<div class=\'updated\' style=\'border-left-color:#ffb900;padding:5px 10px;\'>". esc_js(__('If empty then title defined as WordPress', 'booking' ))."</div>')"; |
| 820 | 822 | $js_script .= " }"; |
| 821 | 823 | $js_script .= " }); "; |
| 822 | 824 | |
| 823 | - //FixIn: 8.1.2.17 | |
| 825 | + // FixIn: 8.1.2.17. | |
| 824 | 826 | $js_script .= " jQuery('#deleted_copy_to_admin').on( 'change', function(){ "; |
| 825 | 827 | $js_script .= " if ( jQuery('#deleted_copy_to_admin').is(':checked') ) {"; |
| 826 | 828 | $js_script .= " jQuery('.wpbc_tr_copy_to_admin_to').show();"; |
| 827 | 829 | $js_script .= " } else { "; |
| @@ -861,49 +863,65 @@ | ||
| 861 | 863 | $replace = array(); |
| 862 | 864 | |
| 863 | 865 | // Resources /////////////////////////////////////////////////////////////// |
| 864 | 866 | $bk_title = wpbc_get_resource_title( $bktype ); |
| 867 | + $parent_resource_title = wpbc_get_parent_resource_title( $bktype ); // FixIn: 10.9.2.4. | |
| 865 | 868 | |
| 866 | 869 | // Dates /////////////////////////////////////////////////////////////////// |
| 867 | 870 | $my_dates4emeil = wpbc_db__get_sql_dates__in_booking__as_str( $booking_id ); |
| 868 | - if ( get_bk_option( 'booking_date_view_type' ) == 'short' ) | |
| 869 | - $my_dates_4_send = wpbc_get_dates_short_format( $my_dates4emeil ); | |
| 870 | - else | |
| 871 | - $my_dates_4_send = wpbc_get_dates_comma_string_localized( $my_dates4emeil ); | |
| 872 | - | |
| 873 | - $my_dates4emeil_check_in_out = explode(',', $my_dates4emeil ); | |
| 874 | 871 | |
| 875 | - $my_check_in_date = wpbc_get_dates_comma_string_localized( $my_dates4emeil_check_in_out[0] ); | |
| 876 | - $my_check_out_date = wpbc_get_dates_comma_string_localized( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] ); | |
| 877 | - //FixIn: 8.7.2.5 | |
| 878 | - $my_check_in_onlydate = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( date( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[0] ) ), 'Y-m-d 00:00:00' ) ); | |
| 879 | - $my_check_out_onlydate = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( date( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] ) ), 'Y-m-d 00:00:00' ) ); | |
| 872 | + $my_dates_4_send = ( 'short' === get_bk_option( 'booking_date_view_type' ) ) | |
| 873 | + ? wpbc_get_dates_short_format( $my_dates4emeil ) | |
| 874 | + : wpbc_get_dates_comma_string_localized( $my_dates4emeil ); | |
| 875 | + $my_dates4emeil_check_in_out = explode( ',', $my_dates4emeil ); | |
| 880 | 876 | |
| 881 | - $my_check_out_plus1day = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( date( 'Y-m-d H:i:s', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] . " +1 day" ) ), 'Y-m-d H:i:s' ) ) ; //FixIn: 6.0.1.11 | |
| 877 | + $my_check_in_date = wpbc_get_dates_comma_string_localized( $my_dates4emeil_check_in_out[0] ); | |
| 878 | + $my_check_out_date = wpbc_get_dates_comma_string_localized( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] ); | |
| 879 | + $my_check_in_onlydate = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[0] ) ), 'Y-m-d 00:00:00' ) ); // FixIn: 8.7.2.5. | |
| 880 | + $my_check_out_onlydate = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d 00:00:00', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] ) ), 'Y-m-d 00:00:00' ) ); | |
| 881 | + $my_check_out_plus1day = wpbc_get_dates_comma_string_localized( wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s', strtotime( $my_dates4emeil_check_in_out[ count( $my_dates4emeil_check_in_out ) - 1 ] . " +1 day" ) ), 'Y-m-d H:i:s' ) ); // FixIn: 6.0.1.11. | |
| 882 | 882 | |
| 883 | + // FixIn: 10.1.5.6. | |
| 884 | + $dates_only_arr = wpbc_get_only_dates__from_dates_ymd_his_csv__as_arr( $my_dates4emeil ); // -> '2023-10-09, 2023-10-09' | |
| 885 | + $dates_only_str = implode( ',', $dates_only_arr ); | |
| 886 | + $dates_only_str_formatted = ( 'short' === get_bk_option( 'booking_date_view_type' ) ) | |
| 887 | + ? wpbc_get_dates_short_format( $dates_only_str ) | |
| 888 | + : wpbc_get_dates_comma_string_localized( $dates_only_str ); | |
| 889 | + | |
| 883 | 890 | // Cost //////////////////////////////////////////////////////////////////// |
| 884 | - $booking_cost_digits_only = apply_bk_filter( 'get_booking_cost_from_db', '', $booking_id ); //FixIn: 9.2.3.1 | |
| 891 | + $booking_cost_digits_only = apply_bk_filter( 'get_booking_cost_from_db', '', $booking_id ); // FixIn: 9.2.3.1. | |
| 885 | 892 | $booking_cost = wpbc_get_cost_with_currency_for_user( $booking_cost_digits_only ); |
| 886 | 893 | // Other /////////////////////////////////////////////////////////////////// |
| 887 | 894 | $replace[ 'booking_id' ] = $booking_id; |
| 888 | 895 | $replace[ 'id' ] = $replace[ 'booking_id' ]; |
| 889 | 896 | $replace[ 'dates' ] = $my_dates_4_send; |
| 897 | + $replace[ 'only_dates' ] = $dates_only_str_formatted; | |
| 898 | + $replace[ 'dates_only' ] = $dates_only_str_formatted; | |
| 890 | 899 | $replace[ 'check_in_date' ] = $my_check_in_date; |
| 891 | 900 | $replace[ 'check_out_date' ] = $my_check_out_date; |
| 892 | - //FixIn: 8.7.2.5 | |
| 901 | + // FixIn: 8.7.2.5. | |
| 893 | 902 | $replace[ 'check_in_only_date' ] = $my_check_in_onlydate; |
| 894 | 903 | $replace[ 'check_out_only_date' ] = $my_check_out_onlydate; |
| 895 | 904 | |
| 896 | - $replace[ 'check_out_plus1day'] = $my_check_out_plus1day; //FixIn: 6.0.1.11 | |
| 897 | - $replace[ 'dates_count' ] = count( $my_dates4emeil_check_in_out ); | |
| 905 | + $replace[ 'check_out_plus1day'] = $my_check_out_plus1day; // FixIn: 6.0.1.11. | |
| 906 | + | |
| 907 | + $replace['dates_count'] = count( $my_dates4emeil_check_in_out ); | |
| 908 | + $replace['days_count'] = intval( $replace['dates_count'] ); // FixIn: 10.15.1.3. | |
| 909 | + $replace['nights_count'] = ( $replace['days_count'] > 1 ) ? intval( $replace['days_count'] - 1 ) : 1; | |
| 910 | + $replace['days_count_plus1day'] = intval( $replace['days_count'] + 1 ); | |
| 911 | + | |
| 912 | + | |
| 898 | 913 | $replace['cost'] = $booking_cost; |
| 899 | 914 | $replace['cost_digits_only'] = $booking_cost_digits_only; |
| 900 | - $replace[ 'siteurl' ] = htmlspecialchars_decode( '<a href="' . home_url() . '">' . home_url() . '</a>' ); | |
| 915 | + $replace[ 'siteurl' ] = htmlspecialchars_decode( '<a href="' . esc_url( home_url() ) . '">' . home_url() . '</a>' ); | |
| 901 | 916 | $replace[ 'resource_title'] = wpbc_lang( $bk_title ); |
| 917 | + $replace[ 'parent_resource_title'] = wpbc_lang( $parent_resource_title ); // FixIn: 10.9.2.4. | |
| 902 | 918 | $replace[ 'bookingtype' ] = $replace[ 'resource_title']; |
| 903 | - $replace[ 'remote_ip' ] = wpbc_get_user_ip(); //FixIn:7.1.2.4 // The IP address from which the user is viewing the current page. | |
| 904 | - $replace[ 'user_agent' ] = $_SERVER['HTTP_USER_AGENT']; // Contents of the User-Agent: header from the current request, if there is one. | |
| 905 | - $replace[ 'request_url' ] = ( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '' ); // The address of the page (if any) where action was occured. Because we are sending it in Ajax request, we need to use the REFERER HTTP | |
| 919 | + $replace[ 'remote_ip' ] = wpbc_get_user_ip(); //FixIn:7.1.2.4 // The IP address from which the user is viewing the current page. | |
| 920 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 921 | + $replace[ 'user_agent' ] = ( ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) : '' ); // Contents of the User-Agent: header from the current request, if there is one. | |
| 922 | + $server_http_referer_uri = ( ( isset( $_SERVER['HTTP_REFERER'] ) ) ? sanitize_text_field( $_SERVER['HTTP_REFERER'] ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash */ /* FixIn: sanitize_unslash */ | |
| 923 | + $replace['request_url'] = $server_http_referer_uri; // The address of the page (if any) where action was occured. Because we are sending it in Ajax request, we need to use the REFERER HTTP | |
| 906 | 924 | $replace[ 'current_date' ] = date_i18n( get_bk_option( 'booking_date_format' ) ); |
| 907 | 925 | $replace[ 'current_time' ] = date_i18n( get_bk_option( 'booking_time_format' ) ); |
| 908 | 926 | |
| 909 | 927 | // Form Fields ///////////////////////////////////////////////////////////// |
| @@ -918,10 +936,10 @@ | ||
| 918 | 936 | |
| 919 | 937 | // Links /////////////////////////////////////////////////////////////////// |
| 920 | 938 | $replace[ 'moderatelink' ] = htmlspecialchars_decode( |
| 921 | 939 | // '<a href="' . |
| 922 | - esc_url( wpbc_get_bookings_url() . '&view_mode=vm_listing&tab=actions&wh_booking_id=' . $booking_id ) | |
| 923 | - // . '">' . __('here', 'booking') . '</a>' | |
| 940 | + esc_url( wpbc_get_bookings_url() . '&tab=vm_booking_listing&wh_booking_id=' . $booking_id ) | |
| 941 | + // . '">' . esc_html__('here', 'booking') . '</a>' | |
| 924 | 942 | ); |
| 925 | 943 | $replace[ 'visitorbookingediturl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingediturl]', $booking_id ); |
| 926 | 944 | $replace[ 'visitorbookingslisting' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingslisting]', $booking_id ); //FixIn: 8.1.3.5.1 |
| 927 | 945 | $replace[ 'visitorbookingcancelurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingcancelurl]', $booking_id ); |
| @@ -927,11 +945,11 @@ | ||
| 927 | 945 | $replace[ 'visitorbookingcancelurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingcancelurl]', $booking_id ); |
| 928 | 946 | $replace[ 'visitorbookingpayurl' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[visitorbookingpayurl]', $booking_id ); |
| 929 | 947 | $replace[ 'bookinghash' ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '[bookinghash]', $booking_id ); |
| 930 | 948 | |
| 931 | - //////////////////////////////////////////////////////////////////////////// | |
| 949 | + // ----------------------------------------------------------------------------------------------------------------- | |
| 932 | 950 | // Get additional replace paramaters to the email shortcodes |
| 933 | - $replace = apply_filters( 'wpbc_replace_params_for_booking', $replace, $booking_id, $bktype, $formdata ); //FixIn: 8.0.1.7 | |
| 951 | + $replace = apply_filters( 'wpbc_replace_params_for_booking', $replace, $booking_id, $bktype, $formdata ); // FixIn: 8.0.1.7. | |
| 934 | 952 | |
| 935 | 953 | |
| 936 | 954 | return $replace; |
| 937 | 955 | |
| @@ -947,13 +965,13 @@ | ||
| 947 | 965 | * @param type $formdata - booking form data |
| 948 | 966 | */ |
| 949 | 967 | |
| 950 | 968 | function wpbc_send_email_deleted( $deleted_id_str, $is_send_emeils, $deletedreason = '' ) { |
| 951 | - | |
| 952 | - global $wpdb; | |
| 953 | - $sql = "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id IN ({$deleted_id_str})"; | |
| 954 | - $result = $wpdb->get_results( $sql ); | |
| 955 | 969 | |
| 970 | + global $wpdb; | |
| 971 | + $sql = "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id IN ({$deleted_id_str})"; | |
| 972 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 973 | + $result = $wpdb->get_results( $sql ); | |
| 956 | 974 | |
| 957 | 975 | foreach ( $result as $res ) { |
| 958 | 976 | |
| 959 | 977 | $booking_id = $res->booking_id; |
| @@ -980,9 +998,9 @@ | ||
| 980 | 998 | |
| 981 | 999 | $init_fields_values = wpbc_import6_email__deleted__get_fields_array_for_activation(); |
| 982 | 1000 | |
| 983 | 1001 | // Get Value of first element - array of default or imported OLD data, because need only array of values without key - name of options for wp_options table |
| 984 | - $init_fields_values_temp = array_values( $init_fields_values ); //FixIn: 7.0.1.32 | |
| 1002 | + $init_fields_values_temp = array_values( $init_fields_values ); // FixIn: 7.0.1.32. | |
| 985 | 1003 | $init_fields_values = array_shift( $init_fields_values_temp ); |
| 986 | 1004 | |
| 987 | 1005 | |
| 988 | 1006 | $mail_api = new WPBC_Emails_API_Deleted( WPBC_EMAIL_DELETED_ID, $init_fields_values ); |
| @@ -991,10 +1009,11 @@ | ||
| 991 | 1009 | |
| 992 | 1010 | if ( $mail_api->fields_values['enabled'] == 'Off' ) return false; // Email template deactivated - exit. |
| 993 | 1011 | |
| 994 | 1012 | |
| 995 | - $replace = wpbc__get_replace_shortcodes__email_deleted( $booking_id, $bktype, $formdata ); | |
| 996 | - $replace[ 'denyreason' ] = $deletedreason; //FixIn: 7.0.1.1 | |
| 1013 | + $replace = wpbc__get_replace_shortcodes__email_deleted( $booking_id, $bktype, $formdata ); | |
| 1014 | + $replace['denyreason'] = $deletedreason; // FixIn: 7.0.1.1. | |
| 1015 | + $replace['reason'] = $deletedreason; | |
| 997 | 1016 | |
| 998 | 1017 | // Replace shortcodes with custom URL parameter, like: 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl' |
| 999 | 1018 | foreach ( array( 'visitorbookingediturl', 'visitorbookingcancelurl', 'visitorbookingpayurl' , 'visitorbookingslisting' ) as $url_shortcode ) { //FixIn: 7.0.1.8 //FixIn: 8.1.3.5.1 |
| 1000 | 1019 | |
| @@ -1008,15 +1027,15 @@ | ||
| 1008 | 1027 | $pos = $shortcode_params['end']; |
| 1009 | 1028 | |
| 1010 | 1029 | $exist_replace = substr( $mail_api->fields_values['content'], $shortcode_params['start'], ( $shortcode_params['end'] - $shortcode_params['start'] ) ); |
| 1011 | 1030 | |
| 1012 | - $new_replace = $url_shortcode . rand(1000,9000); | |
| 1031 | + $new_replace = $url_shortcode . wp_rand(1000,9000); | |
| 1013 | 1032 | |
| 1014 | 1033 | $pos = $shortcode_params['start'] + strlen( $new_replace ); //FixIn: 9.7.3.5.1 |
| 1015 | 1034 | $mail_api->fields_values['content'] = str_replace( $exist_replace, $new_replace ,$mail_api->fields_values['content'] ); |
| 1016 | 1035 | |
| 1017 | 1036 | $replace[ $new_replace ] = apply_bk_filter( 'wpdev_booking_set_booking_edit_link_at_email', '['.$exist_replace.']', $booking_id ); |
| 1018 | - } else if ( //FixIn: 8.1.1.8 | |
| 1037 | + } else if ( // FixIn: 8.1.1.8. | |
| 1019 | 1038 | ( ! empty( $shortcode_params ) ) |
| 1020 | 1039 | && ( isset( $shortcode_params['end'] ) ) |
| 1021 | 1040 | && ( $shortcode_params['end'] < strlen( $mail_api->fields_values['content'] ) ) |
| 1022 | 1041 | ) { |
| @@ -1024,14 +1043,14 @@ | ||
| 1024 | 1043 | } else { |
| 1025 | 1044 | $shortcode_params = false; //FixIn: 7.0.1.58 |
| 1026 | 1045 | } |
| 1027 | 1046 | |
| 1028 | - } while ( ! empty( $shortcode_params ) ); //FixIn: 7.0.1.52 | |
| 1047 | + } while ( ! empty( $shortcode_params ) ); // FixIn: 7.0.1.52. | |
| 1029 | 1048 | |
| 1030 | 1049 | } |
| 1031 | 1050 | |
| 1032 | 1051 | $mail_api->set_replace( $replace ); |
| 1033 | - $mail_api->fields_values['from_name'] = $mail_api->replace_shortcodes( $mail_api->fields_values['from_name'] ); //FixIn: 7.0.1.29 | |
| 1052 | + $mail_api->fields_values['from_name'] = $mail_api->replace_shortcodes( $mail_api->fields_values['from_name'] ); // FixIn: 7.0.1.29. | |
| 1034 | 1053 | |
| 1035 | 1054 | |
| 1036 | 1055 | $to = ( isset( $replace['email'] ) ) ? $replace['email'] : ''; // Get To field |
| 1037 | 1056 | |
| @@ -1038,9 +1057,9 @@ | ||
| 1038 | 1057 | if ( ! empty( $replace['email'] ) ) { |
| 1039 | 1058 | $to = wpbc_email_prepand_person_name( $replace['email'], $replace ); |
| 1040 | 1059 | } |
| 1041 | 1060 | |
| 1042 | - $to = wpbc_check_for_several_emails_in_form( $to, $formdata, $bktype ); //FixIn: 6.0.1.9 | |
| 1061 | + $to = wpbc_check_for_several_emails_in_form( $to, $formdata, $bktype ); // FixIn: 6.0.1.9. | |
| 1043 | 1062 | |
| 1044 | 1063 | $to = str_replace( ';', ',', $to ); |
| 1045 | 1064 | |
| 1046 | 1065 | |