public static function get_shortcodes($content, $form_id)
 {
     if (empty($form_id) || strpos($content, '[') === false) {
         // don't continue if there are no shortcodes to check
         return array(array());
     }
     $tagregexp = array('deletelink', 'detaillink', 'evenodd', 'get', 'entry_count', 'event_date');
     $form_id = (int) $form_id;
     $form_ids = array($form_id);
     //get linked form ids
     $fields = FrmProFormsHelper::has_repeat_field($form_id, false);
     foreach ($fields as $field) {
         if (FrmField::is_option_true($field, 'form_select')) {
             $form_ids[] = $field->field_options['form_select'];
             $tagregexp[] = $field->id;
             $tagregexp[] = $field->field_key;
         }
         unset($field);
     }
     foreach ($form_ids as $form_id) {
         $fields = FrmField::get_all_for_form($form_id, '', 'include');
         foreach ($fields as $field) {
             $tagregexp[] = $field->id;
             $tagregexp[] = $field->field_key;
         }
     }
     $tagregexp = implode('|', $tagregexp) . '|';
     $tagregexp .= FrmFieldsHelper::allowed_shortcodes();
     if (!ini_get('safe_mode')) {
         // make sure the backtrack limit is as least at the default
         $backtrack_limit = ini_get('pcre.backtrack_limit');
         if ($backtrack_limit < 1000000) {
             ini_set('pcre.backtrack_limit', 1000000);
         }
     }
     preg_match_all("/\\[(if |foreach )?({$tagregexp})\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\])?/s", $content, $matches, PREG_PATTERN_ORDER);
     // run conditional and foreach first
     $new_order = $matches[0];
     $move_up = array();
     foreach ($new_order as $short_key => $tag) {
         $conditional = preg_match('/^\\[if/s', $matches[0][$short_key]) ? true : false;
         $foreach = preg_match('/^\\[foreach/s', $matches[0][$short_key]) ? true : false;
         if ($conditional || $foreach) {
             $move_up[$short_key] = $tag;
         }
     }
     if (!empty($move_up)) {
         $matches[0] = $move_up + $matches[0];
     }
     return $matches;
 }
 /**
  * Add confirmation and "other" hidden fields to help carry all data throughout the form
  * Note: This doesn't control the HTML for fields in repeating sections
  *
  * @since 2.0
  *
  * @param array $field
  * @param string $opt_key
  * @param string $html_id
  */
 public static function insert_extra_hidden_fields($field, $opt_key = false)
 {
     // If we're dealing with a repeating section, hidden fields are already taken care of
     if (isset($field['original_type']) && $field['original_type'] == 'divider') {
         return;
     }
     //If confirmation field on previous page, store value in hidden field
     if (FrmField::is_option_true($field, 'conf_field') && isset($_POST['item_meta']['conf_' . $field['id']])) {
         self::insert_hidden_confirmation_fields($field);
         //If Other field on previous page, store value in hidden field
     } else {
         if (FrmField::is_option_true($field, 'other') && isset($_POST['item_meta']['other'][$field['id']])) {
             self::insert_hidden_other_fields($field, $opt_key);
         }
     }
 }
 public static function set_post_fields($field, $value, $errors)
 {
     // save file ids for later use
     if ('file' == $field->type) {
         global $frm_vars;
         if (!isset($frm_vars['media_id'])) {
             $frm_vars['media_id'] = array();
         }
         $frm_vars['media_id'][$field->id] = $value;
     }
     if (empty($value) || !FrmField::is_option_true($field, 'unique')) {
         return $errors;
     }
     $post_form_action = FrmFormAction::get_action_for_form($field->form_id, 'wppost', 1);
     if (!$post_form_action) {
         return $errors;
     }
     // check if this is a regular post field
     $post_field = array_search($field->id, $post_form_action->post_content);
     $custom_field = '';
     if (!$post_field) {
         // check if this is a custom field
         foreach ($post_form_action->post_content['post_custom_fields'] as $custom_field) {
             if (isset($custom_field['field_id']) && !empty($custom_field['field_id']) && isset($custom_field['meta_name']) && !empty($custom_field['meta_name']) && $field->id == $custom_field['field_id']) {
                 $post_field = 'post_custom';
                 $custom_field = $custom_field['meta_name'];
             }
         }
         if (!$post_field) {
             return $errors;
         }
     }
     // check for unique values in post fields
     $entry_id = $_POST && isset($_POST['id']) ? $_POST['id'] : false;
     $post_id = false;
     if ($entry_id) {
         global $wpdb;
         $post_id = FrmDb::get_var($wpdb->prefix . 'frm_items', array('id' => $entry_id), 'post_id');
     }
     if (self::post_value_exists($post_field, $value, $post_id, $custom_field)) {
         $errors['field' . $field->id] = FrmFieldsHelper::get_error_msg($field, 'unique_msg');
     }
     return $errors;
 }
 /**
  * Check if each field is needed in the formresults table
  *
  * @since 2.0.09
  * @param object $f - field
  * @param array $atts
  * @param array $subforms_to_include
  * @return boolean
  */
 private static function is_field_needed($f, $atts, &$subforms_to_include)
 {
     if (!empty($atts['fields'])) {
         if (FrmField::is_no_save_field($f->type)) {
             if (FrmField::is_option_true($f, 'form_select') && (in_array($f->id, $atts['fields']) || in_array($f->field_key, $atts['fields']))) {
                 $subforms_to_include[] = $f->field_options['form_select'];
             }
             return false;
         }
         if (!in_array($f->form_id, $subforms_to_include) && !in_array($f->id, $atts['fields']) && !in_array($f->field_key, $atts['fields'])) {
             return false;
         }
     } else {
         if (FrmField::is_no_save_field($f->type)) {
             return false;
         }
     }
     return true;
 }
