| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template Name: Email stats block — Top wins + One thing to try. |
| 4 |
* |
| 5 |
* Expected variables (passed from Cartflows_Admin_Report_Emails::get_email_content()): |
| 6 |
* - $top_wins (array) Highlight bullets (empty on Free / no data). |
| 7 |
* - $weekly_tip (array) Rotating tip with 'headline' and 'body' keys. |
| 8 |
* |
| 9 |
* @package CartFlows |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
// Defensive defaults so the template renders without notices if a variable is missing. |
| 17 |
$top_wins = isset( $top_wins ) ? $top_wins : array(); |
| 18 |
$weekly_tip = isset( $weekly_tip ) ? $weekly_tip : array( |
| 19 |
'headline' => '', |
| 20 |
'body' => '', |
| 21 |
); |
| 22 |
?> |
| 23 |
|
| 24 |
<?php if ( ! empty( $top_wins ) ) : ?> |
| 25 |
<!-- Top wins & highlights --> |
| 26 |
<tr> |
| 27 |
<td class="px-lg modern-sans" style="padding:32px 40px 0 40px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif;"> |
| 28 |
<p style="margin:0; font-size:16px; font-weight:700; color:#0f172a; letter-spacing:-0.01em;"> |
| 29 |
<?php echo esc_html__( 'Top wins & highlights', 'cartflows' ); ?> |
| 30 |
</p> |
| 31 |
</td> |
| 32 |
</tr> |
| 33 |
<tr> |
| 34 |
<td class="px-lg modern-sans" style="padding:14px 40px 0 40px; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:14px; color:#334155; line-height:1.5;"> |
| 35 |
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 36 |
<?php |
| 37 |
$last_index = count( $top_wins ) - 1; |
| 38 |
foreach ( $top_wins as $index => $win ) : |
| 39 |
$label = isset( $win['label'] ) ? $win['label'] : ''; |
| 40 |
$detail = isset( $win['detail'] ) ? $win['detail'] : ''; |
| 41 |
$is_last = ( $index === $last_index ); |
| 42 |
$text_pad = $is_last ? '0' : '0 0 8px 0'; |
| 43 |
?> |
| 44 |
<tr> |
| 45 |
<td valign="middle" style="padding:0 6px 0 0;"> |
| 46 |
<span style="display:block; width:6px; height:6px; background-color:#f06434; border-radius:50%; line-height:6px; font-size:6px;"></span> |
| 47 |
</td> |
| 48 |
<td valign="middle" style="padding:<?php echo esc_attr( $text_pad ); ?>;"> |
| 49 |
<?php if ( '' !== $label ) : ?> |
| 50 |
<strong style="color:#0f172a;"><?php echo esc_html( $label ); ?></strong> |
| 51 |
<?php endif; ?> |
| 52 |
<?php echo wp_kses_post( $detail ); ?> |
| 53 |
</td> |
| 54 |
</tr> |
| 55 |
<?php endforeach; ?> |
| 56 |
</table> |
| 57 |
</td> |
| 58 |
</tr> |
| 59 |
<?php endif; ?> |
| 60 |
|
| 61 |
<?php if ( ! empty( $weekly_tip['headline'] ) ) : ?> |
| 62 |
<!-- One thing to try (callout card) --> |
| 63 |
<tr> |
| 64 |
<td class="px-lg" style="padding:32px 40px 0 40px;"> |
| 65 |
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color:#fff4eb; border-radius:12px;"> |
| 66 |
<tr> |
| 67 |
<td style="padding:24px 24px 24px 28px; border-left:3px solid #f06434; border-top-left-radius:12px; border-bottom-left-radius:12px;"> |
| 68 |
<p class="modern-sans" style="margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:11px; font-weight:700; color:#c2410c; text-transform:uppercase; letter-spacing:1.4px;"> |
| 69 |
<?php echo esc_html__( 'One thing to try this week', 'cartflows' ); ?> |
| 70 |
</p> |
| 71 |
<p class="modern-sans" style="margin:10px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:16px; font-weight:700; color:#0f172a; line-height:1.4; letter-spacing:-0.01em;"> |
| 72 |
<?php echo esc_html( $weekly_tip['headline'] ); ?> |
| 73 |
</p> |
| 74 |
<p class="modern-sans" style="margin:8px 0 0 0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif; font-size:14px; color:#475569; line-height:1.6;"> |
| 75 |
<?php echo wp_kses_post( $weekly_tip['body'] ); ?> |
| 76 |
</p> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
</table> |
| 80 |
</td> |
| 81 |
</tr> |
| 82 |
<?php endif; ?> |
| 83 |
|