rename to figfonts
This commit is contained in:
parent
411043718a
commit
95bb0c4910
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (isset($_GET["count"])) { // get number of taglines
|
||||
header("Content-Type: text/plain");
|
||||
$tags = new SplFileObject("../taglines.txt", "r");
|
||||
$tags->seek(PHP_INT_MAX);
|
||||
echo $tags->key();
|
||||
}
|
||||
|
||||
elseif (isset($_GET["key"])) { // get specified tagline (with bounds checking)
|
||||
header("Content-Type: text/plain");
|
||||
$tags = file("../taglines.txt");
|
||||
$i = intval($_GET["key"]);
|
||||
if (array_key_exists($i, $tags))
|
||||
echo $tags[$i];
|
||||
else
|
||||
die("$i not found");
|
||||
}
|
||||
|
||||
elseif (isset($_GET["fonts"])) { // get list of fonts
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode(array_map(function ($f) {
|
||||
return basename($f, ".flf");
|
||||
}, glob("fonts/*.flf")));
|
||||
}
|
||||
|
||||
elseif (isset($_GET["text"])) { // run figlet
|
||||
header("Content-Type: text/plain");
|
||||
echo shell_exec(
|
||||
"/usr/bin/figlet -d fonts -w 76 -f " .
|
||||
escapeshellarg($_GET["font"] ?? "standard") . " -- " .
|
||||
escapeshellarg($_GET["text"])
|
||||
);
|
||||
}
|
||||
|
||||
else { // get a random tagline
|
||||
header("Content-Type: text/plain");
|
||||
$tags = file("../taglines.txt");
|
||||
echo $tags[array_rand($tags)];
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue