public static function email_value($value, $meta, $entry)
 {
     if ($entry->id != $meta->item_id) {
         $entry = FrmEntry::getOne($meta->item_id);
     }
     $field = FrmField::getOne($meta->field_id);
     if (!$field) {
         return $value;
     }
     if (FrmField::is_option_true($field, 'post_field')) {
         $value = self::get_post_or_meta_value($entry, $field, array('truncate' => true));
         $value = maybe_unserialize($value);
     }
     switch ($field->type) {
         case 'user_id':
             $value = FrmProFieldsHelper::get_display_name($value);
             break;
         case 'data':
             if (is_array($value)) {
                 $new_value = array();
                 foreach ($value as $val) {
                     $new_value[] = FrmProFieldsHelper::get_data_value($val, $field);
                 }
                 $value = $new_value;
             } else {
                 $value = FrmProFieldsHelper::get_data_value($value, $field);
             }
             break;
         case 'file':
             $value = FrmProFieldsHelper::get_file_name($value);
             break;
         case 'date':
             $value = FrmProFieldsHelper::get_date($value);
     }
     if (is_array($value)) {
         $new_value = '';
         foreach ($value as $val) {
             if (is_array($val)) {
                 // This will affect checkboxes inside of repeating sections
                 $new_value .= implode(', ', $val) . "\n";
             }
         }
         if ($new_value != '') {
             $value = $new_value;
         } else {
             // Only keep non-empty values in array
             $value = array_filter($value);
         }
     }
     return $value;
 }
            <span class="dashicons dashicons-admin-users wp-media-buttons-icon"></span>
			<?php 
        printf(__('Created by: %1$s', 'formidable'), FrmProFieldsHelper::get_display_name($entry->user_id, 'display_name', array('link' => true)));
        ?>
        </div>
        <?php 
    }
    ?>

        <?php 
    if ($entry->updated_by && $entry->updated_by != $entry->user_id) {
        ?>
        <div class="misc-pub-section">
            <span class="dashicons dashicons-admin-users wp-media-buttons-icon"></span>
			<?php 
        printf(__('Updated by: %1$s', 'formidable'), FrmProFieldsHelper::get_display_name($entry->updated_by, 'display_name', array('link' => true)));
        ?>
        </div>
        <?php 
    }
    ?>
        <?php 
}
?>

    </div>
</div>

<div class="postbox">
    <h3 class="hndle"><span><?php 
