BootstrapSQLiteBlog/lib/PostRender.php

69 lines
2.5 KiB
PHP

<?php
class PostRender
{
public static function rows($varRows)
{
$varUser = UserAuth::getUser();
$varParsedown = new Parsedown();
$intRenderedRows = 0;
?>
<style>
<?php
echo Settings::get(
"css",
"/* Put in your custom CSS here: */\nblockquote {\n padding: 1em;\n background:\n rgba(127, 127, 127, 0.2);\n border-left: 3px solid rgba(127, 127, 127, 0.2); \n}",
true);
?>
</style>
<?php foreach ($varRows as $r): ?>
<?php if (!UserAuth::visible($r["visibility"])) continue; ?>
<div class="container my-5">
<div class="row">
<div class="col-lg-8">
<div class="xborder xborder-secondary xrounded xp-3">
<?php echo $varParsedown->text($r["content"]); ?>
</div>
<hr />
<div class="text-muted">
<div>by <?= $r["username"]; ?></div>
<div>on <?= $r["created"]; ?> UTC</div>
</div>
<?php if (UserAuth::has("is_admin")): ?>
<div>
<a class="link-underline link-underline-opacity-0" href="/post/<?= $r["id"]; ?>"><i class="fa fa-fw fa-edit"></i> Edit</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php $intRenderedRows++; ?>
<?php endforeach; ?>
<?php if ($intRenderedRows < 1): ?>
<div class="container my-5">
<div class="row">
<div class="col-lg-8">
<p>Sorry, there is nothing here to show.</p>
</div>
</div>
</div>
<?php endif; ?>
<script>
<?php
echo Settings::get(
"js",
"$(function() {\n // My script here.\n});",
true);
?>
</script>
<?php
}
}
?>