{$title}
{$title}

{$description}

HTML; } $meta['title'] = $meta['title'] !== '' ? $meta['title'] : 'Home'; $meta['title'] ??= ucfirst(str_replace('/', '', $path)) ?: 'Home'; function extractMeta($directory) { $metaData = []; if (!is_dir($directory)) { throw new Exception("Directory not found: $directory"); } foreach (new DirectoryIterator($directory) as $file) { if ($file->isFile() && $file->getExtension() === 'md') { $contents = file_get_contents($file->getPathname()); // Extract title and image from the front matter if (preg_match('/^-{3,}\s*(.*?)\s*-{3,}/s', $contents, $matches)) { $frontMatter = $matches[1]; // Extract title preg_match('/title:\s*(.*?)\s*$/m', $frontMatter, $titleMatch); $title = trim($titleMatch[1] ?? ''); // Extract image preg_match('/image:\s*(.*?)\s*$/m', $frontMatter, $imageMatch); $image = trim($imageMatch[1] ?? ''); $metaData[$file->getFilename()] = [ 'title' => $title, 'image' => $image, ]; } } } return $metaData; } $file = '/path/to/your/file.txt'; if (file_exists($file)) { $modTime = filemtime($file); echo "Last modified: " . date(DATE_RFC2822, $modTime); } else { echo "File not found."; } echo realpath($_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME']); function render_meta($config, $core = [], $options = []) { // Default options $defaults = [ 'ogm' => false, 'twitter' => false, 'schema' => true, ]; // Merge provided options with defaults $options = array_merge($defaults, $options); // Example usage var_dump($options); } function compareDates($date1, $date2) { try { // Normalize both dates to the same format (ISO 8601) $normalized1 = (new DateTime($date1))->format('Y-m-d'); $normalized2 = (new DateTime($date2))->format('Y-m-d'); // Return comparison result return strcmp($normalized1, $normalized2); } catch (Exception $e) { // Handle invalid date formats trigger_error("Invalid date format: " . $e->getMessage(), E_USER_WARNING); return null; } }