_e('User Information', 'formidable');
 public static function display_value($value, $field, $atts = array())
 {
     global $wpdb, $frm_field;
     $defaults = array('type' => '', 'show_icon' => true, 'show_filename' => true, 'truncate' => false, 'sep' => ', ', 'post_id' => 0, 'form_id' => $field->form_id, 'field' => $field, 'keepjs' => 0);
     $atts = wp_parse_args($atts, $defaults);
     $atts = apply_filters('frm_display_value_atts', $atts, $field, $value);
     if (!isset($field->field_options['post_field'])) {
         $field->field_options['post_field'] = '';
     }
     if (!isset($field->field_options['custom_field'])) {
         $field->field_options['custom_field'] = '';
     }
     if ($atts['post_id'] and ($field->field_options['post_field'] or $atts['type'] == 'tag')) {
         $atts['pre_truncate'] = $atts['truncate'];
         $atts['truncate'] = true;
         $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
         $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
         $atts['truncate'] = $atts['pre_truncate'];
     }
     if ($value == '') {
         return $value;
     }
     $value = maybe_unserialize($value);
     $value = apply_filters('frm_display_value_custom', $value, $field, $atts);
     $new_value = '';
     if (is_array($value)) {
         foreach ($value as $val) {
             if (is_array($val)) {
                 //TODO: add options for display (li or ,)
                 $new_value .= implode($atts['sep'], $val);
                 if ($atts['type'] != 'data') {
                     $new_value .= "<br/>";
                 }
             }
             unset($val);
         }
     }
     if (!empty($new_value)) {
         $value = $new_value;
     } else {
         if (is_array($value)) {
             $value = implode($atts['sep'], $value);
         }
     }
     if ($atts['truncate'] and $atts['type'] != 'image') {
         $value = FrmAppHelper::truncate($value, 50);
     }
     if ($atts['type'] == 'image') {
         $value = '<img src="' . $value . '" height="50px" alt="" />';
     } else {
         if ($atts['type'] == 'user_id') {
             $value = FrmProFieldsHelper::get_display_name($value);
         } else {
             if ($atts['type'] == 'file') {
                 $old_value = explode(', ', $value);
                 $value = '';
                 foreach ($old_value as $mid) {
                     $value .= '<div class="frm_file_container">';
                     if ($atts['show_icon']) {
                         $img = FrmProFieldsHelper::get_file_icon($mid);
                         $value .= $img;
                         if ($atts['show_filename'] and $img and preg_match("/wp-includes\\/images\\/crystal/", $img)) {
                             //prevent two filenames
                             $atts['show_filename'] = $show_filename = false;
                         }
                         unset($img);
                     }
                     if ($atts['show_icon'] and $atts['show_filename']) {
                         $value .= '<br/>';
                     }
                     if ($atts['show_filename']) {
                         $value .= FrmProFieldsHelper::get_file_name($mid);
                     }
                     if (isset($show_filename)) {
                         //if skipped filename, show it for the next file
                         $atts['show_filename'] = true;
                         unset($show_filename);
                     }
                     $value .= '</div>';
                 }
             } else {
                 if ($atts['type'] == 'date') {
                     $value = FrmProFieldsHelper::get_date($value);
                 } else {
                     if ($atts['type'] == 'data') {
                         if (!is_numeric($value)) {
                             $value = explode($atts['sep'], $value);
                             if (is_array($value)) {
                                 $new_value = '';
                                 foreach ($value as $entry_id) {
                                     if (!empty($new_value)) {
                                         $new_value .= $atts['sep'];
                                     }
                                     if (is_numeric($entry_id)) {
                                         $dval = FrmProFieldsHelper::get_data_value($entry_id, $field, $atts);
                                         if (is_array($dval)) {
                                             $dval = implode($atts['sep'], $dval);
                                         }
                                         $new_value .= $dval;
                                     } else {
                                         $new_value .= $entry_id;
                                     }
                                 }
                                 $value = $new_value;
                             }
                         } else {
                             //replace item id with specified field
                             $new_value = FrmProFieldsHelper::get_data_value($value, $field, $atts);
                             if ($field->field_options['data_type'] == 'data' or $field->field_options['data_type'] == '') {
                                 $linked_field = $frm_field->getOne($field->field_options['form_select']);
                                 if ($linked_field->type == 'file') {
                                     $old_value = explode(', ', $new_value);
                                     $new_value = '';
                                     foreach ($old_value as $v) {
                                         $new_value .= '<img src="' . $v . '" height="50px" alt="" />';
                                         if ($atts['show_filename']) {
                                             $new_value .= '<br/>' . $v;
                                         }
                                         unset($v);
                                     }
                                 } else {
                                     $new_value = $value;
                                 }
                             }
                             $value = $new_value;
                         }
                     }
                 }
             }
         }
     }
     if (!$atts['keepjs']) {
         $value = wp_kses_post($value);
     }
     return apply_filters('frm_display_value', $value, $field, $atts);
 }
 function display_value($value, $field, $atts = array())
 {
     global $wpdb;
     $defaults = array('type' => '', 'show_icon' => true, 'show_filename' => true, 'truncate' => false, 'sep' => ', ', 'post_id' => 0, 'form_id' => $field->form_id, 'field' => $field);
     $atts = wp_parse_args($atts, $defaults);
     $field->field_options = maybe_unserialize($field->field_options);
     if (!isset($field->field_options['post_field'])) {
         $field->field_options['post_field'] = '';
     }
     if (!isset($field->field_options['custom_field'])) {
         $field->field_options['custom_field'] = '';
     }
     if ($atts['post_id'] and ($field->field_options['post_field'] or $atts['type'] == 'tag')) {
         $atts['pre_truncate'] = $atts['truncate'];
         $atts['truncate'] = true;
         $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0;
         $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts);
         $atts['truncate'] = $atts['pre_truncate'];
     }
     if ($value == '') {
         return $value;
     }
     $value = maybe_unserialize($value);
     if (is_array($value)) {
         $value = stripslashes_deep($value);
     }
     $value = apply_filters('frm_display_value_custom', $value, $field, $atts);
     $new_value = '';
     if (is_array($value)) {
         foreach ($value as $val) {
             if (is_array($val)) {
                 //TODO: add options for display (li or ,)
                 $new_value .= implode($atts['sep'], $val);
                 if ($atts['type'] != 'data') {
                     $new_value .= "<br/>";
                 }
             }
             unset($val);
         }
     }
     if (!empty($new_value)) {
         $value = $new_value;
     } else {
         if (is_array($value)) {
             $value = implode($atts['sep'], $value);
         }
     }
     if ($atts['truncate'] and $atts['type'] != 'image') {
         $value = FrmAppHelper::truncate($value, 50);
     }
     if ($atts['type'] == 'image') {
         $value = '<img src="' . $value . '" height="50px" alt="" />';
     } else {
         if ($atts['type'] == 'user_id') {
             $value = FrmProFieldsHelper::get_display_name($value);
         } else {
             if ($atts['type'] == 'file') {
                 $old_value = $value;
                 $value = '';
                 if ($atts['show_icon']) {
                     $value .= FrmProFieldsHelper::get_file_icon($old_value);
                 }
                 if ($atts['show_icon'] and $atts['show_filename']) {
                     $value .= '<br/>';
                 }
                 if ($atts['show_filename']) {
                     $value .= FrmProFieldsHelper::get_file_name($old_value);
                 }
             } else {
                 if ($atts['type'] == 'date') {
                     $value = FrmProFieldsHelper::get_date($value);
                 } else {
                     if ($atts['type'] == 'data') {
                         if (!is_numeric($value)) {
                             $value = explode($atts['sep'], $value);
                             if (is_array($value)) {
                                 $new_value = '';
                                 foreach ($value as $entry_id) {
                                     if (!empty($new_value)) {
                                         $new_value .= $atts['sep'];
                                     }
                                     if (is_numeric($entry_id)) {
                                         $new_value .= FrmProFieldsHelper::get_data_value($entry_id, $field, $atts);
                                     } else {
                                         $new_value .= $entry_id;
                                     }
                                 }
                                 $value = $new_value;
                             }
                         } else {
                             //replace item id with specified field
                             $value = FrmProFieldsHelper::get_data_value($value, $field, $atts);
                             if ($field->field_options['data_type'] == 'data' or $field->field_options['data_type'] == '') {
                                 $linked_field = FrmField::getOne($field->field_options['form_select']);
                                 if ($linked_field->type == 'file') {
                                     $old_value = $value;
                                     $value = '<img src="' . $value . '" height="50px" alt="" />';
                                     if ($atts['show_filename']) {
                                         $value .= '<br/>' . $old_value;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $value = stripslashes_deep($value);
     return apply_filters('frm_display_value', $value, $field, $atts);
 }
Example #5
0
 function get_display_value($replace_with, $field, $atts = array())
 {
     $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
     if ($field->type == 'user_id') {
         $user_info = isset($atts['show']) ? $atts['show'] : 'display_name';
         $replace_with = FrmProFieldsHelper::get_display_name($replace_with, $user_info, $atts);
         if (is_array($replace_with)) {
             $new_val = '';
             foreach ($replace_with as $key => $val) {
                 if (!empty($new_val)) {
                     $new_val .= ', ';
                 }
                 $new_val .= $key . '. ' . $val;
             }
             $replace_with = $new_val;
         }
     } else {
         if ($field->type == 'date') {
             if (isset($atts['time_ago'])) {
                 $atts['format'] = 'Y-m-d H:i:s';
             }
             if (!isset($atts['format'])) {
                 $atts['format'] = false;
             }
             $replace_with = FrmProFieldsHelper::get_date($replace_with, $atts['format']);
             if (isset($atts['time_ago'])) {
                 $replace_with = FrmProAppHelper::human_time_diff(strtotime($replace_with), strtotime(date_i18n('Y-m-d')));
             }
         } else {
             if (is_numeric($replace_with) and $field->type == 'file') {
                 //size options are thumbnail, medium, large, or full
                 $size = isset($atts['size']) ? $atts['size'] : 'thumbnail';
                 if ($size != 'id') {
                     $replace_with = FrmProFieldsHelper::get_media_from_id($replace_with, $size);
                 }
             } else {
                 if ($field->type == 'data') {
                     //and (is_numeric($replace_with) or is_array($replace_with))
                     $field->field_options = maybe_unserialize($field->field_options);
                     if (isset($field->field_options['form_select']) and $field->field_options['form_select'] == 'taxonomy') {
                         return $replace_with;
                     }
                     $replace_with = explode($sep, $replace_with);
                     if (isset($atts['show'])) {
                         if (in_array($atts['show'], array('key', 'created-at', 'created_at', 'updated-at', 'updated_at', 'post_id'))) {
                             global $frm_entry;
                             if (is_array($replace_with)) {
                                 $linked_ids = $replace_with;
                                 $replace_with = '';
                                 foreach ($linked_ids as $linked_id) {
                                     $linked_entry = FrmEntry::getOne($linked_id);
                                     if (!empty($replace_with)) {
                                         $replace_with .= $sep;
                                     }
                                     if ($atts['show'] == 'created-at') {
                                         $replace_with .= $linked_entry->created_at;
                                     } else {
                                         if ($atts['show'] == 'updated-at') {
                                             $replace_with .= $linked_entry->updated_at;
                                         } else {
                                             if ($atts['show'] == 'key') {
                                                 $replace_with .= $linked_entry->item_key;
                                             } else {
                                                 $replace_with .= isset($linked_entry->{$atts['show']}) ? $linked_entry->{$atts['show']} : $linked_entry->item_key;
                                             }
                                         }
                                     }
                                 }
                             } else {
                                 $linked_entry = FrmEntry::getOne($replace_with);
                                 if ($atts['show'] == 'created-at') {
                                     $replace_with = $linked_entry->created_at;
                                 } else {
                                     if ($atts['show'] == 'updated-at') {
                                         $replace_with = $linked_entry->updated_at;
                                     } else {
                                         if ($atts['show'] == 'key') {
                                             $replace_with = $linked_entry->item_key;
                                         } else {
                                             $replace_with = isset($linked_entry->{$atts['show']}) ? $linked_entry->{$atts['show']} : $linked_entry->item_key;
                                         }
                                     }
                                 }
                             }
                         } else {
                             if ($atts['show'] == 'id') {
                                 if (is_array($replace_with)) {
                                     $replace_with = implode($sep, $replace_with);
                                 }
                                 //just keep the value since it's already the id
                             } else {
                                 if (is_array($replace_with)) {
                                     $linked_ids = $replace_with;
                                     $replace_with = array();
                                     foreach ($linked_ids as $linked_id) {
                                         $new_val = FrmProFieldsHelper::get_data_value($linked_id, $field, $atts);
                                         if ($linked_id != $new_val) {
                                             $replace_with[] = $new_val;
                                         }
                                         unset($new_val);
                                     }
                                     $replace_with = implode($sep, $replace_with);
                                 } else {
                                     $replace_with = FrmProFieldsHelper::get_data_value($replace_with, $field, $atts);
                                 }
                             }
                         }
                     } else {
                         if (is_array($replace_with)) {
                             $linked_ids = $replace_with;
                             $replace_with = array();
                             foreach ($linked_ids as $linked_id) {
                                 $new_val = FrmProFieldsHelper::get_data_value($linked_id, $field, $atts);
                                 if ($linked_id != $new_val) {
                                     $replace_with[] = $new_val;
                                 }
                                 unset($new_val);
                             }
                             $replace_with = implode($sep, $replace_with);
                         } else {
                             $replace_with = FrmProFieldsHelper::get_data_value($replace_with, $field, $atts);
                         }
                     }
                 } else {
                     if ($field->type == 'textarea') {
                         $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true;
                         if (apply_filters('frm_use_wpautop', $autop)) {
                             $replace_with = wpautop($replace_with);
                         }
                         unset($autop);
                     } else {
                         if ($field->type == 'number') {
                             if (!isset($atts['decimal'])) {
                                 $num = explode('.', $replace_with);
                                 $atts['decimal'] = isset($num[1]) ? strlen($num[1]) : 0;
                             }
                             if (!isset($atts['dec_point'])) {
                                 $atts['dec_point'] = '.';
                             }
                             if (!isset($atts['thousands_sep'])) {
                                 $atts['thousands_sep'] = '';
                             }
                             $replace_with = number_format($replace_with, $atts['decimal'], $atts['dec_point'], $atts['thousands_sep']);
                         }
                     }
                 }
             }
         }
     }
     $replace_with = stripslashes_deep($replace_with);
     return $replace_with;
 }
 public static function &filter_display_value($value, $field, $atts = array())
 {
     $defaults = array('html' => 0, 'type' => $field->type, 'keepjs' => 0);
     $atts = array_merge($defaults, $atts);
     switch ($atts['type']) {
         case 'user_id':
             $value = FrmProFieldsHelper::get_display_name($value);
             break;
         case 'date':
             $value = FrmProFieldsHelper::get_date($value);
             break;
         case 'file':
             $old_value = $value;
             if ($atts['html']) {
                 $value = '<div class="frm_file_container">';
             } else {
                 $value = '';
             }
             foreach ((array) $old_value as $mid) {
                 if ($atts['html']) {
                     $img = FrmProFieldsHelper::get_file_icon($mid);
                     $value .= $img;
                     if ($atts['show_filename'] && $img && preg_match('/wp-includes\\/images\\/(crystal|media)/', $img)) {
                         //prevent two filenames
                         $atts['show_filename'] = $show_filename = false;
                     }
                     unset($img);
                     if ($atts['html'] && $atts['show_filename']) {
                         $value .= '<br/>' . FrmProFieldsHelper::get_file_name($mid) . '<br/>';
                     }
                     if (isset($show_filename)) {
                         //if skipped filename, show it for the next file
                         $atts['show_filename'] = true;
                         unset($show_filename);
                     }
                 } else {
                     if ($mid) {
                         $value .= FrmProFieldsHelper::get_file_name($mid) . $atts['sep'];
                     }
                 }
             }
             $value = rtrim($value, $atts['sep']);
             if ($atts['html']) {
                 $value .= '</div>';
             }
             break;
         case 'data':
             if (!is_numeric($value)) {
                 if (!is_array($value)) {
                     $value = explode($atts['sep'], $value);
                 }
                 if (is_array($value)) {
                     $new_value = '';
                     foreach ($value as $entry_id) {
                         if (!empty($new_value)) {
                             $new_value .= $atts['sep'];
                         }
                         if (is_numeric($entry_id)) {
                             $new_value .= FrmProFieldsHelper::get_data_value($entry_id, $field, $atts);
                         } else {
                             $new_value .= $entry_id;
                         }
                     }
                     $value = $new_value;
                 }
             } else {
                 //replace item id with specified field
                 $new_value = FrmProFieldsHelper::get_data_value($value, $field, $atts);
                 if (FrmProField::is_list_field($field)) {
                     $linked_field = FrmField::getOne($field->field_options['form_select']);
                     if ($linked_field && $linked_field->type == 'file') {
                         $old_value = explode(', ', $new_value);
                         $new_value = '';
                         foreach ($old_value as $v) {
                             $new_value .= '<img src="' . esc_url($v) . '" class="frm_image_from_url" alt="" />';
                             if ($atts['show_filename']) {
                                 $new_value .= '<br/>' . $v;
                             }
                             unset($v);
                         }
                     } else {
                         $new_value = $value;
                     }
                 }
                 $value = $new_value;
             }
             break;
         case 'image':
             $value = FrmProFieldsHelper::get_image_display_value($value, array('html' => true));
             break;
     }
     if (!$atts['keepjs']) {
         $value = FrmAppHelper::recursive_function_map($value, 'wp_kses_post');
     }
     return FrmEntriesController::filter_display_value($value, $field, $atts);
 }
Example #7
0
        ?>
</post_id>
		<ip><?php 
        echo $entry->ip;
        ?>
</ip>
		<is_draft><?php 
        echo $entry->is_draft;
        ?>
</is_draft>
		<user_id><?php 
        echo FrmXMLHelper::cdata(FrmProFieldsHelper::get_display_name($entry->user_id, 'user_login'));
        ?>
</user_id>
		<updated_by><?php 
        echo FrmXMLHelper::cdata(FrmProFieldsHelper::get_display_name($entry->updated_by, 'user_login'));
        ?>
</updated_by>
        <parent_item_id><?php 
        echo $entry->parent_item_id;
        ?>
</parent_item_id>
        
<?php 
        $metas = $wpdb->get_results($wpdb->prepare("SELECT meta_value, field_id FROM {$wpdb->prefix}frm_item_metas WHERE item_id=%d", $entry->id));
        foreach ($metas as $meta) {
            ?>
		<item_meta>
		    <field_id><?php 
            echo $meta->field_id;
            ?>
Example #8
0
header('Pragma: no-cache');
foreach ($form_cols as $col) {
    echo '"' . FrmProEntriesHelper::encode_value(strip_tags($col->name), $charset, $to_encoding) . '",';
}
echo '"' . __('Timestamp', 'formidable') . '","IP","ID","Key"' . "\n";
foreach ($entries as $entry) {
    foreach ($form_cols as $col) {
        $field_value = isset($entry->metas[$col->id]) ? $entry->metas[$col->id] : false;
        if (!$field_value and $entry->post_id) {
            $col->field_options = maybe_unserialize($col->field_options);
            if (isset($col->field_options['post_field']) and $col->field_options['post_field']) {
                $field_value = FrmProEntryMetaHelper::get_post_value($entry->post_id, $col->field_options['post_field'], $col->field_options['custom_field'], array('truncate' => $col->field_options['post_field'] == 'post_category' ? true : false, 'form_id' => $entry->form_id, 'field' => $col, 'type' => $col->type, 'exclude_cat' => isset($col->field_options['exclude_cat']) ? $col->field_options['exclude_cat'] : 0));
            }
        }
        if ($col->type == 'user_id') {
            $field_value = FrmProFieldsHelper::get_display_name($field_value);
        } else {
            if ($col->type == 'file') {
                $field_value = FrmProFieldsHelper::get_file_name($field_value);
            } else {
                if ($col->type == 'date') {
                    $field_value = FrmProFieldsHelper::get_date($field_value, $wp_date_format);
                } else {
                    if ($col->type == 'data' && is_numeric($field_value)) {
                        $field_value = FrmProFieldsHelper::get_data_value($field_value, $col);
                        //replace entry id with specified field
                    } else {
                        $checked_values = maybe_unserialize($field_value);
                        $checked_values = apply_filters('frm_csv_value', $checked_values, array('field' => $col));
                        if (is_array($checked_values)) {
                            if ($col->type == 'data') {
Example #9
0
                    <h3 class="hndle"><span><?php 
    _e('Comments/Notes', 'formidable');
    ?>
</span></h3>
                    <div class="inside">
                        <table class="form-table"><tbody> 
                        <?php 
    foreach ($comments as $comment) {
        $meta = $comment->meta_value;
        if (!isset($meta['comment'])) {
            continue;
        }
        ?>
                            <tr class="frm_comment_block">
                                <th scope="row"><p><strong><?php 
        echo FrmProFieldsHelper::get_display_name($meta['user_id'], 'display_name', array('link' => true));
        ?>
</strong><br/>
                                    <?php 
        echo FrmProAppHelper::get_formatted_time($comment->created_at, $date_format, $time_format);
        ?>
</p>
                                </th>
                                <td><div class="frm_comment"><?php 
        echo wpautop(strip_tags($meta['comment']));
        ?>
</div></td>
                            </tr>
                        <?php 
    }
    ?>
 public static function email_value($value, $meta, $entry)
 {
     global $frm_field, $frm_entry;
     if ($entry->id != $meta->item_id) {
         $entry = $frm_entry->getOne($meta->item_id);
     }
     $field = $frm_field->getOne($meta->field_id);
     if (!$field) {
         return $value;
     }
     $field->field_options = maybe_unserialize($field->field_options);
     if (isset($field->field_options['post_field']) and $field->field_options['post_field']) {
         $value = FrmProEntryMetaHelper::get_post_or_meta_value($entry, $field, array('truncate' => true));
         $value = maybe_unserialize($value);
     }
     switch ($field->type) {
         case 'user_id':
             $value = FrmProFieldsHelper::get_display_name($value);
             break;
         case 'data':
             if (is_array($value)) {
                 $new_value = array();
                 foreach ($value as $val) {
                     $new_value[] = FrmProFieldsHelper::get_data_value($val, $field);
                 }
                 $value = $new_value;
             } else {
                 $value = FrmProFieldsHelper::get_data_value($value, $field);
             }
             break;
         case 'file':
             $value = self::get_file_name($value);
             break;
             /*case 'date':
               $value = FrmProFieldsHelper::get_date($value);*/
     }
     if (is_array($value)) {
         $new_value = '';
         foreach ($value as $val) {
             if (is_array($val)) {
                 $new_value .= implode(', ', $val) . "\n";
             }
         }
         if ($new_value != '') {
             $value = $new_value;
         }
     }
     return $value;
 }
 private static function add_entry_data_to_csv(&$row)
 {
     $row['created_at'] = FrmAppHelper::get_formatted_time(self::$entry->created_at, self::$wp_date_format, ' ');
     $row['updated_at'] = FrmAppHelper::get_formatted_time(self::$entry->updated_at, self::$wp_date_format, ' ');
     $row['user_id'] = FrmProFieldsHelper::get_display_name(self::$entry->user_id, 'user_login');
     $row['updated_by'] = FrmProFieldsHelper::get_display_name(self::$entry->updated_by, 'user_login');
     $row['is_draft'] = self::$entry->is_draft ? '1' : '0';
     $row['ip'] = self::$entry->ip;
     $row['id'] = self::$entry->id;
     $row['item_key'] = self::$entry->item_key;
 }
Example #12
0
                unset($co);
                $v = FrmProEntriesHelper::encode_value(FrmProFieldsHelper::get_display_name($c['user_id'], 'user_login'), $charset, $to_encoding);
                unset($c);
                echo '"' . $v . '"' . $col_sep;
                $v = FrmProEntriesHelper::encode_value(FrmProAppHelper::get_formatted_time($comment->created_at, $wp_date_format, ' '), $charset, $to_encoding);
                echo '"' . $v . '"' . $col_sep;
                unset($v);
            }
        }
        if ($place_holder) {
            for ($i = 0; $i < $place_holder; $i++) {
                echo '""' . $col_sep . '""' . $col_sep . '""' . $col_sep;
            }
            unset($i);
        }
        unset($place_holder);
        $formatted_date = FrmProAppHelper::get_formatted_time($entry->created_at, $wp_date_format, ' ');
        echo '"' . $formatted_date . '"' . $col_sep;
        $formatted_date = FrmProAppHelper::get_formatted_time($entry->updated_at, $wp_date_format, ' ');
        echo '"' . $formatted_date . '"' . $col_sep;
        unset($formatted_date);
        echo '"' . FrmProEntriesHelper::encode_value(FrmProFieldsHelper::get_display_name($entry->user_id, 'user_login'), $charset, $to_encoding) . '"' . $col_sep;
        echo '"' . FrmProEntriesHelper::encode_value(FrmProFieldsHelper::get_display_name($entry->updated_by, 'user_login'), $charset, $to_encoding) . '"' . $col_sep;
        echo '"' . ($entry->is_draft ? '1' : '0') . '"' . $col_sep;
        echo '"' . $entry->ip . '"' . $col_sep;
        echo '"' . $entry->id . '"' . $col_sep;
        echo '"' . $entry->item_key . '"' . "\n";
        unset($entry);
    }
    unset($entries);
}