'', 'url' => '', 'updated' => '']; $errors = []; $success = false; // Handle POST save if ($_SERVER['REQUEST_METHOD'] === 'POST') { $desc = trim($_POST['description'] ?? ''); $url = trim($_POST['url'] ?? ''); $updated = date('Y-m-d'); // Basic URL validation (allow empty) if ($url !== '' && !filter_var($url, FILTER_VALIDATE_URL)) { $errors[] = 'URL does not appear to be valid.'; } if (empty($errors)) { $export = var_export([ 'description' => $desc, 'url' => $url, 'updated' => $updated, ], true); $content = " $desc, 'url' => $url, 'updated' => $updated]; } else { $errors[] = 'Could not write vibe.php — check file permissions.'; } } } // Detect embed type for preview function admin_vibe_detect_type(string $url): string { if (empty($url)) return 'none'; $path = strtolower(parse_url($url, PHP_URL_PATH) ?? ''); $ext = pathinfo($path, PATHINFO_EXTENSION); $images = ['jpg','jpeg','png','gif','webp','bmp','svg','avif']; $videos = ['mp4','webm','ogv','mov']; $audio = ['mp3','flac','wav','ogg','aac','opus','m4a']; if (in_array($ext, $images)) return 'image'; if (in_array($ext, $videos)) return 'video'; if (in_array($ext, $audio)) return 'audio'; if (preg_match('/(?:youtube\.com\/watch\?.*v=|youtu\.be\/)([A-Za-z0-9_-]{11})/', $url, $m)) return 'youtube:' . $m[1]; if (preg_match('/vimeo\.com\/(\d+)/', $url, $m)) return 'vimeo:' . $m[1]; return 'link'; } $preview_type = admin_vibe_detect_type($vibe['url'] ?? ''); $safe_url = htmlspecialchars($vibe['url'] ?? '', ENT_QUOTES, 'UTF-8'); // Human-readable label for detected type function type_label(string $type): string { if ($type === 'none') return '—'; if ($type === 'image') return 'Image'; if ($type === 'video') return 'Video'; if ($type === 'audio') return 'Audio'; if ($type === 'link') return 'Plain link'; if (str_starts_with($type, 'youtube:')) return 'YouTube embed'; if (str_starts_with($type, 'vimeo:')) return 'Vimeo embed'; return 'Unknown'; } ?> Edit Current Vibe — SillyLaird
← Back to admin

Edit: My Current Vibe

✓ Saved successfully.

Detected type:

Last saved:

Current Preview

Vibe preview