| 1 |
<?php |
| 2 |
namespace NotificationX\Admin\Rating; |
| 3 |
|
| 4 |
class EmailTemplate |
| 5 |
{ |
| 6 |
public function template_body($data, $frequency) { |
| 7 |
$rating = $data['rating'] ?? 'N/A'; |
| 8 |
$review = $data['review'] ?? 'No review provided'; |
| 9 |
|
| 10 |
// Fetch Site Owner Info |
| 11 |
$site_name = get_bloginfo('name'); |
| 12 |
$site_url = get_site_url(); |
| 13 |
$admin_email = get_option('admin_email'); |
| 14 |
$wp_version = get_bloginfo('version'); |
| 15 |
|
| 16 |
$admin_user = get_user_by('ID', 1); |
| 17 |
if ($admin_user) { |
| 18 |
$first_name = get_user_meta($admin_user->ID, 'first_name', true); |
| 19 |
$last_name = get_user_meta($admin_user->ID, 'last_name', true); |
| 20 |
|
| 21 |
$admin_full_name = trim("$first_name $last_name"); |
| 22 |
|
| 23 |
// Fallback to display name if full name is not set |
| 24 |
if (empty($admin_full_name)) { |
| 25 |
$admin_full_name = $admin_user->display_name; |
| 26 |
} |
| 27 |
} else { |
| 28 |
$admin_full_name = 'Unknown'; |
| 29 |
} |
| 30 |
|
| 31 |
$emailTemplate = ' |
| 32 |
<!DOCTYPE html> |
| 33 |
<html lang="en"> |
| 34 |
<head> |
| 35 |
<meta charset="UTF-8"> |
| 36 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 37 |
<title>NotificationX Feedback Received</title> |
| 38 |
<link href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap" rel="stylesheet"> |
| 39 |
<style> |
| 40 |
@media (max-width: 600px) { |
| 41 |
.notificationx-email-container .notificationx-email-body { |
| 42 |
width: 100% !important; |
| 43 |
max-width: 100%; |
| 44 |
} |
| 45 |
} |
| 46 |
</style> |
| 47 |
</head> |
| 48 |
<body class="notificationx-email-wrapper" style="background-color: #f3f7fa; margin: 0; padding: 0"> |
| 49 |
<table class="notificationx-email-container" cellpadding="25" cellspacing="0" border="0" width="100%" align="center" |
| 50 |
bgcolor="#f3f7fa" style="background-color: #f3f7fa; margin: 0; padding: 25px 0 0"> |
| 51 |
<tbody> |
| 52 |
<tr> |
| 53 |
<td> |
| 54 |
<table width="540" cellpadding="0" cellspacing="0" border="0" class="notificationx-email-body" bgcolor="#fff" |
| 55 |
align="center" |
| 56 |
style="box-shadow: 0 0 15px rgba(0,0,0,0.15); width: 800px;border-radius: 10px; text-align: left"> |
| 57 |
<tbody> |
| 58 |
<tr> |
| 59 |
<td> |
| 60 |
<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" |
| 61 |
style="border-bottom: 1px solid #eee;"> |
| 62 |
<tbody> |
| 63 |
<tr> |
| 64 |
<td style="text-align: center; padding: 20px"> |
| 65 |
<a href="https://notificationx.com" target="_blank" |
| 66 |
style="text-align: center"> |
| 67 |
<img src="https://notificationx.com/wp-content/uploads/2025/02/NotificationX-300x80.png" alt="' . $site_name . ' Logo"> |
| 68 |
</a> |
| 69 |
</td> |
| 70 |
</tr> |
| 71 |
</tbody> |
| 72 |
</table> |
| 73 |
</td> |
| 74 |
</tr> |
| 75 |
<tr> |
| 76 |
<td> |
| 77 |
<table width="100%" cellpadding="0" cellspacing="0" align="center" border="0"> |
| 78 |
<tbody> |
| 79 |
<tr> |
| 80 |
<td style="text-align: center; padding: 20px 10px 10px"> |
| 81 |
<h3 style="font-size: 20px; font-weight: 700; font-family: Lato, sans-serif; color: #052d3d;"> |
| 82 |
Feedback Overview</h3> |
| 83 |
</td> |
| 84 |
</tr> |
| 85 |
|
| 86 |
<tr> |
| 87 |
<td> |
| 88 |
<table cellpadding="5" cellspacing="2" align="center" border="0" style="border: 1px solid #eee; margin-bottom: 20px; border-collapse: collapse; min-width: 75%"> |
| 89 |
<tr> |
| 90 |
<td colspan="2" style="border-bottom: 1px solid #eee; text-align:left; padding: 6px 15px;"> |
| 91 |
<strong style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;">Email:</strong> |
| 92 |
<a href="mailto:' . $admin_email . '">' . $admin_email . '</a> |
| 93 |
</td> |
| 94 |
</tr> |
| 95 |
<tr> |
| 96 |
<td style="border-bottom: 1px solid #eee; padding: 6px 15px"> |
| 97 |
<strong style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;">Rating:</strong> |
| 98 |
<span style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;"> |
| 99 |
' . $rating . ' ⭐ |
| 100 |
</span> |
| 101 |
</td> |
| 102 |
</tr> |
| 103 |
<tr> |
| 104 |
<td colspan="2" style="border-bottom: 1px solid #eee;text-align:left; padding: 6px 15px;"> |
| 105 |
<strong style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;">User:</strong> |
| 106 |
<a target="_blank">' . $admin_full_name . '</a> |
| 107 |
</td> |
| 108 |
</tr> |
| 109 |
<tr> |
| 110 |
<td colspan="2" style="border-bottom: 1px solid #eee;text-align:left; padding: 6px 15px;"> |
| 111 |
<strong style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;">Site URL:</strong> |
| 112 |
<a href="' . $site_url . '" target="_blank">' . $site_url . '</a> |
| 113 |
</td> |
| 114 |
</tr> |
| 115 |
<tr> |
| 116 |
<td colspan="2" style="text-align:left;padding: 6px 15px"> |
| 117 |
<strong style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;">Feedback:</strong> |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td colspan="2" style="border-bottom: 1px solid #eee;text-align: justify; padding: 8px 15px"> |
| 122 |
<span style="font-size: 16px; font-family: Lato, sans-serif; color: #052d3d;"> |
| 123 |
' . nl2br($review) . ' |
| 124 |
</span> |
| 125 |
</td> |
| 126 |
</tr> |
| 127 |
</table> |
| 128 |
</td> |
| 129 |
</tr> |
| 130 |
</tbody> |
| 131 |
</table> |
| 132 |
</td> |
| 133 |
</tr> |
| 134 |
</tbody> |
| 135 |
</table> |
| 136 |
</td> |
| 137 |
</tr> |
| 138 |
</tbody> |
| 139 |
</table> |
| 140 |
</body> |
| 141 |
</html>'; |
| 142 |
|
| 143 |
return $emailTemplate; |
| 144 |
} |
| 145 |
} |
| 146 |
|