-
Notifications
You must be signed in to change notification settings - Fork 36
/
data.php
38 lines (33 loc) · 929 Bytes
/
data.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
<?php
/**
* Copyright (c) (2017) - Aikar's Minecraft Timings Parser
*
* Written by Aikar <[email protected]>
* + Contributors (See AUTHORS)
*
* http://aikar.co
* http://starlis.com
*
* @license MIT
*
*/
namespace Starlis\Timings;
require_once __DIR__ . "/init.php";
if ($_SERVER['HTTP_ACCEPT'] === 'application/json') {
header("Content-Type: application/json");
}
$timings = Timings::getInstance();
$template = DataLoader::getInstance();
$timings->prepareData();
/** @noinspection NotOptimalIfConditionsInspection */
if (!DataLoader::loadData() || empty($template->data)) {
header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found", true, 404);
echo json_encode(null);
exit;
}
//util::var_dump($template->data['timingsMaster']);
$options = JSON_UNESCAPED_SLASHES;
if (DEBUGGING && $_SERVER['HTTP_ACCEPT'] !== 'application/json') {
$options |= JSON_PRETTY_PRINT;
}
echo json_encode($template->data, $options);