-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbox-singlesection.inc
56 lines (51 loc) · 1.3 KB
/
box-singlesection.inc
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
<?php
foreach ($attributes as $attr) {
if (isset($AllAttributes[$attr]))
$name = $AllAttributes[$attr][1];
else
$name = $attr;
echo "<p>\n";
echo "\t<span class=\"label\">{$name}:</span>\n";
# htmlspecialchars is done in results-single.inc
$value = $Entry[$attr];
switch ($attr):
case "contactinfo":
$value = "<ul>\n\t<li>".implode("</li>\n\t<li>", $value)."</li>\n</ul>\n";
break;
case "c":
$code = strtoupper($value);
$country = lookup_country($code);
if ($country)
$value = $country;
$file = "flags/".strtolower($code).".png";
if (file_exists($file))
$value = "<img src=\"{$file}\"> $value";
else
$value = "$value ($code)";
break;
case "labeleduri":
$urls = $value;
sort($urls);
$value = "<ul>\n";
foreach ($urls as $v) {
@list ($uri, $label) = explode(" ", $v, 2);
if (!strlen($label))
$label = "<i>$uri</i>";
$value .= "\t<li><a href=\"{$uri}\">{$label}</a></li>\n";
}
$value .= "</ul>\n";
break;
case "mail":
case "altemail":
$value = linkify($value, "mail");
break;
case "pgpkeyid":
@list($id, $uri) = explode(" ", $value, 2);
if (strlen(@$uri))
$value = "<a href=\"{$uri}\">{$id}</a>";
break;
endswitch;
if (is_array($value)) $value = implode(", ", $value);
echo "\t<span class=\"value\">{$value}</span>\n";
echo "</p>\n";
}