$args) { $name = $args['type'].'_'.$key; $val = $_POST[$name]; $val_len = strlen($_POST[$name]); if($args['type'] == 'captcha') { if($_SESSION['captcha_code'] != $val) {array_push($error,$name);} } else if(array_key_exists('required',$args) && $args['required'] == 'true' || in_array($args['type'],array('select'))) { if($val_len == 0) { array_push($error,$name); continue; } if(!in_array($args['type'],array('captcha','select'))) { if(array_key_exists('length_min',$args) && is_numeric($args['length_min'])) { if($val_len < $args['length_min']) { array_push($error,$name); continue; } } if(array_key_exists('length_max',$args) && is_numeric($args['length_max'])) { if($val_len > $args['length_max']) { array_push($error,$name); continue; } } } switch($args['type']) { case 'character': if(!preg_match($regexp_character,$val)) array_push($error,$name); continue 2; case 'date': if(!preg_match($regexp_date,$val)) array_push($error,$name); continue 2; case 'mail': if(!filter_var($val,FILTER_VALIDATE_EMAIL)) array_push($error,$name); continue 2; case 'number': if(!preg_match($regexp_number,$val)) array_push($error,$name); continue 2; case 'tel': if(!preg_match($regexp_telephon,$val)) array_push($error,$name); continue 2; case 'url': if(!filter_var($val,FILTER_VALIDATE_URL)) array_push($error,$name); continue 2; } } else { if($val_len > 0) { if(!in_array($args['type'],array('select'))) { if(array_key_exists('length_min',$args) && is_numeric($args['length_min'])) { if($val_len < $args['length_min']) { array_push($error,$name); continue; } } if(array_key_exists('length_max',$args) && is_numeric($args['length_max'])) { if($val_len > $args['length_max']) { array_push($error,$name); continue; } } } switch($args['type']) { case 'character': if(!preg_match($regexp_character,$val)) array_push($error,$name); continue 2; case 'date': if(!preg_match($regexp_date,$val)) array_push($error,$name); continue 2; case 'mail': if(!filter_var($val,FILTER_VALIDATE_EMAIL)) array_push($error,$name); continue 2; case 'number': if(!preg_match($regexp_number,$val)) array_push($error,$name); continue 2; case 'tel': if(!preg_match($regexp_telephon,$val)) array_push($error,$name); continue 2; case 'url': if(!filter_var($val,FILTER_VALIDATE_URL)) array_push($error,$name); continue 2; } } } } return sizeof($error) > 0?$error:true; } function AnyContact_Frontend_HTML($id) { $post = get_post($id,'ARRAY_A'); if(!is_array($post) || sizeof($post) == 0) { return __('Die übermittelte ID enthält leider kein Formular.','anycontact'); } $form_args = json_decode($post['post_content'],true); $output .= ''; $output .= '
| '.$args['title'].' | '.$_POST[$name].' |