$accept = !empty($options[0]) ? " {accept:'{$options['0']}'}" : ''; if ($field_codename != "") { $form_item = sprintf('<input type="file" name="vfb-%1$s" id="%2$s" value="%3$s" class="vfb-text %4$s %5$s %6$s %7$s %8$s" />', $field_codename, $id_attr, $default, $size, $required, $validation, $css, $accept); } else { $form_item = sprintf('<input type="file" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text %4$s %5$s %6$s %7$s %8$s" />', $field_id, $id_attr, $default, $size, $required, $validation, $css, $accept); } $output .= !empty($description) ? sprintf('<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description) : $form_item; break; case 'instructions': $output .= wp_specialchars_decode(esc_html(stripslashes($description)), ENT_QUOTES); break; case 'submit': //'<li class="vfb-item vfb-item-submit" id="item-%2$s"> //</li> //$submit = sprintf( $output .= sprintf('<input type="submit" name="vfb-submit" id="%2$s" value="%3$s" class="vfb-submit %4$s" />' . '', $field_id, getTranslatedText($id_attr), wp_specialchars_decode(esc_html($field_name), ENT_QUOTES), $css); break; case 'captcha': $vfb_path = plugins_url('visual-form-builder/includes'); $form_item = ""; $rnd = ''; $alphabet = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "p", "q", "r", "s", "t", "u", "w", "x", "y", "z", "2", "3", "4", "5", "6", "7", "8", "9"); for ($i = 0; $i < 8; $i++) { $n = rand(0, count($alphabet) - 1); $rnd .= $alphabet[$n]; } $img = $vfb_path . '/vfb-captcha.php?rnd=' . $rnd; if ($field_codename != "") { $form_item = sprintf('<img src="%3$s" alt="captcha" id="%2$s-image" /><br />', $field_codename, $id_attr, $img); $form_item .= sprintf('<input type="text" name="vfb-%1$s" id="%2$s" class="vfb-text %3$s %4$s %6$s" value="" />', $field_codename, $id_attr, $size, $required, $validation, $css, $accept); $form_item .= sprintf('<input type="hidden" name="vfb-%1$s-compare" id="%2$s" value="%3$s" />', $field_codename, $id_attr, $rnd);
$form_subject = wp_specialchars_decode($form_settings->form_subject, ENT_QUOTES); $notify_subject = wp_specialchars_decode($form_settings->form_notification_subject, ENT_QUOTES); // Sanitize main emails_to $emails_to = array_map('sanitize_email', $form_settings->form_to); $cu = wp_get_current_user(); if ($cu) { if ($form->form_price > 0) { $kredit = get_user_meta($cu->ID, '_kredit', TRUE); if ($kredit >= $form->form_price) { $new_kredit = $kredit - $form->form_price; if (update_user_meta($cu->ID, '_kredit', $new_kredit)) { add_user_meta($cu->ID, 'transaction', date('YmdHis') . '|' . $form->form_id . '|' . date('d.m.Y - H:i:s') . '|' . $form->form_price . '|-'); eval(stripslashes($form->form_success_action)); } } else { wp_die(getTranslatedText('Na požadovanú akciu nemáte dostatočný kredit')); } } else { if ($form->form_price < 0) { $kredit = get_user_meta($cu->ID, '_kredit', TRUE); if ($kredit) { $new_kredit = $kredit - $form->form_price; update_user_meta($cu->ID, '_kredit', $new_kredit); } else { add_user_meta($cu->ID, '_kredit', $form->form_price * -1, TRUE); } add_user_meta($cu->ID, 'transaction', date('YmdHis') . '|' . $form->form_id . '|' . date('d.m.Y - H:i:s') . '|' . $form->form_price * -1 . '|+'); } eval(stripslashes($form->form_success_action)); } }