#!/usr/bin/env php trim($w, ".:;()[]{}'\"<>,/?"), array_slice($argv, 1) ); // Generate HTML title. $title = implode(' ', $title_words); $title = "

$title

\n\n"; // Generate post filename/URL. $filename = strtolower(implode('-', $title_words)); $date = date('Y-m-d'); $filename = "$date-$filename.php"; if (!$handle = fopen("./drafts/$filename", 'a')) { fwrite(STDERR, "Cannot append to file: $filename\n"); exit; } if (fwrite($handle, $title) === false) { fwrite(STDERR, "Cannot write contents to file: $filename\n"); exit; } printf("Created draft %s\n", $filename);