function eventfulAPI_findEvents($queryString, $optionsArray) { $app_key = 'NzRqz6hgC5t3ZR8B'; // Filter Parameters $q = urlencode(strtolower($queryString)); $userLat = $optionsArray['userLat']; $userLong = $optionsArray['userLng']; $filterCity = $optionsArray['city']; $filterState = $optionsArray['state']; $filterDate = $optionsArray['date']; $filterRadius = $optionsArray['radius']; if ($q == $filterCity) { $q == null; } // Just do a simple lookup $ev_noauth = new Services_Eventful($app_key); $args = array('keywords' => "{$q}", 'location' => "{$filterCity}, {$filterState}", 'within' => "{$filterRadius}", 'units' => "mi", 'sort_order' => "date", 'page_size' => 100); $data = $ev_noauth->call('events/search', $args, "json"); $num = $data['page_size']; $gEvents = array(); $i = 0; // Loop through Json Results from CURL resuest while ($i < $num) { $externalId = empty($data['events']['event'][$i]['id']) ? null : $data['events']['event'][$i]['id']; $city = empty($data['events']['event'][$i]['city_name']) ? null : $data['events']['event'][$i]['city_name']; $state = empty($data['events']['event'][$i]['region_abbr']) ? null : $data['events']['event'][$i]['region_abbr']; $date = empty($data['events']['event'][$i]['start_time']) ? null : $data['events']['event'][$i]['start_time']; $desc = empty($data['events']['event'][$i]['description']) ? null : $data['events']['event'][$i]['description']; $title = empty($data['events']['event'][$i]['title']) ? null : $data['events']['event'][$i]['title']; $venueExternalId = empty($data['events']['event'][$i]['venue_id']) ? null : $data['events']['event'][$i]['venue_id']; $venueName = empty($data['events']['event'][$i]['venue_name']) ? null : $data['events']['event'][$i]['venue_name']; $venueAddress = empty($data['events']['event'][$i]['venue_address']) ? null : $data['events']['event'][$i]['venue_address']; $country = empty($data['events']['event'][$i]['country_abbr']) ? null : $data['events']['event'][$i]['country_abbr']; $postalCode = empty($data['events']['event'][$i]['postal_code']) ? null : $data['events']['event'][$i]['postal_code']; $defaultDomain = empty($data['events']['event'][$i]['default_domain']) ? "http://eventful.com" : $data['events']['event'][$i]['default_domain']; $venueExternalUrl = empty($data['events']['event'][$i]['venue_url']) ? null : $data['events']['event'][$i]['venue_url']; $latitude = empty($data['events']['event'][$i]['latitude']) ? null : $data['events']['event'][$i]['latitude']; $longitude = empty($data['events']['event'][$i]['longitude']) ? null : $data['events']['event'][$i]['longitude']; $timezone = empty($data['events']['event'][$i]['olson_path']) ? null : $data['events']['event'][$i]['olson_path']; $startTime = empty($data['events']['event'][$i]['start_time']) ? null : $data['events']['event'][$i]['start_time']; $endTime = empty($data['events']['event'][$i]['stop_time']) ? null : $data['events']['event'][$i]['stop_time']; $minPrice = null; $maxPrice = null; $channel = null; $eventExternalUrl = empty($data['events']['event'][$i]['url']) ? null : $data['events']['event'][$i]['url']; $imageExternalUrl = empty($data['events']['event'][$i]['image']) ? null : $data['events']['event'][$i]['image']; $geoParent = empty($data['events']['event'][$i]['geocode_type']) ? null : $data['events']['event'][$i]['geocode_type']; $currentEvent = true; if (!empty($startTime)) { date_default_timezone_set($timezone); $currentUnixTime = strtotime("now"); $eventUnixTime = strtotime($startTime); $currentEvent = $currentUnixTime > $eventUnixTime ? false : true; } if (null != $latitude && null != $longitude && null != $userLat && null != $userLong) { $distance = distanceInMiles($userLat, $userLong, $latitude, $longitude); } else { $distance = null; } if (!empty($externalId) && $currentEvent) { if (empty($filterRadius) || $distance <= $filterRadius && $distance > 0) { $gEvent = new gEvent(); $gEvent->setExternal_id($externalId); $gEvent->setDatasource("eventful"); $gEvent->setTitle($title); $gEvent->setDescription($title); $gEvent->setNotes($desc); $gEvent->setVenue_external_id($venueExternalId); $gEvent->setVenue_name($venueName); $gEvent->setVenue_address($venueAddress); $gEvent->setCountry_name($country); $gEvent->setState_name($state); $gEvent->setCity_name($city); $gEvent->setPostal_code($postalCode); $gEvent->setVenue_external_url($venueExternalUrl); $gEvent->setLatitude($latitude); $gEvent->setLongitude($longitude); $gEvent->setDistance(number_format((double) $distance, 2, '.', '')); $gEvent->setTimezone($timezone); $gEvent->setTimezone_abbr(convertTimezoneToAbbr($timezone)); $gEvent->setStart_time($startTime); $gEvent->setEnd_time($endTime); $gEvent->setStart_date_month(convertDateToMonthOptions($startTime)); $gEvent->setStart_date_day(convertDateToDayOptions($startTime, $timezone)); $gEvent->setStart_date_year(convertDateToYearOptions($startTime)); $gEvent->setStart_date_time(convertDateToTimeOptions($startTime)); $gEvent->setPrice_range($minPrice . " - " . $maxPrice); if (substr($gEvent->getPrice_range(), 0, 2) === "0 ") { $gEvent->setIs_free(true); } else { if ($gEvent->getPrice_range() !== null) { $gEvent->setIs_free(false); } } $minorGenre = array(); $majorGenre = array(); $gEvent->setMinor_genre($minorGenre); $gEvent->setMajor_genre($majorGenre); $gEvent->setEvent_external_url($eventExternalUrl); // Populate image links found $gEventImages = array(); if (isset($imageExternalUrl)) { $image = $data['events']['event'][$i]['image']['medium']; //var_dump($image); //if(!empty($image['medium'])){ $gImage = new gEventImage(); $gImage->setImage_external_url($image['url']); $gImage->setImage_height($image['height']); $gImage->setImage_width($image['width']); $gImage->setImage_category("attraction"); array_push($gEventImages, $gImage); //} } else { $gImage = new gEventImage(); $searchImageQuery = explode("[", $desc); $searchImageQuery = explode("-", $searchImageQuery[0]); $searchImageQuery = urlencode($searchImageQuery[0]); $searchImageUrl = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q={$searchImageQuery}"; $googleImageUrl = googleImageSearch($searchImageUrl); $gImage->setImage_external_url($googleImageUrl); //$gImage->setImage_external_url("https://cdn4.iconfinder.com/data/icons/small-n-flat/24/calendar-128.png"); $gImage->setImage_category("attraction"); array_push($gEventImages, $gImage); } $gEvent->setImages($gEventImages); //Populate performers found $gEventPerformers = array(); if (isset($data['events']['event'][$i]['performers']['performer'])) { foreach ($data['events']['event'][$i]['performers']['performer'] as $performer) { if (isset($performer) && isset($performer['id'])) { $gPerformer = new gEventPerformer(); $gPerformer->setPerformer_external_id($performer['id']); $gPerformer->setPerformer_name($performer['name']); $gPerformer->setPerformer_external_url($performer['url']); $gPerformer->setPerformer_short_bio($performer['short_bio']); array_push($gEventPerformers, $gPerformer); } } } $gEvent->setPerformers($gEventPerformers); // Push gEvent object onto arraylist of gEvent objects array_push($gEvents, $gEvent); } } $i++; } return $gEvents; }
function stubhubAPI_findEvent($externalEventId, $optionsArray) { // Filter Parameters $q = urlencode($externalEventId); $id = $externalEventId; $userLat = $optionsArray['userLat']; $userLong = $optionsArray['userLng']; $endpoint_stubhub = "http://publicfeed.stubhub.com/listingCatalog/select/"; $url = "{$endpoint_stubhub}?q={$q}&wt=json&stubhubDocumentType=event&rows=1&id={$externalEventId}"; $data = get_data($url); $json = json_decode($data); $num = $json->response->numFound; $gEvents = array(); $i = 0; // Loop through Json Results from CURL resuest while ($i < $num) { $externalId = empty($json->response->docs[$i]->event_id) ? null : $json->response->docs[$i]->event_id; $city = empty($json->response->docs[$i]->city) ? null : $json->response->docs[$i]->city; $state = empty($json->response->docs[$i]->state) ? null : $json->response->docs[$i]->state; $date = empty($json->response->docs[$i]->event_date) ? null : substr($json->response->docs[$i]->event_date, 0, -10); $desc = empty($json->response->docs[$i]->description) ? null : $json->response->docs[$i]->description; $title = empty($json->response->docs[$i]->title) ? null : $json->response->docs[$i]->title; $venueExternalId = empty($json->response->docs[$i]->venue_config_id) ? null : $json->response->docs[$i]->venue_config_id; $venueName = empty($json->response->docs[$i]->venue_name) ? null : $json->response->docs[$i]->venue_name; $venueAddress = empty($json->response->docs[$i]->addr1) ? null : $json->response->docs[$i]->addr1; $country = empty($json->response->docs[$i]->country) ? null : $json->response->docs[$i]->country; $postalCode = empty($json->response->docs[$i]->zip) ? null : $json->response->docs[$i]->zip; $defaultDomain = empty($json->response->docs[$i]->defaultDomain) ? "http://stubhub.com" : $json->response->docs[$i]->defaultDomain; $venueExternalUrl = empty($json->response->docs[$i]->venueDetailUrlPath) ? null : "http://" . $defaultDomain . "/" . $json->response->docs[$i]->venueDetailUrlPath; $latitude = empty($json->response->docs[$i]->latitude) ? null : $json->response->docs[$i]->latitude; $longitude = empty($json->response->docs[$i]->longitude) ? null : $json->response->docs[$i]->longitude; $timezone = empty($json->response->docs[$i]->jdk_timezone) ? null : $json->response->docs[$i]->jdk_timezone; $startTime = empty($json->response->docs[$i]->event_date) ? null : str_replace("T", " ", substr($json->response->docs[$i]->event_date, 0, -1)); $minPrice = empty($json->response->docs[$i]->minPrice) ? null : $json->response->docs[$i]->minPrice; $maxPrice = empty($json->response->docs[$i]->maxPrice) ? null : $json->response->docs[$i]->maxPrice; $channel = empty($json->response->docs[$i]->channel) ? null : strtolower($json->response->docs[$i]->channel); $eventExternalUrl = empty($json->response->docs[$i]->urlpath) ? null : "http://" . $defaultDomain . "/" . $json->response->docs[$i]->urlpath; $imageExternalUrl = empty($json->response->docs[$i]->image_url) ? null : $json->response->docs[$i]->image_url; $geoParent = empty($json->response->docs[$i]->geography_parent) ? null : $json->response->docs[$i]->geography_parent; $imageExternalUrlLong = empty($json->response->docs[$i]->image_url) ? null : "http://cache1.stubhubstatic.com/data/venue_maps/" . $geoParent . "/" . $json->response->docs[$i]->image_url; if (null != $latitude && null != $longitude && null != $userLat && null != $userLong) { $distance = distanceInMiles($userLat, $userLong, $latitude, $longitude); } else { $distance = null; } $currentEvent = true; if (!empty($startTime)) { date_default_timezone_set($timezone); $currentUnixTime = strtotime("now"); $eventUnixTime = strtotime($startTime); $currentEvent = $currentUnixTime > $eventUnixTime ? false : true; } // If no externalId is set, don't pull record. Avoids empty // records from getting pulled. if (!empty($externalId) && $currentEvent) { if (empty($filterCity) || strtolower($filterCity) == strtolower($city)) { if (empty($filterState) || strtolower($filterState) == strtolower($state)) { if (empty($filterDate) || $filterDate == $date) { if (empty($filterDesc) || strpos(strtolower($desc), strtolower($filterDesc)) !== FALSE) { if (empty($filterRadius) || $distance <= $filterRadius && $distance > 0) { $gEvent = new gEvent(); $gEvent->setExternal_id($externalId); $gEvent->setDatasource("stubhub"); $gEvent->setTitle($title); $gEvent->setDescription($desc); $gEvent->setNotes(""); $gEvent->setVenue_external_id($venueExternalId); $gEvent->setVenue_name($venueName); $gEvent->setVenue_address($venueAddress); $gEvent->setCountry_name($country); $gEvent->setState_name($state); $gEvent->setCity_name($city); $gEvent->setPostal_code($postalCode); $gEvent->setVenue_external_url($venueExternalUrl); $gEvent->setLatitude($latitude); $gEvent->setLongitude($longitude); $gEvent->setDistance(number_format((double) $distance, 2, '.', '')); $gEvent->setTimezone($timezone); $gEvent->setTimezone_abbr(convertTimezoneToAbbr($timezone)); $gEvent->setStart_time($startTime); $gEvent->setEnd_time(""); $gEvent->setStart_date_month(convertDateToMonthOptions($startTime)); $gEvent->setStart_date_day(convertDateToDayOptions($startTime, $timezone)); $gEvent->setStart_date_year(convertDateToYearOptions($startTime)); $gEvent->setStart_date_time(convertDateToTimeOptions($startTime)); $gEvent->setPrice_range($minPrice . " - " . $maxPrice); if (substr($gEvent->getPrice_range(), 0, 2) === "0 ") { $gEvent->setIs_free(true); } else { if ($gEvent->getPrice_range() !== null) { $gEvent->setIs_free(false); } } $minorGenre = trim(str_replace("tickets", " ", $channel)); $majorGenre = trim(str_replace("tickets", " ", $channel)); $gEvent->setMinor_genre(array($minorGenre)); $gEvent->setMajor_genre(array($majorGenre)); $gEvent->setEvent_external_url($eventExternalUrl); // Populate image links found $gEventImages = array(); $gImage = new gEventImage(); $searchImageQuery = explode("[", $desc); $searchImageQuery = explode("-", $searchImageQuery[0]); $searchImageQuery = urlencode($searchImageQuery[0]); $searchImageUrl = "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q={$searchImageQuery}"; $googleImageUrl = googleImageSearch($searchImageUrl); $gImage->setImage_external_url($googleImageUrl); //$gImage->setImage_external_url("https://cdn4.iconfinder.com/data/icons/small-n-flat/24/calendar-128.png"); $gImage->setImage_category("attraction"); array_push($gEventImages, $gImage); if (isset($imageExternalUrl)) { $gImage = new gEventImage(); $gImage->setImage_external_url($imageExternalUrlLong); $gImage->setImage_category("venue"); array_push($gEventImages, $gImage); } $gEvent->setImages($gEventImages); /* //Populate performers found $gEventPerformers = array(); if(isset($json->response->docs[$i]->AttractionName[0])){ $aI = 0; foreach ($json->response->docs[$i]->AttractionName as $performer) { if(isset($performer) && null != $performer && $performer != ""){ $gPerformer = new gEventPerformer; $gPerformer->setPerformer_name($performer); $gPerformer->setPerformer_external_image_url("http://s1.ticketm.net/tm/en-us".$json->response->docs[$i]->AttractionImage[$aI]); array_push($gEventPerformers, $gPerformer); } $aI++; } } $gEvent->setPerformers($gEventPerformers); */ // Push gEvent object onto arraylist of gEvent objects array_push($gEvents, $gEvent); } } } } } } $i++; } return $gEvents; }
function ticketmasterAPI_findEvent($eventId, $optionsArray) { // There is currently do way to search the ticketmaster API by event id // so we're going to scrape the vendor and artist id from the site // to be able to use it in the json search request $html = file_get_html("http://www.ticketmaster.com/event/{$eventId}"); $patternAID = '/"artistID":"(.*?)"/'; preg_match($patternAID, $html, $AIDmatches); if (isset($AIDmatches[0])) { $aid = explode(":", $AIDmatches[0]); $aid = $aid[1]; $aid = str_replace('"', '', $aid); } $patternVID = '/"venueID":"(.*?)"/'; preg_match($patternVID, $html, $VIDmatches); if (isset($VIDmatches[0])) { $vid = explode(":", $VIDmatches[0]); $vid = $vid[1]; $vid = str_replace('"', '', $vid); } // no match, return empty array if (!isset($aid) && !isset($vid)) { $gEvents = array(); return $gEvents; } // Filter Parameters $eid = $eventId; $vid = $vid; $aid = $aid; $userLat = $optionsArray['userLat']; $userLong = $optionsArray['userLng']; $endpoint_ticketmaster = "http://www.ticketmaster.com/json/search/event"; $url = isset($vid) ? "{$endpoint_ticketmaster}?vid={$vid}" : "{$endpoint_ticketmaster}?aid={$aid}"; $data = get_data($url); $json = json_decode($data); $num = $json->response->numFound; $gEvents = array(); $i = 0; // Loop through Json Results from CURL resuest while ($i < $num) { $externalId = empty($json->response->docs[$i]->Id) ? null : $json->response->docs[$i]->Id; $city = empty($json->response->docs[$i]->VenueCity) ? null : $json->response->docs[$i]->VenueCity; $state = empty($json->response->docs[$i]->VenueState) ? null : $json->response->docs[$i]->VenueState; $date = empty($json->response->docs[$i]->PostProcessedData->LocalEventDate) ? null : substr($json->response->docs[$i]->PostProcessedData->LocalEventDate, 0, -15); $desc = empty($json->response->docs[$i]->EventName) ? null : $json->response->docs[$i]->EventName; $title = empty($json->response->docs[$i]->EventName) ? null : $json->response->docs[$i]->EventName; $eventInfo = empty($json->response->docs[$i]->EventInfo) ? null : htmlspecialchars($json->response->docs[$i]->EventInfo . "\n\n", ENT_QUOTES); $eventNotes = empty($json->response->docs[$i]->EventNotes) ? null : htmlspecialchars($json->response->docs[$i]->EventNotes, ENT_QUOTES); $venueExternalId = empty($json->response->docs[$i]->VenueId) ? null : $json->response->docs[$i]->VenueId; $venueName = empty($json->response->docs[$i]->VenueName) ? null : $json->response->docs[$i]->VenueName; $venueAddress = empty($json->response->docs[$i]->VenueAddress) ? null : $json->response->docs[$i]->VenueAddress; $country = empty($json->response->docs[$i]->VenueCountry) ? null : $json->response->docs[$i]->VenueCountry; $postalCode = empty($json->response->docs[$i]->VenuePostalCode) ? null : $json->response->docs[$i]->VenuePostalCode; $defaultDomain = "http://ticketmaster.com"; $venueExternalUrl = empty($json->response->docs[$i]->VenueSEOLink) ? null : $defaultDomain . $json->response->docs[$i]->VenueSEOLink; $venueLatLongString = empty($json->response->docs[$i]->VenueLatLong) ? null : $json->response->docs[$i]->VenueLatLong; $timezone = empty($json->response->docs[$i]->Timezone) ? null : $json->response->docs[$i]->Timezone; $startTime = empty($json->response->docs[$i]->PostProcessedData->LocalEventDate) ? null : str_replace("T", " ", substr($json->response->docs[$i]->PostProcessedData->LocalEventDate, 0, -6)); $priceRange = empty($json->response->docs[$i]->PriceRange) ? null : $json->response->docs[$i]->PriceRange; $minPrice = empty($json->response->docs[$i]->minPrice) ? null : $json->response->docs[$i]->minPrice; $maxPrice = empty($json->response->docs[$i]->maxPrice) ? null : $json->response->docs[$i]->maxPrice; $genre = empty($json->response->docs[$i]->Genre[0]) ? null : $json->response->docs[$i]->Genre; $minorGenre = empty($json->response->docs[$i]->MinorGenre[0]) ? null : $json->response->docs[$i]->MinorGenre; $majorGenre = empty($json->response->docs[$i]->MajorGenre[0]) ? null : $json->response->docs[$i]->MajorGenre; $eventSEOName = empty($json->response->docs[$i]->EventSEOName) ? null : $json->response->docs[$i]->EventSEOName; $eventExternalUrl = $defaultDomain . "/" . $eventSEOName . "/event/" . $externalId; $eventExternalAttractionUrl = empty($json->response->docs[$i]->AttractionSEOLink[0]) ? null : "http://ticketmaster.com" . $json->response->docs[$i]->AttractionSEOLink[0]; $currentEvent = true; $distance = 0.0; if (!empty($venueLatLongString)) { $venueLatLong = explode(",", $venueLatLongString); if (null != $venueLatLong[0] && null != $venueLatLong[1] && null != $userLat && null != $userLong) { $distance = distanceInMiles($userLat, $userLong, $venueLatLong[0], $venueLatLong[1]); } } if (!empty($startTime)) { date_default_timezone_set($timezone); $currentUnixTime = strtotime("now"); $eventUnixTime = strtotime($startTime); $currentEvent = $currentUnixTime > $eventUnixTime ? false : true; } // If no externalId is set, don't pull record. Avoids empty // records from getting pulled. if (!empty($externalId) && $currentEvent && $externalId == $eid) { if (empty($filterCity) || strtolower($filterCity) == strtolower($city)) { if (empty($filterState) || strtolower($filterState) == strtolower($state)) { if (empty($filterDate) || $filterDate == $date) { if (empty($filterDesc) || strpos(strtolower($desc), strtolower($filterDesc)) !== FALSE) { if (empty($filterRadius) || $distance <= $filterRadius && $distance > 0) { $gEvent = new gEvent(); $gEvent->setExternal_id($externalId); $gEvent->setDatasource("ticketmaster"); $gEvent->setTitle($title); $gEvent->setDescription($desc); $gEvent->setNotes($eventInfo . $eventNotes); $gEvent->setVenue_external_id($venueExternalId); $gEvent->setVenue_name($venueName); $gEvent->setVenue_address($venueAddress); $gEvent->setCountry_name($country); $gEvent->setState_name($state); $gEvent->setCity_name($city); $gEvent->setPostal_code($postalCode); $gEvent->setVenue_external_url($venueExternalUrl); if (!empty($venueLatLongString)) { $venueLatLong = explode(",", $venueLatLongString); $gEvent->setLatitude((double) $venueLatLong[0]); $gEvent->setLongitude((double) $venueLatLong[1]); $gEvent->setDistance(number_format((double) $distance, 2, '.', '')); } $gEvent->setTimezone($timezone); $gEvent->setTimezone_abbr(convertTimezoneToAbbr($timezone)); $gEvent->setStart_time($startTime); $gEvent->setEnd_time(""); $gEvent->setStart_date_month(convertDateToMonthOptions($startTime)); $gEvent->setStart_date_day(convertDateToDayOptions($startTime, $timezone)); $gEvent->setStart_date_year(convertDateToYearOptions($startTime)); $gEvent->setStart_date_time(convertDateToTimeOptions($startTime)); $gEvent->setPrice_range($priceRange); if (substr($priceRange, 0, 2) === "0 ") { $gEvent->setIs_free(true); } else { if ($gEvent->getPrice_range() !== null) { $gEvent->setIs_free(false); } } $gEvent->setMinor_genre(array_merge($genre, $minorGenre)); $gEvent->setMajor_genre($majorGenre); $gEvent->setEvent_external_url($eventExternalUrl); // Populate image links found $gEventImages = array(); if (!empty($json->response->docs[$i]->AttractionImage[0])) { foreach ($json->response->docs[$i]->AttractionImage as $image) { if (isset($image) && null != $image && $image != "") { $gImage = new gEventImage(); $gImage->setImage_external_url("http://s1.ticketm.net/tm/en-us" . $image); $gImage->setImage_category("attraction"); array_push($gEventImages, $gImage); } } } if (!empty($json->response->docs[$i]->VenueImage)) { $gImage = new gEventImage(); $gImage->setImage_external_url("http://s1.ticketm.net/tm/en-us" . $json->response->docs[$i]->VenueImage); $gImage->setImage_category("venue"); array_push($gEventImages, $gImage); } $gEvent->setImages($gEventImages); //Populate performers found $gEventPerformers = array(); if (!empty($json->response->docs[$i]->AttractionName[0])) { $aI = 0; foreach ($json->response->docs[$i]->AttractionName as $performer) { if (!empty($performer)) { $gPerformer = new gEventPerformer(); $gPerformer->setPerformer_name($performer); $attractionImageUrl = empty($json->response->docs[$i]->AttractionImage[$aI]) ? null : $json->response->docs[$i]->AttractionImage[$aI]; if (!empty($attractionImageUrl)) { $gPerformer->setPerformer_external_image_url("http://s1.ticketm.net/tm/en-us" . $json->response->docs[$i]->AttractionImage[$aI]); } array_push($gEventPerformers, $gPerformer); } $aI++; } } $gEvent->setPerformers($gEventPerformers); // Push gEvent object onto arraylist of gEvent objects array_push($gEvents, $gEvent); } } } } } } $i++; } return $gEvents; }