5 require_once __DIR__
."/config.php";
6 require_once __DIR__
."/web.php";
11 use http\Env\Response
;
15 $injector->share(Plates\Engine
::class)
16 ->define(Plates\Engine
::class, [
17 ":directory" => __DIR__
."/../views",
18 ":fileExtension" => "phtml"
20 ->prepare(Plates\Engine
::class, function(Plates\Engine
$view) use($injector) {
22 "config" => $injector->make(Config
::class),
23 "baseUrl" => $injector->make(BaseUrl
::class),
24 "request" => $injector->make(Request
::class),
25 "response" => $injector->make(Response
::class),
27 $view->registerFunction("shorten", function($text) {
28 if (strlen($text) < 78) {
31 return current(explode("\n", wordwrap($text)))."…";
33 $view->registerFunction("utc", function($d) {
34 return date_create($d)->setTimeZone(new \
DateTimeZone("UTC"));
36 $view->registerFunction("md", function($string, $file = false) {
38 $md = \MarkdownDocument
::createFromStream($string);
40 $md = \MarkdownDocument
::createFromString($string);
42 $md->compile(\MarkdownDocument
::AUTOLINK
);
43 return $md->getHtml();