-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.php
48 lines (40 loc) · 1.54 KB
/
functions.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
<?php
function getPictureURL($speakerName) {
$URLPicture = 'assets/Conference/Speaker/150px'; // relative path, w/o trailing '/'
$speaker = array(); // silverstripes renames files after upload!!
$speaker['Alexander Werner'] = 'alexanderwerner.png';
$speaker['Alfredo Parisi'] = 'alfredoparisi.jpg';
$speaker['Andras Timar'] = 'andrastimar.png';
$speaker['Charles Schulz'] = 'charleshschulz.jpg';
$speaker['Eike Rathke'] = 'eikerathke.png';
$speaker['Florian Effenberger'] = 'florianeffenberg.png';
$speaker['Fridrich Strba'] = 'fridrichstrba.png';
$speaker['Italo Vignoli'] = 'italovignoli.jpg';
$speaker['Lothar K. Becker'] = 'lotharkbecker.jpg';
$speaker['Michael Meeks'] = 'michaelmeeks.png';
$speaker['Miklos Vajna'] = 'miklosvajna.png';
$speaker['Robinson Tryon'] = 'robinsontryon.jpg';
$speaker['Tobias Mueller'] = 'tobiasmueller.jpg';
$speaker['Tor Lillqvist'] = 'torlillqvist.png';
if ( isset($speaker[$speakerName]) ){
return sprintf('%s/%s', $URLPicture, $speaker[$speakerName]);
}
return sprintf('%s/dummy.png', $URLPicture);
}
function getSpeakerURL($speakerName) {
// config
$speakerURL = '/2014/speaker'; // relative path
if($speakerName !== '') {
return sprintf('%s#%s', $speakerURL, getAnchor($speakerName));
}
return $speakerURL;
}
// http://stackoverflow.com/questions/2910976/php-urlize-function
function getAnchor($speakerName) {
return strtolower(
preg_replace(
array( '/[^-a-zA-Z0-9\s]/', '/[\s]/' ), array( '', '-' ),
$speakerName
)
);
}