public static function generate_csv($atts) { global $frm_vars; $frm_vars['prevent_caching'] = true; self::$fields = $atts['form_cols']; self::$form_id = $atts['form']->id; self::set_class_paramters(); $filename = apply_filters('frm_csv_filename', date('ymdHis', time()) . '_' . sanitize_title_with_dashes($atts['form']->name) . '_formidable_entries.csv', $atts['form']); unset($atts['form'], $atts['form_cols']); self::print_file_headers($filename); unset($filename); $comment_count = FrmDb::get_count('frm_item_metas', array('item_id' => $atts['entry_ids'], 'field_id' => 0, 'meta_value like' => '{'), array('group_by' => 'item_id', 'order_by' => 'count(*) DESC', 'limit' => 1)); self::$comment_count = $comment_count; self::prepare_csv_headings(); // fetch 20 posts at a time rather than loading the entire table into memory while ($next_set = array_splice($atts['entry_ids'], 0, 20)) { self::prepare_next_csv_rows($next_set); } }