-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
config.php
68 lines (57 loc) · 2.17 KB
/
config.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
use Zend\Escaper\Escaper;
/**
* Bundles configuration
*/
return [
'joindin' => [
'user' => 'ocramius',
'template' => function($talks) {
$templatePattern = <<<'HTML'
<div class="item" itemscope itemtype="https://schema.org/Event">
<meta itemprop="duration" content="%s"/>
<meta itemprop="startDate" content="%s"/>
<h3 itemprop="name">%s</h3><p><small itemprop="description">%s</small></p>
<div class="links">
<div><i class="icon-calendar"> </i> %s</div>
<div><i class="icon-star"> </i> %s</div>
<div><a itemprop="url" href="%s" target="_blank"><i class="icon-eye-open"> </i> Comments</a></div>
%s
</div>
</div>
%s
HTML;
$slidesLinkPattern = <<<'HTML'
<div itemscope itemtype="http://schema.org/CreativeWork">
<a itemprop="url" href="%s" target="_blank"><i class="icon-film"> </i> Slides</a>
</div>
HTML;
$escaper = new Escaper();
$template = '<h1>My talks <small><i>(via joind.in)</i></small></h1><hr />';
$increment = 0;
foreach ($talks['talks'] as $talk) {
$increment++;
$start = DateTime::createFromFormat(DateTime::ISO8601, $talk['start_date'], new DateTimeZone('UTC'));
$slides = (isset($talk['slides_link']) && $talk['slides_link'])
? sprintf(
$slidesLinkPattern,
$talk['slides_link']
)
: '';
$template .= sprintf(
$templatePattern,
'T' . ((int) $talk['duration']) . 'M',
$start->format(DateTime::ISO8601),
$escaper->escapeHtml($talk['talk_title']),
$escaper->escapeHtml($talk['talk_description']),
$start->format('Y-m-d'),
(int) $talk['average_rating'],
$escaper->escapeHtmlAttr($talk['website_uri']),
$slides,
(0 == $increment % 2) ? '<div class="clear"></div>' : ' '
);
}
return $template;
},
]
];