### FeedWriter.php
lastUpdated));
$this->sendHeader();
}
$this->printTitle($title);
foreach($arrItems as $item) {
$this->printItem($item);
}
$this->printEnd();
}
protected function sendHeader() {
header("Content-Type: text/xml");
}
abstract protected function printItem($item);
abstract protected function printTitle($title);
abstract protected function printEnd();
}
### FeedWriterRssWriter.php
-
title; ?>
link; ?>
description; ?>
content; ?>
pubDate); ?>
guid; ?>
author; ?>
encoding . '"?>';
?>
title; ?>
link; ?>
description; ?>
de
lastUpdated); ?>
generator; ?>
title; ?>
link; ?>
imageURL; ?>
normal time change
$back = (boolean) ($currentMonth - 3) / 6;
$items = array();
for ($i = 0; $i < $numberOfPosts; ++$i) {
$year = (int) ($currentYear - ( $i / 2));
$lastChangeTime = getMeszShiftTime($year, $back);
if (!$back) {
$season = 'vor auf Sommer';
}
else {
$season = 'zurück auf Normal';
}
$description = 'Zeitumstellung '
. $season . 'zeit am ' . readableDate($lastChangeTime, $timezone);
if ($rss) {
$item = new FeedWriterItem();
$pubdate = $lastChangeTime - $prePublish;
$item->pubDate = $pubdate;
$item->description = $description;
$item->title = $item->description;
$item->content = $item->description;
$item->guid = URL . '&date=' . $lastChangeTime;
$item->link = URL;
$items[] = $item;
}
else {
echo $description, "\n";
}
$back = !$back;
}
if ($rss) {
$title = new FeedWriterTitle();
$title->generator = GENERATOR;
$title->lastUpdated = getMeszShiftTime($currentYear, $back) - $timezone;
$title->description = 'Sommer-/Normalzeitumstellungsbenachrichtigung';
$title->title = $title->description;
$title->link = URL;
$writer = new FeedWriterRssWriter();
$writer->main($items, $title);
}
function getMeszShiftTime($year, $back = false) {
if ($back) {
$month = 10;
}
else {
$month = 3;
}
//find last sunday in month
$lastDay = gmdate('w', gmmktime(0, 0, 0, $month, 31, $year, 0));
$day = 31 - $lastDay;
// in oct time changes at 3 oclock, not 2
$hours = 1 + (int) $back;
//return a timestamp
return gmmktime($hours, 00, 0, $month, $day, $year);
}
function readableDate($time, $timezone = -1) {
$time -= $timezone * 60 * 60;
return mb_convert_encoding(strftime('%A, dem %e. %B %Y', $time), 'utf-8') . ' um ' . gmdate('G:i', $time);
}