本文整理汇总了PHP中GFCommon::implode_non_blank方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::implode_non_blank方法的具体用法?PHP GFCommon::implode_non_blank怎么用?PHP GFCommon::implode_non_blank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFCommon
的用法示例。
在下文中一共展示了GFCommon::implode_non_blank方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_value_merge_tag
public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br)
{
$use_value = $modifier == 'value';
$use_price = in_array($modifier, array('price', 'currency'));
$format_currency = $modifier == 'currency';
if (is_array($raw_value) && (string) intval($input_id) != $input_id) {
$items = array($input_id => $value);
//float input Ids. (i.e. 4.1 ). Used when targeting specific checkbox items
} elseif (is_array($raw_value)) {
$items = $raw_value;
} else {
$items = array($input_id => $raw_value);
}
$ary = array();
foreach ($items as $input_id => $item) {
if ($use_value) {
list($val, $price) = rgexplode('|', $item, 2);
} elseif ($use_price) {
list($name, $val) = rgexplode('|', $item, 2);
if ($format_currency) {
$val = GFCommon::to_money($val, rgar($entry, 'currency'));
}
} elseif ($this->type == 'post_category') {
$use_id = strtolower($modifier) == 'id';
$item_value = GFCommon::format_post_category($item, $use_id);
$val = RGFormsModel::is_field_hidden($form, $this, array(), $entry) ? '' : $item_value;
} else {
$val = RGFormsModel::is_field_hidden($form, $this, array(), $entry) ? '' : RGFormsModel::get_choice_text($this, $raw_value, $input_id);
}
$ary[] = GFCommon::format_variable_value($val, $url_encode, $esc_html, $format);
}
return GFCommon::implode_non_blank(', ', $ary);
}
示例2: get_value_merge_tag
public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format)
{
if ($this->type == 'post_category') {
$use_id = $modifier == 'id';
$items = explode(',', $value);
if (is_array($items)) {
$cats = array();
foreach ($items as $item) {
$cat = GFCommon::format_post_category($item, $use_id);
$cats[] = GFCommon::format_variable_value($cat, $url_encode, $esc_html, $format);
}
$value = GFCommon::implode_non_blank(', ', $cats);
}
}
return $value;
}
示例3: leads_page
//.........这里部分代码省略.........
echo intval($lead["is_starred"]);
?>
.png" onclick="ToggleStar(this, <?php
echo $lead["id"] . ",'" . $filter . "'";
?>
);" />
</td>
<?php
}
$is_first_column = true;
$nowrap_class = "entry_nowrap";
foreach ($field_ids as $field_id) {
/* maybe move to function */
$field = RGFormsModel::get_field($form, $field_id);
$value = rgar($lead, $field_id);
if ($field['type'] == 'post_category') {
$value = GFCommon::prepare_post_category_value($value, $field, 'entry_list');
}
//filtering lead value
$value = apply_filters("gform_get_field_value", $value, $lead, $field);
$input_type = !empty($columns[$field_id]["inputType"]) ? $columns[$field_id]["inputType"] : $columns[$field_id]["type"];
switch ($input_type) {
case "checkbox":
$value = "";
//if this is the main checkbox field (not an input), display a comma separated list of all inputs
if (absint($field_id) == $field_id) {
$lead_field_keys = array_keys($lead);
$items = array();
foreach ($lead_field_keys as $input_id) {
if (is_numeric($input_id) && absint($input_id) == $field_id) {
$items[] = GFCommon::selection_display(rgar($lead, $input_id), null, $lead["currency"], false);
}
}
$value = GFCommon::implode_non_blank(", ", $items);
// special case for post category checkbox fields
if ($field['type'] == 'post_category') {
$value = GFCommon::prepare_post_category_value($value, $field, 'entry_list');
}
} else {
$value = "";
if (GFFormsModel::is_checkbox_checked($field_id, $columns[$field_id]["label"], $lead, $form)) {
$value = "<i class='fa fa-check gf_valid'></i>";
}
}
break;
case "post_image":
list($url, $title, $caption, $description) = rgexplode("|:|", $value, 4);
if (!empty($url)) {
//displaying thumbnail (if file is an image) or an icon based on the extension
$thumb = self::get_icon_url($url);
$value = "<a href='" . esc_attr($url) . "' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
}
break;
case "fileupload":
if (rgar($field, "multipleFiles")) {
$uploaded_files_arr = empty($value) ? array() : json_decode($value, true);
$file_count = count($uploaded_files_arr);
if ($file_count > 1) {
$value = empty($uploaded_files_arr) ? "" : sprintf(__("%d files", "gravityforms"), count($uploaded_files_arr));
break;
} elseif ($file_count == 1) {
$value = $uploaded_files_arr[0];
}
}
$file_path = $value;
if (!empty($file_path)) {
示例4: get_value_export
public function get_value_export($entry, $input_id = '', $use_text = false, $is_csv = false)
{
if (empty($input_id)) {
$input_id = $this->id;
} elseif (!ctype_digit($input_id)) {
$field_id_array = explode('.', $input_id);
$input_id = rgar($field_id_array, 0);
$column_num = rgar($field_id_array, 1);
}
$value = rgar($entry, $input_id);
if (empty($value) || $is_csv) {
return $value;
}
$list_values = $column_values = unserialize($value);
if (isset($column_num) && is_numeric($column_num) && $this->enableColumns) {
$column = rgars($this->choices, "{$column_num}/text");
$column_values = array();
foreach ($list_values as $value) {
$column_values[] = rgar($value, $column);
}
} elseif ($this->enableColumns) {
return json_encode($list_values);
}
return GFCommon::implode_non_blank(', ', $column_values);
}
示例5: get_list_field_value
/**
* Returns the value of the specified List field.
*
* @param array $entry
* @param string $field_id
* @param object $field
*
* @return string
*/
protected function get_list_field_value($entry, $field_id, $field)
{
if (!ctype_digit($field_id)) {
$field_id_array = explode('.', $field_id);
$field_id = rgar($field_id_array, 0);
$column_num = rgar($field_id_array, 1);
}
$value = rgar($entry, $field_id);
if (empty($value)) {
return '';
}
$list_values = $column_values = unserialize($value);
if (!empty($column_num) && $field->enableColumns) {
$column = rgars($field->choices, "{$column_num}/text");
$column_values = array();
foreach ($list_values as $value) {
$column_values[] = rgar($value, $column);
}
} elseif ($field->enableColumns) {
return $value;
}
return GFCommon::implode_non_blank(', ', $column_values);
}
示例6: get_value_export
/**
* Format the entry value before it is used in entry exports and by framework add-ons using GFAddOn::get_field_value().
*
* @param array $entry The entry currently being processed.
* @param string $input_id The field or input ID.
* @param bool|false $use_text When processing choice based fields should the choice text be returned instead of the value.
* @param bool|false $is_csv Is the value going to be used in the .csv entries export?
*
* @return string
*/
public function get_value_export($entry, $input_id = '', $use_text = false, $is_csv = false)
{
if (empty($input_id)) {
$input_id = $this->id;
}
$value = rgar($entry, $input_id);
if (!empty($value) && !$is_csv) {
$items = explode(',', $value);
foreach ($items as &$item) {
$item = GFCommon::selection_display($item, $this, rgar($entry, 'currency'), $use_text);
}
$value = GFCommon::implode_non_blank(', ', $items);
}
return $value;
}
示例7: leads_page
//.........这里部分代码省略.........
?>
" src="<?php
echo GFCommon::get_base_url();
?>
/images/star<?php
echo intval($lead["is_starred"]);
?>
.png" onclick="ToggleStar(this, <?php
echo $lead["id"];
?>
);" />
</td>
<?php
}
$is_first_column = true;
$nowrap_class = "entry_nowrap";
foreach ($field_ids as $field_id) {
$value = RGForms::get($field_id, $lead);
//filtering lead value
$value = apply_filters("gform_get_field_value", $value, $lead, RGFormsModel::get_field($form, $field_id));
$input_type = !empty($columns[$field_id]["inputType"]) ? $columns[$field_id]["inputType"] : $columns[$field_id]["type"];
switch ($input_type) {
case "checkbox":
$value = "";
//if this is the main checkbox field (not an input), display a comma separated list of all inputs
if (absint($field_id) == $field_id) {
$lead_field_keys = array_keys($lead);
$items = array();
foreach ($lead_field_keys as $input_id) {
if (is_numeric($input_id) && absint($input_id) == $field_id) {
$items[] = GFCommon::selection_display(rgar($lead, $input_id), null, $lead["currency"], false);
}
}
$value = GFCommon::implode_non_blank(", ", $items);
} else {
$value = "";
//looping through lead detail values trying to find an item identical to the column label. Mark with a tick if found.
$lead_field_keys = array_keys($lead);
foreach ($lead_field_keys as $input_id) {
//mark as a tick if input label (from form meta) is equal to submitted value (from lead)
if (is_numeric($input_id) && absint($input_id) == absint($field_id)) {
if ($lead[$input_id] == $columns[$field_id]["label"]) {
$value = "<img src='" . GFCommon::get_base_url() . "/images/tick.png'/>";
} else {
$field = RGFormsModel::get_field($form, $field_id);
if (rgar($field, "enableChoiceValue") || rgar($field, "enablePrice")) {
foreach ($field["choices"] as $choice) {
if ($choice["value"] == $lead[$field_id]) {
$value = "<img src='" . GFCommon::get_base_url() . "/images/tick.png'/>";
break;
} else {
if ($field["enablePrice"]) {
$ary = explode("|", $lead[$field_id]);
$val = count($ary) > 0 ? $ary[0] : "";
$price = count($ary) > 1 ? $ary[1] : "";
if ($val == $choice["value"]) {
$value = "<img src='" . GFCommon::get_base_url() . "/images/tick.png'/>";
break;
}
}
}
}
}
}
}
}