-
Notifications
You must be signed in to change notification settings - Fork 3
/
helpers.php
42 lines (36 loc) · 1.03 KB
/
helpers.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
<?php
use Beebmx\KirbyBlade\Foundation\Vite;
use Illuminate\Contracts\Support\Htmlable;
if (! function_exists('b')) {
function b($value, $doubleEncode = true): string
{
return _e($value, $doubleEncode);
}
}
if (! function_exists('_e')) {
/**
* Encode HTML special characters in a string.
*
* @param \Illuminate\Contracts\Support\Htmlable|string $value
* @param bool $doubleEncode
*/
function _e($value, $doubleEncode = true): string
{
if ($value instanceof Htmlable) {
return $value->toHtml();
}
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode);
}
}
if (! function_exists('public_path')) {
function public_path($path = ''): string
{
return kirby()->roots()->index().($path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path);
}
}
if (! function_exists('vite')) {
function vite($entrypoints, $buildDirectory = 'build')
{
return (new Vite)($entrypoints, $buildDirectory);
}
}