'Facebook', 'instagram' => 'Instagram', 'linkedin' => 'LinkedIn', 'youtube' => 'YouTube', 'tiktok' => 'TikTok', 'x' => 'X', 'threads' => 'Threads', 'pinterest' => 'Pinterest', 'xing' => 'Xing', 'whatsapp' => 'WhatsApp', 'google' => 'Google-Unternehmensprofil', ]; /** Beispieladressen für die Eingabefelder. */ public const PLACEHOLDERS = [ 'facebook' => 'https://www.facebook.com/…', 'instagram' => 'https://www.instagram.com/…', 'linkedin' => 'https://www.linkedin.com/company/…', 'youtube' => 'https://www.youtube.com/@…', 'tiktok' => 'https://www.tiktok.com/@…', 'x' => 'https://x.com/…', 'threads' => 'https://www.threads.net/@…', 'pinterest' => 'https://www.pinterest.de/…', 'xing' => 'https://www.xing.com/pages/…', 'whatsapp' => 'https://wa.me/49…', 'google' => 'https://g.page/…', ]; public const SHAPES = ['plain' => 'Nur Symbol', 'circle' => 'Runde Fläche', 'square' => 'Eckige Fläche']; public const LAYOUTS = ['horizontal' => 'Nebeneinander', 'vertical' => 'Untereinander']; /** * Prüft die Eingabe der Einstellungen und gibt nur gefüllte, gültige Adressen zurück. * * @param mixed $input das Feld `social` des Formulars: Netzwerk → Adresse * * @return array * * @throws InvalidPage */ public static function clean(mixed $input): array { $profiles = []; foreach (self::NETWORKS as $key => $label) { $url = trim((string) (is_array($input) ? ($input[$key] ?? '') : '')); if ('' === $url) { continue; } if (strlen($url) > 400 || !str_starts_with($url, 'https://') || false === filter_var($url, FILTER_VALIDATE_URL) || 1 === preg_match('/[\s"<>\\\\]/', $url)) { throw new InvalidPage(sprintf('Die Adresse für %s muss mit https:// beginnen und eine gültige Adresse sein.', $label)); } $profiles[$key] = $url; } return $profiles; } }