Improve article fetching logic in index.php by adding a check for DOMElement instances. Clean up newsletter HTML by removing outdated text and logo image for a more streamlined presentation.

This commit is contained in:
smueller
2026-07-07 10:47:11 +02:00
parent ecd7d2b341
commit 65ea9f6e30

View File

@@ -170,6 +170,10 @@ function fetchLatestArticles(string $wikiUrl, int $limit = 150): array
$nodes = $xpath->query('//li'); $nodes = $xpath->query('//li');
foreach ($nodes as $li) { foreach ($nodes as $li) {
if (!$li instanceof DOMElement) {
continue;
}
$text = trim(preg_replace('/\s+/', ' ', $li->textContent ?? '')); $text = trim(preg_replace('/\s+/', ' ', $li->textContent ?? ''));
if (!preg_match('/\((\d{2}\.\d{2}\.\d{4})\)/', $text, $dateMatch)) { if (!preg_match('/\((\d{2}\.\d{2}\.\d{4})\)/', $text, $dateMatch)) {
@@ -443,16 +447,6 @@ function buildNewsletterHtml(array $config, array $articles, string $periodLabel
<tr> <tr>
<td align="center" style="padding:12px 8px;"> <td align="center" style="padding:12px 8px;">
<table role="presentation" width="690" border="0" cellspacing="0" cellpadding="0" class="email-container" style="width:100%;max-width:690px;background:#ffffff;"> <table role="presentation" width="690" border="0" cellspacing="0" cellpadding="0" class="email-container" style="width:100%;max-width:690px;background:#ffffff;">
<tr>
<td align="center" style="padding:10px 26px 7px 26px;font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:16px;color:#4e5561;">
Sollte diese E-Mail nicht einwandfrei dargestellt werden, klicken Sie bitte hier.
</td>
</tr>
<tr>
<td align="center" style="padding:8px 26px 14px 26px;">
<img src="https://www.thomas-krenn.com/res/pics/tk_logo_340px.png" width="170" alt="Thomas-Krenn Logo" style="display:block;margin:0 auto;border:0;outline:none;text-decoration:none;height:auto;">
</td>
</tr>
<tr> <tr>
<td style="padding:0 26px;" class="mobile-padding"> <td style="padding:0 26px;" class="mobile-padding">
<table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" style="width:100%;background:#10233a;"> <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0" style="width:100%;background:#10233a;">