| @@ -1,69 +1,110 @@ | ||
| 1 | 1 | <?php |
| 2 | - $staff_name = $this->staff->get_display_name(); | |
| 3 | - $customer_name = $this->customer->get_display_name(); | |
| 4 | - $customer_email = $this->customer->get_email(); | |
| 5 | - $title = $this->get_title(); | |
| 6 | - $description = $this->meeting->get_description(); | |
| 7 | - $location = $this->booking->get_location(); | |
| 8 | - $location_type = $this->booking->get_location_type(); | |
| 2 | +defined( 'ABSPATH' ) || exit; | |
| 9 | 3 | |
| 10 | - $event = $this->booking->get_event(); | |
| 11 | - $join_link = 'google-meet' === $location_type && ! empty( $event['hangoutLink'] ) ? $event['hangoutLink'] : ''; | |
| 12 | - $timezone = $event ? $event['start']['timeZone'] : ''; | |
| 13 | - $timestr = $event ? strtotime( $event['start']['dateTime'] ) : ''; | |
| 4 | + $timetics_staff_name = $this->staff->get_display_name(); | |
| 5 | + $timetics_customer_name = $this->customer->get_display_name(); | |
| 6 | + $timetics_customer_email = $this->customer->get_email(); | |
| 7 | + $timetics_title = $this->get_title(); | |
| 8 | + $timetics_description = $this->meeting->get_description(); | |
| 9 | + $timetics_location = $this->booking->get_location(); | |
| 10 | + $timetics_location_type = $this->booking->get_location_type(); | |
| 14 | 11 | |
| 15 | - $day = gmdate( 'l', strtotime( $this->booking->get_start_date() ) ); | |
| 16 | - $time = gmdate( 'h:i a', strtotime( $this->booking->get_start_time() ) ); | |
| 17 | - $date = gmdate( 'd F Y', strtotime( $this->booking->get_start_date() ) ); | |
| 12 | + $timetics_event = $this->booking->get_event(); | |
| 13 | + $timetics_join_link = 'google-meet' === $timetics_location_type && ! empty( $timetics_event['hangoutLink'] ) ? $timetics_event['hangoutLink'] : ''; | |
| 14 | + $timetics_timezone = $timetics_event ? $timetics_event['start']['timeZone'] : ''; | |
| 15 | + $timetics_timestr = $timetics_event ? strtotime( $timetics_event['start']['dateTime'] ) : ''; | |
| 18 | 16 | |
| 19 | - $email_body = timetics_get_option( 'booking_canceled_host_email_body' ); | |
| 20 | - $email_title = timetics_get_option( 'booking_canceled_host_email_title' ); | |
| 21 | - $email_title = ! empty( $email_title ) ? $email_title : $this->get_title(); | |
| 17 | + // Use WordPress date and time format settings | |
| 18 | + $timetics_formatted = timetics_format_email_datetime( $this->booking->get_start_date(), $this->booking->get_start_time() ); | |
| 19 | + $timetics_day = $timetics_formatted['day']; | |
| 20 | + $timetics_time = $timetics_formatted['time']; | |
| 21 | + $timetics_date = $timetics_formatted['date']; | |
| 22 | 22 | |
| 23 | - $placeholders = [ | |
| 24 | - '{%meeting_title%}' => $this->meeting->name, | |
| 25 | - '{%meeting_date%}' => $date, | |
| 26 | - '{%meeting_time%}' => $time, | |
| 27 | - '{%meeting_location%}' => $location, | |
| 28 | - '{%meeting_duration%}' => $this->meeting->duration, | |
| 29 | - '{%host_name%}' => $staff_name, | |
| 23 | + $timetics_email_body = timetics_get_option( 'booking_canceled_host_email_body' ); | |
| 24 | + $timetics_email_title = timetics_get_option( 'booking_canceled_host_email_title' ); | |
| 25 | + $timetics_email_title = ! empty( $timetics_email_title ) ? $timetics_email_title : $this->get_title(); | |
| 26 | + | |
| 27 | + $timetics_placeholders = [ | |
| 28 | + '{%meeting_title%}' => $this->meeting->get_name(), | |
| 29 | + '{%meeting_date%}' => $timetics_date, | |
| 30 | + '{%meeting_time%}' => $timetics_time, | |
| 31 | + '{%meeting_location%}' => $timetics_location, | |
| 32 | + '{%meeting_duration%}' => $this->meeting->get_duration(), | |
| 33 | + '{%host_name%}' => $timetics_staff_name, | |
| 30 | 34 | '{%host_email%}' => $this->staff->get_email(), |
| 31 | - '{%customer_name%}' => $customer_name, | |
| 32 | - '{%customer_email%}' => $customer_email, | |
| 35 | + '{%customer_name%}' => $timetics_customer_name, | |
| 36 | + '{%customer_email%}' => $timetics_customer_email, | |
| 33 | 37 | ]; |
| 34 | 38 | ?> |
| 35 | 39 | |
| 36 | -<main class="email-wrapper"> | |
| 37 | - <div class="email-title"><h3><?php echo esc_html( timetics_replace_placeholder( $email_title, $placeholders ) ); ?></h3></div> | |
| 40 | +<main 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;"> | |
| 41 | + <div style="max-width: 600px; margin: 0 auto;"> | |
| 42 | + <div class="email-content" style="padding: 40px; background-color: #ffffff; border-radius: 0 0 12px 12px; border-top: 4px solid #3161F1; margin-bottom: 40px;"> | |
| 43 | + <?php do_action('timetics_email_header') ;?> | |
| 44 | + <div class="email-title"> | |
| 45 | + <h3 style="color: #3161F1; font-size: 24px; font-weight: 600; margin: 30px 0;"> | |
| 46 | + <?php echo esc_html( timetics_replace_placeholder( $timetics_email_title, $timetics_placeholders ) ); ?> | |
| 47 | + </h3> | |
| 48 | + </div> | |
| 38 | 49 | |
| 39 | - <div class="email-content"> | |
| 40 | - <?php if ( $email_body ): ?> | |
| 41 | - <?php echo timetics_replace_placeholder( $email_body, $placeholders ); ?> | |
| 42 | - <?php else: ?> | |
| 43 | - <p class="greeting"> | |
| 44 | - <?php printf( esc_html__( 'Hi %s', 'timetics' ), esc_html( $staff_name ) );?> | |
| 45 | - </p> | |
| 46 | - <p><?php esc_attr_e( 'Meeting has been canceled', 'timetics' );?></p> | |
| 47 | - <p> | |
| 48 | - <?php printf( '%s %s', esc_html__( 'Invitee:', 'timetics' ), esc_html( $customer_name ) );?> | |
| 49 | - <br> | |
| 50 | - <?php printf( '%s %s', esc_html__( 'Invitee Email:', 'timetics' ), esc_html( $customer_email ) );?> | |
| 51 | - </p> | |
| 52 | - <p> | |
| 53 | - <?php printf( esc_html__( 'Meeting Date/Time: %s - %s, %s %s', 'timetics' ), esc_html( $time ), esc_html( $day ), esc_html( $date ), esc_html( $timezone ) );?> | |
| 54 | - </p> | |
| 55 | - <p> | |
| 56 | - <?php printf( '%s %s', esc_html__( 'Description:', 'timetics' ), esc_html( $description ) );?> | |
| 57 | - </p> | |
| 50 | + <?php if ( $timetics_email_body ): ?> | |
| 51 | + <?php echo wp_kses( timetics_replace_placeholder( $timetics_email_body, $timetics_placeholders ), 'post' ); ?> | |
| 52 | + <?php else: ?> | |
| 53 | + <p class="greeting" style="color: #556880; margin-bottom: 5px"> | |
| 54 | + <?php | |
| 55 | + /* translators: %s: Recipient name */ | |
| 56 | + printf( esc_html__( 'Hi %s,', 'timetics' ), esc_html( $timetics_staff_name ) );?> | |
| 57 | + </p> | |
| 58 | 58 | |
| 59 | - <?php if ( 'virtual' === $location_type && $join_link ): ?> | |
| 60 | - <p><?php esc_html_e( 'Location: This is a Google Meet web conference.', 'timetics' );?> | |
| 61 | - </p> | |
| 62 | - <span><a href="<?php echo esc_url( $join_link ); ?>"><?php esc_html_e( 'Join Now', 'timetics' );?></a></span> | |
| 63 | - <?php endif;?> | |
| 64 | - <p> | |
| 65 | - <?php printf( '%s %s', esc_html__( 'Invitee Time Zone:', 'timetics' ), esc_html( $timezone ) );?> | |
| 66 | - </p> | |
| 67 | - <?php endif;?> | |
| 59 | + <p style="color: #556880; margin-bottom: 5px"><?php esc_attr_e( 'Meeting has been canceled', 'timetics' );?></p> | |
| 60 | + | |
| 61 | + <div class="data-wrapper" style="border: 1px solid #E2ECF4; border-radius: 12px; padding: 30px; margin: 24px 0;"> | |
| 62 | + <div class="single-data-entry" style="margin: 0 0 20px;"> | |
| 63 | + <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> | |
| 64 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> | |
| 65 | + <?php echo esc_html( timetics_replace_placeholder( $timetics_email_title, $timetics_placeholders ) ); ?> | |
| 66 | + </p> | |
| 67 | + | |
| 68 | + </div> | |
| 69 | + <div class="single-data-entry" style="margin: 0 0 20px;"> | |
| 70 | + <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"><?php echo esc_html__( 'Invitee:', 'timetics' ); ?></p> | |
| 71 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> | |
| 72 | + <?php echo esc_html( $timetics_customer_name );?> - | |
| 73 | + <a style="color: #3161F1" href="mailto:<?php echo esc_attr( $timetics_customer_email )?>"><?php echo esc_html( $timetics_customer_email ); ?></a> | |
| 74 | + </p> | |
| 75 | + </div> | |
| 76 | + | |
| 77 | + <div class="single-data-entry" style="margin: 10px 0 20px;"> | |
| 78 | + <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> | |
| 79 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php | |
| 80 | + /* translators: 1: Time, 2: Day, 3: Date */ | |
| 81 | + printf( esc_html__( '%1$s, %2$s %3$s', 'timetics' ), esc_html( $timetics_time ), esc_html( $timetics_day ), esc_html( $timetics_date ), esc_html( $timetics_timezone ) );?></p> | |
| 82 | + </div> | |
| 83 | + | |
| 84 | + <?php if ( 'google-meet' === $timetics_location_type && $timetics_join_link ): ?> | |
| 85 | + <div class="single-data-entry" style="margin: 10px 0 20px;"> | |
| 86 | + <p style="font-weight: 600; font-size: 14px; line-height: 1; color: #0C274A; margin: 0 0 5px;"> | |
| 87 | + <?php esc_html_e( 'Location:', 'timetics' );?> | |
| 88 | + </p> | |
| 89 | + <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"> | |
| 90 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"> | |
| 91 | + <?php echo esc_html__('Joining link:', 'timetics') ;?> | |
| 92 | + <a style="color: #3161F1" href="<?php echo esc_url( $timetics_join_link ); ?>"><?php echo esc_url( $timetics_join_link ); ?></a> | |
| 93 | + </p> | |
| 94 | + </div> | |
| 95 | + <?php endif;?> | |
| 96 | + | |
| 97 | + <?php if($timetics_timezone) :?> | |
| 98 | + <div class="single-data-entry" style="margin: 10px 0 20px;"> | |
| 99 | + <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> | |
| 100 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php echo esc_html( $timetics_timezone ); ?></p> | |
| 101 | + </div> | |
| 102 | + <?php endif;?> | |
| 103 | + </div> | |
| 104 | + <?php endif;?> | |
| 105 | + | |
| 106 | + <p style="font-weight: 400; font-size: 14px; color: #556880; margin: 0;"><?php echo esc_html__('Thank you!', 'timetics'); ?></p> | |
| 107 | + </div> | |
| 108 | + <?php do_action('timetics_email_footer', $timetics_customer_email) ;?> | |
| 68 | 109 | </div> |
| 69 | -</main> | |
| 110 | +</main> | |