mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 14:44:21 +00:00
30 lines
586 B
PHP
30 lines
586 B
PHP
<?php
|
|
|
|
class Upcoming
|
|
{
|
|
private static $events;
|
|
|
|
public static function getNextEvents($filter = null)
|
|
{
|
|
try {
|
|
if (!isset(self::$events)) {
|
|
$events = file_get_contents('configs/upcoming.json');
|
|
$events = json_decode($events, true);
|
|
|
|
self::$events = array_values($events['voc_events']);
|
|
}
|
|
|
|
if (!is_null($filter) && $filter) {
|
|
return array_values(array_filter(self::$events, function($event) use($filter) {
|
|
return preg_match($filter, $event['slug']);
|
|
}));
|
|
}
|
|
|
|
return self::$events;
|
|
}
|
|
catch(ErrorException $e)
|
|
{
|
|
return array();
|
|
}
|
|
}
|
|
}
|