<?php /** ** A base module for [checkbox], [checkbox*], and [radio] **/ /* Shortcode handler */ wpef7_add_shortcode('checkbox', 'wpef7_checkbox_shortcode_handler', true); wpef7_add_shortcode('checkbox*', 'wpef7_checkbox_shortcode_handler', true); wpef7_add_shortcode('radio', 'wpef7_checkbox_shortcode_handler', true); function wpef7_checkbox_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; $labels = (array) $tag['labels']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $tabindex_att = ''; $defaults = array(); $label_first = false; $use_label_element = false; if ('checkbox*' == $type) {
<?php /** ** A base module for [select] and [select*] **/ /* Shortcode handler */ wpef7_add_shortcode('select', 'wpef7_select_shortcode_handler', true); wpef7_add_shortcode('select*', 'wpef7_select_shortcode_handler', true); function wpef7_select_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; $labels = (array) $tag['labels']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $tabindex_att = ''; $defaults = array(); $class_att .= ' wpef7-select'; if ('select*' == $type) { $class_att .= ' wpef7-validates-as-required'; }
<?php /** ** A base module for [acceptance] **/ /* Shortcode handler */ wpef7_add_shortcode('acceptance', 'wpef7_acceptance_shortcode_handler', true); function wpef7_acceptance_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $tabindex_att = ''; $class_att .= ' wpef7-acceptance'; foreach ($options as $option) { if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) { $id_att = $matches[1]; } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) { $class_att .= ' ' . $matches[1]; } elseif ('invert' == $option) {
<?php /** ** A base module for [textarea] and [textarea*] **/ /* Shortcode handler */ wpef7_add_shortcode('textarea', 'wpef7_textarea_shortcode_handler', true); wpef7_add_shortcode('textarea*', 'wpef7_textarea_shortcode_handler', true); function wpef7_textarea_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; $content = $tag['content']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $cols_att = ''; $rows_att = ''; $tabindex_att = ''; if ('textarea*' == $type) { $class_att .= ' wpef7-validates-as-required'; }
<?php /** ** A base module for [quiz] **/ /* Shortcode handler */ wpef7_add_shortcode('quiz', 'wpef7_quiz_shortcode_handler', true); function wpef7_quiz_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $pipes = $tag['pipes']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $size_att = ''; $maxlength_att = ''; $tabindex_att = ''; $class_att .= ' wpef7-quiz'; foreach ($options as $option) { if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) { $id_att = $matches[1]; } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
<?php /** ** A base module for [file] and [file*] **/ /* Shortcode handler */ wpef7_add_shortcode('file', 'wpef7_file_shortcode_handler', true); wpef7_add_shortcode('file*', 'wpef7_file_shortcode_handler', true); function wpef7_file_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $tabindex_att = ''; $class_att .= ' wpef7-file'; if ('file*' == $type) { $class_att .= ' wpef7-validates-as-required'; } foreach ($options as $option) { if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
<?php /** ** A base module for [text], [text*], [email], and [email*] **/ /* Shortcode handler */ wpef7_add_shortcode('text', 'wpef7_text_shortcode_handler', true); wpef7_add_shortcode('text*', 'wpef7_text_shortcode_handler', true); wpef7_add_shortcode('email', 'wpef7_text_shortcode_handler', true); wpef7_add_shortcode('email*', 'wpef7_text_shortcode_handler', true); function wpef7_text_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; if (empty($name)) { return ''; } $atts = ''; $id_att = ''; $class_att = ''; $size_att = ''; $maxlength_att = ''; $tabindex_att = ''; $class_att .= ' wpef7-text'; if ('email' == $type || 'email*' == $type) {
<?php /** ** A base module for [response] **/ /* Shortcode handler */ wpef7_add_shortcode('response', 'wpef7_response_shortcode_handler'); function wpef7_response_shortcode_handler($tag) { global $wpef7_contact_form; $wpef7_contact_form->responses_count += 1; return $wpef7_contact_form->form_response_output(); }
<?php /** ** A base module for [captchac] and [captchar] **/ /* Shortcode handler */ wpef7_add_shortcode('captchac', 'wpef7_captcha_shortcode_handler', true); wpef7_add_shortcode('captchar', 'wpef7_captcha_shortcode_handler', true); function wpef7_captcha_shortcode_handler($tag) { global $wpef7_contact_form; if (!is_array($tag)) { return ''; } $type = $tag['type']; $name = $tag['name']; $options = (array) $tag['options']; $values = (array) $tag['values']; if (empty($name)) { return ''; } $validation_error = ''; if (is_a($wpef7_contact_form, 'WPEF7_ContactForm')) { $validation_error = $wpef7_contact_form->validation_error($name); } $atts = ''; $id_att = ''; $class_att = ''; $size_att = ''; $maxlength_att = ''; $tabindex_att = '';
<?php /** ** A base module for [submit] **/ /* Shortcode handler */ wpef7_add_shortcode('submit', 'wpef7_submit_shortcode_handler'); function wpef7_submit_shortcode_handler($tag) { if (!is_array($tag)) { return ''; } $options = (array) $tag['options']; $values = (array) $tag['values']; $atts = ''; $id_att = ''; $class_att = ''; $tabindex_att = ''; $class_att .= ' wpef7-submit'; foreach ($options as $option) { if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) { $id_att = $matches[1]; } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) { $class_att .= ' ' . $matches[1]; } elseif (preg_match('%^tabindex:(\\d+)$%', $option, $matches)) { $tabindex_att = (int) $matches[1]; } } if ($id_att) { $atts .= ' id="' . trim($id_att) . '"'; }