$uvddate
$uvcalendarmonth
"); } function uv_calendar_get_menumonths($uvdate){ $uvdate = date("Y-m-01", strtotime($uvdate)); $uvdate = strtotime($uvdate); $uvfirstmonth = "current"; for($i=0; $i<7; $i++){ $uvdatadate = date("Y-m-01", $uvdate); $uvdatesdate = date("ymd", $uvdate); $uvdmonth = date("F", $uvdate); $uvdmonthyear = date("Y", $uvdate); $uvmenumonths .= "
  • $uvdmonth $uvdmonthyear
  • "; $uvdate = strtotime("+1 month", $uvdate); $uvfirstmonth = ""; } return $uvmenumonths; } function uv_calendar_get_month($uvfeedtoken, $uvstartdate){ global $uv_today; $uvcalfeed = uv_get_feed("calendar", $uvfeedtoken); $uvtoday = $uv_today; $uvweeks = $uvcalfeed["weeks"]; $uvnextmonth = ($uvcalfeed["info"]) ? $uvcalfeed["info"]["nextmonth"] : ""; $uvprevmonth = ($uvcalfeed["info"]) ? date("Y-m-31", strtotime($uvcalfeed["info"]["prevmonth"])) : ""; if(is_array($uvweeks)){ $uvcalendarmonth = ""; foreach($uvweeks as $uvweek){ $uvcalendarmonth .= ""; for($i=0; $i<7; $i++){ $uvtdclass = ""; $uvcdate = $uvweek[$i]; $uvdateevents = $uvcdate["events"]; $uvdate = $uvcdate["date"]; $uvlabeldate = date("M d", strtotime($uvdate)); $uvtdclass = ($uvtoday > $uvdate) ? $uvtdclass . "past" : $uvtdclass; $uvtdclass = ($uvdate >= $uvnextmonth) ? $uvtdclass . " next" : $uvtdclass; $uvtdclass = ($uvprevmonth > $uvdate) ? $uvtdclass . " prev" : $uvtdclass; $uvdatecellcont = $uvdateevents ? uv_calendar_get_date($uvdateevents) : ""; if($uvdateevents) $uvmontheventlist .= uv_calendar_list_get_date($uvdateevents); $uvcalendarmonth .= ""; } $uvcalendarmonth .= ""; } if(!$uvmontheventlist) $uvmontheventlist = "
    No events for this month.
    "; $uvcalendarmonth .= "
    MondayTuesdayWednesdayThursdayFridaySaturdaySunday
    $uvlabeldate
    $uvdatecellcont
    $uvmontheventlist
    "; } else return "UV Error: There was a problem getting the calendar feed"; return $uvcalendarmonth; } function uv_calendar_get_date($uvdateevents){ $uvdateflyer = uv_get_flyer($uvdateevents[0]["flyers"], "calendar"); $uvdateflyerfolder = $uvdateflyer["flyer_folder"]; $uvdateflyerfile = $uvdateflyer["flyer_file"]; $uvdateflyerratio = $uvdateflyer["flyer_ratio"]; $uvdateevents[0]["marketareaid"] = $ven_mkareaid; $uveventlink = uv_get_event_link($uvdateevents[0]); $uvdateflyerimsize = (($uvdateflyerratio == "Vertical") or ($uvdateflyerratio == "Horizontal")) ? "300SC0" : "300KT300"; $uvdatecell = "
    "; return $uvdatecell; } function uv_calendar_list_get_date($uvdateevents){ if(is_array($uvdateevents)) foreach($uvdateevents as $event_info){ $evt_id = $event_info["id"]; $evt_caldate = $event_info["date"]; $evt_name = $event_info["name"]; $evt_venueid = $event_info["venueid"]; $evt_vname = $event_info["venuename"]; $evt_city = $ven_marketarea; $evt_mkareaid = $ven_mkareaid; $evt_calmonnth = date("M", strtotime($evt_caldate)); $evt_calday = date("j", strtotime($evt_caldate)); $evt_flyers = $event_info["flyers"]; $evt_flyer = uv_get_flyer($evt_flyers, "calendar"); $evt_fly_folder = $evt_flyer["flyer_folder"]; $evt_fly_file = $evt_flyer["flyer_file"]; $evt_fly_url = ""; if($evt_fly_folder && $evt_fly_file) $evt_fly_url = "$evt_fly_folder/90KT90/$evt_fly_file"; $evt_url = uv_get_event_link($event_info); if($evt_fly_url) $uveventlistitem .= "

    $evt_name

    $evt_calmonnth
    $evt_calday
    View
    "; } return $uveventlistitem; } /**********/ /*UVFEEDS*/ function uv_get_feed($uvfeedkey, $uvterms = ""){ global $uvlib_feeds; if(preg_match("/^\d+$/", $uvfeedkey)) return uv_get_media_feed($uvfeedkey, $uvterms); else if(preg_match("/^https?:\/\/.+$/", $uvfeedkey)){ $uvfeedexpiration = $uvterms ? $uvterms : 3600; return uv_call_feed($uvfeedkey, $uvfeedexpiration); } else{ if(array_key_exists($uvfeedkey, $uvlib_feeds)){ if($uvterms) return uv_get_lib_feed($uvfeedkey, $uvterms); else return "UV Error: Parameters are required"; } else return "UV Error: Given feed key({$uvfeedkey}) does not exist"; } } function uv_get_media_feed($uvmediaid, $uvmediaelement){ global $uvlib_mediafeeds; $uvfeedmediapath = $uvlib_mediafeeds["m$uvmediatypeid"] ? $uvlib_mediafeeds["feedmediapath"] : ""; $uvterms = array( "mediaid" => $uvmediaid ); $uvfeedcotent = uv_get_lib_feed("MEDIA", $uvterms); $uvmediatypeid = $uvfeedcotent["mediatypeid"]; if(!$uvmediatypeid and $uvfeedcotent["pic"]) $uvmediatypeid = $uvfeedcotent["pic"][0]["mediatypeid"]; else if(!$uvmediatypeid and $uvfeedcotent["singlevideo"]) $uvmediatypeid = $uvfeedcotent["singlevideo"][0]["video"][0]["mediatypeid"]; else if(!$uvmediatypeid and $uvfeedcotent["pdf"]) $uvmediatypeid = $uvfeedcotent["pdf"][0]["mediatypeid"]; else if(!$uvmediatypeid and $uvfeedcotent["article"]) $uvmediatypeid = $uvfeedcotent["article"][0]["mediatypeid"]; else if(!$uvmediatypeid and $uvfeedcotent["gallery"]) $uvmediatypeid = $uvfeedcotent["gallery"][0]["mediatypeid"]; if($uvmediatypeid and $uvlib_mediafeeds["m$uvmediatypeid"]){ $uvfeedreturnpath = $uvlib_mediafeeds["m$uvmediatypeid"]["feedreturnpath"]; $uvlibfeedreturn = $uvlib_mediafeeds["m$uvmediatypeid"]["feedreturn"]; $uvfeedreturn = !$uvmediaelement ? $uvlibfeedreturn : $uvmediaelement; if($uvfeedreturnpath){ $uvfeedrpaths = explode(":", $uvfeedreturnpath); foreach($uvfeedrpaths as $uvpathindex){ $uvfeedcotent = $uvfeedcotent[$uvpathindex]; if(!$uvfeedcotent) return "UV Error: Wrong feed return path, contact aa"; } } if($uvlibfeedreturn == "imageurl" and !$uvmediaelement == "feed"){ $uvfeedimgsize = $uvmediaelement ? $uvmediaelement : "raw"; $uvfeedcotentreturn = $uvfeedcotent["folder"] . "/$uvfeedimgsize/" . $uvfeedcotent["file"]; } else if($uvlibfeedreturn == "videoframeurl" and !$uvmediaelement == "feed"){ $uvfeedcotentreturn = $uvfeedcotent["videoexternalid"]; $uvfeedvidurl = $uvfeedcotent["videourl"]; $uvfeedcotentreturn = (preg_match("/vimeo/", $uvfeedvidurl)) ? "https://player.vimeo.com/video/" . $uvfeedcotentreturn : "https://www.youtube.com/embed/" . $uvfeedcotentreturn; } else if($uvlibfeedreturn == "pdfurl" and !$uvmediaelement == "feed"){ $uvfeedcotentreturn = $uvfeedcotent["folder"] . "/raw/" . $uvfeedcotent["file"]; } else if($uvlibfeedreturn == "article" and !$uvmediaelement == "feed"){ $uvfeedcotentreturn = $uvfeedcotent["plaintext"]; } else if($uvlibfeedreturn == "feed" or $uvmediaelement == "feed") $uvfeedcotentreturn = $uvfeedcotent; else if(!$uvmediaelement) $uvfeedcotentreturn = $uvfeedcotent["$uvfeedreturn"]; else $uvfeedcotentreturn = $uvfeedcotent["$uvmediaelement"] ? $uvfeedcotent["$uvmediaelement"] : "Feed element not found"; } else return "UV Error: mediatype not supported, contact aa"; return $uvfeedcotentreturn; } function uv_get_lib_feed($uvfeedkey, $uvterms){ global $uvlib_feeds, $uvlib_global, $uv_feedspath; $uv_server = $uvlib_global["uvserver"]; $uvlibfeedurl = $uvlib_feeds[$uvfeedkey]["url"]; $uvlibfeedexpiration = $uvlib_feeds[$uvfeedkey]["expiration"]; $uvlibfeedvarpass = $uvlib_feeds[$uvfeedkey]["varpass"]; if($uvlibfeedvarpass == "url"){ if(is_array($uvterms)){ foreach($uvterms as $uvkey => $uvvalue) $uvparams .= $uvkey . $uvvalue; } else $uvparams = $uvterms; } else if($uvlibfeedvarpass == "get"){ foreach($uvterms as $uvkey => $uvvalue){ $uvparams .= $uvgetandchar . $uvkey . "=" . $uvvalue; $uvgetandchar = "&"; } if($uv_feedspath and is_writable($uv_feedspath)){ $uvparams .= "&cmscache=" . uv_get_cmscacheword(); } } $uvlibfeedurl = str_replace("{uvserver}", $uv_server, $uvlibfeedurl); $uvlibfeedurl = str_replace("{params}", $uvparams, $uvlibfeedurl); return uv_call_feed($uvlibfeedurl, $uvlibfeedexpiration, $uvfeedkey); } function uv_call_feed($uvfeedurl, $uvfeedexpiration, $uvfeedkey = "direct"){ global $uv_feedspath; if(($uv_feedspath) and (is_writable($uv_feedspath)) and ($uvfeedexpiration > 0)){ return uv_get_cached_feed($uvfeedurl, $uvfeedexpiration, $uvfeedkey); } else{ if($uv_feedspath) return "UV Error: Cache path does not exist or is not writable"; else return uv_get_feed_nocache($uvfeedurl, $uvfeedkey); } } function uv_get_feed_nocache($uvfeedurl, $uvfeedkey = ""){ global $uv_testfeeds; if((preg_match("/^.+\.(\w{3,4})$/", $uvfeedurl, $uvfeedurlparts) or preg_match("/^.+\.(\w{3,4})[\?].+$/", $uvfeedurl, $uvfeedurlparts))){ $uvfeedfiletype = $uvfeedurlparts[1]; $uvfilecontent = uv_file_get_contents($uvfeedurl); $uvfilecontent = uv_get_feed_array($uvfilecontent, $uvfeedfiletype, $uvfeedkey); if($uv_testfeeds) echo("UV Debug: No cache feed called: $uvfeedurl"); return $uvfilecontent; } else return "UV Error: Filetype not supported, contact: aa"; } function uv_get_cached_feed($uvfeedurl, $uvfeedexpiration, $uvfeedkey){ global $uv_feedspath, $uv_testfeeds; if($uv_feedspath and (preg_match("/^.+\.(\w{3,4})$/", $uvfeedurl, $uvfeedurlparts) or preg_match("/^.+\.(\w{3,4})[\?].+$/", $uvfeedurl, $uvfeedurlparts))){ $uvfeedhash = hash('md5', $uvfeedurl); $uvfeedfiletype = $uvfeedurlparts[1]; $uvfeedfullpath = $uv_feedspath . "/" . $uvfeedhash . "." . $uvfeedfiletype; if(file_exists("$uvfeedfullpath")){ $uvfileexpiresat = filemtime($uvfeedfullpath) + $uvfeedexpiration; $uvnowtime = time(); if($uvnowtime > $uvfileexpiresat){ $uvfilecontent = uv_create_feed_file($uvfeedurl, $uvfeedfullpath, $uvfeedexpiration); uv_update_feeds_infofile($uvfeedurl, $uvfeedfullpath, $uvfeedexpiration, $uvfeedhash, $uvfeedkey); if($uv_testfeeds) echo("UV Debug: Cached feed refreshed: $uvfeedurl"); } else{ $uvfilecontent = uv_file_get_contents($uvfeedfullpath); if($uv_testfeeds) echo("UV Debug: Feed called from cache: $uvfeedurl"); } } else{ $uvfilecontent = uv_create_feed_file($uvfeedurl, $uvfeedfullpath, $uvfeedexpiration); uv_update_feeds_infofile($uvfeedurl, $uvfeedfullpath, $uvfeedexpiration, $uvfeedhash, $uvfeedkey); if($uv_testfeeds) echo("UV Debug: Cache feed created: $uvfeedurl"); } $uvfilecontent = uv_get_feed_array($uvfilecontent, $uvfeedfiletype, $uvfeedkey); return $uvfilecontent; } else return "UV Error: Filetype not supported, contact: aa"; } function uv_create_feed_file($uvfeedurl, $uvfeedfullpath, $uvfeedexpiration){ if($uvfeedfullpath and $uvfeedurl){ $uvfilecotent = uv_file_get_contents($uvfeedurl); if(file_exists("$uvfeedfullpath")) unlink("$uvfeedfullpath"); $fp = fopen("$uvfeedfullpath", "w+"); fwrite($fp, $uvfilecotent); fclose($fp); return $uvfilecotent; } } function uv_get_feed_array($uvfilecontent, $uvfeedfiletype, $uvfeedkey = ""){ if($uvfeedfiletype == "json"){ $uvfilecontent = json_decode($uvfilecontent, true); if($uvfeedkey == "MEDIA") $uvfilecontent = $uvfilecontent["xc8"][0]; } else if($uvfeedfiletype == "pc8"){ eval($uvfilecontent); $uvfilecontent = $xc8; } return $uvfilecontent; } function uv_update_feeds_infofile($uvfeedurl, $uvfeedfullpath, $uvfeedexpiration, $uvfeedhash, $uvfeedkey){ global $uv_feedspath, $uvlib_feedscleartime, $uvtmp_cmscacheword; if($uv_feedspath){ $uvfeedsinfofilepath = $uv_feedspath . "/cachedfeedsinfo.php"; $uvtimenow = time(); if(!file_exists($uvfeedsinfofilepath)){ $uvclearfeedstime = $uvtimenow + $uvlib_feedscleartime; $uvcmscacheword = $uvtmp_cmscacheword ? $uvtmp_cmscacheword : uv_generate_random_word(); $uvfeedsinfofilearray = array( "clearfeedstime" => $uvclearfeedstime, "cmscacheword" => $uvcmscacheword, "feeds" => array() ); } else $uvfeedsinfofilearray = include("$uvfeedsinfofilepath"); $uvclearfeedstime = $uvfeedsinfofilearray["clearfeedstime"]; $uvfeedsinfofilearray["feeds"]["$uvfeedhash"]["feedurl"] = $uvfeedurl; $uvfeedsinfofilearray["feeds"]["$uvfeedhash"]["feedpath"] = $uvfeedfullpath; $uvfeedsinfofilearray["feeds"]["$uvfeedhash"]["expiration"] = $uvfeedexpiration; $uvfeedsinfofilearray["feeds"]["$uvfeedhash"]["lastupdate"] = $uvtimenow; $uvfeedsinfofilearray["feeds"]["$uvfeedhash"]["feedkey"] = $uvfeedkey; $fp = fopen("$uvfeedsinfofilepath", "w+"); fwrite($fp, " $uvclearfeedstime) uv_clean_cached_feeds(); } } function uv_clean_cached_feeds(){ global $uv_feedspath; if($uv_feedspath){ if(file_exists($uv_feedspath)){ $uvfiles = glob("$uv_feedspath/*"); foreach($uvfiles as $uvfile){ if(is_file($uvfile)) unlink($uvfile); } } return true; } return false; } function uv_get_cmscacheword(){ global $uvtmp_cmscacheword, $uv_feedspath; $uvfeedsinfofilepath = $uv_feedspath . "/cachedfeedsinfo.php"; if(!$uvtmp_cmscacheword){ if(!file_exists($uvfeedsinfofilepath)) $uvtmp_cmscacheword = uv_generate_random_word(); else{ $uvfeedsinfofilearray = include("$uvfeedsinfofilepath"); $uvtmp_cmscacheword = $uvfeedsinfofilearray["cmscacheword"]; } } return $uvtmp_cmscacheword; } function uv_generate_random_word($uvlenght = 8){ $uvrword = array_merge(range('a', 'z'), range('A', 'Z')); shuffle($uvrword); return substr(implode($uvrword), 0, $uvlenght); } /****************/ function uv_file_get_contents($uvfileurl){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $uvfileurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,5); curl_setopt($ch, CURLOPT_TIMEOUT, 60); $output = curl_exec($ch); return($output); } /*UVPERFORMANCE*/ function uv_set_performance(){ return microtime(true); } function uv_get_performance($uvperftimestart){ $uvperftimeend = microtime(true); $uvperftime = ($uvperftimeend - $uvperftimestart); return $uvperftime; } /****************/ /*TEXT AND INFO PROCESSING*/ function uv_get_event_link($uveventinfo = ""){ global $uvlib_global; $evt_id = $uveventinfo["id"]; $evt_caldate = $uveventinfo["date"]; $evt_name = $uveventinfo["name"]; $evt_venueid = $uveventinfo["venueid"]; $evt_veroomid = $uveventinfo["venueroomid"]; $evt_mkareaid = $uveventinfo["marketareaid"]; $evt_fname = uv_get_linkstring($evt_name); $evt_tokendate = date("ymd", strtotime($evt_caldate)); $evt_url = $uvlib_global["eventurl"]; $evt_addroomid = $evt_veroomid ? "rm$evt_veroomid" : ""; $evt_tokenvars = "ve{$evt_venueid}dt{$evt_tokendate}{$evt_addroomid}"; $evt_url = str_replace("{tokenvars}", $evt_tokenvars, $evt_url); $evt_url = str_replace("{eventurlname}", $evt_fname, $evt_url); $evt_url = str_replace("{eventid}", $evt_id, $evt_url); $evt_url = str_replace("{eventdate}", $evt_caldate, $evt_url); $evt_url = str_replace("{seventdate}", $evt_tokendate, $evt_url); return $evt_url; } function uv_get_linkstring($string){ $string = uv_get_string2u($string, "-"); $string = preg_replace("|[^a-zA-Z0-9_]|", "-", $string); $string = preg_replace("|-+|", "-", $string); if(substr($string, -1) == "-") $string = substr($string, 0, -1); if(substr($string, 0, 1) == "-") $string=substr($string, 1); $string = strtolower($string); return($string); } function uv_get_string2u($string, $uchar){ global $uvlib_cleanchars; if(!$uchar) $uchar="-"; $string = strtr($string, $uvlib_cleanchars); $string = ucwords($string); $string=preg_replace("|[&][#0-9a-zA-Z]+[;]|", "", $string); $string=preg_replace("|[^0-9a-zA-Z]|", $uchar, $string); $string=preg_replace("|[$uchar][$uchar]+|", "$uchar", $string); return $string; } function uv_get_flyer($uvflyers, $uvflyeruse = "default", $uvflyerforce = false){ global $uvlib_flyers_priority; $uvflyerreturn = false; $uvflyerreturn_cur = false; $uvflyertypehc_cur = $uvflyerratiohc_cur = 0; if(is_array($uvflyers)){ foreach($uvflyers as $uvflyer){ $uvflyertypehc = (array_search($uvflyer["flyer_type"], $uvlib_flyers_priority[$uvflyeruse]["flyertype"]) !== FALSE) ? array_search($uvflyer["flyer_type"], $uvlib_flyers_priority[$uvflyeruse]["flyertype"]) + 1 : -1; $uvflyerratiohc = (array_search($uvflyer["flyer_ratio"], $uvlib_flyers_priority[$uvflyeruse]["flyerratio"]) !== FALSE) ? array_search($uvflyer["flyer_ratio"], $uvlib_flyers_priority[$uvflyeruse]["flyerratio"]) + 1 : -1; if(($uvflyertypehc < $uvflyertypehc_cur) or ($uvflyertypehc_cur == 0)){ $uvflyertypehc_cur = $uvflyertypehc; $uvflyerratiohc_cur = $uvflyerratiohc; $uvflyerreturn_cur = $uvflyer; } else if($uvflyertypehc == $uvflyertypehc_cur){ if($uvflyerratiohc < $uvflyerratiohc_cur){ $uvflyertypehc_cur = $uvflyertypehc; $uvflyerratiohc_cur = $uvflyerratiohc; $uvflyerreturn_cur = $uvflyer; } } if(($uvflyertypehc == 1) and ($uvflyerratiohc == 1)){ $uvflyertypehc_cur = $uvflyertypehc; $uvflyerratiohc_cur = $uvflyerratiohc; $uvflyerreturn_cur = $uvflyer; break; } } } $uvflyerreturn = is_array($uvflyerreturn_cur) ? $uvflyerreturn_cur : $uvflyerreturn; return $uvflyerreturn; } function uv_get_date_restypes($uvcaldate, $uvvenueid = false){ global $uvlib_global; $uvserver = $uvlib_global["uvserver"]; $uvvenueid = $uvvenueid ? $uvvenueid : $uvlib_global["uvvenueid"]; $uvdaystatusfeed = @uv_file_get_contents("http://$uvserver/api/v1/venues/$uvvenueid/daystatus.json?startdate=$uvcaldate&enddate=$uvcaldate"); $uvdaystatusfeed = json_decode($uvdaystatusfeed, true); $uvdaystatusfeed = $uvdaystatusfeed["xc8"][0]; if($uvdaystatusfeed){ $uvdaystatus = $uvdaystatusfeed["$uvcaldate"][1]["daystatus"]; $uvdaytimezone = $uvdaystatusfeed["$uvcaldate"][2]["timezone"]; $uvdaytimeidet = $uvdaystatusfeed["$uvcaldate"][3]["timezoneidentifier"]; if($daytimeidet) date_default_timezone_set($daytimeidet); $uvdayrestypes = array(); if(($uvdaystatus == "Open") and (is_array($uvdaystatusfeed["$uvcaldate"][0]["restypes"]))){ foreach($uvdaystatusfeed["$uvcaldate"][0]["restypes"] as $dayrestype){ $showrestyp = 1; $timecutoff = $dayrestype["cutofftime"]; if(($timecutoff != "-1") && ($timecutoff)){ $timenow = strtotime(date("Y-m-d H:i:s")); $timecheck = strtotime("$uvcaldate $timecutoff"); if($timenow>$timecheck){ $showrestyp = 0; } } if(($dayrestype["status"] == "Open") and ($dayrestype["blockwebsubmission"] != 1) and $showrestyp){ $dayrestypes[] = $dayrestype; } } } } if(count($dayrestypes) == 0) $dayrestypes = ""; return $dayrestypes; } function uv_get_restypes_checkboxes($uvdayrestypes){ $uvvrc = 0; if(is_array($uvdayrestypes)) foreach($uvdayrestypes as $venuerestype){ $resischecked = $uvvrc == 0 ? "checked" : ""; $uvvrc++; $showrestypename = $venuerestype["restypename"]; $uvrescheckslist .= "
    "; } return $uvrescheckslist; } function uv_get_formhtml($uvresdate, $uvrescheckboxes = ""){ global $uvlib_formtemplates, $uvlib_formfields_structure; $uvfomethod = $uvlib_formtemplates["formsheaders"]["method"]; $uvfoaction = $uvlib_formtemplates["formsheaders"]["action"]; $uvfosuccessmsg = $uvlib_formtemplates["formsheaders"]["successmsg"]; $uvformhtml = "
    "; if(is_array($uvlib_formtemplates["formsheaders"]["hiddenfields"])) foreach($uvlib_formtemplates["formsheaders"]["hiddenfields"] as $uvhfieldname => $uvhfieldvalue){ $uvformhiddenfields .= ""; } $uvformhiddenfields = str_replace("{resdate}", $uvresdate, $uvformhiddenfields); $uvformhtml .= $uvformhiddenfields; if(is_array($uvlib_formtemplates["default"])) foreach($uvlib_formtemplates["default"] as $uvformfield){ $uvformfieldhandle = $uvformfield["handle"]; if($uvformfieldhandle != "restypecheckboxes"){ $uvfieldvalidateattrs = ""; $uvfieldstructure = $uvlib_formfields_structure["simplelabel"][$uvformfieldhandle]; $uvfieldextraattrs = $uvformfield["extraattr"] ? $uvformfield["extraattr"] : ""; $uvfieldmaxwidth = $uvformfield["maxwidth"] ? "style='max-width: " . $uvformfield["maxwidth"] . "px'" : ""; if($uvformfield["required"]){ $uvfieldvalidateattrs = $uvformfield["error"] ? "data-msg-required='" . $uvformfield["error"] . "' " : ""; $uvfieldvalidateattrs = $uvformfield["valtype"] ? $uvfieldvalidateattrs . $uvformfield["valtype"] . "='true' data-msg-" . $uvformfield["valtype"] . "='" . $uvformfield["valtypeerror"] . "'" : $uvfieldvalidateattrs; $uvfieldvalidateattrs .= "required"; } $uvformfieldhtml = str_replace(array("{label}", "{name}", "{type}", "{validateattrs}", "{extraattrs}", "{fieldparentstyle}", "{placeholder}"), array($uvformfield["label"], $uvformfield["name"], $uvformfield["type"], $uvfieldvalidateattrs, $uvfieldextraattrs, $uvfieldmaxwidth, $uvformfield["placeholder"]), $uvfieldstructure); if(($uvformfieldhandle == "resdate") && ($uvresdate)) $uvformfieldhtml = ""; $uvformhtml .= $uvformfieldhtml; } else if($uvformfieldhandle == "restypecheckboxes"){ if(preg_match("/^\d+$/", $uvrescheckboxes)) $uvformhtml .= ""; else $uvformhtml .= $uvrescheckboxes; } } $uvformhtml .= ""; $uvformhtml .= "
    "; return $uvformhtml; } function uv_get_restypeopendays_script($uvrestypeid){ global $uvlib_global, $uv_today; $uvserver = $uvlib_global["uvserver"]; $uvvenueid = $uvvenueid ? $uvvenueid : $uvlib_global["uvvenueid"]; $uvstartdate = $uv_today; $uvenddate = date("Y-m-d", strtotime("+90 days")); $uvrestypeopendaysfeed = @uv_file_get_contents("http://$uvserver/api/v1/venue/$uvvenueid/daystatus.json?restypeid=$uvrestypeid&startdate=$uvstartdate&enddate=$uvenddate"); $uvrestypeopendaysfeed = json_decode($uvrestypeopendaysfeed, true); $uvrestypeopendaysfeed = $uvrestypeopendaysfeed["xc8"][0]; if(is_array($uvrestypeopendaysfeed)) foreach($uvrestypeopendaysfeed as $uvdayresdate => $uvrestypeday){ $uvdaystatus = $uvrestypeday[1]["daystatus"]; $uvdaytimezone = $uvrestypeday[2]["timezone"]; $uvdaytimeidet = $uvrestypeday[3]["timezoneidentifier"]; $uvdayrestype = $uvrestypeday[0]["restypes"][0]; if(($uvdaystatus == "Open") and ($uvdayrestype["status"] == "Open") and ($uvdayrestype["blockwebsubmission"] != 1)){ $uvretypeopendays["$uvdayresdate"] = $uvdayresdate; } } $uvretypeopendays = json_encode($uvretypeopendays); $uvretypeopendays = $uvretypeopendays ? $uvretypeopendays : "\"\""; return $uvretypeopendays; } function uv_cut_string($uvtextstring, $uvnchars = "60", $uvaddto = "...", $uvnlines = ""){ $uvtextstring = str_replace("
    ", "wwbrww", $uvtextstring); $uvtextstringnew = explode(";,;", wordwrap($uvtextstring, $uvnchars, ";,;")); $uvtextstring = count($uvtextstringnew) > 1 ? $uvtextstringnew[0] . $uvaddto : $uvtextstring; $uvtextstring = str_replace("wwbrww", "
    ", $uvtextstring); if($uvnlines){ $uvbrlines = explode("
    ", $uvtextstring); if(count($uvbrlines) >= $uvnlines){ $uvtextstring = ""; for($i=0; $i<$uvnlines; $i++){ $uvtextstring .= $uvbrlines[$i]; $uvtextstring .= ($i < ($uvnlines - 1)) ? "
    " : ""; } $uvtextstring .= $uvaddto; } } return $uvtextstring; } function uv_get_imsize($uvimwidth, $uvimheight, $uvlimit, $uvimlet = "KT"){ $uvimlimprop = ($uvimwidth >= $uvimheight) ? $uvlimit / $uvimwidth : $uvlimit / $uvimheight; $uvimsize = ceil($uvimwidth * $uvimlimprop) . $uvimlet . ceil($uvimheight * $uvimlimprop); return $uvimsize; } function uv_get_eventlisthtml($uveventlisttemplate, $uvineventtemplate = "default"){ global $uvlib_global, $uvlib_designtemplates; $uveventitemtemplate = $uvlib_designtemplates[$uveventlisttemplate][$uvineventtemplate]["template"]; $uveventflyerpcode = $uvlib_designtemplates[$uveventlisttemplate][$uvineventtemplate]["flyerprioritycode"]; $uveventflyerpimksize = $uvlib_designtemplates[$uveventlisttemplate][$uvineventtemplate]["flyerimksize"]; $uveventddatephpformat = $uvlib_designtemplates[$uveventlisttemplate][$uvineventtemplate]["ddatephpformat"]; $uvvenueevents = uv_get_feed("events", "uv" . $uvlib_global["uvvenueid"]); $uvvenueeventshtml = ""; if($uvvenueevents){ $uvvenueevents = $uvvenueevents["events"]; if(is_array($uvvenueevents)) foreach($uvvenueevents as $uvvenueevent){ $eventflyer = ""; $eventid = $uvvenueevent["id"]; $eventname = $uvvenueevent["name"]; $eventdate = $uvvenueevent["date"]; $eventflyers = $uvvenueevent["flyers"]; $eventfrecurring = $uvvenueevent["flyers_recurrent"]; $eventddate = date($uveventddatephpformat, strtotime($eventdate)); $eventlink = uv_get_event_link($uvvenueevent); $eventbuttons = uv_get_htmleventbuttons($uvvenueevent); $eventflyer = uv_get_flyer($eventflyers, $uveventflyerpcode); $eventflyer = is_array($eventflyer) ? $eventflyer : uv_get_flyer($eventfrecurring, $uveventflyerpcode); $eventflyerfolder = $eventflyer["flyer_folder"]; $eventflyerfile = $eventflyer["flyer_file"]; $eventflyer = "$eventflyerfolder/$uveventflyerpimksize/$eventflyerfile"; $uveventitemhtml = str_replace(array("{eventlink}", "{eventflyer}", "{eventname}", "{eventddate}", "{eventlinkbtns}"), array($eventlink, $eventflyer, $eventname, $eventddate, $eventbuttons), $uveventitemtemplate); if($eventflyer) $uvvenueeventshtml .= $uveventitemhtml; } } return $uvvenueeventshtml; } function uv_get_htmleventbuttons($uveventinfo){ $eventticketcount = $uveventinfo["ticketcount"][0]; $eventlink = uv_get_event_link($uveventinfo); $eventbtnscont = 0; if($eventticketcount["ticket"] > 0){ $eventdivbuttons = "Tickets"; $eventbtnscont++; } if($eventticketcount["table"] > 0){ $eventdivbuttons .= "Tables"; $eventbtnscont++; } if($eventbtnscont < 2){ $eventdivbuttons .= "Details"; $eventbtnscont++; } $eventdivbuttons = "
    " . $eventdivbuttons . "
    "; return $eventdivbuttons; } /*OLD UVTIX FUNCTIONS (Need to be replaced)*/ function uvGetUvTixItems($uvfeedtoken){ global $uv_testfeeds; $uvtixfeedurl = "https://urtickets.club/api/XRO/kyuvtix-vdwuuboja0{$uvfeedtoken}/itemsvenue.pc8"; $uvtixfeed = uv_file_get_contents($uvtixfeedurl); if($uv_testfeeds) echo("UV Debug: Items feed called: $uvtixfeedurl"); return $uvtixfeed; } $urcart_class = ""; $map_exists = false; function uvGetUvTixByType($uvtixitems, $uvtixtype){ global $urcart_class, $map_exists, $hidetiers, $test, $dyna_include_urlpath, $dyna_token, $dyna_tokenaffid, $dyna_clientid; if($uvtixitems["tabs"][0]){ $aux = 0; foreach($uvtixitems["tabs"][0]["tab"] as $tabs){ $validtabs[] = $tabs["catid"][0]; } //print_r($validtabs); $btn_viewtabshow=0; if(in_array("Cmaptable", $validtabs)) $btn_viewtabshow=1; foreach ($uvtixitems["tixx"][0] as $arritmkey => $arritm){ if($arritm and $arritm[0]["displayname"][0] == $uvtixtype){ $itemcatname = $arritmkey; if(!in_array($itemcatname, $validtabs)) continue; $itemdisplayname = $arritm[0]["displayname"][0]; $numitems = $arritm[0]["numitems"][0]; $itmlayout = $arritm[0]["layouts"][0]["layout"]; $itmtable = urcart_tablecreate($itmlayout); $aux++; if($aux==1) $addclass="active in"; else $addclass=""; $addclass2=""; $tabicon = "fa-ticket"; $tabtoogle = "data-toggle='tab' href='#tab-$aux'"; if($itemdisplayname == "Packages") $tabicon = "fa-cubes"; if($itemdisplayname == "Tables"){ $tabicon = "fa-glass"; $addclass2 ="uvtabbable"; if($map_exists===true) $tabtoogle = ""; } if($itemdisplayname == "Frees") $tabicon = "fa-tags"; $itemsinfo = $arritm[0]["tix"][0]; $cont = 0; foreach ($itemsinfo as $iteminfo) { $rowdata = ""; $iteminfo = $iteminfo[0]; $itmid=$iteminfo["id"][0]; $itmname=$iteminfo["name"][0]; $itmdescr=$iteminfo["descr"][0]; $itmcatid = $iteminfo["catid"][0]; $itmcatname = $iteminfo["catname"][0]; $itmallowlead = $iteminfo["allowlead"][0]; //echo("
    hola: $itmallowlead"); $itmglobalname = $iteminfo["globaltype"][0]; $itmmapid = $iteminfo["mapid"][0]; $itminfo = $iteminfo["terms"][0]; $itmtermstring = $iteminfo["termstring"][0]; $itmstate = $iteminfo["state"][0]; $itmlineorder = $iteminfo["lineorder"][0]; $itmcapacity = $iteminfo["capacity"][0]; $itmmaxguests = $iteminfo["maxguests"][0]; $itmovercharge = $iteminfo["overcharge"][0]; $itmbaseprice = money($iteminfo["baseprice"][0],2); $itmdepositperc = $iteminfo["depositperc"][0]; $itmglobaltype = $iteminfo["globaltype"][0]; $itmdarrivebytime = $iteminfo["darrivebytime"]; $itmstock = $iteminfo["stock"]; $itmgender = $iteminfo["gender"]; //! TO DISPLAY SOLD OUT $itmstate = $iteminfo['state'][0]; $itmstatename = $iteminfo['statename'][0]; $itmnotavailable = 0; if($itmstate != 7 and $itmstate != 4) { $itmnotavailable = 1; } /////////////////////////// $itmspecialoffer=$iteminfo["specialoffer"][0]; $itmtixtriggers=$iteminfo["tixtriggers"][0]; $addlab=""; if($itmtixtriggers && !$hidetiers) { for ($t=0;$t
    $dtier
    "; } $addlab="- Tier ". ($t+1); } $itmadddescr=""; if($itmspecialoffer) $itmadddescr=$itmspecialoffer; elseif($itmdescr) $itmadddescr=$itmdescr; /*OLD CODE if($itmadddescr and (strlen($itmadddescr) > 250)) $itmadddescr = "more info"; else $itmadddescr = "

    $itmadddescr

    "; */ if($itmadddescr and (strlen($itmadddescr) >115)){ $shortdescr = substr($itmadddescr, 0, 115)."..."; $itmadddescr = "

    $shortdescr more info

    "; }else $itmadddescr = "

    $itmadddescr

    "; $urcart_class = "urcart_item urcart_$itmid' data-urcart-type='$itemcatname' data-urcart-item='$itmid' "; $srtselect=""; $urcat_classp="urcart_price urcart_p$itmid"; $urcat_classm="urcart_price urcart_m$itmid"; $urcat_classd="urcart_price urcart_d$itmid"; //! TO DISPLAY SOLD OUT $qtyselect = null; if(!$itmnotavailable) { switch($itmglobaltype) { case "tickets": $qtyselect = urcart_ticketselect($itmmaxguests); if(!$addb) $addb=""; break; case "table": $qtyselect = urcart_tableselect($itmmaxguests,$itmcapacity); $addeventid=""; if($dyna_eventid) $addeventid="ev{$dyna_eventid}"; $addb=" View Map "; break; case "package": $qtyselect = urcart_tableselect($itmmaxguests,$itmcapacity); if(!$addb) $addb=""; break; case "freeguestlist": $qtyselect = 1; if(!$addb) $addb=""; break; default: $qtyselect = urcart_ticketselect($itmmaxguests); if(!$addb) $addb=""; } } else { $itmbaseprice = $itmstatename; } if($cont%2==0) $trclass = "tr1"; else $trclass = "tr2"; $rowdata .= "
  • "; foreach($itmlayout as $itmlayoutfield) { $tdclass = ""; $tdvalue = ""; switch ($itmlayoutfield["layoutvar"][0]) { case "itemname": $tdvalue = "
    $itmname {$addlab} $itmadddescr
    "; break; /* case "descr": $tdvalue = "
    $itmdescr
    "; break; */ case "dates": $tdvalue = $itmddate; break; case "guests": $tdvalue = "
    $qtyselect
    "; $tdclass = "center"; break; case "total": if($itmglobaltype == "freeguestlist") { $tdvalue = "
    "; $tdclass = "center"; } else { $tdvalue = "
    "; $tdclass = "cartright urcart_deactive"; } break; case "terms": //$tdvalue = ""; $tdvalue = ""; $tdclass = "center hidden-480"; if($itmglobaltype == "freeguestlist") { $tdvalue = "
    "; $tdclass = ""; } break; case "button": //$tdvalue = "$itmtermstring"; $tdclass = "hidden-480"; break; case "tablefee": $tdvalue = $itmtablefee; $tdclass = "cartright hidden-480"; break; case "minspend": $tdvalue = ""; $tdclass = "cartright urcart_deactive"; break; case "deposit": $tdvalue = ""; $tdclass = "cartright urcart_deactive"; break; case "baseamount": $tdvalue = $itmbaseamount; $tdclass = "cartright"; break; default; echo ""; } $rowdata .= "$tdvalue"; } //! TO DISPLAY SOLD OUT INQUIRY if(!$itmnotavailable){ $itminqurl = $dyna_include_urlpath . "/uvcore/{$dyna_token}{$dyna_tokenaffid}it{$itmid}ci{$dyna_clientid}/uvinquiry/"; $addrowclass = ($itmallowlead == 1) ? "uv-leadallowed" : ""; $addleadbtn = ($itmallowlead == 1) ? "" : ""; if($itmglobaltype == "freeguestlist") { if($itmstock>0) { $rowdata .= "
    $addleadbtn
  • "; } else { $rowdata .= "
    $addleadbtn
    "; } } else { $rowdata .= "
    $addleadbtn
    "; } } else { $rowdata .= "
    "; } $sviewsubtab .= $rowdata; $cont++; } } } } if($uvtixtype=="Guest List") $sviewsubtab=$itemsinfo; return $sviewsubtab; } function urcart_tablecreate($itmlayout){ $itmtable .= " "; $rowf=count($itmlayout); $auxx=0; foreach($itmlayout as $itmlayoutfield) { $thclass = ""; if($itmlayoutfield['layoutvar'][0] == "info" || $itmlayoutfield['layoutvar'][0] == "tablefee") $thclass = "hidden-480"; if($itmlayoutfield['layoutvar'][0] == "guests") $thclass = "center"; if($itmlayoutfield['layoutvar'][0] == "total" || $itmlayoutfield['layoutvar'][0] == "baseamount") $thclass = "cartright"; if($itmlayoutfield['layoutvar'][0] == "info" || $itmlayoutfield['layoutvar'][0] == "terms") $thclass.= " center "; if($itmlayoutfield['layoutvar'][0] == "minspend" || $itmlayoutfield['layoutvar'][0] == "deposit") $thclass.= " cartright "; if($auxx!=$rowf-1) { $itmtable .= " "; } else $itmtable .= ""; $auxx++; } $itmtable .= " "; return $itmtable; } function urcart_ticketselect($itmmaxguests){ global $urcart_class; $tmpstr = strpos($urcart_class, 'ticket'); if($itmmaxguests>5 && $tmpstr!==false) $itmmaxguests=5; if($itmmaxguests>0){ $srtselect.=""; } else{ $srtselect=""; } return $srtselect; } function urcart_tableselect($itmmaxguests,$itmcapacity){ global $urcart_class; global $map_exists; if(!$itmmaxguests) $itmmaxguests = $itmcapacity; $srtselect.=""; return $srtselect; } if(!$f_money) { $f_money=1; function percentage($number) { $number*=100; $number=number_format($number, 2); $number.="%"; return($number); } function money($money, $decimals=0) { global $zc8_curprefix; if(!$zc8_curprefix) $zc8_curprefix="$"; if(!$money) { return(""); } // if($money==0.1) // { // return("FREE"); // } else { if($decimals) { $money/=100; $money=number_format($money, $decimals); $money=$zc8_curprefix.$money; } elseif($money%100) { $money/=100; $money=number_format($money, 2); $money=$zc8_curprefix.$money; } else { $money/=100; $money=number_format($money, 0); $money=$zc8_curprefix.$money; } return($money); } } function nmoney($money) { $money/=100; $money=number_format($money, 2); $money=str_replace(",", "", $money); return($money); } function zmoney($money) { return($money); } }
    {$itmlayoutfield['layoutname'][0]}