本文整理汇总了PHP中gform_get_meta_values_for_entries函数的典型用法代码示例。如果您正苦于以下问题:PHP gform_get_meta_values_for_entries函数的具体用法?PHP gform_get_meta_values_for_entries怎么用?PHP gform_get_meta_values_for_entries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gform_get_meta_values_for_entries函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _check_deleted_entry_meta
/**
* Make sure that the GV approval entry meta has been deleted, but not other meta
* @since 1.15
* @param $entry_ids
*/
function _check_deleted_entry_meta($entry_ids)
{
$values = gform_get_meta_values_for_entries($entry_ids, array('is_approved', 'do_not_delete'));
foreach ($values as $value) {
$this->assertFalse($value->is_approved);
$this->assertEquals("DO NOT DELETE", $value->do_not_delete);
}
}
示例2: build_lead_array
public static function build_lead_array($results, $use_long_values = true)
{
$leads = array();
$lead = array();
$form_id = 0;
if (is_array($results) && sizeof($results) > 0) {
$form_id = $results[0]->form_id;
$lead = array('id' => $results[0]->id, 'form_id' => $results[0]->form_id, 'date_created' => $results[0]->date_created, 'is_starred' => intval($results[0]->is_starred), 'is_read' => intval($results[0]->is_read), 'ip' => $results[0]->ip, 'source_url' => $results[0]->source_url, 'post_id' => $results[0]->post_id, 'currency' => $results[0]->currency, 'payment_status' => $results[0]->payment_status, 'payment_date' => $results[0]->payment_date, 'transaction_id' => $results[0]->transaction_id, 'payment_amount' => $results[0]->payment_amount, 'payment_method' => $results[0]->payment_method, 'is_fulfilled' => $results[0]->is_fulfilled, 'created_by' => $results[0]->created_by, 'transaction_type' => $results[0]->transaction_type, 'user_agent' => $results[0]->user_agent, 'status' => $results[0]->status, 'orderStatus' => $results[0]->orderStatus);
$form = RGFormsModel::get_form_meta($form_id);
$prev_lead_id = 0;
foreach ($results as $result) {
if ($prev_lead_id != $result->id && $prev_lead_id > 0) {
array_push($leads, $lead);
$lead = array('id' => $result->id, 'form_id' => $result->form_id, 'date_created' => $result->date_created, 'is_starred' => intval($result->is_starred), 'is_read' => intval($result->is_read), 'ip' => $result->ip, 'source_url' => $result->source_url, 'post_id' => $result->post_id, 'currency' => $result->currency, 'payment_status' => $result->payment_status, 'payment_date' => $result->payment_date, 'transaction_id' => $result->transaction_id, 'payment_amount' => $result->payment_amount, 'payment_method' => $result->payment_method, 'is_fulfilled' => $result->is_fulfilled, 'created_by' => $result->created_by, 'transaction_type' => $result->transaction_type, 'user_agent' => $result->user_agent, 'status' => $result->status);
}
$field_value = $result->value;
$field_number = (string) $result->field_number;
//using long values if specified
if ($use_long_values && strlen($field_value) >= GFORMS_MAX_FIELD_LENGTH - 10) {
$long_text = RGFormsModel::get_field_value_long($lead, $field_number, $form, false);
$field_value = !empty($long_text) ? $long_text : $field_value;
}
$lead[$field_number] = $field_value;
$prev_lead_id = $result->id;
}
}
//adding last lead.
if (sizeof($lead) > 0) {
array_push($leads, $lead);
}
//running entry through gform_get_field_value filter
foreach ($leads as &$lead) {
foreach ($form['fields'] as $field) {
/* @var GF_Field $field */
$inputs = $field->get_entry_inputs();
// skip types html, page and section?
if (is_array($inputs)) {
foreach ($inputs as $input) {
$lead[(string) $input['id']] = apply_filters('gform_get_input_value', rgar($lead, (string) $input['id']), $lead, $field, $input['id']);
}
} else {
$value = rgar($lead, (string) $field->id);
if (self::is_encrypted_field($lead['id'], $field->id)) {
$value = GFCommon::decrypt($value);
}
$lead[$field->id] = apply_filters('gform_get_input_value', $value, $lead, $field, '');
}
}
}
//add custom entry properties
$entry_ids = array();
foreach ($leads as $l) {
$entry_ids[] = $l['id'];
}
$entry_meta = GFFormsModel::get_entry_meta($form_id);
$meta_keys = array_keys($entry_meta);
$entry_meta_data_rows = gform_get_meta_values_for_entries($entry_ids, $meta_keys);
foreach ($leads as &$lead) {
foreach ($entry_meta_data_rows as $entry_meta_data_row) {
if ($entry_meta_data_row->lead_id == $lead['id']) {
foreach ($meta_keys as $meta_key) {
$lead[$meta_key] = $entry_meta_data_row->{$meta_key};
}
}
}
}
return $leads;
}
示例3: build_lead_array
public static function build_lead_array($results, $use_long_values = false)
{
$leads = array();
$lead = array();
$form_id = 0;
if (is_array($results) && sizeof($results) > 0) {
$form_id = $results[0]->form_id;
$lead = array("id" => $results[0]->id, "form_id" => $results[0]->form_id, "date_created" => $results[0]->date_created, "is_starred" => intval($results[0]->is_starred), "is_read" => intval($results[0]->is_read), "ip" => $results[0]->ip, "source_url" => $results[0]->source_url, "post_id" => $results[0]->post_id, "currency" => $results[0]->currency, "payment_status" => $results[0]->payment_status, "payment_date" => $results[0]->payment_date, "transaction_id" => $results[0]->transaction_id, "payment_amount" => $results[0]->payment_amount, "is_fulfilled" => $results[0]->is_fulfilled, "created_by" => $results[0]->created_by, "transaction_type" => $results[0]->transaction_type, "user_agent" => $results[0]->user_agent, "status" => $results[0]->status);
$form = RGFormsModel::get_form_meta($form_id);
$prev_lead_id = 0;
foreach ($results as $result) {
if ($prev_lead_id != $result->id && $prev_lead_id > 0) {
array_push($leads, $lead);
$lead = array("id" => $result->id, "form_id" => $result->form_id, "date_created" => $result->date_created, "is_starred" => intval($result->is_starred), "is_read" => intval($result->is_read), "ip" => $result->ip, "source_url" => $result->source_url, "post_id" => $result->post_id, "currency" => $result->currency, "payment_status" => $result->payment_status, "payment_date" => $result->payment_date, "transaction_id" => $result->transaction_id, "payment_amount" => $result->payment_amount, "is_fulfilled" => $result->is_fulfilled, "created_by" => $result->created_by, "transaction_type" => $result->transaction_type, "user_agent" => $result->user_agent, "status" => $result->status);
}
$field_value = $result->value;
//using long values if specified
if ($use_long_values && strlen($field_value) >= GFORMS_MAX_FIELD_LENGTH - 10) {
$field = RGFormsModel::get_field($form, $result->field_number);
$long_text = RGFormsModel::get_field_value_long($lead, $result->field_number, $form, false);
$field_value = !empty($long_text) ? $long_text : $field_value;
}
$lead[$result->field_number] = $field_value;
$prev_lead_id = $result->id;
}
}
//adding last lead.
if (sizeof($lead) > 0) {
array_push($leads, $lead);
}
//running entry through gform_get_field_value filter
foreach ($leads as &$lead) {
foreach ($form["fields"] as $field) {
if (isset($field["inputs"]) && is_array($field["inputs"])) {
foreach ($field["inputs"] as $input) {
$lead[(string) $input["id"]] = apply_filters("gform_get_input_value", rgar($lead, (string) $input["id"]), $lead, $field, $input["id"]);
}
} else {
$lead[$field["id"]] = apply_filters("gform_get_input_value", rgar($lead, (string) $field["id"]), $lead, $field, "");
}
}
}
//adding custom entry properties
$entry_ids = array();
foreach ($leads as $l) {
$entry_ids[] = $l["id"];
}
$entry_meta = GFFormsModel::get_entry_meta($form_id);
$meta_keys = array_keys($entry_meta);
$entry_meta_data_rows = gform_get_meta_values_for_entries($entry_ids, $meta_keys);
foreach ($leads as &$lead) {
foreach ($entry_meta_data_rows as $entry_meta_data_row) {
if ($entry_meta_data_row->lead_id == $lead["id"]) {
foreach ($meta_keys as $meta_key) {
$lead[$meta_key] = $entry_meta_data_row->{$meta_key};
}
}
}
}
return $leads;
}