PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 1.32.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v1.32.0
2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.10.0 All 48 releases
thinkrank / templates / email-report / email.html.php

email.html.php in ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO 1.32.0, at templates/email-report/email.html.php

142 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Email Report Layout
4 *
5 * Receives a $payload array assembled by Email_Report_Renderer.
6 *
7 * Email-client safety notes:
8 * - Inline styles only — Gmail / Outlook / Apple Mail strip / partially
9 * support <style> blocks. Anything that must render reliably is inline.
10 * - Tables for outer layout — most reliable across clients (especially
11 * older Outlook versions).
12 * - The `additional_css` block (Pro-only) is injected as a <style> tag so
13 * advanced agencies can theme without us re-engineering inline rules
14 * every time. The PRD calls out that CSS support varies — that's their
15 * risk to take.
16 *
17 * @var array $payload
18 *
19 * @package ThinkRank
20 */
21
22 declare(strict_types=1);
23
24 // This file is included from Email_Report_Renderer, so its variables live in
25 // that method's scope, not the global one — the prefix sniff assumes file
26 // scope means global scope. The two unescaped echoes are the logo anchor and
27 // the section HTML, both assembled from esc_url()/esc_html() output above and
28 // in the section renderers; escaping them again would print entities in the
29 // email body.
30 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound, WordPress.Security.EscapeOutput.OutputNotEscaped
31
32 if (!defined('ABSPATH')) {
33 exit;
34 }
35
36 $payload = isset($payload) && is_array($payload) ? $payload : [];
37 $site_title = (string) ($payload['site_title'] ?? '');
38 $header_logo = (string) ($payload['header_logo'] ?? '');
39 $header_bg = (string) ($payload['header_bg'] ?? '');
40 $logo_link = (string) ($payload['logo_link'] ?? '');
41 $intro_text = (string) ($payload['intro_text'] ?? '');
42 $sections_html = (string) ($payload['sections_html'] ?? '');
43 $footer_text = (string) ($payload['footer_text'] ?? '');
44 $additional_css = (string) ($payload['additional_css'] ?? '');
45 $cta_url = (string) ($payload['cta_url'] ?? '');
46 $context = (array) ($payload['context'] ?? []);
47 $period_label = (string) ($context['period_label'] ?? '');
48 $is_test = !empty($context['is_test']);
49
50 $header_style = 'padding:24px;text-align:center;';
51 if ($header_bg !== '') {
52 $header_style .= 'background:' . $header_bg . ';';
53 } else {
54 $header_style .= 'background:#0f172a;';
55 }
56
57 $logo_img = $header_logo !== ''
58 ? '<img src="' . esc_url($header_logo) . '" alt="' . esc_attr($site_title) . '" style="max-height:48px;border:0;display:inline-block;" />'
59 : '<span style="font:700 22px/1 -apple-system,Segoe UI,Roboto,sans-serif;color:#ffffff;">'
60 . esc_html($site_title !== '' ? $site_title : 'ThinkRank')
61 . '</span>';
62
63 if ($logo_link !== '') {
64 $logo_img = '<a href="' . esc_url($logo_link) . '" style="text-decoration:none;color:#ffffff;">' . $logo_img . '</a>';
65 }
66 ?>
67 <!doctype html>
68 <html lang="<?php echo esc_attr(str_replace('_', '-', get_locale())); ?>">
69 <head>
70 <meta charset="UTF-8" />
71 <meta name="viewport" content="width=device-width,initial-scale=1" />
72 <title><?php echo esc_html($site_title); ?></title>
73 <?php if ($additional_css !== '') : ?>
74 <style type="text/css">
75 <?php echo esc_html($additional_css); ?>
76 </style>
77 <?php endif; ?>
78 </head>
79 <body style="margin:0;padding:0;background:#f4f4f5;-webkit-font-smoothing:antialiased;">
80 <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#f4f4f5;">
81 <tr>
82 <td align="center" style="padding:32px 12px;">
83
84 <?php if ($is_test) : ?>
85 <table role="presentation" width="640" cellpadding="0" cellspacing="0" style="max-width:640px;width:100%;margin:0 0 12px 0;">
86 <tr>
87 <td style="background:#fef3c7;color:#78350f;padding:10px 16px;border-radius:6px;font:500 13px/1.4 -apple-system,Segoe UI,Roboto,sans-serif;">
88 <?php esc_html_e('Test email — this is a preview triggered from the ThinkRank settings.', 'thinkrank'); ?>
89 </td>
90 </tr>
91 </table>
92 <?php endif; ?>
93
94 <table role="presentation" width="640" cellpadding="0" cellspacing="0" style="max-width:640px;width:100%;background:#ffffff;border-radius:12px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,0.08);">
95 <tr>
96 <td style="<?php echo esc_attr($header_style); ?>">
97 <?php echo $logo_img; // already escaped above ?>
98 <?php if ($period_label !== '') : ?>
99 <div style="margin-top:8px;color:rgba(255,255,255,0.85);font:500 13px/1.4 -apple-system,Segoe UI,Roboto,sans-serif;">
100 <?php echo esc_html($period_label); ?>
101 </div>
102 <?php endif; ?>
103 </td>
104 </tr>
105
106 <?php if ($intro_text !== '') : ?>
107 <tr>
108 <td style="padding:24px 24px 0 24px;font:400 15px/1.6 -apple-system,Segoe UI,Roboto,sans-serif;color:#374151;">
109 <?php echo wp_kses_post($intro_text); ?>
110 </td>
111 </tr>
112 <?php endif; ?>
113
114 <tr>
115 <td style="padding:24px;font:400 14px/1.6 -apple-system,Segoe UI,Roboto,sans-serif;color:#1f2937;">
116 <?php echo $sections_html; // sections render their own escaped HTML ?>
117 </td>
118 </tr>
119
120 <?php if ($cta_url !== '') : ?>
121 <tr>
122 <td align="center" style="padding:0 24px 28px 24px;">
123 <a href="<?php echo esc_url($cta_url); ?>" style="display:inline-block;background:#2563eb;color:#ffffff;text-decoration:none;font:600 14px/1 -apple-system,Segoe UI,Roboto,sans-serif;padding:12px 22px;border-radius:8px;">
124 <?php esc_html_e('View Full Report in Dashboard', 'thinkrank'); ?>
125 </a>
126 </td>
127 </tr>
128 <?php endif; ?>
129
130 <tr>
131 <td style="padding:18px 24px;background:#f9fafb;color:#6b7280;font:400 12px/1.5 -apple-system,Segoe UI,Roboto,sans-serif;text-align:center;border-top:1px solid #e5e7eb;">
132 <?php echo wp_kses_post($footer_text); ?>
133 </td>
134 </tr>
135 </table>
136
137 </td>
138 </tr>
139 </table>
140 </body>
141 </html>
142