forked from Sobak/stats.sobak.pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
51 lines (40 loc) · 1.3 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
<!doctype html>
<html lang="pl">
<head>
<meta charset="utf-8">
<title>Sobak - kilka nudnych statystyk</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato&subset=latin-ext">
</head>
<body>
<h1>Sobak <span>- kilka nudnych statystyk</span></h1>
<?php
require 'services/ServiceInterface.php';
if (!file_exists('database.json') || filesize('database.json') < 10) {
echo '<h2>Ups, baza sobie poszła...</h2>';
die;
}
$database = json_decode(file_get_contents('database.json'), true);
foreach ($database as $service => $data) {
require 'services/Service'.ucfirst($service).'.php';
$class = 'Service'.ucfirst($service);
$object = new $class;
$template = $object->template($data);
echo '<section id="'.$service.'">';
echo '<h2><a href="'.$object->url.'">'.$object->title.'</a></h2>';
echo '<table>';
foreach ($template as $name => $value) {
echo '<tr>';
echo '<th scope="row">'.$name.'</th>';
echo '<td>'.$value.'</td>';
echo '</tr>';
}
echo '</table>';
echo '</section>';
}
?>
<footer>
<p>Ostatnia aktualizacja: <?=date('d.m.Y H:i', filemtime('database.json'))?> || Copyright by <a href="http://sobak.pl">Sobak</a> || Kod dostępny na <a href="https://github.com/Sobak/stats.sobak.pl">GitHub</a></p>
</footer>
</body>
</html>