| @@ -1,49 +1,68 @@ | ||
| 1 | 1 | <?php |
| 2 | - $staff_name = $this->staff->get_display_name(); | |
| 3 | - $staff_email = $this->staff->get_email(); | |
| 4 | - $customer_name = $this->customer->get_display_name(); | |
| 5 | - $customer_email = $this->customer->get_email(); | |
| 6 | - $title = $this->get_title(); | |
| 7 | - $description = $this->meeting->get_description(); | |
| 8 | - $location = $this->booking->get_location(); | |
| 9 | - $location_type = $this->booking->get_location_type(); | |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 10 | 3 | |
| 11 | - $event = $this->booking->get_event(); | |
| 12 | - $join_link = 'google-meet' === $location_type && ! empty( $event['hangoutLink'] ) ? $event['hangoutLink'] : ''; | |
| 4 | + $timetics_staff_name = $this->staff->get_display_name(); | |
| 5 | + $timetics_staff_email = $this->staff->get_email(); | |
| 6 | + $timetics_customer_name = $this->customer->get_display_name(); | |
| 7 | + $timetics_customer_email = $this->customer->get_email(); | |
| 8 | + $timetics_title = $this->get_title(); | |
| 9 | + $timetics_description = $this->meeting->get_description(); | |
| 10 | + $timetics_location = $this->booking->get_location(); | |
| 11 | + $timetics_location_type = $this->booking->get_location_type(); | |
| 13 | 12 | |
| 14 | - $timezone = $this->booking->get_timezone(); | |
| 15 | - $staff_timezone = $this->meeting->get_timezone(); | |
| 13 | + $timetics_event = $this->booking->get_event(); | |
| 14 | + $timetics_join_link = 'google-meet' === $timetics_location_type && ! empty( $timetics_event['hangoutLink'] ) ? $timetics_event['hangoutLink'] : ''; | |
| 16 | 15 | |
| 17 | - $dt = timetics_convert_timezone( $this->booking->get_start_date() . ' ' . $this->booking->get_start_time(), $timezone, $staff_timezone ); | |
| 16 | + $timetics_timezone = $this->booking->get_timezone(); | |
| 17 | + $timetics_staff_timezone = $this->meeting->get_timezone(); | |
| 18 | 18 | |
| 19 | - $day = $dt->format('l'); | |
| 20 | - $time = $dt->format('h:i a'); | |
| 21 | - $date = $dt->format('d F Y'); | |
| 19 | + $timetics_dt = timetics_convert_timezone( $this->booking->get_start_date() . ' ' . $this->booking->get_start_time(), $timetics_timezone, $timetics_staff_timezone ); | |
| 22 | 20 | |
| 23 | - $day = gmdate( 'l', strtotime( $this->booking->get_start_date() ) ); | |
| 24 | - $time = gmdate( 'h:i a', strtotime( $this->booking->get_start_time() ) ); | |
| 25 | - $date = gmdate( 'd F Y', strtotime( $this->booking->get_start_date() ) ); | |
| 21 | + // Use WordPress date and time format settings | |
| 22 | + $timetics_formatted = timetics_format_email_datetime( $this->booking->get_start_date(), $this->booking->get_start_time() ); | |
| 23 | + $timetics_day = $timetics_formatted['day']; | |
| 24 | + $timetics_time = $timetics_formatted['time']; | |
| 25 | + $timetics_date = $timetics_formatted['date']; | |
| 26 | 26 | |
| 27 | - $email_body = timetics_get_option( 'booking_created_customer_email_body' ); | |
| 28 | - $email_title = timetics_get_option( 'booking_created_customer_email_title' ); | |
| 29 | - $email_title = ! empty( $email_title ) ? $email_title : $this->get_title(); | |
| 27 | + $timetics_email_body = timetics_get_option( 'booking_created_customer_email_body' ); | |
| 28 | + $timetics_email_title = timetics_get_option( 'booking_created_customer_email_title' ); | |
| 29 | + $timetics_email_title = ! empty( $timetics_email_title ) ? $timetics_email_title : $this->get_title(); | |
| 30 | 30 | |
| 31 | - $meeting_id = $this->meeting->get_id(); | |
| 32 | - $booking_cancel_url = $this->meeting->get_appointment_permalink() . '?id=' . $this->booking->get_id() . '&meeting_id=' . $this->meeting->get_id() .'&booking_action=cancel'; | |
| 33 | - $booking_reschedule_url = $this->meeting->get_appointment_permalink() . '?id=' . $this->booking->get_id() . '&meeting_id=' . $this->meeting->get_id() . '&booking_action=reschedule'; | |
| 31 | + $timetics_meeting_id = $this->meeting->get_id(); | |
| 32 | + $timetics_booking_cancel_url = $this->meeting->get_appointment_permalink() . '?id=' . $this->booking->get_id() . '&meeting_id=' . $this->meeting->get_id() .'&booking_action=cancel'. '&appointment_token=' . $this->booking->get_security_token(); | |
| 33 | + $timetics_booking_reschedule_url = $this->meeting->get_appointment_permalink() . '?id=' . $this->booking->get_id() . '&meeting_id=' . $this->meeting->get_id() . '&booking_action=reschedule'. '&appointment_token='. $this->booking->get_security_token(); | |
| 34 | 34 | |
| 35 | + $timetics_login_url = wp_login_url(); | |
| 36 | + $timetics_login_username = $timetics_customer_email; | |
| 37 | + $timetics_set_password_url = ''; | |
| 35 | 38 | |
| 36 | - $placeholders = [ | |
| 37 | - '{%meeting_title%}' => $this->meeting->name, | |
| 38 | - '{%meeting_date%}' => $date, | |
| 39 | - '{%meeting_time%}' => $time, | |
| 40 | - '{%meeting_location%}' => $location, | |
| 41 | - '{%meeting_duration%}' => $this->meeting->duration, | |
| 42 | - '{%host_name%}' => $staff_name, | |
| 43 | - '{%host_email%}' => $this->staff->get_email(), | |
| 44 | - '{%customer_name%}' => $customer_name, | |
| 45 | - '{%customer_email%}' => $customer_email, | |
| 39 | + $timetics_customer_user = get_user_by( 'id', $this->customer->get_id() ); | |
| 40 | + | |
| 41 | + if ( $timetics_customer_user ) { | |
| 42 | + $timetics_reset_key = get_password_reset_key( $timetics_customer_user ); | |
| 43 | + | |
| 44 | + if ( ! is_wp_error( $timetics_reset_key ) ) { | |
| 45 | + $timetics_set_password_url = network_site_url( | |
| 46 | + 'wp-login.php?action=rp&key=' . $timetics_reset_key . '&login=' . rawurlencode( $timetics_customer_user->user_login ), | |
| 47 | + 'login' | |
| 48 | + ); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + $timetics_placeholders = [ | |
| 53 | + '{%meeting_title%}' => $this->meeting->get_name(), | |
| 54 | + '{%meeting_date%}' => $timetics_date, | |
| 55 | + '{%meeting_time%}' => $timetics_time, | |
| 56 | + '{%meeting_location%}' => $timetics_location, | |
| 57 | + '{%meeting_duration%}' => $this->meeting->get_duration(), | |
| 58 | + '{%host_name%}' => $timetics_staff_name, | |
| 59 | + '{%host_email%}' => $this->staff->get_email(), | |
| 60 | + '{%customer_name%}' => $timetics_customer_name, | |
| 61 | + '{%customer_email%}' => $timetics_customer_email, | |
| 62 | + '{%login_url%}' => $timetics_login_url, | |
| 63 | + '{%login_username%}' => $timetics_login_username, | |
| 64 | + '{%set_password_url%}' => $timetics_set_password_url, | |
| 46 | 65 | ]; |
| 47 | 66 | ?> |
| 48 | 67 | |
| 49 | 68 | <div class="email-wrapper" style="margin-bottom: 30px; background-color: #f4f5f7; font-family: -apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji', sans-serif;"> |
| @@ -51,15 +70,15 @@ | ||
| 51 | 70 | <div class="email-content" style="padding: 40px; background-color: #ffffff; border-radius: 0 0 12px 12px; border-top: 4px solid #3161F1; margin-bottom: 40px;"> |
| 52 | 71 | <?php do_action('timetics_email_header') ;?> |
| 53 | 72 | <div class="email-title"> |
| 54 | 73 | <h3 style="color: #3161F1; font-size: 24px; font-weight: 600; margin: 30px 0;"> |
| 55 | - <?php echo timetics_replace_placeholder( $email_title, $placeholders ); ?> | |
| 74 | + <?php echo wp_kses( timetics_replace_placeholder( $timetics_email_title, $timetics_placeholders ), 'post' ); ?> | |
| 56 | 75 | </h3> |
| 57 | 76 | </div> |
| 58 | - <?php if ( $email_body ): ?> | |
| 77 | + <?php if ( $timetics_email_body ): ?> | |
| 59 | 78 | |
| 60 | - <?php echo timetics_replace_placeholder( $email_body, $placeholders ); ?> | |
| 61 | - <?php if ( 'google-meet' === $location_type && $join_link ): ?> | |
| 79 | + <?php echo wp_kses( timetics_replace_placeholder( $timetics_email_body, $timetics_placeholders ), 'post' ); ?> | |
| 80 | + <?php if ( 'google-meet' === $timetics_location_type && $timetics_join_link ): ?> | |
| 62 | 81 | |
| 63 | 82 | <div class="single-data-entry" style="margin: 10px 0 20px;"> |
| 64 | 83 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"> |
| 65 | 84 | <?php esc_html_e( 'Location:', 'timetics' );?> |
| @@ -65,9 +84,9 @@ | ||
| 65 | 84 | <?php esc_html_e( 'Location:', 'timetics' );?> |
| 66 | 85 | </p> |
| 67 | 86 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> |
| 68 | 87 | <?php echo esc_html__('Joining link:', 'timetics') ;?> |
| 69 | - <a style="color: #3161F1" href="<?php echo esc_url( $join_link ); ?>"><?php echo esc_url( $join_link ); ?></a> | |
| 88 | + <a style="color: #3161F1" href="<?php echo esc_url( $timetics_join_link ); ?>"><?php echo esc_url( $timetics_join_link ); ?></a> | |
| 70 | 89 | </p> |
| 71 | 90 | </div> |
| 72 | 91 | |
| 73 | 92 | <?php else : ?> |
| @@ -76,9 +95,9 @@ | ||
| 76 | 95 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"> |
| 77 | 96 | <?php esc_html_e( 'Location:', 'timetics' );?> |
| 78 | 97 | </p> |
| 79 | 98 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> |
| 80 | - <?php echo esc_html( $location ) ;?> | |
| 99 | + <?php echo esc_html( $timetics_location ) ;?> | |
| 81 | 100 | </p> |
| 82 | 101 | </div> |
| 83 | 102 | |
| 84 | 103 | <?php endif;?> |
| @@ -86,9 +105,11 @@ | ||
| 86 | 105 | <?php do_action( 'timetics_new_event_email', $this->booking, 'customer' ); ?> |
| 87 | 106 | |
| 88 | 107 | <?php else: ?> |
| 89 | 108 | <p class="greeting" style="color: #556880; margin-bottom: 5px"> |
| 90 | - <?php printf( esc_html__( 'Hi %s,', 'timetics' ), esc_html( $customer_name ) );?> | |
| 109 | + <?php | |
| 110 | + /* translators: %s: Recipient name */ | |
| 111 | + printf( esc_html__( 'Hi %s,', 'timetics' ), esc_html( $timetics_customer_name ) );?> | |
| 91 | 112 | </p> |
| 92 | 113 | |
| 93 | 114 | <p style="color: #556880; margin-bottom: 5px"><?php esc_attr_e( 'A new meeting has been scheduled', 'timetics' );?></p> |
| 94 | 115 | |
| @@ -95,9 +116,9 @@ | ||
| 95 | 116 | <div class="data-wrapper" style="border: 1px solid #E2ECF4; border-radius: 12px; padding: 30px; margin: 24px 0;"> |
| 96 | 117 | <div class="single-data-entry" style="margin: 0 0 20px;"> |
| 97 | 118 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"><?php echo esc_html__( 'Meeting Name:', 'timetics' ); ?></p> |
| 98 | 119 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> |
| 99 | - <?php echo esc_html( timetics_replace_placeholder( $email_title, $placeholders ) ); ?> | |
| 120 | + <?php echo esc_html( timetics_replace_placeholder( $timetics_email_title, $timetics_placeholders ) ); ?> | |
| 100 | 121 | </p> |
| 101 | 122 | |
| 102 | 123 | </div> |
| 103 | 124 | <div class="single-data-entry" style="margin: 0 0 20px;"> |
| @@ -102,27 +123,29 @@ | ||
| 102 | 123 | </div> |
| 103 | 124 | <div class="single-data-entry" style="margin: 0 0 20px;"> |
| 104 | 125 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"><?php echo esc_html__( 'Organized By:', 'timetics' ); ?></p> |
| 105 | 126 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> |
| 106 | - <?php echo esc_html( $staff_name );?> - | |
| 107 | - <a style="color: #3161F1" href="mailto:<?php echo esc_attr( $staff_email )?>"><?php echo esc_html( $staff_email ); ?></a> | |
| 127 | + <?php echo esc_html( $timetics_staff_name );?> - | |
| 128 | + <a style="color: #3161F1" href="mailto:<?php echo esc_attr( $timetics_staff_email )?>"><?php echo esc_html( $timetics_staff_email ); ?></a> | |
| 108 | 129 | </p> |
| 109 | 130 | </div> |
| 110 | 131 | |
| 111 | 132 | <div class="single-data-entry" style="margin: 10px 0 20px;"> |
| 112 | 133 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"><?php echo esc_html__( 'Date and time:', 'timetics' ); ?></p> |
| 113 | - <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php printf( esc_html__( '%s, %s %s (%s)', 'timetics' ), esc_html( $time ), esc_html( $day ), esc_html( $date ), esc_html( $timezone ) );?></p> | |
| 134 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php | |
| 135 | + /* translators: 1: Time, 2: Day, 3: Date, 4: Timezone */ | |
| 136 | + printf( esc_html__( '%1$s, %2$s %3$s (%4$s)', 'timetics' ), esc_html( $timetics_time ), esc_html( $timetics_day ), esc_html( $timetics_date ), esc_html( $timetics_timezone ) );?></p> | |
| 114 | 137 | </div> |
| 115 | 138 | |
| 116 | - <?php if ( 'google-meet' === $location_type && $join_link ): ?> | |
| 139 | + <?php if ( 'google-meet' === $timetics_location_type && $timetics_join_link ): ?> | |
| 117 | 140 | <div class="single-data-entry" style="margin: 10px 0 20px;"> |
| 118 | 141 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"> |
| 119 | 142 | <?php esc_html_e( 'Location:', 'timetics' );?> |
| 120 | 143 | </p> |
| 121 | - <img width="110" style="margin: 5px 0;" src="https://arraytics.dev/social-icons/google-meet.png" alt="Google Meet"> | |
| 144 | + <img width="110" style="margin: 5px 0;" src="<?php echo esc_url( TIMETICS_PLUGIN_URL . 'assets/images/social-icons/google-meet.svg' ); ?>" alt="Google Meet"> | |
| 122 | 145 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> |
| 123 | 146 | <?php echo esc_html__('Joining link:', 'timetics') ;?> |
| 124 | - <a style="color: #3161F1" href="<?php echo esc_url( $join_link ); ?>"><?php echo esc_url( $join_link ); ?></a> | |
| 147 | + <a style="color: #3161F1" href="<?php echo esc_url( $timetics_join_link ); ?>"><?php echo esc_url( $timetics_join_link ); ?></a> | |
| 125 | 148 | </p> |
| 126 | 149 | </div> |
| 127 | 150 | <?php else : ?> |
| 128 | 151 | <div class="single-data-entry" style="margin: 10px 0 20px;"> |
| @@ -129,20 +152,23 @@ | ||
| 129 | 152 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"> |
| 130 | 153 | <?php esc_html_e( 'Location:', 'timetics' );?> |
| 131 | 154 | </p> |
| 132 | 155 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> |
| 133 | - <?php echo esc_html($location) ;?> | |
| 156 | + <?php echo esc_html($timetics_location) ;?> | |
| 134 | 157 | </p> |
| 135 | 158 | </div> |
| 136 | 159 | <?php endif;?> |
| 137 | 160 | |
| 138 | 161 | <?php do_action( 'timetics_new_event_email', $this->booking, 'customer' ); ?> |
| 139 | - <?php if($timezone) :?> | |
| 162 | + <?php if($timetics_timezone) :?> | |
| 140 | 163 | <div class="single-data-entry" style="margin: 10px 0 20px;"> |
| 141 | 164 | <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"><?php echo esc_html__( 'Invitee Time Zone:', 'timetics' ); ?></p> |
| 142 | - <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php echo esc_html( $timezone ); ?></p> | |
| 165 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php echo esc_html( $timetics_timezone ); ?></p> | |
| 143 | 166 | </div> |
| 144 | 167 | <?php endif;?> |
| 168 | + | |
| 169 | + <?php do_action( 'timetics_new_seats', $this->booking, 'customer' ); ?> | |
| 170 | + | |
| 145 | 171 | </div> |
| 146 | 172 | <?php endif;?> |
| 147 | 173 | |
| 148 | 174 | <p style="color: #556880; margin-bottom: 0; font-size: 15px; font-weight: 600; line-height: 1;"><?php echo esc_html__( 'Need to make changes to this meeting?', 'timetics' ); ?></p> |
| @@ -148,14 +174,14 @@ | ||
| 148 | 174 | <p style="color: #556880; margin-bottom: 0; font-size: 15px; font-weight: 600; line-height: 1;"><?php echo esc_html__( 'Need to make changes to this meeting?', 'timetics' ); ?></p> |
| 149 | 175 | <table cellspacing="0" cellpadding="0" border="0" style="margin: 35px 0 40px;"> |
| 150 | 176 | <tr> |
| 151 | 177 | <td style="padding-right: 10px;"> |
| 152 | - <a style="padding: 9px 11px 10px 11px; border-radius: 5px; font-weight: 600; font-size: 13px; border: 1px solid #D8DCE2; text-decoration: none; color: #3161F1; text-align: center; white-space: nowrap;" href="<?php echo esc_url( $booking_reschedule_url ); ?>"> | |
| 178 | + <a style="padding: 9px 11px 10px 11px; border-radius: 5px; font-weight: 600; font-size: 13px; border: 1px solid #D8DCE2; text-decoration: none; color: #3161F1; text-align: center; white-space: nowrap;" href="<?php echo esc_url( $timetics_booking_reschedule_url ); ?>"> | |
| 153 | 179 | <?php echo esc_html__( 'Reschedule', 'timetics' ); ?> |
| 154 | 180 | </a> |
| 155 | 181 | </td> |
| 156 | 182 | <td> |
| 157 | - <a style="padding: 9px 11px 10px 11px; border-radius: 5px; font-weight: 600; font-size: 13px; border: 1px solid #D8DCE2; text-decoration: none; color: #3161F1; text-align: center; white-space: nowrap;" href="<?php echo esc_url( $booking_cancel_url ); ?>"> | |
| 183 | + <a style="padding: 9px 11px 10px 11px; border-radius: 5px; font-weight: 600; font-size: 13px; border: 1px solid #D8DCE2; text-decoration: none; color: #3161F1; text-align: center; white-space: nowrap;" href="<?php echo esc_url( $timetics_booking_cancel_url ); ?>"> | |
| 158 | 184 | <?php echo esc_html__( 'Cancel', 'timetics' ); ?> |
| 159 | 185 | </a> |
| 160 | 186 | </td> |
| 161 | 187 | </tr> |
| @@ -161,7 +187,7 @@ | ||
| 161 | 187 | </tr> |
| 162 | 188 | </table> |
| 163 | 189 | <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php echo esc_html__('Thank you!', 'timetics'); ?></p> |
| 164 | 190 | </div> |
| 165 | - <?php do_action('timetics_email_footer', $customer_email) ;?> | |
| 191 | + <?php do_action('timetics_email_footer', $timetics_customer_email) ;?> | |
| 166 | 192 | </div> |
| 167 | -</div> | |
| 193 | +</div> | |