本文整理汇总了PHP中GFCommon::get_label方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::get_label方法的具体用法?PHP GFCommon::get_label怎么用?PHP GFCommon::get_label使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFCommon
的用法示例。
在下文中一共展示了GFCommon::get_label方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replace_merge_tags
public static function replace_merge_tags($form)
{
$current_page = isset(GFFormDisplay::$submission[$form['id']]) ? GFFormDisplay::$submission[$form['id']]['page_number'] : 1;
$replace_merge_tags_in_labels = apply_filters('gppc_replace_merge_tags_in_labels', false, $form);
// get all HTML fields on the current page
foreach ($form['fields'] as &$field) {
if ($replace_merge_tags_in_labels) {
// @todo: add support for individual input labels
$label = GFCommon::get_label($field);
if (gp_preview_submission()->has_any_merge_tag($label)) {
$field['label'] = self::preview_replace_variables($label, $form);
}
}
// skip all fields on the first page
if (rgar($field, 'pageNumber') <= 1) {
continue;
}
$default_value = rgar($field, 'defaultValue');
if (gp_preview_submission()->has_any_merge_tag($default_value)) {
$field['defaultValue'] = rgar($field, 'pageNumber') != $current_page ? '' : self::preview_replace_variables($default_value, $form);
}
// only run 'content' filter for fields on the current page
if (rgar($field, 'pageNumber') != $current_page) {
continue;
}
$html_content = rgar($field, 'content');
if (gp_preview_submission()->has_any_merge_tag($html_content)) {
$field['content'] = self::preview_replace_variables($html_content, $form);
}
}
return $form;
}
示例2: load
/**
* Loads the matching meta data for the currently set form id
* @return boolean true on success and false on failure
*/
public function load()
{
if (!defined('WPINC') || !$this->_post_id || !class_exists('GFAPI')) {
return false;
}
$lead = \GFAPI::get_entry($this->_post_id);
$form = \GFAPI::get_form($lead['form_id']);
$values = array();
foreach ($form['fields'] as $field) {
if (isset($field["inputs"]) && is_array($field['inputs'])) {
foreach ($field['inputs'] as $input) {
// Extract best label
$key = $input['label'] ? $input['label'] : \GFCommon::get_label($field, (string) $input["id"]);
// Redundant formatting
$key = strtolower(str_replace(array(' '), array('_'), $key));
$value = isset($lead[(string) $input['id']]) ? $lead[(string) $input['id']] : "";
$values[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
} elseif (!rgar($field, 'displayOnly')) {
// Extract best label
$key = isset($field['adminLabel']) && $field['adminLabel'] != "" ? $field['adminLabel'] : ($field['label'] ? $field['label'] : \GFCommon::get_label($field));
// More redundant formatting
$key = strtolower(str_replace(array(' '), array('_'), $key));
$value = isset($lead[$field['id']]) ? $lead[$field['id']] : "";
$values[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
}
try {
$this->assign($values);
} catch (Exception $e) {
$error = $e->getMessage();
}
return true;
}
示例3: load_form_data
public function load_form_data($lead, $form_id = '')
{
$form_id = is_numeric($form_id) ? $form_id : (isset($lead['form_id']) ? $lead['form_id'] : $lead['id']);
// No form id
if (!$form_id) {
return false;
}
$form = \GFAPI::get_form($form_id);
// Invalid form ID
if (!$form) {
return false;
}
$file_fields = array();
$url_field = array();
$values = array();
foreach ($form['fields'] as $field) {
if (isset($field["inputs"]) && is_array($field['inputs'])) {
foreach ($field['inputs'] as $input) {
// Extract best label
$key = $input['label'] ? $input['label'] : \GFCommon::get_label($field, (string) $input["id"]);
// Redundant formatting
$key = strtolower(str_replace(array(' '), array('_'), $key));
$value = isset($lead[(string) $input['id']]) ? $lead[(string) $input['id']] : "";
$values[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
} elseif (!rgar($field, 'displayOnly')) {
// Extract best label
$key = isset($field['adminLabel']) && $field['adminLabel'] != "" ? $field['adminLabel'] : ($field['label'] ? $field['label'] : \GFCommon::get_label($field));
// More redundant formatting
$key = strtolower(str_replace(array(' '), array('_'), $key));
$value = isset($lead[$field['id']]) ? $lead[$field['id']] : "";
$values[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
}
$values['logo'] = $this->logo ? $this->logo : $values['logo'];
// An image field being re-assign from post file data
try {
$this->assign($values);
} catch (Exception $e) {
$error = $e->getMessage();
}
if (!$this->product_id && isset($lead['source_url'])) {
// only needed if used in conjunction with woocommerce fulfillment
$this->product_id = url_to_postid($lead['source_url']);
}
return true;
}
示例4: select_export_form
public static function select_export_form()
{
check_ajax_referer('rg_select_export_form', 'rg_select_export_form');
$form_id = intval($_POST['form_id']);
$form = RGFormsModel::get_form_meta($form_id);
/**
* Filters through the Form Export Page
*
* @param int $form_id The ID of the form to export
* @param int $form The Form Object of the form to export
*/
$form = gf_apply_filters('gform_form_export_page', $form_id, $form);
$filter_settings = GFCommon::get_field_filter_settings($form);
$filter_settings_json = json_encode($filter_settings);
$fields = array();
$form = GFExport::add_default_export_fields($form);
if (is_array($form['fields'])) {
/* @var GF_Field $field */
foreach ($form['fields'] as $field) {
$inputs = $field->get_entry_inputs();
if (is_array($inputs)) {
foreach ($inputs as $input) {
$fields[] = array($input['id'], GFCommon::get_label($field, $input['id']));
}
} else {
if (!$field->displayOnly) {
$fields[] = array($field->id, GFCommon::get_label($field));
}
}
}
}
$field_json = GFCommon::json_encode($fields);
die("EndSelectExportForm({$field_json}, {$filter_settings_json});");
}
示例5: get_field_merge_tag
private static function get_field_merge_tag($form, $field_id)
{
$field = self::get_field($form, $field_id);
if (!$field) {
return false;
}
return '{' . GFCommon::get_label($field, $field_id) . ':' . $field_id . '}';
}
示例6: start_export
public static function start_export($form)
{
$form_id = $form['id'];
$fields = $_POST['export_field'];
$start_date = empty($_POST['export_date_start']) ? '' : self::get_gmt_date($_POST['export_date_start'] . ' 00:00:00');
$end_date = empty($_POST['export_date_end']) ? '' : self::get_gmt_date($_POST['export_date_end'] . ' 23:59:59');
$search_criteria['status'] = 'active';
$search_criteria['field_filters'] = GFCommon::get_field_filters_from_post($form);
if (!empty($start_date)) {
$search_criteria['start_date'] = $start_date;
}
if (!empty($end_date)) {
$search_criteria['end_date'] = $end_date;
}
$sorting = array('key' => 'date_created', 'direction' => 'DESC', 'type' => 'info');
GFCommon::log_debug("GFExport::start_export(): Start date: {$start_date}");
GFCommon::log_debug("GFExport::start_export(): End date: {$end_date}");
$form = self::add_default_export_fields($form);
$entry_count = GFAPI::count_entries($form_id, $search_criteria);
$page_size = 100;
$offset = 0;
//Adding BOM marker for UTF-8
$lines = chr(239) . chr(187) . chr(191);
// set the separater
$separator = gf_apply_filters('gform_export_separator', $form_id, ',', $form_id);
$field_rows = self::get_field_row_count($form, $fields, $entry_count);
//writing header
$headers = array();
foreach ($fields as $field_id) {
$field = RGFormsModel::get_field($form, $field_id);
$label = gf_apply_filters('gform_entries_field_header_pre_export', array($form_id, $field_id), GFCommon::get_label($field, $field_id), $form, $field);
$value = str_replace('"', '""', $label);
GFCommon::log_debug("GFExport::start_export(): Header for field ID {$field_id}: {$value}");
$headers[$field_id] = $value;
$subrow_count = isset($field_rows[$field_id]) ? intval($field_rows[$field_id]) : 0;
if ($subrow_count == 0) {
$lines .= '"' . $value . '"' . $separator;
} else {
for ($i = 1; $i <= $subrow_count; $i++) {
$lines .= '"' . $value . ' ' . $i . '"' . $separator;
}
}
GFCommon::log_debug("GFExport::start_export(): Lines: {$lines}");
}
$lines = substr($lines, 0, strlen($lines) - 1) . "\n";
//paging through results for memory issues
while ($entry_count > 0) {
$paging = array('offset' => $offset, 'page_size' => $page_size);
$leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging);
$leads = gf_apply_filters('gform_leads_before_export', $form_id, $leads, $form, $paging);
foreach ($leads as $lead) {
foreach ($fields as $field_id) {
switch ($field_id) {
case 'date_created':
$lead_gmt_time = mysql2date('G', $lead['date_created']);
$lead_local_time = GFCommon::get_local_timestamp($lead_gmt_time);
$value = date_i18n('Y-m-d H:i:s', $lead_local_time, true);
break;
default:
$field = RGFormsModel::get_field($form, $field_id);
$value = is_object($field) ? $field->get_value_export($lead, $field_id, false, true) : rgar($lead, $field_id);
$value = apply_filters('gform_export_field_value', $value, $form_id, $field_id, $lead);
GFCommon::log_debug("GFExport::start_export(): Value for field ID {$field_id}: {$value}");
break;
}
if (isset($field_rows[$field_id])) {
$list = empty($value) ? array() : unserialize($value);
foreach ($list as $row) {
$row_values = array_values($row);
$row_str = implode('|', $row_values);
$lines .= '"' . str_replace('"', '""', $row_str) . '"' . $separator;
}
//filling missing subrow columns (if any)
$missing_count = intval($field_rows[$field_id]) - count($list);
for ($i = 0; $i < $missing_count; $i++) {
$lines .= '""' . $separator;
}
} else {
$value = maybe_unserialize($value);
if (is_array($value)) {
$value = implode('|', $value);
}
$lines .= '"' . str_replace('"', '""', $value) . '"' . $separator;
}
}
$lines = substr($lines, 0, strlen($lines) - 1);
GFCommon::log_debug("GFExport::start_export(): Lines: {$lines}");
$lines .= "\n";
}
$offset += $page_size;
$entry_count -= $page_size;
if (!seems_utf8($lines)) {
$lines = utf8_encode($lines);
}
$lines = apply_filters('gform_export_lines', $lines);
echo $lines;
$lines = '';
}
/**
* Fires after exporting all the entries in form
//.........这里部分代码省略.........
示例7: ajax_get_results
public function ajax_get_results()
{
$output = array();
$html = "";
$form_id = rgpost("id");
$form = GFFormsModel::get_form_meta($form_id);
$form = apply_filters("gform_form_pre_results_{$form_id}", apply_filters("gform_form_pre_results", $form));
$search_criteria["status"] = "active";
$fields = $this->get_fields($form);
$total_entries = GFAPI::count_entries($form_id, $search_criteria);
if ($total_entries == 0) {
$html = __("No results.", "gravityforms");
} else {
$search_criteria = array();
$search_criteria["field_filters"] = GFCommon::get_field_filters_from_post();
$start_date = rgpost("start");
$end_date = rgpost("end");
if ($start_date) {
$search_criteria["start_date"] = $start_date;
}
if ($end_date) {
$search_criteria["end_date"] = $end_date;
}
$search_criteria["status"] = "active";
$output["s"] = http_build_query($search_criteria);
$state_array = null;
if (isset($_POST["state"])) {
$state = $_POST["state"];
$posted_check_sum = rgpost("checkSum");
$generated_check_sum = self::generate_checksum($state);
$state_array = json_decode(base64_decode($state), true);
if ($generated_check_sum !== $posted_check_sum) {
$output["status"] = "complete";
$output["html"] = __('There was an error while processing the entries. Please contact support.', "gravityforms");
echo json_encode($output);
die;
}
}
$data = isset($this->_callbacks["data"]) ? call_user_func($this->_callbacks["data"], $form, $fields, $search_criteria, $state_array) : $this->get_results_data($form, $fields, $search_criteria, $state_array);
$entry_count = $data["entry_count"];
if ("incomplete" === rgar($data, "status")) {
$state = base64_encode(json_encode($data));
$output["status"] = "incomplete";
$output["stateObject"] = $state;
$output["checkSum"] = self::generate_checksum($state);
$output["html"] = sprintf(__('Entries processed: %1$d of %2$d', "gravityforms"), rgar($data, "offset"), $entry_count);
echo json_encode($output);
die;
}
if ($total_entries > 0) {
$html = isset($this->_callbacks["markup"]) ? call_user_func($this->_callbacks["markup"], $html, $data, $form, $fields) : "";
if (empty($html)) {
foreach ($fields as $field) {
$field_id = $field['id'];
$html .= "<div class='gresults-results-field' id='gresults-results-field-{$field_id}'>";
$html .= "<div class='gresults-results-field-label'>" . esc_html(GFCommon::get_label($field)) . "</div>";
$html .= "<div>" . self::get_field_results($form_id, $data, $field, $search_criteria) . "</div>";
$html .= "</div>";
}
}
} else {
$html .= __("No results", "gravityforms");
}
}
$output["html"] = $html;
$output["status"] = "complete";
$output["searchCriteria"] = $search_criteria;
echo json_encode($output);
die;
}
示例8: get_form_fields
private static function get_form_fields($form)
{
$fields = array();
if (is_array($form["fields"])) {
foreach ($form["fields"] as $field) {
if (isset($field["inputs"]) && is_array($field["inputs"])) {
foreach ($field["inputs"] as $input) {
$fields[] = array($input["id"], GFCommon::get_label($field, $input["id"]));
}
} else {
if (!rgar($field, 'displayOnly')) {
$fields[] = array($field["id"], GFCommon::get_label($field));
}
}
}
}
return $fields;
}
示例9: get_submitted_fields
public static function get_submitted_fields($form, $lead, $display_empty = false, $use_text = false, $format = "html", $use_admin_label = false, $merge_tag = "", $options = "")
{
$field_data = "";
if ($format == "html") {
$field_data = '<table width="99%" border="0" cellpadding="1" cellspacing="0" bgcolor="#EAEAEA"><tr><td>
<table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">';
}
$options_array = explode(",", $options);
$no_admin = in_array("noadmin", $options_array);
$no_hidden = in_array("nohidden", $options_array);
$has_product_fields = false;
foreach ($form["fields"] as $field) {
$field_value = "";
$field_label = $use_admin_label && !rgempty("adminLabel", $field) ? rgar($field, "adminLabel") : esc_html(GFCommon::get_label($field));
switch ($field["type"]) {
case "captcha":
break;
case "section":
if (!GFCommon::is_section_empty($field, $form, $lead) || $display_empty) {
switch ($format) {
case "text":
$field_value = "--------------------------------\n{$field_label}\n\n";
break;
default:
$field_value = sprintf('<tr>
<td colspan="2" style="font-size:14px; font-weight:bold; background-color:#EEE; border-bottom:1px solid #DFDFDF; padding:7px 7px">%s</td>
</tr>', $field_label);
break;
}
}
$field_value = apply_filters("gform_merge_tag_filter", $field_value, $merge_tag, $options, $field, $field_label);
$field_data .= $field_value;
break;
case "password":
//ignore password fields
break;
default:
//ignore product fields as they will be grouped together at the end of the grid
if (self::is_product_field($field["type"])) {
$has_product_fields = true;
continue;
} else {
if (RGFormsModel::is_field_hidden($form, $field, array(), $lead)) {
//ignore fields hidden by conditional logic
continue;
}
}
$raw_field_value = RGFormsModel::get_lead_field_value($lead, $field);
$field_value = GFCommon::get_lead_field_display($field, $raw_field_value, rgar($lead, "currency"), $use_text, $format, "email");
$display_field = true;
//depending on parameters, don't display adminOnly or hidden fields
if ($no_admin && rgar($field, "adminOnly")) {
$display_field = false;
} else {
if ($no_hidden && RGFormsModel::get_input_type($field) == "hidden") {
$display_field = false;
}
}
//if field is not supposed to be displayed, pass false to filter. otherwise, pass field's value
if (!$display_field) {
$field_value = false;
}
$field_value = apply_filters("gform_merge_tag_filter", $field_value, $merge_tag, $options, $field, $raw_field_value);
if ($field_value === false) {
continue;
}
if (!empty($field_value) || strlen($field_value) > 0 || $display_empty) {
switch ($format) {
case "text":
$field_data .= "{$field_label}: {$field_value}\n\n";
break;
default:
$field_data .= sprintf('<tr bgcolor="#EAF2FA">
<td colspan="2">
<font style="font-family: sans-serif; font-size:12px;"><strong>%s</strong></font>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="20"> </td>
<td>
<font style="font-family: sans-serif; font-size:12px;">%s</font>
</td>
</tr>', $field_label, empty($field_value) && strlen($field_value) == 0 ? " " : $field_value);
break;
}
}
}
}
if ($has_product_fields) {
$field_data .= self::get_submitted_pricing_fields($form, $lead, $format, $use_text, $use_admin_label);
}
if ($format == "html") {
$field_data .= '</table>
</td>
</tr>
</table>';
}
return $field_data;
}
示例10: select_export_form
public static function select_export_form()
{
check_ajax_referer("rg_select_export_form", "rg_select_export_form");
$form_id = intval($_POST["form_id"]);
$form = RGFormsModel::get_form_meta($form_id);
$fields = array();
$form = GFExport::add_default_export_fields($form);
if (is_array($form["fields"])) {
foreach ($form["fields"] as $field) {
if (is_array(rgar($field, "inputs"))) {
foreach ($field["inputs"] as $input) {
$fields[] = array($input["id"], GFCommon::get_label($field, $input["id"]));
}
} else {
if (!rgar($field, "displayOnly")) {
$fields[] = array($field["id"], GFCommon::get_label($field));
}
}
}
}
$field_json = GFCommon::json_encode($fields);
die("EndSelectExportForm({$field_json});");
}
示例11: gffd_get_form_fields
function gffd_get_form_fields($form)
{
$fields = array();
if (is_array($form["fields"])) {
foreach ($form["fields"] as $field) {
if (is_array(gffd_rgar($field, 'inputs'))) {
foreach ($field["inputs"] as $input) {
$fields[] = array($input["id"], GFCommon::get_label($field, $input["id"]));
}
} else {
if (!gffd_rgar($field, 'displayOnly')) {
$fields[] = array($field["id"], GFCommon::get_label($field));
}
}
}
}
return $fields;
}
示例12: get_column_value_amount
public function get_column_value_amount($feed)
{
$form = $this->get_current_form();
$field_id = $feed["meta"]["transactionType"] == "subscription" ? $feed["meta"]["recurringAmount"] : $feed["meta"]["paymentAmount"];
if ($field_id == "form_total") {
$label = __("Form Total", "gravityforms");
} else {
$field = GFFormsModel::get_field($form, $field_id);
$label = GFCommon::get_label($field);
}
return $label;
}
示例13: ajax_get_results
public function ajax_get_results()
{
$output = array();
$html = "";
$form_id = rgpost("id");
$form = GFFormsModel::get_form_meta($form_id);
$form = apply_filters("gform_form_pre_results_{$form_id}", apply_filters("gform_form_pre_results", $form));
$search_criteria = array();
$fields = $this->get_fields($form);
$total_entries = GFFormsModel::count_search_leads($form_id, $search_criteria);
if ($total_entries == 0) {
$html = __("No results.", "gravityforms");
} else {
$filter_fields = rgpost("f");
if (is_array($filter_fields)) {
$filter_types = rgpost("t");
$filter_operators = rgpost("o");
$filter_values = rgpost("v");
for ($i = 0; $i < count($filter_fields); $i++) {
$field_filter = array();
$field_filter["type"] = "field";
$key = $filter_fields[$i];
$filter_type = $filter_types[$i];
$operator = $filter_operators[$i];
$val = $filter_values[$i];
$strpos_row_key = strpos($key, "|");
if ($strpos_row_key !== false) {
//multi-row
$key_array = explode("|", $key);
$key = $key_array[0];
$val = $key_array[1] . ":" . $val;
}
$field_filter["key"] = $key;
$field_filter["type"] = $filter_type;
$field_filter["operator"] = $operator;
$field_filter["value"] = $val;
$search_criteria[] = $field_filter;
}
}
$start_date = rgpost("start");
$end_date = rgpost("end");
if ($start_date) {
$search_criteria[] = array('key' => 'date_created', 'type' => 'info', 'operator' => '>=', 'value' => $start_date);
}
if ($end_date) {
$search_criteria[] = array('key' => 'date_created', 'type' => 'info', 'operator' => '<=', 'value' => $end_date);
}
$search_criteria[] = array("type" => "info", "key" => "status", "value" => "active");
$output["s"] = http_build_query($search_criteria);
$state_array = null;
if (isset($_POST["state"])) {
$state = $_POST["state"];
$posted_check_sum = rgpost("checkSum");
$generated_check_sum = self::generate_checksum($state);
$state_array = json_decode(base64_decode($state), true);
if ($generated_check_sum !== $posted_check_sum) {
$output["status"] = "complete";
$output["html"] = __('There was an error while processing the entries. Please contact support.', "gravityforms");
echo json_encode($output);
die;
}
}
$data = $this->get_results_data($form, $fields, $search_criteria, $state_array);
$entry_count = $data["entry_count"];
if ("incomplete" === rgar($data, "status")) {
$state = base64_encode(json_encode($data));
$output["status"] = "incomplete";
$output["stateObject"] = $state;
$output["checkSum"] = self::generate_checksum($state);
$output["html"] = sprintf(__('Entries processed: %1$d of %2$d', "gravityforms"), rgar($data, "offset"), $entry_count);
echo json_encode($output);
die;
}
if ($total_entries > 0) {
$html = isset($this->_callbacks["markup"]) ? call_user_func($this->_callbacks["markup"], $html, $data, $form, $fields) : "";
if (empty($html)) {
foreach ($fields as $field) {
$field_id = $field['id'];
$html .= "<div class='gresults-results-field' id='gresults-results-field-{$field_id}'>";
$html .= "<div class='gresults-results-field-label'>" . esc_html(GFCommon::get_label($field)) . "</div>";
$html .= "<div>" . self::get_field_results($form_id, $data, $field, $search_criteria) . "</div>";
$html .= "</div>";
}
}
} else {
$html .= __("No results", "gravityforms");
}
}
$output["html"] = $html;
$output["status"] = "complete";
$output["searchCriteria"] = $search_criteria;
echo json_encode($output);
die;
}
示例14: get_value_export
public function get_value_export($entry, $input_id = '', $use_text = false, $is_csv = false)
{
if (empty($input_id) || absint($input_id) == $input_id) {
$selected = array();
foreach ($this->inputs as $input) {
$index = (string) $input['id'];
if (!rgempty($index, $entry)) {
$selected[] = GFCommon::selection_display(rgar($entry, $index), $this, rgar($entry, 'currency'), $use_text);
}
}
return implode(', ', $selected);
} elseif ($is_csv) {
$value = $this->is_checkbox_checked($input_id, GFCommon::get_label($this, $input_id), $entry);
return empty($value) ? '' : $value;
} else {
return GFCommon::selection_display(rgar($entry, $input_id), $this, rgar($entry, 'currency'), $use_text);
}
}
示例15: start_export
public static function start_export($form)
{
$form_id = $form["id"];
$fields = $_POST["export_field"];
$start_date = $_POST["export_date_start"];
$end_date = $_POST["export_date_end"];
//adding default fields
array_push($form["fields"], array("id" => "id", "label" => __("Entry Id", "gravityforms")));
array_push($form["fields"], array("id" => "date_created", "label" => __("Entry Date", "gravityforms")));
array_push($form["fields"], array("id" => "ip", "label" => __("User IP", "gravityforms")));
array_push($form["fields"], array("id" => "source_url", "label" => __("Source Url", "gravityforms")));
array_push($form["fields"], array("id" => "payment_status", "label" => __("Payment Status", "gravityforms")));
array_push($form["fields"], array("id" => "payment_date", "label" => __("Payment Date", "gravityforms")));
array_push($form["fields"], array("id" => "transaction_id", "label" => __("Transaction Id", "gravityforms")));
$entry_count = RGFormsModel::get_lead_count($form_id, "", null, null, $start_date, $end_date);
$page_size = 200;
$offset = 0;
//Adding BOM marker for UTF-8
$lines = chr(239) . chr(187) . chr(191);
//writing header
foreach ($fields as $field_id) {
$field = RGFormsModel::get_field($form, $field_id);
$value = '"' . str_replace('"', '""', GFCommon::get_label($field, $field_id)) . '"';
$lines .= "{$value},";
}
$lines = substr($lines, 0, strlen($lines) - 1) . "\n";
//paging through results for memory issues
while ($entry_count > 0) {
$leads = RGFormsModel::get_leads($form_id, "date_created", "DESC", "", $offset, $page_size, null, null, false, $start_date, $end_date);
foreach ($leads as $lead) {
foreach ($fields as $field_id) {
$long_text = "";
if (strlen($lead[$field_id]) >= GFORMS_MAX_FIELD_LENGTH) {
$long_text = RGFormsModel::get_field_value_long($lead["id"], $field_id);
}
$value = !empty($long_text) ? $long_text : $lead[$field_id];
$lines .= '"' . str_replace('"', '""', $value) . '",';
}
$lines = substr($lines, 0, strlen($lines) - 1);
$lines .= "\n";
}
$offset += $page_size;
$entry_count -= $page_size;
if (!seems_utf8($lines)) {
$lines = utf8_encode($lines);
}
echo $lines;
$lines = "";
}
}