Plugin-System; Neuigkeiten und Termine als mitgelieferte Plugins

- Plugins nach WordPress-Prinzip: plugin.json-Manifest mit Versions- und
  Abhängigkeitsprüfung, eigenes PSR-4-Autoloading, register()/boot(),
  activate()/deactivate()/uninstall(), Migrationen, Routen und Views je Plugin
- plugins-core/ (mitgeliefert, aktiv bis zur Deaktivierung) und plugins/
  (Kunden-Plugins, geschützt vor Updates, inaktiv bis zur Aktivierung)
- Zustand in storage/app/plugins.json – Laden ohne Datenbankabfrage
- Wiederherstellungsmodus: Ausnahmen und Fatal Errors beim Laden
  deaktivieren das Plugin, das Portal bleibt erreichbar
- Hooks (Actions/Filter mit Prioritäten) und Registries für Navigation,
  Startseiten-Kacheln, Rechte und Admin-Seiten (Filament-Discovery)
- Admin-Seite „Plugins“: aktivieren, deaktivieren, per ZIP installieren
  (ZIP-Slip-Schutz), löschen mit oder ohne Daten; abschaltbar per
  INHAUS_DISALLOW_FILE_MODS
- Startseite komplett aus Kacheln; Plugin-Seiten als „slug::Seite“
- Version 0.3.0

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 07:06:16 +00:00
parent cc0020458f
commit 28ef1e4a20
155 changed files with 2762 additions and 573 deletions

View file

@ -1,86 +0,0 @@
<?php
namespace App\Support;
use App\Models\Event;
use Illuminate\Support\Str;
/**
* iCalendar-Export (RFC 5545) für einzelne Termine – zum Übernehmen in Outlook & Co.
*/
class Calendar
{
public function toIcs(Event $event, string $organizer): string
{
$end = $event->ends_at ?? ($event->all_day ? $event->starts_at : $event->starts_at->copy()->addHour());
$lines = [
'BEGIN:VCALENDAR',
'VERSION:2.0',
'PRODID:-//'.$this->escape($organizer).'//Inhaus//DE',
'CALSCALE:GREGORIAN',
'METHOD:PUBLISH',
'BEGIN:VEVENT',
'UID:event-'.$event->id.'@'.(parse_url(config('app.url'), PHP_URL_HOST) ?: 'inhaus'),
'DTSTAMP:'.now()->utc()->format('Ymd\THis\Z'),
];
if ($event->all_day) {
$lines[] = 'DTSTART;VALUE=DATE:'.$event->starts_at->format('Ymd');
// DTEND ist bei ganztägigen Terminen exklusiv: der Tag nach dem letzten Tag.
$lines[] = 'DTEND;VALUE=DATE:'.$end->copy()->startOfDay()->addDay()->format('Ymd');
} else {
$lines[] = 'DTSTART:'.$event->starts_at->copy()->utc()->format('Ymd\THis\Z');
$lines[] = 'DTEND:'.$end->copy()->utc()->format('Ymd\THis\Z');
}
$lines[] = 'SUMMARY:'.$this->escape($event->title);
if ($event->location) {
$lines[] = 'LOCATION:'.$this->escape($event->location);
}
$description = trim(html_entity_decode(strip_tags(str_replace(['</p>', '<br>'], "\n", (string) $event->description_html))));
if ($description !== '') {
$lines[] = 'DESCRIPTION:'.$this->escape(Str::limit($description, 2000));
}
if ($event->online_url) {
$lines[] = 'URL:'.$this->escape($event->online_url);
}
$lines[] = 'END:VEVENT';
$lines[] = 'END:VCALENDAR';
return implode("\r\n", array_map($this->fold(...), $lines))."\r\n";
}
private function escape(string $value): string
{
return str_replace(['\\', ';', ',', "\r\n", "\n"], ['\\\\', '\;', '\\,', '\\n', '\\n'], $value);
}
/**
* Zeilen nach 75 Oktetts umbrechen (Folgezeilen beginnen mit einem Leerzeichen,
* das mitzählt), ohne UTF-8-Zeichen zu zerschneiden.
*/
private function fold(string $line): string
{
$folded = '';
$current = '';
$limit = 75;
foreach (mb_str_split($line) as $char) {
if (strlen($current.$char) > $limit) {
$folded .= $current."\r\n ";
$current = '';
$limit = 74;
}
$current .= $char;
}
return $folded.$current;
}
}