Upcoming Shows:

ini_set(‘date.timezone’, ‘America/Chicago’);
date_default_timezone_set(‘America/Chicago’);
?>

function filterEventDetails($contentText) {

$data = array();

foreach($contentText as $row)
{

if(strstr($row, ‘When: ‘)) {
##cleaning “when” string to get date in the format “May 28, 2009″##
$data['duration'] = str_replace(‘When: ‘,”,$row);
// $data['duration'] = str_replace(‘to’,'-’,$row);
$data['duration'] = str_replace(‘When: ‘,”,$row);

list($when, ) = explode(‘ to ‘,$data['duration']);
$data['when'] = substr($when,4);

if(strlen($data['when'])>13){
$data['when'] = trim(str_replace(strrchr($data['when'], ‘ ‘),”,$data['when']));
$data['duration'] = substr($data['duration'], 0, strlen($data['duration'])-4); //trimming time zone identifier (UTC etc.)
// $data['when'] = str_replace(‘to’,'-’,$row);
}
}
//—– ##cleaning “when” string to get date in the format “May 28, 2009″##

if(strstr($row, ‘When: ‘)) {
$data['durationTest'] = str_replace(‘When: ‘,”,$row);
}

//—-

if(strstr($row, ‘Where: ‘)) {
$data['where'] = str_replace(‘Where: ‘,”,$row);

}

//—-
if(strstr($row, ‘Event Description: ‘)) {

$event_desc = str_replace(‘Event Description: ‘,”,$row);

// Iterates through the Details and sets the index to those input in the google calendar by the user with “==”
foreach (explode(‘|’,$event_desc) as $line) {
$l = explode(‘==’, trim($line));
if (isset($l[1]))
$data[$l[0]] = $l[1];
}

}
}
return $data;
}

// load library
require_once ‘Zend/Loader.php’;
Zend_Loader::loadClass(‘Zend_Gdata’);
Zend_Loader::loadClass(‘Zend_Gdata_ClientLogin’);
Zend_Loader::loadClass(‘Zend_Gdata_Calendar’);
Zend_Loader::loadClass(‘Zend_Http_Client’);

// create authenticated HTTP client for Calendar service
$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = “joel@rattletree.com”;
$pass = “AbundantJoy“;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
$gcal = new Zend_Gdata_Calendar($client);

$query = $gcal->newEventQuery();
$query->setUser(‘rattletree.com_ucvggfiidi214hs78sl9eipnco@group.calendar.google.com’);

$secondary=true;
$query->setVisibility(‘private’);
$query->setProjection(‘basic/’);

$query->setOrderby(‘starttime’);
$query->setSortOrder(‘ascending’);
//$query->setFutureevents(‘true’);

$startDate=date(‘Y-m-d h:i:s’);
$endDate=”2015-12-31″;
$query->setStartMin($startDate);
$query->setStartMax($endDate);
$query->setMaxResults(30);
try {
// THE CHANGES NEEDED FOR THE GOOGLE CALENDAR TEXT PROBLEM //
$eventUrl = $query->getQueryUrl() . ‘&hl=en’;
$feed = $gcal->getCalendarEventFeed($eventUrl);

// $feed = $gcal->getCalendarEventFeed($query); } catch (Zend_Gdata_App_Exception $e) {
echo “Error: ” . $e->getResponse();
}

?>

//checking if at least one event is there in this date range
if((int)$feed->totalResults>0)
{
//iterating through all events
foreach ($feed as $event)
{
$contentText = stripslashes($event->content->text); //striping any escape character
$contentText = preg_replace(‘/\
[\n\t\s]{1,}\
/’,’
‘,stripslashes($event->content->text)); //replacing multiple breaks with a single break
$contentText = explode(‘
‘,$contentText); //splitting data by break tag
$eventData = filterEventDetails($contentText);//I can hard code or add variables here….$when = $eventData['when'];
$where = $eventData['where'];
$duration = $eventData['duration'];
$durationTest = $eventData['durationTest'];
$act_name = $eventData['act_name'];
$venue_url = $eventData['venue_url'];
$details = $eventData['details'];
$tickets_url = $eventData['tickets_url'];
$tickets_button = ‘http://www.rattletree.com/buttons/ticket1.jpg’;
$facebook_url = $eventData['facebook_url'];
$facebook_icon = ‘http://www.rattletree.com/images/icons/Facebook/48×48.png’;
$title = stripslashes($event->title);// testing act_name conditionalif ($act_name == “Kupira Marimba” || $act_name == “Kupira Marimba Trio”) {
echo ‘
‘; echo ‘

$pattern = ‘/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d+/’;
$numMatches = preg_match_all($pattern, $duration, $dates);
if ($numMatches == 1) // case 2
{
echo $dates[0][0];
}
else // case 1
{
if (($dates[0][0])!=($dates[0][1]))
{
echo $dates[0][0].” – “.$dates[0][1];
}
else
{
echo $dates[0][0];
}
}echo ”;
echo ”;
if($venue_url!=”) {
if(trim($act_name) !=”) {
echo $act_name.’
‘;
}
echo ‘‘.$title.’‘;} else {
if(trim($act_name) !=”) {
echo $act_name.’
‘;
}
echo $title;
}
echo ”;
echo ”; echo $where; echo ”;
echo ”;
$details = str_replace(“\n”,”
“,htmlentities($details));
$duration = str_replace(“\n”,”
“,$duration);
$detailed_description = “When:
“.$duration.”";
$detailed_description .= “Description:
“.$details;
echo $detailed_description;
// echo ‘View Details‘;
echo ”;
echo ”;
if(trim($tickets_url) !=”)
{
echo ‘‘;
}
if(trim($facebook_url) !=”)
{
echo ‘‘;
}
else
{
echo ‘……’;
}
echo ”;
echo ”;
}
}
}
else //else show ‘no event found’ message
{
echo ‘
‘; echo ”;
echo ”;
}?>

 DATE     VENUE     CITY     DETAILS                LINKS             
‘; ‘;
echo “No event found”;
echo ‘