This repository has been archived by the owner on Oct 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
view-post.php
59 lines (45 loc) · 1.61 KB
/
view-post.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
55
56
57
58
<?php
require ("vendor/autoload.php");
use \Michelf\MarkdownExtra;
use Symfony\Component\Yaml\Yaml;
require("header.php");
require("menu.php");
$post = $_GET['post'];
$trueFile = false;
foreach (glob("posts/*.md") as $file) {
if ($file === 'posts/' .$post. ".md") {
$trueFile = true;
}
}
if (true === $trueFile) {
$postFile = __DIR__. '/posts/' .$post. '.md';
$fileContent = file_get_contents($postFile);
$reContent = "/\\+{3}.*?\\+{3}(.*?)$/s";
preg_match($reContent, $fileContent, $matchesContent);
$html = MarkdownExtra::defaultTransform($matchesContent[1]);
printf("<hr /> <h3><a href=\"posts.php\">Artigos</a></h3> %s", PHP_EOL);
echo $html;
}
?>
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//openbsdbr.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
<?php
require("footer.php");