Restore atom feed to last working version. Escape late.
This commit is contained in:
parent
0f0cfb5b22
commit
083250adc0
@ -90,7 +90,7 @@ class TickModel {
|
|||||||
$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
$lines = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
if (str_starts_with($line, $timestamp)) {
|
if (str_starts_with($line, $timestamp)) {
|
||||||
$tick = Util::escape_and_linkify(explode('|', $line)[1]);
|
$tick = explode('|', $line)[1];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'tickTime' => $tickTime,
|
'tickTime' => $tickTime,
|
||||||
|
@ -13,11 +13,11 @@ echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
|||||||
<title><?= "$siteTitle Atom Feed" ?></title>
|
<title><?= "$siteTitle Atom Feed" ?></title>
|
||||||
<link rel="self"
|
<link rel="self"
|
||||||
type="application/atom+xml"
|
type="application/atom+xml"
|
||||||
title="<?php echo htmlspecialchars($config->siteTitle, ENT_XML1, 'UTF-8') ?> Atom Feed"
|
title="<?php echo htmlspecialchars($config->siteTitle) ?> Atom Feed"
|
||||||
href="<?php echo htmlspecialchars($siteUrl . $basePath, ENT_XML1, 'UTF-8') ?>feed/atom">
|
href="<?php echo htmlspecialchars($siteUrl . $basePath) ?>feed/atom" />
|
||||||
<link rel="alternate" href="<?= $siteUrl . $basePath ?>">
|
<link rel="alternate" href="<?= $siteUrl ?>"/>
|
||||||
<updated><?= $updated ?></updated>
|
<updated><?= $updated ?></updated>
|
||||||
<id><?= $siteUrl . $basePath . 'feed/atom'?></id>
|
<id><?= $siteUrl ?></id>
|
||||||
<author>
|
<author>
|
||||||
<name><?= $siteTitle ?></name>
|
<name><?= $siteTitle ?></name>
|
||||||
</author>
|
</author>
|
||||||
@ -30,17 +30,16 @@ echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
|
|||||||
[$hour, $minute, $second] = $timeParts;
|
[$hour, $minute, $second] = $timeParts;
|
||||||
|
|
||||||
$tickPath = "$year/$month/$day/$hour/$minute/$second";
|
$tickPath = "$year/$month/$day/$hour/$minute/$second";
|
||||||
$tickUrl = htmlspecialchars($siteUrl . $basePath . "tick/$tickPath", ENT_XML1, 'UTF-8');
|
$tickUrl = htmlspecialchars($siteUrl . $basePath . "tick/$tickPath");
|
||||||
$tickTime = date(DATE_ATOM, strtotime($tick['timestamp']));
|
$tickTime = date(DATE_ATOM, strtotime($tick['timestamp']));
|
||||||
$tickTitle = htmlspecialchars($tick['tick'], ENT_XML1, 'UTF-8');
|
$tickText = htmlspecialchars($tick['tick']);
|
||||||
$tickContent = Util::escape_and_linkify($tick['tick'], ENT_XML1, false);
|
|
||||||
?>
|
?>
|
||||||
<entry>
|
<entry>
|
||||||
<title><?= $tickTitle ?></title>
|
<title><?= $tickText ?></title>
|
||||||
<link rel="alternate" type="text/html" href="<?= $tickUrl ?>"/>
|
<link href="<?= $tickUrl ?>"/>
|
||||||
<id><?= $tickUrl ?></id>
|
<id><?= $tickUrl ?></id>
|
||||||
<updated><?= $tickTime ?></updated>
|
<updated><?= $tickTime ?></updated>
|
||||||
<content type="html"><?= $tickContent ?></content>
|
<content type="html"><?= $tickText ?></content>
|
||||||
</entry>
|
</entry>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</feed>
|
</feed>
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
<?php /** @var Date $tickTime */ ?>
|
<?php /** @var Date $tickTime */ ?>
|
||||||
<?php /** @var string $tick */ ?>
|
<?php /** @var string $tick */ ?>
|
||||||
<h1>Tick from <?= $tickTime->format('Y-m-d H:i:s'); ?></h1>
|
<h1>Tick from <?= $tickTime->format('Y-m-d H:i:s'); ?></h1>
|
||||||
<p><?= $tick ?></p>
|
<p><?= Util::escape_and_linkify($tick) ?></p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user