Example #5
0
                ?>
        </ul>
    <?php 
            }
        } else {
            if ($field['type'] == 'select') {
                if (isset($field['post_field']) && $field['post_field'] == 'post_category') {
                    echo FrmFieldsHelper::dropdown_categories(array('name' => $field_name, 'field' => $field));
                } else {
                    ?>
	<select name="<?php 
                    echo esc_attr($field_name) . (FrmField::is_option_true($field, 'multiple') ? '[]' : '');
                    ?>
" <?php 
                    echo FrmField::is_option_true($field, 'size') ? 'class="auto_width"' : '';
                    echo FrmField::is_option_true($field, 'multiple') ? ' multiple="multiple"' : '';
                    ?>
 >
		<?php 
                    foreach ($field['options'] as $opt_key => $opt) {
                        $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
                        $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
                        $selected = $field['default_value'] == $field_val || FrmFieldsHelper::get_other_val(array('opt_key', 'field')) ? ' selected="selected"' : '';
                        ?>
            <option value="<?php 
                        echo esc_attr($field_val);
                        ?>
"<?php 
                        echo $selected;
                        ?>
><?php 
 /**
  * Sets radio or checkbox value equal to "other" value if it is set - FOR REPEATING SECTIONS
  *
  * @since 2.0
  *
  * @param object $field
  * @param string|array $value
  * @param array $args
  */
 public static function set_other_repeating_vals($field, &$value, &$args)
 {
     if (!$args['parent_field_id']) {
         return;
     }
     // Check if there are any other posted "other" values for this field
     if (FrmField::is_option_true($field, 'other') && isset($_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id])) {
         // Save original value
         $args['temp_value'] = $value;
         $args['other'] = true;
         $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id];
         // Set the validation value now
         self::set_other_validation_val($value, $other_vals, $field, $args);
     }
 }
 public static function add_field_class($class, $field)
 {
     if ($field['type'] == 'scale' && FrmField::is_option_true($field, 'star')) {
         $class .= ' star';
     } else {
         if ($field['type'] == 'date') {
             $class .= ' frm_date';
         } else {
             if ($field['type'] == 'file' && FrmField::is_option_true($field, 'multiple')) {
                 $class .= ' frm_multiple_file';
             }
         }
     }
     // Hide the "No files selected" text if files are selected
     if ($field['type'] == 'file' && !FrmField::is_option_empty($field, 'value')) {
         $class .= ' frm_transparent';
     }
     if (!FrmAppHelper::is_admin() && FrmField::is_option_true($field, 'autocom') && ($field['type'] == 'select' || $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'select') && !empty($field['options']) && !FrmField::is_read_only($field)) {
         global $frm_vars;
         $frm_vars['chosen_loaded'] = true;
         $class .= ' frm_chzn';
         $style = FrmStylesController::get_form_style($field['form_id']);
         if ($style && 'rtl' == $style->post_content['direction']) {
             $class .= ' chosen-rtl';
         }
     }
     return $class;
 }
Example #8
0
 /**
  * Switch the form_select on a repeating field or embedded form if it needs to be switched
  *
  * @since 2.0.16
  * @param array $f
  * @param array $imported
  */
 private static function maybe_update_form_select(&$f, $imported)
 {
     if (!isset($imported['forms'])) {
         return;
     }
     if ($f['type'] == 'form' || $f['type'] == 'divider' && FrmField::is_option_true($f['field_options'], 'repeat')) {
         if (FrmField::is_option_true($f['field_options'], 'form_select')) {
             $form_select = $f['field_options']['form_select'];
             if (isset($imported['forms'][$form_select])) {
                 $f['field_options']['form_select'] = $imported['forms'][$form_select];
             }
         }
     }
 }
        _e('Dark', 'formidable');
        ?>
</option>
						</select>
					</td>
				</tr>
                <?php 
    }
    ?>
                <?php 
    do_action('frm_' . $field['type'] . '_field_options_form', $field, $display, $values);
    do_action('frm_field_options_form', $field, $display, $values);
    if ($display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field']) {
        ?>
					<tr class="frm_validation_msg <?php 
        echo $display['invalid'] || $field['required'] || FrmField::is_option_true($field, 'unique') || FrmField::is_option_true($field, 'conf_field') ? '' : 'frm_hidden';
        ?>
">
					<td colspan="2">
                    <div class="menu-settings">
                    <h3 class="frm_no_bg"><?php 
        _e('Validation', 'formidable');
        ?>
</h3>

                    <div class="frm_validation_box">
                        <?php 
        if ($display['required']) {
            ?>
                        <p class="frm_required_details<?php 
            echo esc_attr($field['id'] . ($field['required'] ? '' : ' frm_hidden'));
Example #10
0
 public static function get_multi_opts($value, $field)
 {
     if (!$field || empty($value) || in_array($value, (array) $field->options)) {
         return $value;
     }
     if ($field->type != 'checkbox' && $field->type != 'select') {
         return $value;
     }
     if ($field->type == 'select' && !FrmField::is_option_true($field, 'multiple')) {
         return $value;
     }
     $checked = is_array($value) ? $value : maybe_unserialize($value);
     if (!is_array($checked)) {
         $checked = explode(',', $checked);
     }
     if (!empty($checked) && count($checked) > 1) {
         $value = array_map('trim', $checked);
     }
     unset($checked);
     return $value;
 }
 /**
  * Get values for graph with only one field and no x-axis
  *
  * @since 2.0
  *
  * @param array $values
  * @param array $labels
  * @param array $tooltips
  * @param boolean $pie - for pie graph
  * @param object $field
  * @param array $args
  */
 public static function get_count_values(&$values, &$labels, &$tooltips, &$pie, $field, $args)
 {
     // Get all inputs for this field
     $inputs = self::get_generic_inputs($field, $args);
     if (!$inputs) {
         return;
     }
     // Get counts for each value
     $temp_values = array_count_values(array_map('strtolower', $inputs));
     // Get displayed values ( for DFE, separate values, or Other val )
     if ($field->type == 'data' || $field->field_options['separate_value'] || FrmField::is_option_true($field, 'other')) {
         self::get_displayed_values($temp_values, $field);
     } else {
         if ($field->type == 'user_id') {
             self::get_user_id_values($values, $labels, $tooltips, $pie, $temp_values, $field);
             return;
         }
     }
     // Sort values by order of field options
     if ($args['x_order'] == 'field_opts' && in_array($field->type, array('radio', 'checkbox', 'select', 'data'))) {
         self::field_opt_order_vals($temp_values, $field);
         // Sort by descending count if x_order is set to 'desc'
     } else {
         if ($args['x_order'] == 'desc') {
             arsort($temp_values);
             // Sort alphabetically by default
         } else {
             ksort($temp_values);
         }
     }
     // Get slice of array
     if ($args['limit']) {
         $temp_values = array_slice($temp_values, 0, $args['limit']);
     }
     // Capitalize the first letter of each value
     foreach ($temp_values as $val => $count) {
         $new_val = ucwords($val);
         $labels[] = $new_val;
         $values[] = $count;
     }
 }
Example #12
0
<?php

if (is_array($field['options'])) {
    if (!isset($field['value'])) {
        $field['value'] = maybe_unserialize($field['default_value']);
    }
    $star = FrmField::is_option_true($field, 'star');
    foreach ($field['options'] as $opt_key => $opt) {
        $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
        $last = end($field['options']) == $opt ? ' frm_last' : '';
        if (!$star) {
            ?>
<div class="frm_scale <?php 
            echo esc_attr($last);
            ?>
"><label for="<?php 
            echo esc_attr($html_id);
            ?>
-<?php 
            echo esc_attr($opt_key);
            ?>
"><?php 
        }
        ?>
<input type="radio" name="<?php 
        echo esc_attr($field_name);
        ?>
" id="<?php 
        echo esc_attr($html_id . '-' . $opt_key);
        ?>
" value="<?php 
 /**
  * Flatten multi-dimensional array for multi-file upload fields
  * @since 2.0.9
  */
 public static function flatten_multi_file_upload($field, &$val)
 {
     if ($field->type == 'file' && FrmField::is_option_true($field, 'multiple')) {
         $val = FrmAppHelper::array_flatten($val);
     }
 }
 /**
  * Get value that belongs in "Other" text box
  *
  * @since 2.0.6
  *
  * @param array $args
  */
 public static function get_other_val($args)
 {
     $defaults = array('opt_key' => 0, 'field' => array(), 'parent' => false, 'pointer' => false);
     $args = wp_parse_args($args, $defaults);
     $opt_key = $args['opt_key'];
     $field = $args['field'];
     $parent = $args['parent'];
     $pointer = $args['pointer'];
     $other_val = '';
     // If option is an "other" option and there is a value set for this field,
     // check if the value belongs in the current "Other" option text field
     if (!FrmFieldsHelper::is_other_opt($opt_key) || !FrmField::is_option_true($field, 'value')) {
         return $other_val;
     }
     // Check posted vals before checking saved values
     // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero
     if ($parent && isset($_POST['item_meta'][$parent][$pointer]['other'][$field['id']])) {
         if (FrmField::is_field_with_multiple_values($field)) {
             $other_val = isset($_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key]) ? sanitize_text_field($_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key]) : '';
         } else {
             $other_val = sanitize_text_field($_POST['item_meta'][$parent][$pointer]['other'][$field['id']]);
         }
         return $other_val;
     } else {
         if (isset($field['id']) && isset($_POST['item_meta']['other'][$field['id']])) {
             // For normal fields
             if (FrmField::is_field_with_multiple_values($field)) {
                 $other_val = isset($_POST['item_meta']['other'][$field['id']][$opt_key]) ? sanitize_text_field($_POST['item_meta']['other'][$field['id']][$opt_key]) : '';
             } else {
                 $other_val = sanitize_text_field($_POST['item_meta']['other'][$field['id']]);
             }
             return $other_val;
         }
     }
     // For checkboxes
     if ($field['type'] == 'checkbox' && is_array($field['value'])) {
         // Check if there is an "other" val in saved value and make sure the
         // "other" val is not equal to the Other checkbox option
         if (isset($field['value'][$opt_key]) && $field['options'][$opt_key] != $field['value'][$opt_key]) {
             $other_val = $field['value'][$opt_key];
         }
     } else {
         /**
          * For radio buttons and dropdowns
          * Check if saved value equals any of the options. If not, set it as the other value.
          */
         foreach ($field['options'] as $opt_key => $opt_val) {
             $temp_val = is_array($opt_val) ? $opt_val['value'] : $opt_val;
             // Multi-select dropdowns - key is not preserved
             if (is_array($field['value'])) {
                 $o_key = array_search($temp_val, $field['value']);
                 if (isset($field['value'][$o_key])) {
                     unset($field['value'][$o_key], $o_key);
                 }
             } else {
                 if ($temp_val == $field['value']) {
                     // For radio and regular dropdowns
                     return '';
                 } else {
                     $other_val = $field['value'];
                 }
             }
             unset($opt_key, $opt_val, $temp_val);
         }
         // For multi-select dropdowns only
         if (is_array($field['value']) && !empty($field['value'])) {
             $other_val = reset($field['value']);
         }
     }
     return $other_val;
 }
Example #15
0
 /**
  * Get metas for post or non-post fields
  *
  * @since 2.0
  */
 public static function get_all_metas_for_field($field, $args = array())
 {
     global $wpdb;
     $query = array();
     if (!FrmField::is_option_true($field, 'post_field')) {
         // If field is not a post field
         $get_field = 'em.meta_value';
         $get_table = $wpdb->prefix . 'frm_item_metas em INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)';
         $query['em.field_id'] = $field->id;
         $query['e.is_draft'] = 0;
     } else {
         if ($field->field_options['post_field'] == 'post_custom') {
             // If field is a custom field
             $get_field = 'pm.meta_value';
             $get_table = $wpdb->postmeta . ' pm INNER JOIN ' . $wpdb->prefix . 'frm_items e ON pm.post_id=e.post_id';
             $query['pm.meta_key'] = $field->field_options['custom_field'];
             // Make sure to only get post metas that are linked to this form
             $query['e.form_id'] = $field->form_id;
         } else {
             if ($field->field_options['post_field'] != 'post_category') {
                 // If field is a non-category post field
                 $get_field = 'p.' . sanitize_title($field->field_options['post_field']);
                 $get_table = $wpdb->posts . ' p INNER JOIN ' . $wpdb->prefix . 'frm_items e ON p.ID=e.post_id';
                 // Make sure to only get post metas that are linked to this form
                 $query['e.form_id'] = $field->form_id;
             } else {
                 // If field is a category field
                 //TODO: Make this work
                 return array();
                 //$field_options = FrmProFieldsHelper::get_category_options( $field );
             }
         }
     }
     // Add queries for additional args
     self::add_meta_query($query, $args);
     // Get the metas
     $metas = FrmDb::get_col($get_table, $query, $get_field);
     // Maybe unserialize
     foreach ($metas as $k => $v) {
         $metas[$k] = maybe_unserialize($v);
         unset($k, $v);
     }
     // Strip slashes
     $metas = stripslashes_deep($metas);
     return $metas;
 }
Example #16
0
			</label>
        </td>
    </tr>
<?php 
                            } else {
                                if ($field['type'] == 'html') {
                                    ?>
<tr><td colspan="2"><?php 
                                    _e('Content', 'formidable');
                                    ?>
<br/>
<textarea name="field_options[description_<?php 
                                    echo $field['id'];
                                    ?>
]" style="width:98%;" rows="8"><?php 
                                    if (FrmField::is_option_true($field, 'stop_filter')) {
                                        echo $field['description'];
                                    } else {
                                        echo FrmAppHelper::esc_textarea($field['description']);
                                    }
                                    ?>
</textarea>
</td>
</tr>
<?php 
                                } else {
                                    if ($field['type'] == 'form') {
                                        ?>
<tr><td><?php 
                                        _e('Insert Form', 'formidable');
                                        ?>
<tr>
	<td class="frm_150_width"><label><?php 
_e('Field Size', 'formidable');
?>
</label></td>
	<td>
		<label for="size_<?php 
echo esc_attr($field['id']);
?>
">
			<input type="checkbox" name="field_options[size_<?php 
echo esc_attr($field['id']);
?>
]" id="size_<?php 
echo esc_attr($field['id']);
?>
" value="1" <?php 
echo FrmField::is_option_true($field, 'size') ? 'checked="checked"' : '';
?>
 />
			<?php 
_e('automatic width', 'formidable');
?>
		</label>
	</td>
</tr>
 public static function &filter_display_value($value, $field, $atts = array())
 {
     $saved_value = isset($atts['saved_value']) && $atts['saved_value'] ? true : false;
     if (!in_array($field->type, array('radio', 'checkbox', 'radio', 'select')) || !FrmField::is_option_true($field, 'separate_value') || $saved_value) {
         return $value;
     }
     $f_values = $f_labels = array();
     foreach ($field->options as $opt_key => $opt) {
         if (!is_array($opt)) {
             continue;
         }
         $f_labels[$opt_key] = isset($opt['label']) ? $opt['label'] : reset($opt);
         $f_values[$opt_key] = isset($opt['value']) ? $opt['value'] : $f_labels[$opt_key];
         if ($f_labels[$opt_key] == $f_values[$opt_key]) {
             unset($f_values[$opt_key], $f_labels[$opt_key]);
         }
         unset($opt_key, $opt);
     }
     if (!empty($f_values)) {
         foreach ((array) $value as $v_key => $val) {
             if (in_array($val, $f_values)) {
                 $opt = array_search($val, $f_values);
                 if (is_array($value)) {
                     $value[$v_key] = $f_labels[$opt];
                 } else {
                     $value = $f_labels[$opt];
                 }
             }
             unset($v_key, $val);
         }
     }
     return $value;
 }
    <?php 
}
?>
</ul>
<textarea name="frm_bulk_options" id="frm_bulk_options">
<?php 
$other_array = array();
foreach ($field->options as $fkey => $fopt) {
    //If it is an other option, don't include it
    if ($fkey && strpos($fkey, 'other') !== false) {
        continue;
    }
    if (is_array($fopt)) {
        $label = isset($fopt['label']) ? $fopt['label'] : reset($fopt);
        $value = isset($fopt['value']) ? $fopt['value'] : $label;
        if ($label != $value && FrmField::is_option_true($field, 'separate_value')) {
            echo "{$label}|{$value}\n";
        } else {
            echo $label . "\n";
        }
    } else {
        echo $fopt . "\n";
    }
}
?>
</textarea>

<p class="submit frm_clear">
<input type="button" onclick="frmUpdateBulkOpts(<?php 
echo (int) $field->id;
?>
 public static function check_value($opt, $opt_key, $field)
 {
     if (is_array($opt)) {
         if (FrmField::is_option_true($field, 'separate_value')) {
             $opt = isset($opt['value']) ? $opt['value'] : (isset($opt['label']) ? $opt['label'] : reset($opt));
         } else {
             $opt = isset($opt['label']) ? $opt['label'] : reset($opt);
         }
     }
     return $opt;
 }
" id="<?php 
    echo esc_attr($html_id);
    ?>
" value="<?php 
    echo esc_attr($field['default_value']);
    ?>
" class="dyn_default_value" />
<?php 
} else {
    if ($field['type'] == 'textarea') {
        ?>
    <textarea name="<?php 
        echo esc_attr($field_name);
        ?>
" <?php 
        echo FrmField::is_option_true($field, 'size') ? esc_attr('style="width:' . $field['size'] . (is_numeric($field['size']) ? 'px' : '') . ';"') : '';
        ?>
 rows="<?php 
        echo esc_attr($field['max']);
        ?>
" id="<?php 
        echo esc_attr($html_id);
        ?>
" class="dyn_default_value"><?php 
        echo FrmAppHelper::esc_textarea(force_balance_tags($field['default_value']));
        ?>
</textarea>

<?php 
    } else {
        if ($field['type'] == 'radio' || $field['type'] == 'checkbox') {
Example #22
0
 /**
  * Keep track of imported repeating fields and embedded forms
  *
  * @since 2.0.09
  * @param array $f - field array
  * @param int $repeat_field_id
  * @param array $repeat_fields - pass by reference
  */
 private static function track_repeating_fields($f, $repeat_field_id, &$repeat_fields)
 {
     if ($f['type'] == 'divider' && FrmField::is_option_true($f['field_options'], 'repeat') || $f['type'] == 'form') {
         $old_form_id = trim($f['field_options']['form_select']);
         if (!isset($repeat_fields[$old_form_id])) {
             $repeat_fields[$old_form_id] = array();
         }
         $repeat_fields[$old_form_id][] = $repeat_field_id;
     }
 }
Example #23
0
                                                if (FrmField::is_option_true($field, 'multiple')) {
                                                    echo '[]';
                                                }
                                                ?>
" value="<?php 
                                                echo esc_attr($media_id);
                                                ?>
" />
<div class="frm_file_icon"><?php 
                                                echo FrmProFieldsHelper::get_file_icon($media_id);
                                                ?>
</div>
<?php 
                                            }
                                        } else {
                                            if (FrmField::is_option_true($field, 'multiple')) {
                                                $media_ids = maybe_unserialize($field['value']);
                                                if (!is_array($media_ids) && strpos($media_ids, ',')) {
                                                    $media_ids = explode(',', $media_ids);
                                                }
                                                foreach ((array) $media_ids as $media_id) {
                                                    $media_id = trim($media_id);
                                                    if (!is_numeric($media_id)) {
                                                        continue;
                                                    }
                                                    $media_id = (int) $media_id;
                                                    ?>
<div id="frm_uploaded_<?php 
                                                    echo esc_attr($media_id);
                                                    ?>
" class="frm_uploaded_files">