forked from palmtreephp/form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bootstrap.php
48 lines (38 loc) · 972 Bytes
/
.bootstrap.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
<?php declare(strict_types=1);
function template($file, $data = [])
{
ob_start();
extract($data);
include $file;
return ob_get_clean();
}
function redirect($location)
{
header("Location: $location", true, 302);
exit;
}
function send_json($data = [], $success = true)
{
$response = json_encode([
'success' => $success,
'data' => $data,
]);
echo $response;
exit;
}
function send_json_error($data = [])
{
send_json($data, false);
}
function get_styles()
{
return <<<HTML
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
HTML;
}
function get_scripts()
{
return <<<HTML
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
HTML;
}