Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $events = glob('events/*.jpg');
- $events = array_reverse($events);
- $upcoming = array();
- $regular = array();
- $past = array();
- if(!empty($events)) {
- foreach($events as $event) {
- $path = $event;
- $basename = pathinfo(basename($path), PATHINFO_FILENAME);
- $exp = explode('--',$basename);
- if($exp[0]!='REGULAR') {
- $date = date('F d, Y', strtotime($exp[0]));
- $exp2 = explode('-',$exp[1]); $title = '';
- foreach($exp2 as $p) $title .= $p.' ';
- $evt = array(
- 'path'=>$path,
- 'date'=>$date,
- 'title'=>$title
- );
- if(file_exists('events/'.$basename.'.json')) {
- $contents = trim(file_get_contents('events/'.$basename.'.json', FILE_USE_INCLUDE_PATH));
- $info = json_decode($contents, true);
- $evt['tickets'] = (isset($info['links']['tickets']) && !empty($info['links']['tickets']) ? $info['links']['tickets'] : '');
- $evt['facebook_event'] = (isset($info['links']['facebook_event']) && !empty($info['links']['facebook_event']) ? $info['links']['facebook_event'] : '');
- $evt['facebook_album'] = (isset($info['links']['facebook_album']) && !empty($info['links']['facebook_album']) ? $info['links']['facebook_album'] : '');
- }
- if(date('U', strtotime($exp[0]))>strtotime('yesterday')) { //time()
- $upcoming[] = $evt;
- } else {
- $past[] = $evt;
- };
- } else {
- $date_exp = explode('-',$exp[1]); $date = '';
- foreach($date_exp as $p) $date .= $p.' ';
- $exp2 = explode('-',$exp[2]); $title = '';
- foreach($exp2 as $p) $title .= $p.' ';
- $regular[] = array(
- 'path'=>$path,
- 'date'=>$date,
- 'title'=>$title
- );
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement