@@ -48,20 +48,26 @@ function ICSEvents($atts)
48
48
}
49
49
}
50
50
$ html = '' ;
51
- foreach ($ eventsToDisplay as $ event ) {
52
- $ timestamp = $ ical ->iCalDateToUnixTimestamp ($ event ['DTSTART ' ]);
53
- $ html .= '<ul class="next-date">
54
- <li><time datetime=" ' .strftime ('%F ' , $ timestamp ).'">
55
- <span> ' .strftime ('%e ' , $ timestamp ).'</span>
56
- <span> ' .strftime ('%b ' , $ timestamp ).'</span></time></li>
57
- <li> ' .$ event ['SUMMARY ' ].'</li> ' ;
58
- if (!empty ($ event ['LOCATION ' ])) {
59
- $ html .= '<li> ' .$ event ['LOCATION ' ].'</li> ' ;
51
+ if (empty ($ eventsToDisplay )) {
52
+ if (isset ($ atts ['noeventsmsg ' ]) ){
53
+ $ html .= $ atts ['noeventsmsg ' ];
60
54
}
61
- if (strlen ($ event ['DTSTART ' ]) > 8 ) {
62
- $ html .= '<li> ' .strftime ('%Hh%M ' , $ timestamp ).'</li> ' ;
55
+ } else {
56
+ foreach ($ eventsToDisplay as $ event ) {
57
+ $ timestamp = $ ical ->iCalDateToUnixTimestamp ($ event ['DTSTART ' ]);
58
+ $ html .= '<ul class="next-date">
59
+ <li><time datetime=" ' .strftime ('%F ' , $ timestamp ).'">
60
+ <span> ' .strftime ('%e ' , $ timestamp ).'</span>
61
+ <span> ' .strftime ('%b ' , $ timestamp ).'</span></time></li>
62
+ <li> ' .$ event ['SUMMARY ' ].'</li> ' ;
63
+ if (!empty ($ event ['LOCATION ' ])) {
64
+ $ html .= '<li> ' .$ event ['LOCATION ' ].'</li> ' ;
65
+ }
66
+ if (strlen ($ event ['DTSTART ' ]) > 8 ) {
67
+ $ html .= '<li> ' .strftime ('%Hh%M ' , $ timestamp ).'</li> ' ;
68
+ }
69
+ $ html .= '</ul> ' ;
63
70
}
64
- $ html .= '</ul> ' ;
65
71
}
66
72
return $ html ;
67
73
0 commit comments