From 5a6906f710e9333507486df3cbb545a67a040881 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 24 May 2026 02:26:17 +0000
Subject: [PATCH] =Minor changes to email.php, which had info for Legacy and edmonton.ink hardcoded in it. Added a colours.php and JVB_COLOURS constant to define our base, contrast, action, and secondary colours for use within php templates
---
inc/managers/EmailManager.php | 39 ++++++++++++++++++++++++++++++++++-----
1 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/inc/managers/EmailManager.php b/inc/managers/EmailManager.php
index f1c7e33..e480a06 100644
--- a/inc/managers/EmailManager.php
+++ b/inc/managers/EmailManager.php
@@ -24,7 +24,7 @@
class EmailManager
{
- public array $colours = JVB_EMAIL['colours'];
+ public array $colours;
private string $title = JVB_EMAIL['content']['title'];
private string $prefix = JVB_EMAIL['content']['subjectPrefix'];
private string $signature = JVB_EMAIL['content']['signature'];
@@ -42,7 +42,7 @@
$this->site_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$this->site_url = get_site_url();
$this->footer = (is_array(JVB_EMAIL['content']['footer'])) ? implode('', JVB_EMAIL['content']['footer']) : JVB_EMAIL['content']['footer'];
-
+ $this->colours = JVB_COLOURS;
add_filter('wp_mail_content_type', [$this, 'setHtmlContentType']);
// User registration emails
add_filter('wp_new_user_notification_email', [$this, 'customizeNewUserEmail'], 999, 3);
@@ -756,11 +756,35 @@
);
}
- public function grid(array $items, int $columns = 2):string
+ public function grid(array $items, int $columns = 2, string $title = '', string|array $description = '', string $after = ''):string
{
$width = floor(100 / $columns) - 2; // 2% gap
- $html = '<div style="display:table;width:100%;margin:20px 0;">';
+ $html = '';
+ if (!empty($title) || !empty($description)) {
+ $html .= '<div>';
+ if (!empty($title)) {
+ $html .= sprintf(
+ '<h2>%s</h2>',
+ $title
+ );
+ }
+ if (!empty($description)) {
+ if (is_string($description)) {
+ if (str_starts_with($description, '<p>')) {
+ $html .= $description;
+ }else {
+ $html .= sprintf(
+ '<p>%s</p>',
+ $description
+ );
+ }
+ } else {
+ $html .= implode('',array_map(function ($p) { return sprintf('<p>%s</p>', $p); }, $description));
+ }
+ }
+ }
+ $html .= '<div style="display:table;width:100%;margin:20px 0;">';
foreach ($items as $index => $item) {
if ($index > 0 && $index % $columns === 0) {
$html .= '</div><div style="display:table;width:100%;margin:20px 0;">';
@@ -771,11 +795,16 @@
$item
);
}
- $html .= '</div>';
+ $html .= '</div>'.$after;
+
+ if (!empty($title) || !empty($description)) {
+ $html .= '</div>';
+ }
return $html;
}
+
public function image(string $src, string $alt = '', int $maxWidth = 600):string
{
return sprintf(
--
Gitblit v1.10.0