-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
111 lines (95 loc) · 1.99 KB
/
index.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
//Enable/disable all errors
use ComponentLibrary\Init as ComponentLibraryInit;
use HbgStyleGuide\App;
if (isset($_GET['debug'])) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
} else {
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(0);
}
define('BASEPATH', dirname(__FILE__) . '/');
require_once BASEPATH . 'config.php';
require_once __DIR__ . '/vendor/autoload.php';
require BASEPATH . 'Public.php';
if(isset($_GET['parentID'])){
$data = [
[
"ID"=> 24963,
"post_parent" => 6978,
"post_title" => "Test",
"href" => "#",
"children" => false
]
];
header('Content-Type: application/json');
echo json_encode($data);
die();
}
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = explode( '/', $uri );
$endpoint = strtolower($uri[1]);
if($endpoint == 'topnav' && isset($_GET['pageID'])){
$parentID = $_GET['pageID'];
$response = null;
switch ($parentID) {
case '1':
$response = [
'title' => 'About',
'href' => '#1',
'items' => [
[
'label' => 'Item',
'href' => '#',
'id' => 12
],
[
'label' => 'Item 2',
'href' => '#',
'id' => 133
],
[
'label' => 'Item 3',
'href' => '#',
'id' => 134
]
]
];
break;
case '2':
$response = [
'title' => 'Stuff',
'href' => '#2',
'items' => [[
'label' => 'Thing',
'href' => '#',
'id' => 13,
'preview' => 'This is a preview...'
]]
];
break;
case '3':
$response = [
'title' => 'More',
'href' => '#3',
'items' => [[
'label' => 'Stuff',
'href' => '#',
'id' => 14,
'preview' => 'This is a preview...'
]]
];
break;
default:
$response = null;
}
header('Content-Type: application/json');
echo json_encode($response);
die();
}
$viewPaths = [BASEPATH . 'views'];
$bladeService = (new ComponentLibraryInit($viewPaths))->getEngine();
new App($bladeService);