-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
54 lines (45 loc) · 986 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Blog</title>
<style>
body { margin: 30px; }
</style>
</head>
<body>
<?php
require('Blogfu.php');
$B = new Blogfu();
$B->mark('start');
if ($B->uriExists()) {
if ($B->isValidRequest()) {
$entry = $B->getEntry();
echo "<h1>{$entry->title}</h1>";
echo "<h5>{$entry->date}</h5>";
// Run the blog post through Parsedown
require('Parsedown.php');
$Parsedown = new Parsedown();
echo $Parsedown->text($entry->body);
}
else {
echo '404';
}
}
else {
// Show a list of blog post titles
foreach ($B->getTitles() as $row) {
echo "<p>";
echo "<a href='example.php/{$row->filename}'>{$row->title}</a>";
echo " - ";
echo $row->date;
echo "</p>";
}
}
$B->mark('end');
echo '<p>Elapsed Time: ';
echo $B->elapsedTime('start', 'end');
echo '</p>';
?>
</body>
</html>