This repository was archived by the owner on Dec 5, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php.old
107 lines (90 loc) · 3.88 KB
/
index.php.old
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
<?php
$html = '<!doctype html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Terence Eden\'s Contact Details</title>
<meta name="description" content="@edent all over the web">
<meta name="author" content="Terence Eden">
<meta name="twitter:card" content="summary" />
<meta name="twitter:creator" content="@edent" />
<meta property="og:url" content="https://edent.tel/" />
<meta property="og:title" content="Contact @edent" />
<meta property="og:description" content="Terence Eden\'s contact details - voice, text, fax. OK. Maybe not fax…" />
<meta property="og:image" content="https://edent.tel/preview.png" />
<meta property="og:image:width" content="380" />
<meta property="og:image:height" content="380" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="/manifest.json">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="theme-color" content="#ffffff">
<style>';
$html .= file_get_contents("css/edent.min.css");
$html .='</style>
<base target="_blank">
</head>
<body>
<div class="marvel-device htc-one">
<div class="top-bar"></div>
<div class="camera"></div>
<div class="sensor"></div>
<div class="speaker"></div>
<div class="screen">
<div itemscope itemtype="http://schema.org/Person" class="h-card" rel="me">
<h1 itemprop="name" class="p-name">Terence Eden</h1>
<p itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"><span itemprop="addressLocality">Oxford</span>, <span itemprop="addressCountry">UK</span></p>
<p class="p-note">Currently running <span itemprop="jobTitle">Open Standards</span> for the <span itemprop="worksFor">UK Government Digital Service.</span></p>
<p title="I speak a little Chinese" lang="zh">我说一点中文.</p>
<p><a href="vcard.php" class="download">Download my contact details.</a></p>';
$str = file_get_contents('config.json');
$json = json_decode($str, true);
foreach ($json as $key => $img) {
$html .= '<div class="icon">';
$link = ($img["link"] != null) ? "href=\"{$img["link"]}\"" : "";
$itemprop = ($img["itemprop"] != null) ? "itemprop=\"{$img["itemprop"]}\"" : "";
$rel = ($img["rel"] != null) ? "rel=\"{$img["rel"]}\"" : "";
$class = ($img["class"] != null) ? "class=\"{$img["class"]}\"" : "";
$target = ($img["target"] != null) ? "target=\"{$img["target"]}\"" : "";
$text = ($img["text"] != null) ? $img["text"] : "";
$svg = generate_svg($key, $img["alt"]);
$html .= "<a {$link} {$itemprop} {$rel} {$class} {$target}>";
$html .= "<span>";
$html .= $svg;
$html .= "{$text}";
$html .= "</span></a>";
$html .= "</div>";
}
function generate_svg($title,$alt){
// Get the tiny SVG
$svg_file = file_get_contents('svg/'.$title.'.svg');
// Add ARIA labels for accessibility
$start ='<svg
role="img"
aria-labelledby="'.$title.'-title"
class="square"
viewBox="0 0 512 512">
<title id="'.$title.'-title">'.$alt.'</title>';
// Replace the original <svg> tag and add the <title> tag
$svg = $start . substr( $svg_file, strpos($svg_file, ">")+1 );
// Remove unecessary whitespace
return preg_replace('/\s+/', ' ',$svg);
}
$html .= ' </div>
</div>
<div class="speaker" id="bottomspeaker"></div>
</div>
</body>
</html>';
// Minify
$html = str_replace(array("\r", "\n", "\t"), '', $html);
$html = str_replace(array(" "), ' ', $html);
$html = str_replace(array("> <"), "><", $html);
$html = str_replace(array("\" >"), "\">", $html);
$html = str_replace(array(" "), ' ', $html);
$html = str_replace(array("\" />"), "\"/>", $html);
$html = str_replace(array(" "), ' ', $html);
echo $html;
die();