本文整理汇总了PHP中GFAPI::get_entries方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::get_entries方法的具体用法?PHP GFAPI::get_entries怎么用?PHP GFAPI::get_entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::get_entries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leads_page
//.........这里部分代码省略.........
RGFormsModel::update_leads_property($leads, 'is_starred', 1);
$update_message = sprintf(esc_html__('%s starred.', 'gravityforms'), $entry_count);
break;
case 'remove_star':
RGFormsModel::update_leads_property($leads, 'is_starred', 0);
$update_message = sprintf(esc_html__('%s unstarred.', 'gravityforms'), $entry_count);
break;
}
break;
case 'change_columns':
check_admin_referer('gforms_entry_list', 'gforms_entry_list');
$columns = GFCommon::json_decode(stripslashes($_POST['grid_columns']), true);
RGFormsModel::update_grid_column_meta($form_id, $columns);
break;
}
if (rgpost('button_delete_permanently')) {
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
RGFormsModel::delete_leads_by_form($form_id, $filter);
}
}
$sort_field = empty($_GET['sort']) ? 0 : $_GET['sort'];
$sort_direction = empty($_GET['dir']) ? 'DESC' : $_GET['dir'];
$sort_field_meta = RGFormsModel::get_field($form, $sort_field);
$is_numeric = $sort_field_meta['type'] == 'number';
$page_size = gf_apply_filters('gform_entry_page_size', $form_id, 20, $form_id);
$first_item_index = $page_index * $page_size;
if (!empty($sort_field)) {
$sorting = array('key' => $_GET['sort'], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
} else {
$sorting = array();
}
$paging = array('offset' => $first_item_index, 'page_size' => $page_size);
$total_count = 0;
$leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging, $total_count);
$summary = RGFormsModel::get_form_counts($form_id);
$active_lead_count = $summary['total'];
$unread_count = $summary['unread'];
$starred_count = $summary['starred'];
$spam_count = $summary['spam'];
$trash_count = $summary['trash'];
$columns = RGFormsModel::get_grid_columns($form_id, true);
$search_qs = empty($search) ? '' : '&s=' . esc_attr(urlencode($search));
$sort_qs = empty($sort_field) ? '' : '&sort=' . esc_attr($sort_field);
$dir_qs = empty($sort_direction) ? '' : '&dir=' . esc_attr($sort_direction);
$star_qs = $star !== null ? '&star=' . esc_attr($star) : '';
$read_qs = $read !== null ? '&read=' . esc_attr($read) : '';
$filter_qs = '&filter=' . esc_attr($filter);
$search_field_id_qs = !isset($_GET['field_id']) ? '' : '&field_id=' . esc_attr($search_field_id);
$search_operator_urlencoded = urlencode($search_operator);
$search_operator_qs = empty($search_operator_urlencoded) ? '' : '&operator=' . esc_attr($search_operator_urlencoded);
$display_total = ceil($total_count / $page_size);
$page_links = paginate_links(array('base' => admin_url('admin.php') . "?page=gf_entries&view=entries&id={$form_id}&%_%" . $search_qs . $sort_qs . $dir_qs . $star_qs . $read_qs . $filter_qs . $search_field_id_qs . $search_operator_qs, 'format' => 'paged=%#%', 'prev_text' => esc_html__('«', 'gravityforms'), 'next_text' => esc_html__('»', 'gravityforms'), 'total' => $display_total, 'current' => $page_index + 1, 'show_all' => false));
wp_print_styles(array('thickbox'));
$field_filters = GFCommon::get_field_filter_settings($form);
$init_field_id = empty($search_field_id) ? 0 : $search_field_id;
$init_field_operator = empty($search_operator) ? 'contains' : $search_operator;
$init_filter_vars = array('mode' => 'off', 'filters' => array(array('field' => $init_field_id, 'operator' => $init_field_operator, 'value' => $search)));
$min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG || isset($_GET['gform_debug']) ? '' : '.min';
?>
<script type="text/javascript">
var messageTimeout = false,
gformFieldFilters = <?php
echo json_encode($field_filters);
?>
示例2: admin_menu
public static function admin_menu()
{
$tribe_settings = TribeSettings::instance();
// Export entries
if ($_REQUEST['page'] === 'tribe-events-calendar-registration-export' and !is_null($_REQUEST['id'])) {
$post_id = $_REQUEST['id'];
$forms = GFFormsModel::get_forms();
foreach ($forms as $form) {
if (strtolower($form->title) == strtolower(self::$formTitle)) {
$form_id = $form->id;
$entries = GFAPI::get_entries($form_id, array('field_filters' => array(array('key' => '7', 'value' => $post_id))), null, array('offset' => '0', 'page_size' => '1000'));
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=" . sanitize_title_with_dashes($entries[0]['6']) . ".csv");
header("Pragma: no-cache");
header("Expires: 0");
echo $entries[0]['6'] . "\n";
echo "Date Created, First Name, Last Name, Email, Phone Number, Number of Participants\n";
foreach ($entries as $entry) {
echo $entry['date_created'] . ',';
echo $entry['1'] . ',';
echo $entry['2'] . ',';
echo $entry['3'] . ',';
echo $entry['4'] . ',';
echo $entry['5'] . "\n";
}
die;
}
}
}
}
示例3: run
public function run($arguments)
{
if (class_exists('RGFormsModel') && is_callable(array('RGFormsModel', 'get_form_meta')) && class_exists('GFAPI') && is_callable(array('GFAPI', 'get_entries'))) {
if (empty($arguments['id'])) {
return array('error' => 'Form ID Required');
}
$return = array();
$form_meta = GFFormsModel::get_form_meta(absint($arguments['id']));
$return['field_labels'] = array();
foreach ($form_meta['fields'] as $field) {
$return['field_labels']["{$field['id']}"] = $this->_process_label($field);
}
$return['current_page'] = empty($arguments['page']) ? 1 : absint($arguments['page']);
if ($return['current_page'] < 1) {
$return['current_page'] = 1;
}
$paging = array('page_size' => 20);
$paging['offset'] = ($return['current_page'] - 1) * $paging['page_size'];
$return['total_count'] = 0;
$return['entries'] = GFAPI::get_entries(absint($arguments['id']), null, null, $paging, $return['total_count']);
$return['page_size'] = $paging['page_size'];
$return['total_pages'] = ceil($return['total_count'] / $paging['page_size']);
return $return;
}
return false;
}
示例4: cgc_contest_get_entries
function cgc_contest_get_entries($id = 0, $url = '', $limit = '')
{
$paging = array('offset' => 0, 'page_size' => 100);
// get entries via GF api with entry id
$entries = GFAPI::get_entries($id, '', null, $paging);
// bail if no data
if (!$id || !$url) {
return;
}
if (!$entries) {
echo 'No entries yet, be the first to enter by submitting your entry above!';
}
$i = 0;
foreach ($entries as $entry) {
$i++;
// bail if no url in entry
if (empty($entry[$url])) {
return;
}
// get the sketchfab url from the entry and build the iframe url
$source = $entry[$url] ? sprintf('%s/embed', $entry[$url]) : null;
// add a class to every 3rd
if (0 == $i % 3) {
$last = 'last';
} else {
$last = null;
}
// draw the item
printf('<div class="cgc-contest-entry %s"><div class="cgc-contest-entry-inner"><iframe width="310" height="230" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="%s" onload=lzld(this) frameborder="0" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe></div></div>', $last, $source);
// if a limit is set then break at the set limit
if ($limit && 0 == $i % $limit) {
break;
}
}
}
示例5: aura_get_master_aura_form_details
function aura_get_master_aura_form_details($form, $ajax_enabled, $field_values)
{
// Get details from master form.
$ar_form = GFAPI::get_form(1);
$au_search_criteria = array('status' => array('active', 'trash'));
$ar_entries = GFAPI::get_entries(1, $au_search_criteria);
$body_part = array();
// To hold description associated with bodypart/color.
$pos_color = array();
$neg_color = array();
$bp = array();
// Pull details from aura details form to display in this form.
// Index each entry by 'body part'
foreach ($ar_entries as $entry) {
if ($entry['1'] == '') {
continue;
} else {
$idx = $entry['1'];
$bp[] = array('text' => $entry['1'], 'value' => $entry['1']);
if ($entry['2'] != '') {
$body_part[$idx]['pos_color'][$entry['2']] = $entry['4'];
// Set pos colour value to description
$needle = array('text' => $entry['2'], 'value' => $entry['2']);
if (!in_array($needle, $pos_color)) {
$pos_color[] = $needle;
}
}
if ($entry['3'] != '') {
$body_part[$idx]['neg_color'][$entry['3']] = $entry['5'];
$needle = array('text' => $entry['3'], 'value' => $entry['3']);
if (!in_array($needle, $neg_color)) {
$neg_color[] = $needle;
}
}
}
}
// To display description using JS
$json_bp = json_encode($body_part);
/*
$html =
'<input type="hidden" name="aura_body_part"' .
'id="aura_body_part_id"' .
'value=' . $json_bp .
' />' ;
*/
// HACK/REVISIT: Creating JS var safe?
$html = '<script type="text/javascript"> var g_aura_body_part=' . $json_bp . '</script>';
echo $html;
$form['fields'][5]['choices'] = $bp;
$form['fields'][6]['choices'] = $pos_color;
$form['fields'][8]['choices'] = $neg_color;
// Default display
$form['fields'][5]['placeholder'] = 'Pick choice from list below';
$form['fields'][6]['placeholder'] = 'Pick choice from list below';
$form['fields'][8]['placeholder'] = 'Pick choice from list below';
// $form['fields'][7]['choices'] = $pos_color_descr;
// $form['fields'][9]['choices'] = $neg_color_descr;
return $form;
}
示例6: get_entry
/**
* Fetch the entry for the View
*
* We need to use this instead of GFAPI::get_entry() because we want to also pass the Form ID to the
* get_entries() method.
*
* @param int $entry_id
* @param int $form_id
*
* @return array|bool False if no entry exists; Entry array if exists.
*/
function get_entry($entry_id = 0, $form_id = 0)
{
$search_criteria = array('field_filters' => array(array('key' => 'id', 'value' => $entry_id)));
$paging = array('offset' => 0, 'page_size' => 1);
$entries = GFAPI::get_entries($form_id, $search_criteria, null, $paging);
$entry = !is_wp_error($entries) && !empty($entries[0]) ? $entries[0] : false;
return $entry;
}
示例7: get_entry_by_value
public static function get_entry_by_value($form_id = 0, $key = 0, $value = null)
{
if ($value == "user_login") {
global $current_user;
get_currentuserinfo();
$value = $current_user->user_login;
}
// setup search criteria
$search_criteria['field_filters'][] = array('key' => $key, 'value' => $value);
$search_criteria["status"] = "active";
// run query
$entry = GFAPI::get_entries($form_id, $search_criteria);
self::set_entry($entry);
}
示例8: gravitywp_count_func
function gravitywp_count_func($atts, $content = null)
{
extract(shortcode_atts(array('formid' => 'formid', 'field' => 'field'), $atts));
$search_criteria = null;
$sorting = null;
$paging = array('offset' => 0, 'page_size' => 200);
$entries = GFAPI::get_entries($formid, $search_criteria, $sorting, $paging);
$countentries = GFAPI::count_entries($formid);
$gwp_count = 0;
for ($row = 0; $row < $countentries; $row++) {
$gwp_count += $entries[$row][$field];
}
return $gwp_count;
}
示例9: getEntries
function getEntries($formID)
{
if (class_exists("GFForms")) {
$paging = array('offset' => 0, 'page_size' => 200);
$sorting = array();
$total_count = 0;
$search_criteria = array();
$unfilteredEntries = GFAPI::get_entries(5, $search_criteria, $sorting, $paging, $total_count);
$filteredEntries = array();
foreach ($unfilteredEntries as $value) {
array_push($filteredEntries, iff_competition_filterEntry($value));
}
return $filteredEntries;
}
return null;
}
开发者ID:TheHandsomeCoder,项目名称:IFFCompetitionEntriesPlugin,代码行数:16,代码来源:gravity-form-display-entries.php
示例10: getActiveMemberships
function getActiveMemberships($formID, $pageSize)
{
if (class_exists("GFForms")) {
$paging = array('offset' => 0, 'page_size' => (int) $pageSize);
$sorting = array('key' => '19', 'direction' => 'ASC');
$total_count = 0;
$search_criteria = array('field_filters' => array('mode' => 'any', array('key' => 'payment_status', 'value' => 'Paid'), array('key' => '7', 'value' => 'Youth Membership (€0.00)|0'), array('key' => '7', 'value' => 'First Membership (€0.00)|0')));
$unfilteredEntries = GFAPI::get_entries($formID, $search_criteria, $sorting, $paging, $total_count);
$filteredEntries = array();
foreach ($unfilteredEntries as $value) {
array_push($filteredEntries, filterEntry($value));
}
return $filteredEntries;
}
return null;
}
示例11: au_list_aura_details
function au_list_aura_details()
{
$ar_form = GFAPI::get_form(1);
$ar_field_len = sizeof($ar_form['fields']);
echo "<br>";
// Now print all the entries
$au_search_criteria = array('status' => array('active', 'trash'));
$ar_entries = GFAPI::get_entries(1, $au_search_criteria);
$descr = array();
$remedy = array();
foreach ($ar_entries as $ar_row) {
$descr[] = count($ar_row[4] != 0) ? $ar_row[4] : "<>";
$remedy[] = count($ar_row[5] != 0) ? $ar_row[5] : "<>";
}
echo "<br><b> Description: </b>";
foreach ($descr as $d) {
echo $d;
}
echo "<br><br><b> Remedial Measures </b>";
foreach ($remedy as $r) {
echo $r;
}
}
示例12: upgrade
public function upgrade($previous_version)
{
if (version_compare($previous_version, '1.0.5') == -1) {
$forms = GFAPI::get_forms(true);
foreach ($forms as $form) {
$entries = GFAPI::get_entries($form['id']);
$fields = GFAPI::get_fields_by_type($form, 'repeater');
foreach ($entries as $entry) {
foreach ($fields as $field) {
if (array_key_exists($field['id'], $entry)) {
$dataArray = GFFormsModel::unserialize($entry[$field['id']]);
$dataUpdated = false;
if (!is_array($dataArray)) {
continue;
}
foreach ($dataArray as $repeaterChildId => $repeaterChild) {
foreach ($repeaterChild as $repeatedFieldId => $repeatedField) {
if (!is_array($repeatedField)) {
if ($repeatedField !== '[gfRepeater-section]') {
$dataUpdated = true;
$dataArray[$repeaterChildId][$repeatedFieldId] = array($repeatedField);
}
} elseif (reset($repeatedField) == '[gfRepeater-section]') {
$dataUpdated = true;
$dataArray[$repeaterChildId][$repeatedFieldId] = reset($repeatedField);
}
}
}
if ($dataUpdated) {
GFAPI::update_entry_field($entry['id'], $field['id'], maybe_serialize($dataArray));
}
}
}
}
}
}
}
示例13: get_entries
public function get_entries($entry_ids, $form_ids = null, $schema = "", $field_ids = array())
{
$this->authorize("gravityforms_view_entries");
$status = 200;
$response = array();
$result = array();
if ($entry_ids) {
if (is_array($entry_ids)) {
foreach ($entry_ids as $entry_id) {
$result = GFAPI::get_entry($entry_id);
if (!is_wp_error($result)) {
$response[$entry_id] = $result;
if (!empty($field_ids) && !empty($response[$entry_id])) {
$response[$entry_id] = $this->filter_entry_object($response[$entry_id], $field_ids);
}
}
}
} else {
$result = GFAPI::get_entry($entry_ids);
if (!is_wp_error($result)) {
$response = $result;
if (!empty($field_ids) && !empty($response)) {
$response = $this->filter_entry_object($response, $field_ids);
}
}
}
if ($schema == "mtd") {
$response = self::mtd_transform_entry_data($response);
}
} else {
//sorting parameters
$sort_key = isset($_GET["sorting"]["key"]) && !empty($_GET["sorting"]["key"]) ? $_GET["sorting"]["key"] : "id";
$sort_dir = isset($_GET["sorting"]["direction"]) && !empty($_GET["sorting"]["direction"]) ? $_GET["sorting"]["direction"] : "DESC";
$sorting = array('key' => $sort_key, 'direction' => $sort_dir);
//paging parameters
$page_size = isset($_GET["paging"]["page_size"]) ? intval($_GET["paging"]["page_size"]) : 10;
if (isset($_GET["paging"]["current_page"])) {
$current_page = intval($_GET["paging"]["current_page"]);
$offset = $page_size * ($current_page - 1);
} else {
$offset = isset($_GET["paging"]["offset"]) ? intval($_GET["paging"]["offset"]) : 0;
}
$paging = array('offset' => $offset, 'page_size' => $page_size);
$search = isset($_GET["search"]) ? $_GET["search"] : array();
if (empty($form_ids)) {
$form_ids = 0;
}
// all forms
$entry_count = GFAPI::count_entries($form_ids, $search);
$result = $entry_count > 0 ? GFAPI::get_entries($form_ids, $search, $sorting, $paging) : array();
if (!is_wp_error($result)) {
$response = array("total_count" => $entry_count, "entries" => $result);
if ($schema == "mtd") {
$response = $this->mtd_transform_entries_data($response, $form_ids);
}
}
}
if (is_wp_error($result)) {
$response = $this->get_error_response($result);
$status = $this->get_error_status($result);
}
$this->end($status, $response);
}
示例14: 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();
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("start date: {$start_date}");
GFCommon::log_debug("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 = apply_filters('gform_export_separator_' . $form_id, 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);
$value = str_replace('"', '""', GFCommon::get_label($field, $field_id));
GFCommon::log_debug("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("Lines: {$lines}");
}
$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);
$paging = array('offset' => $offset, 'page_size' => $page_size);
$leads = GFAPI::get_entries($form_id, $search_criteria, $sorting, $paging);
$leads = apply_filters("gform_leads_before_export_{$form_id}", apply_filters("gform_leads_before_export", $leads, $form, $paging), $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:
$long_text = "";
if (strlen(rgar($lead, $field_id)) >= GFORMS_MAX_FIELD_LENGTH - 10) {
$long_text = RGFormsModel::get_field_value_long($lead, $field_id, $form);
}
$value = !empty($long_text) ? $long_text : rgar($lead, $field_id);
$field = RGFormsModel::get_field($form, $field_id);
$input_type = RGFormsModel::get_input_type($field);
if ($input_type == "checkbox") {
$value = GFFormsModel::is_checkbox_checked($field_id, $headers[$field_id], $lead, $form);
if ($value === false) {
$value = "";
}
} else {
if ($input_type == "fileupload" && rgar($field, "multipleFiles")) {
$value = !empty($value) ? implode(" , ", json_decode($value, true)) : "";
}
}
$value = apply_filters("gform_export_field_value", $value, $form_id, $field_id, $lead);
GFCommon::log_debug("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;
}
}
//.........这里部分代码省略.........
示例15: 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 = apply_filters('gform_export_separator_' . $form_id, 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);
$value = str_replace('"', '""', GFCommon::get_label($field, $field_id));
GFCommon::log_debug("GFExport::start_export(): Header for field ID {$field_id}: {$value}");
$headers[$field_id] = $str = preg_replace('/[^a-z\\d ]/i', '', $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 = apply_filters("gform_leads_before_export_{$form_id}", apply_filters('gform_leads_before_export', $leads, $form, $paging), $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:
$long_text = '';
if (strlen(rgar($lead, $field_id)) >= GFORMS_MAX_FIELD_LENGTH - 10) {
$long_text = RGFormsModel::get_field_value_long($lead, $field_id, $form);
}
$value = !empty($long_text) ? $long_text : rgar($lead, $field_id);
$field = RGFormsModel::get_field($form, $field_id);
$input_type = RGFormsModel::get_input_type($field);
if ($input_type == 'checkbox') {
//pass in label value that has not had quotes escaped so the is_checkbox_checked function compares the unchanged label value with the lead value
$header_label_not_escaped = GFCommon::get_label($field, $field_id);
$value = GFFormsModel::is_checkbox_checked($field_id, $header_label_not_escaped, $lead, $form);
if ($value === false) {
$value = '';
}
} else {
if ($input_type == 'fileupload' && $field->multipleFiles) {
$value = !empty($value) ? implode(' , ', json_decode($value, true)) : '';
}
}
$value = preg_replace('/[^a-z\\d ]/i', '', $value);
$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;
//.........这里部分代码省略.........