Created
February 16, 2017 09:42
-
-
Save SunboX/102e4c031c78eefc08177a54f5361c1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: VereinOnline.org | |
| Plugin URI: http://www.vereinonline.org/ | |
| Description: Zeigt VereinOnline-Inhalte in WordPress an | |
| Version: 1.6 | |
| Date: 11 Jul 2016 | |
| Author: GRITH AG | |
| Author URI: http://www.grith-ag.de/ | |
| */ | |
| if (!function_exists('vereinonline')) | |
| { | |
| function vereinonline($content) | |
| { | |
| if (function_exists('get_option')) | |
| { | |
| $url=get_option('vereinonline_setting_url', ''); | |
| $usr=get_option('vereinonline_setting_usr', ''); | |
| $pwd=get_option('vereinonline_setting_pwd', ''); $pwd=md5($pwd); | |
| $web=get_option('vereinonline_setting_web', ''); if ($web=="") $web=$url."?veranstaltung="; // nur für [vereinonline_kalender] und [vereinonline_gruppentermine(..)] | |
| if ($url=="") return $content; | |
| } | |
| $html = $content; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_kalender")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_kalender"); | |
| $typ=trim(str_replace("(","", str_replace(")","", VereinOnlineParse($html,"]")))); | |
| if (VereinOnlineContains($html,"[/vereinonline_kalender]")) | |
| { | |
| $hTemplate=parse($html,"[/vereinonline_kalender]"); | |
| $mo=$_REQUEST["monat"]; if ($mo=="") $mo=date("Ym"); $yy=substr($mo,0,4); $mm=intval(substr($mo,4)); | |
| $filter=array("monat"=>$mo); if ($_REQUEST["gruppe"]!="") $filter["gruppenid"]=$_REQUEST["gruppe"]; | |
| $daten=VereinOnlineRequest($url, "GetEvents", $filter, "A/$usr/$pwd"); | |
| $leeretage=date('w', strtotime($yy . "-" . $mm . "-1")); $frei=$leeretage==0?6:$leeretage-1; | |
| for($tag=1; $tag<=$frei; $tag++) | |
| { | |
| $template=VereinOnlineExecuteCondition($hTemplate, array(), array("keintag"=>true)); | |
| //$o=new stdclass; $o->datum=$yy."-".$mm."-29"; | |
| $h.=VereinonlineVeranstaltung(false, $template, $aktuell, $kategorien, $lst); | |
| } | |
| for($tag=1; $tag<=TageMonat($mm,$yy); $tag++) | |
| { | |
| $dat=$yy."-".sprintf("%02d",$mm)."-".sprintf("%02d",$tag); | |
| $termine=array(); foreach($daten as $itm) if ($itm->datum==$dat) $termine[]=$itm; | |
| $template=VereinOnlineExecuteCondition($hTemplate, array(), array("keintermin"=>count($termine)==0, "eintermin"=>count($termine)==1)); | |
| if (count($termine)==0) { $data=new stdclass; $data->datum=sprintf("%04d-%02d-%02d",$yy,$mm,$tag); $h.=VereinonlineVeranstaltung($data, $template, $aktuell, $kategorien, $lst); } | |
| elseif (count($termine)==1) $h.=VereinonlineVeranstaltung($termine[0], $template, $aktuell, $kategorien, $lst); | |
| else | |
| { | |
| $h.=parse($template,"[vereinonline_termine]"); $h2=parse($template,"[/vereinonline_termine]"); | |
| foreach($termine as $t) $h.=VereinonlineVeranstaltung($t, $h2, $aktuell, $kategorien, $lst); | |
| $h.=$template; | |
| } | |
| } | |
| } | |
| else | |
| { | |
| $h.="<h4>Termine</h4>\n"; | |
| $h.="<div class='vereinonlinekalender'></div>"; | |
| $h.="<script> jQuery(document ).ready(function() { var d=new Date(); GoMonat('".$url."','".$web."',d.getMonth()+1, d.getFullYear(), '$typ', 'A/$usr/$pwd'); }); </script>"; | |
| } | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_termin(")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_termin("); | |
| $par=trim(str_replace("(","", str_replace(")","", VereinOnlineParse($html,"]")))); | |
| $id=trim(VereinOnlineParse($par,",")); if ($id=="#id#") $id=$_REQUEST["id"]; | |
| $hTemplate=VereinOnlineParse($html,"[/vereinonline_termin]"); | |
| if ($lst!="") | |
| { | |
| $kategorien=VereinOnlineRequest($url, "GetList", array("id"=>$lst), "A/$usr/$pwd"); | |
| if ($kategorien->error!="") $h.=$kategorien->error; | |
| } | |
| $aktuell=""; | |
| $daten=VereinOnlineRequest($url, "GetEvent", array("id"=>$id), "A/$usr/$pwd"); | |
| if ($daten->error!="") | |
| $h.=$daten->error; | |
| else | |
| { | |
| $h.=VereinonlineVeranstaltung($daten, $hTemplate, $aktuell, $kategorien, $lst); | |
| } | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_termine")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_termine"); | |
| $par=trim(str_replace("(","", str_replace(")","", VereinOnlineParse($html,"]")))); | |
| $typ=trim(VereinOnlineParse($par,",")); | |
| $lst=trim(VereinOnlineParse($par,",")); | |
| $jahr=trim(VereinOnlineParse($par,",")); | |
| $maxanz=trim(VereinOnlineParse($par,",")); | |
| $gruppenid=trim(VereinOnlineParse($par,",")); | |
| $hTemplate=VereinOnlineParse($html,"[/vereinonline_termine]"); | |
| if ($lst!="") | |
| { | |
| $kategorien=VereinOnlineRequest($url, "GetList", array("id"=>$lst), "A/$usr/$pwd"); | |
| if ($kategorien->error!="") $h.=$kategorien->error; | |
| } | |
| $filter=array(); | |
| if ($typ!="") $filter["typ"]=$typ; | |
| if ($jahr!="") $filter["jahr"]=$jahr; | |
| if ($gruppenid!="") $filter["gruppenid"]=$gruppenid; | |
| $daten=VereinOnlineRequest($url, "GetEvents", $filter, "A/$usr/$pwd"); | |
| $aktuell=""; | |
| if ($daten->error!="") | |
| $h.=$daten->error; | |
| else | |
| { | |
| foreach($daten as $rec) | |
| { | |
| $h.=VereinonlineVeranstaltung($rec, $hTemplate, $aktuell, $kategorien, $lst); | |
| if ($maxanz>0) { $maxanz--; if ($maxanz==0) break; } | |
| } | |
| } | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_gruppentermine(")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_gruppentermine("); | |
| $id=VereinOnlineParse($html,")]"); | |
| $daten=VereinOnlineRequest($url, "GetEvents", array(), "A/$usr/$pwd"); | |
| if ($daten->error!="") | |
| $h.=$daten->error; | |
| else | |
| { | |
| foreach($daten as $rec) | |
| { | |
| if ($rec->key_titel_kategorie==$id) | |
| { | |
| $h.="<a href=\"".str_replace("%year%", substr($rec->datum,0,4), $web).$rec->id."\">".VereinOnlineFormatDate($rec->datum, $rec->anzahltage).": ".str_replace("\"","",$rec->titel)."</a>\r\n"; | |
| } | |
| } | |
| } | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_bildergalerien")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_bildergalerien"); | |
| $par=trim(str_replace("(","", str_replace(")","", VereinOnlineParse($html,"]")))); | |
| if ($par!="" && $par!="!" && $par!="*") $maxanzahl=trim(VereinOnlineParse($par,",")); else $maxanzahl=""; | |
| $hTemplate=VereinOnlineParse($html,"[/vereinonline_bildergalerien]"); | |
| $daten=VereinOnlineRequest($url, "GetPictures", array(), "A/$usr/$pwd"); | |
| if ($daten->error!="") | |
| $h.=$daten->error; | |
| else | |
| { | |
| foreach($daten as $nr=>$bildergalerie) | |
| { | |
| if ($maxanzahl!="") if ($nr>=$maxanzahl) break; | |
| if (($par=="*" && $bildergalerie->titel=="") || ($par=="!" && $bildergalerie->titel!="")) continue; | |
| $template=$hTemplate; | |
| $template=str_replace("[vereinonline:id]", $bildergalerie->id, $template); | |
| $template=str_replace("[vereinonline:datum]", VereinOnlineFormatDate($bildergalerie->datum), $template); | |
| $template=str_replace("[vereinonline:titel]", $bildergalerie->titel, $template); | |
| $template=str_replace("[vereinonline:nachlese]", $bildergalerie->nachlese, $template); | |
| $template1=VereinOnlineParse($template,"[vereinonline_bilder]"); | |
| $templateBild=VereinOnlineParse($template,"[/vereinonline_bilder]"); | |
| for($bild=0; $bild<count($bildergalerie->bilder); $bild++) | |
| { | |
| $t=$templateBild; | |
| $t=str_replace("[vereinonline:file]", $url.$bildergalerie->bilder[$bild], $t); | |
| $t=str_replace("[vereinonline:fileklein]", $url.$bildergalerie->bildersmall[$bild], $t); | |
| $t=str_replace("[vereinonline:text]", $bildergalerie->text[$bild], $t); | |
| $t=str_replace("[vereinonline:nr]", $bild+1, $t); | |
| $template1.=$t; | |
| } | |
| $template=$template1.$template; | |
| $h.=$template; | |
| } | |
| } | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_news")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_news"); | |
| $par=trim(str_replace("(","", str_replace(")","", VereinOnlineParse($html,"]")))); | |
| $anz=trim(VereinOnlineParse($par,",")); | |
| $hTemplate=VereinOnlineParse($html,"[/vereinonline_news]"); | |
| $filter=array(); | |
| if ($anz=="*") $filter["alle"]="*"; else if ($anz>0) $filter["maximal"]=$anz; | |
| $daten=VereinOnlineRequest($url, "GetNews", $filter, "A/$usr/$pwd"); | |
| $aktuell=""; | |
| if ($daten->error!="") | |
| $h.=$daten->error; | |
| else | |
| { | |
| $cnt=0; | |
| foreach($daten as $rec) | |
| { | |
| $template=$hTemplate; | |
| $attachments=$rec->attachments; $template=str_replace("[vereinonline:foto]", VereinOnlineParse(str_replace("\r","",$attachments), "\n"), $template); | |
| foreach($rec as $k=>$v) $template=str_replace("[vereinonline:$k]", $v, $template); | |
| $t=""; | |
| while (VereinOnlineContains($template,"[vereinonline:")) | |
| { | |
| $t.=VereinOnlineParse($template,"[vereinonline:"); | |
| $tag=VereinOnlineParse($template,"]"); | |
| if ($tag=="veranstaltung") | |
| { | |
| $t1=VereinOnlineParse($template,"[/vereinonline:veranstaltung]"); | |
| if ($rec->veranstaltungid!=0) | |
| { | |
| $t1=str_replace("[vereinonline:veranstaltung:url]", str_replace("%year%",substr($rec->veranstaltungdatum,0,4),$web).$rec->veranstaltungid, $t1); | |
| $t1=str_replace("[vereinonline:veranstaltung:titel]", $rec->veranstaltungtitel, $t1); | |
| $t1=str_replace("[vereinonline:veranstaltung:datum]", VereinOnlineFormatDate($rec->veranstaltungdatum,$rec->veranstaltunganztage), $t1); | |
| $t.=$t1; | |
| } | |
| } | |
| } | |
| $template=$t.$template; | |
| $h.=$template; | |
| } | |
| } | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_subscribe]")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_subscribe]"); | |
| $h.=VereinOnlineRequestForm($url, "?subscribe"); | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_spenden]")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_spenden]"); | |
| $h.=VereinOnlineRequestForm($url, "?spenden"); | |
| } | |
| $html=$h.$html; | |
| $h=""; | |
| while (VereinOnlineContains($html,"[vereinonline_gruppen")) | |
| { | |
| $h.=VereinOnlineParse($html,"[vereinonline_gruppen"); | |
| $par=trim(str_replace("(","", str_replace(")","", VereinOnlineParse($html,"]")))); | |
| //$p1=trim(VereinOnlineParse($par,",")); | |
| $hTemplate=VereinOnlineParse($html,"[/vereinonline_gruppen]"); | |
| $daten=VereinOnlineRequest($url, "GetGroups", array(), "A/$usr/$pwd"); | |
| $aktuell=""; | |
| if ($daten->error!="") | |
| $h.=$daten->error; | |
| else | |
| { | |
| foreach($daten as $rec) | |
| { | |
| $t=$hTemplate; | |
| $t=str_replace("[vereinonline:name]", $rec->name, $t); | |
| $t=str_replace("[vereinonline:id]", $rec->id, $t); | |
| $h.=$t; | |
| } | |
| } | |
| } | |
| $html=$h.$html; | |
| return $html; | |
| } | |
| if (function_exists('get_option')) | |
| { | |
| function vereinonline_settings_api_init() | |
| { | |
| add_settings_section('vereinonline_setting_section', 'VereinOnline-Einstellungen', 'vereinonline_setting_section_callback_function', 'general'); | |
| add_settings_field('vereinonline_setting_url', 'VereinOnline-URL', 'vereinonline_setting_callback_url', 'general', 'vereinonline_setting_section'); | |
| add_settings_field('vereinonline_setting_usr', 'VereinOnline-Benutzer', 'vereinonline_setting_callback_usr', 'general', 'vereinonline_setting_section'); | |
| add_settings_field('vereinonline_setting_pwd', 'VereinOnline-Passwort', 'vereinonline_setting_callback_pwd', 'general', 'vereinonline_setting_section'); | |
| add_settings_field('vereinonline_setting_web', 'Webseite Termine-URL', 'vereinonline_setting_callback_web', 'general', 'vereinonline_setting_section'); | |
| register_setting('general', 'vereinonline_setting_url'); | |
| register_setting('general', 'vereinonline_setting_usr'); | |
| register_setting('general', 'vereinonline_setting_pwd'); | |
| register_setting('general', 'vereinonline_setting_web'); | |
| } | |
| function vereinonline_setting_section_callback_function() { echo '<p>VereinOnline-Zugang</p>'; } | |
| function vereinonline_setting_callback_url() { $setting = esc_attr( get_option( 'vereinonline_setting_url' ) ); echo "<input type='text' name='vereinonline_setting_url' value='$setting' size='60' />"; } | |
| function vereinonline_setting_callback_usr() { $setting = esc_attr( get_option( 'vereinonline_setting_usr' ) ); echo "<input type='text' name='vereinonline_setting_usr' value='$setting' size='20' />"; } | |
| function vereinonline_setting_callback_pwd() { $setting = esc_attr( get_option( 'vereinonline_setting_pwd' ) ); echo "<input type='text' name='vereinonline_setting_pwd' value='$setting' size='20' />"; } | |
| function vereinonline_setting_callback_web() { $setting = esc_attr( get_option( 'vereinonline_setting_web' ) ); echo "<input type='text' name='vereinonline_setting_web' value='$setting' size='60' />"; } | |
| add_filter('the_content', 'vereinonline', 9); | |
| add_filter('widget_text', 'vereinonline', 9); | |
| add_action('admin_init', 'vereinonline_settings_api_init'); | |
| add_action('wp_enqueue_scripts', 'vereinonline_style'); | |
| add_action('wp_enqueue_scripts', 'vereinonline_script'); | |
| } | |
| } | |
| function vereinonline_style() | |
| { | |
| wp_enqueue_style('vereinonline', plugins_url('vereinonline/vereinonline.css', dirname(__FILE__)), false); | |
| } | |
| function vereinonline_script() | |
| { | |
| wp_enqueue_script('vereinonline-js', plugins_url('vereinonline/vereinonline.js', dirname(__FILE__)), false); | |
| } | |
| function VereinOnlineParse(&$a, $ch) | |
| { | |
| $pos=strpos($a, $ch); | |
| if ($pos===false) { $ret=$a; $a=""; } else { $ret=substr($a, 0, $pos); $a=substr($a, $pos+strlen($ch)); } | |
| return $ret; | |
| } | |
| function VereinOnlineContains($txt, $s) | |
| { | |
| if ($s=="") return false; | |
| return !(strpos($txt, $s)===false); | |
| } | |
| if (function_exists('get_option')) | |
| { | |
| function VereinOnlineRequest($url, $funktion, $daten, $token) | |
| { | |
| $url.="?json"; | |
| $url.="&function=$funktion"; | |
| foreach($daten as $k=>$v) $url.="&$k=".urlencode($v); | |
| $url.="&token=$token"; | |
| $curl=curl_init(); | |
| curl_setopt($curl, CURLOPT_URL, $url); | |
| curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept-Language: ".$_SERVER["HTTP_ACCEPT_LANGUAGE"])); | |
| curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); | |
| curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); | |
| return json_decode(curl_exec($curl)); | |
| } | |
| } | |
| function VereinOnlineRequestForm($url, $parameter) | |
| { | |
| $result="<DIV id=\"vereinonlinesubmit\" url=\"$url\">"; | |
| $curl = curl_init(); | |
| curl_setopt($curl, CURLOPT_URL, "$url$parameter&dialog=4"); | |
| curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept-Language: ".$_SERVER["HTTP_ACCEPT_LANGUAGE"])); | |
| curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); | |
| curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); | |
| $result.=utf8_encode(str_replace("\r","",str_replace("\n","",curl_exec($curl)))); | |
| if (curl_error($curl)!="") $result.="$url$parameter&dialog=4,error:".utf8_encode(curl_error($curl)); | |
| curl_close($curl); | |
| $result.="</DIV>"; | |
| return $result; | |
| } | |
| function VereinOnlineFormatDate($datum, $tage=1) | |
| { | |
| if (strlen(trim($datum))==0) return ""; | |
| if (!(strpos($datum,".")===false)) return $datum; | |
| if ($datum=="0000-00-00") return ""; | |
| $w1=explode(" ",$datum); | |
| $w2=explode("-",$w1[0]); | |
| if ($w1[1]=="00:00:00") $w1[1]=""; | |
| if ($w2[0]=="1900") $w2[0]=""; | |
| $weekdays = array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"); | |
| $dayofweek = date('w', strtotime($w2[0] . "-" . $w2[1] . "-" . $w2[2])); | |
| $wo=$weekdays[$dayofweek]; | |
| $txt=substr($wo,0,2).", ".trim($w2[2].".".$w2[1].".".$w2[0]." ".$w1[1]); | |
| if ($tage>1) $txt.=" bis ".VereinOnlineFormatDate(VereinOnlineAddDays($w1[0], $tage-1)); | |
| return $txt; | |
| } | |
| function VereinOnlineKategorie($kategorien, $id, $key) | |
| { | |
| if (is_array($kategorien)) | |
| foreach($kategorien as $kategorie) | |
| if (in_array("#id=$id", $kategorie)) | |
| foreach($kategorie as $k) if (substr($k,0,strlen($key)+1)==$key."=") | |
| return substr($k,strlen($key)+1); | |
| return "-"; | |
| } | |
| function VereinOnlineAddDays($dat, $tage=1, $monate=0) | |
| { | |
| if ($tage==0 && $monate==0) return $dat; | |
| $a=explode("-",$dat); | |
| $y=$a[0]; | |
| $m=$a[1]+$monate; | |
| $d=$a[2]+$tage; | |
| while ($d<1) { $m--; if ($m<1) { $m+=12; $y--; } $d+=VereinOnlineTageMonat($m,$y); } | |
| while ($d>VereinOnlineTageMonat($m,$y)) { $d-=VereinOnlineTageMonat($m,$y); $m++; if ($m>12) { $m-=12; $y++; } } | |
| while ($m>12) { $m-=12; $y++; } | |
| return sprintf("%04d",$y)."-".sprintf("%02d",$m)."-".sprintf("%02d",$d); | |
| } | |
| function VereinOnlineTageMonat($m,$y) | |
| { | |
| if ($m==4 || $m==6 || $m==9 || $m==11) return 30; | |
| if ($m==1 || $m==3 || $m==5 || $m==7 || $m==8 || $m==10 || $m==12) return 31; | |
| if (intval($y/4)==$y/4) return 29; else return 28; | |
| } | |
| function VereinonlineVeranstaltung($rec, $hTemplate, &$aktuell, $kategorien, $lst) | |
| { | |
| $template=$hTemplate; | |
| $rec->anker=""; $recdatum=$rec->datum; | |
| if ($aktuell=="") if ($rec->datum>=date("Y-m-d")) { $aktuell=$rec->id; $rec->anker="aktuell"; } | |
| $rec->datum_d=date("d",strtotime($rec->datum)); | |
| $rec->datum_M=date("M",strtotime($rec->datum)); | |
| $rec->anmeldeschluss=VereinOnlineFormatDate($rec->anmeldeschluss); if ($rec->anmeldeschluss=="") $rec->anmeldeschluss=VereinOnlineFormatDate($rec->datum); | |
| $rec->datum=VereinOnlineFormatDate($rec->datum, $rec->anzahltage); | |
| if ($lst!="") | |
| { | |
| $rec->kategorie=VereinOnlineKategorie($kategorien, $rec->key_titel_kategorie, "name"); if ($rec->kategorie=="-") $rec->kategorie=""; | |
| $beschreibung=VereinOnlineKategorie($kategorien, $rec->key_titel_kategorie, "beschreibung"); | |
| if ($rec->kategorie==$rec->titel) { $rec->kategorie=""; $rec->beschreibung=$beschreibung; } | |
| $template=str_replace("[vereinonline:key_titel_kategorie:name]", $rec->kategorie, $template); | |
| $template=str_replace("[vereinonline:key_titel_kategorie:beschreibung]", $beschreibung, $template); | |
| $template=str_replace("[vereinonline:activetab]", $rec->kategorie!=""?2:1, $template); | |
| } | |
| $attachments=$rec->attachments; $template=str_replace("[vereinonline:foto]", VereinOnlineParse(str_replace("\r","",$attachments), "\n"), $template); | |
| foreach(array("titel") as $k) $template=str_replace("[vereinonline:$k]", $rec->$k, $template); | |
| foreach($rec as $k=>$v) $template=str_replace("[vereinonline:$k]", $v, $template); | |
| $t=""; | |
| while (VereinOnlineContains($template,"[vereinonline:")) | |
| { | |
| $t.=VereinOnlineParse($template,"[vereinonline:"); | |
| VereinOnlineParse($template,"]"); | |
| } | |
| $template=$t.$template; | |
| $template=VereinOnlineExecuteCondition($template, $rec, array("anmeldungmoeglich"=>$recdatum>=date("Y-m-d") && $rec->oeffentlich!=2)); | |
| return $template; | |
| } | |
| function VereinOnlineExecuteCondition($template, $rec, $conditions) | |
| { | |
| $t=""; | |
| while (VereinOnlineContains($template,"[vereinonline_if(")) | |
| { | |
| $t.=VereinOnlineParse($template,"[vereinonline_if("); | |
| $txt=VereinOnlineParse($template,"[vereinonline_endif]"); | |
| while ($txt!="") | |
| { | |
| $cond=VereinOnlineParse($txt,")]"); | |
| if (VereinOnlineContains($txt,"[vereinonline_elseif(")) { $txtif=VereinOnlineParse($txt,"[vereinonline_elseif("); $txtelseif=$txt; } | |
| else if (VereinOnlineContains($txt,"[vereinonline_else]")) { $txtif=VereinOnlineParse($txt,"[vereinonline_else]"); $txtelseif=""; } | |
| else { $txtif=$txt; $txtelseif=""; $txt=""; } | |
| if (array_key_exists($cond,$conditions)) $ok=$conditions[$cond]; else $ok=$rec->$cond!=""; | |
| if ($ok) { $t.=$txtif; break; } | |
| if ($txtelseif=="") { $t.=$txt; break; } | |
| } | |
| } | |
| return $t.$template; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment