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