当前位置: 首页>>代码示例>>PHP>>正文


PHP rgexplode函数代码示例

本文整理汇总了PHP中rgexplode函数的典型用法代码示例。如果您正苦于以下问题:PHP rgexplode函数的具体用法?PHP rgexplode怎么用?PHP rgexplode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rgexplode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:33,代码来源:class-gf-field-select.php

示例2: get_value_entry_list

 public function get_value_entry_list($value, $entry, $field_id, $columns, $form)
 {
     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 = GFEntryList::get_icon_url($url);
         $value = "<a href='" . esc_attr($url) . "' target='_blank' title='" . __('Click to view', 'gravityforms') . "'><img src='{$thumb}'/></a>";
     }
     return $value;
 }
开发者ID:arobbins,项目名称:davis,代码行数:10,代码来源:class-gf-field-post-image.php

示例3: get_value_save_entry

 public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead)
 {
     // ignore submitted value and recalculate price in backend
     list($prefix, $field_id, $input_id) = rgexplode('_', $input_name, 3);
     if ($input_id == 2) {
         require_once GFCommon::get_base_path() . '/currency.php';
         $currency = new RGCurrency(GFCommon::get_currency());
         $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
         $value = $currency->to_money(GFCommon::calculate($this, $form, $lead));
     }
     return $value;
 }
开发者ID:kidaak,项目名称:gravityforms,代码行数:12,代码来源:class-gf-field-calculation.php

示例4: __construct

 function __construct($args = array(), $step = false)
 {
     $this->step = $step;
     if (is_string($args)) {
         $parts = explode('|', $args);
         $type = $parts[0];
         $id = $parts[1];
     } elseif (is_array($args)) {
         $id = $args['id'];
         $type = $args['type'];
         if (isset($args['editable_fields'])) {
             $this->editable_fields = $args['editable_fields'];
         }
     } else {
         throw new Exception('Assignees must be instantiated with either a string or an array');
     }
     switch ($type) {
         case 'assignee_field':
             $entry = $this->step->get_entry();
             $assignee_key = rgar($entry, $id);
             list($this->type, $this->id) = rgexplode('|', $assignee_key, 2);
             break;
         case 'assignee_user_field':
             $entry = $this->step->get_entry();
             $this->id = absint(rgar($entry, $id));
             $this->type = 'user_id';
             break;
         case 'assignee_role_field':
             $entry = $this->step->get_entry();
             $this->id = sanitize_text_field(rgar($entry, $id));
             $this->type = 'role';
             break;
         case 'email_field':
             $entry = $this->step->get_entry();
             $this->id = sanitize_email(rgar($entry, $id));
             $this->type = 'email';
             break;
         case 'entry':
             $entry = $this->step->get_entry();
             $this->id = rgar($entry, $id);
             $this->type = 'user_id';
             break;
         default:
             $this->type = $type;
             $this->id = $id;
     }
     $this->key = $this->type . '|' . $this->id;
 }
开发者ID:jakejackson1,项目名称:gravityflow,代码行数:48,代码来源:class-assignee.php

示例5: prepare_value

 /**
  * Prepare the value before saving it to the lead.
  *
  * @param mixed $form
  * @param mixed $field
  * @param mixed $value
  * @param mixed $input_name
  * @param mixed $lead_id the current lead ID, used for fields that are processed after other fields have been saved (ie Total, Calculations)
  * @param mixed $lead passed by the RGFormsModel::create_lead() method, lead ID is not available for leads created by this function
  */
 public static function prepare_value($form, $field, $value, $input_name, $lead_id, $lead = array())
 {
     $form_id = $form["id"];
     $input_type = self::get_input_type($field);
     switch ($input_type) {
         case "total":
             $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
             $value = GFCommon::get_order_total($form, $lead);
             break;
         case "calculation":
             // ignore submitted value and recalculate price in backend
             list(, , $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == 2) {
                 require_once GFCommon::get_base_path() . '/currency.php';
                 $currency = new RGCurrency(GFCommon::get_currency());
                 $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
                 $value = $currency->to_money(GFCommon::calculate($field, $form, $lead));
             }
             break;
         case "phone":
             if ($field["phoneFormat"] == "standard" && preg_match('/^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/', $value, $matches)) {
                 $value = sprintf("(%s)%s-%s", $matches[1], $matches[2], $matches[3]);
             }
             break;
         case "time":
             if (!is_array($value) && !empty($value)) {
                 preg_match('/^(\\d*):(\\d*) ?(.*)$/', $value, $matches);
                 $value = array();
                 $value[0] = $matches[1];
                 $value[1] = $matches[2];
                 $value[2] = rgar($matches, 3);
             }
             $hour = empty($value[0]) ? "0" : strip_tags($value[0]);
             $minute = empty($value[1]) ? "0" : strip_tags($value[1]);
             $ampm = strip_tags(rgar($value, 2));
             if (!empty($ampm)) {
                 $ampm = " {$ampm}";
             }
             if (!(empty($hour) && empty($minute))) {
                 $value = sprintf("%02d:%02d%s", $hour, $minute, $ampm);
             } else {
                 $value = "";
             }
             break;
         case "date":
             $value = self::prepare_date($field["dateFormat"], $value);
             break;
         case "post_image":
             $url = self::get_fileupload_value($form_id, $input_name);
             $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : "";
             $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : "";
             $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : "";
             $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : "";
             break;
         case "fileupload":
             $value = self::get_fileupload_value($form_id, $input_name);
             break;
         case "number":
             $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
             $value = GFCommon::has_field_calculation($field) ? GFCommon::round_number(GFCommon::calculate($field, $form, $lead), rgar($field, "calculationRounding")) : GFCommon::clean_number($value, rgar($field, "numberFormat"));
             //return the value as a string when it is zero and a calc so that the "==" comparison done when checking if the field has changed isn't treated as false
             if (GFCommon::has_field_calculation($field) && $value == 0) {
                 $value = "0";
             }
             break;
         case "website":
             if ($value == "http://") {
                 $value = "";
             }
             break;
         case "list":
             if (GFCommon::is_empty_array($value)) {
                 $value = "";
             } else {
                 $value = self::create_list_array($field, $value);
                 $value = serialize($value);
             }
             break;
         case "radio":
             if (rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') {
                 $value = rgpost("input_{$field['id']}_other");
             }
             break;
         case "multiselect":
             $value = empty($value) ? "" : implode(",", $value);
             break;
         case "creditcard":
             //saving last 4 digits of credit card
             list($input_token, $field_id_token, $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == "1") {
//.........这里部分代码省略.........
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:101,代码来源:forms_model.php

示例6: leads_page


//.........这里部分代码省略.........
                    $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)) {
                                //displaying thumbnail (if file is an image) or an icon based on the extension
                                $thumb = self::get_icon_url($file_path);
                                $file_path = esc_attr($file_path);
                                $value = "<a href='{$file_path}' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
                            }
                            break;
                        case "source_url":
                            $value = "<a href='" . esc_attr($lead["source_url"]) . "' target='_blank' alt='" . esc_attr($lead["source_url"]) . "' title='" . esc_attr($lead["source_url"]) . "'>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>";
                            break;
                        case "textarea":
                        case "post_content":
                        case "post_excerpt":
                            $value = esc_html($value);
开发者ID:sashadt,项目名称:wp-deploy-test,代码行数:67,代码来源:entry_list.php

示例7: gravityview_convert_value_to_term_list

/**
 * Take a passed CSV of terms and generate a linked list of terms
 *
 * Gravity Forms passes categories as "Name:ID" so we handle that using the ID, which
 * is more accurate than checking the name, which is more likely to change.
 *
 * @param  string      $value    Existing value
 * @param  string      $taxonomy Type of term (`post_tag` or `category`)
 * @return string                CSV of linked terms
 */
function gravityview_convert_value_to_term_list($value, $taxonomy = 'post_tag')
{
    $output = array();
    $terms = explode(', ', $value);
    foreach ($terms as $term_name) {
        // If we're processing a category,
        if ($taxonomy === 'category') {
            // Use rgexplode to prevent errors if : doesn't exist
            list($term_name, $term_id) = rgexplode(':', $value, 2);
            // The explode was succesful; we have the category ID
            if (!empty($term_id)) {
                $term = get_term_by('id', $term_id, $taxonomy);
            } else {
                // We have to fall back to the name
                $term = get_term_by('name', $term_name, $taxonomy);
            }
        } else {
            // Use the name of the tag to get the full term information
            $term = get_term_by('name', $term_name, $taxonomy);
        }
        // There's still a tag/category here.
        if ($term) {
            $term_link = get_term_link($term, $taxonomy);
            // If there was an error, continue to the next term.
            if (is_wp_error($term_link)) {
                continue;
            }
            $output[] = gravityview_get_link($term_link, esc_html($term->name));
        }
    }
    return implode(', ', $output);
}
开发者ID:roarmoser,项目名称:gv1,代码行数:42,代码来源:class-api.php

示例8: getShipping

 /**
  * extract the shipping amount from a shipping field
  * @return float
  */
 private static function getShipping($form, $field)
 {
     $shipping = 0;
     $id = $field['id'];
     if (!GFFormsModel::is_field_hidden($form, $field, array())) {
         $value = rgpost("input_{$id}");
         if (!empty($value) && $field["inputType"] != 'singleshipping') {
             // drop-down list / radio buttons
             list($name, $value) = rgexplode('|', $value, 2);
         }
         $shipping = GFCommon::to_number($value);
     }
     return $shipping;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:18,代码来源:class.GFEwayFormData.php

示例9: date_display

 public static function date_display($value, $format = "mdy")
 {
     $date = self::parse_date($value, $format);
     if (empty($date)) {
         return $value;
     }
     list($position, $separator) = rgexplode("_", $format, 2);
     switch ($separator) {
         case "dash":
             $separator = "-";
             break;
         case "dot":
             $separator = ".";
             break;
         default:
             $separator = "/";
             break;
     }
     switch ($position) {
         case "ymd":
             return $date["year"] . $separator . $date["month"] . $separator . $date["day"];
             break;
         case "dmy":
             return $date["day"] . $separator . $date["month"] . $separator . $date["year"];
             break;
         default:
             return $date["month"] . $separator . $date["day"] . $separator . $date["year"];
             break;
     }
 }
开发者ID:ipman3,项目名称:Mediassociates-wp,代码行数:30,代码来源:common.php

示例10: prepare_value

 private static function prepare_value($form, $field, $value, $input_name, $lead_id)
 {
     $form_id = $form["id"];
     $input_type = self::get_input_type($field);
     switch ($input_type) {
         case "total":
             $lead = RGFormsModel::get_lead($lead_id);
             $value = GFCommon::get_order_total($form, $lead);
             break;
         case "post_category":
             $cat = get_category($value);
             $value = !empty($cat) ? $cat->name . ":" . $value : "";
             break;
         case "phone":
             if ($field["phoneFormat"] == "standard" && preg_match('/^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/', $value, $matches)) {
                 $value = sprintf("(%s)%s-%s", $matches[1], $matches[2], $matches[3]);
             }
             break;
         case "time":
             if (!is_array($value) && !empty($value)) {
                 preg_match('/^(\\d*):(\\d*) ?(.*)$/', $value, $matches);
                 $value = array();
                 $value[0] = $matches[1];
                 $value[1] = $matches[2];
                 $value[2] = rgar($matches, 3);
             }
             $hour = empty($value[0]) ? "0" : strip_tags($value[0]);
             $minute = empty($value[1]) ? "0" : strip_tags($value[1]);
             $ampm = strip_tags(rgar($value, 2));
             if (!empty($ampm)) {
                 $ampm = " {$ampm}";
             }
             if (!(empty($hour) && empty($minute))) {
                 $value = sprintf("%02d:%02d%s", $hour, $minute, $ampm);
             } else {
                 $value = "";
             }
             break;
         case "date":
             $format = empty($field["dateFormat"]) ? "mdy" : $field["dateFormat"];
             $date_info = GFCommon::parse_date($value, $format);
             if (!empty($date_info)) {
                 $value = sprintf("%d-%02d-%02d", $date_info["year"], $date_info["month"], $date_info["day"]);
             } else {
                 $value = "";
             }
             break;
         case "post_image":
             $url = self::get_fileupload_value($form_id, $input_name);
             $image_title = isset($_POST["{$input_name}_1"]) ? strip_tags($_POST["{$input_name}_1"]) : "";
             $image_caption = isset($_POST["{$input_name}_4"]) ? strip_tags($_POST["{$input_name}_4"]) : "";
             $image_description = isset($_POST["{$input_name}_7"]) ? strip_tags($_POST["{$input_name}_7"]) : "";
             $value = !empty($url) ? $url . "|:|" . $image_title . "|:|" . $image_caption . "|:|" . $image_description : "";
             break;
         case "fileupload":
             $value = self::get_fileupload_value($form_id, $input_name);
             break;
         case "number":
             $value = GFCommon::clean_number($value, rgar($field, "numberFormat"));
             break;
         case "website":
             if ($value == "http://") {
                 $value = "";
             }
             break;
         case "list":
             if (GFCommon::is_empty_array($value)) {
                 $value = "";
             } else {
                 $value = self::create_list_array($field, $value);
                 $value = serialize($value);
             }
             break;
         case "radio":
             if (rgar($field, 'enableOtherChoice') && $value == 'gf_other_choice') {
                 $value = rgpost("input_{$field['id']}_other");
             }
             break;
         case "multiselect":
             $value = empty($value) ? "" : implode(",", $value);
             break;
         case "creditcard":
             //saving last 4 digits of credit card
             list($input_token, $field_id_token, $input_id) = rgexplode("_", $input_name, 3);
             if ($input_id == "1") {
                 $value = str_replace(" ", "", $value);
                 $card_number_length = strlen($value);
                 $value = substr($value, -4, 4);
                 $value = str_pad($value, $card_number_length, "X", STR_PAD_LEFT);
             } else {
                 if ($input_id == "4") {
                     $card_number = rgpost("input_{$field_id_token}_1");
                     $card_type = GFCommon::get_card_type($card_number);
                     $value = $card_type ? $card_type["name"] : "";
                 } else {
                     $value = "";
                 }
             }
             break;
         default:
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:101,代码来源:forms_model.php

示例11: display

    public static function display($args)
    {
        $assignee_key = sanitize_text_field(rgget('assignee'));
        list($assignee_type, $assignee_id) = rgexplode('|', $assignee_key, 2);
        $range = sanitize_key(rgget('range'));
        switch ($range) {
            case 'last-6-months':
                $start_date = date('Y-m-d', strtotime('-6 months'));
                break;
            case 'last-3-months':
                $start_date = date('Y-m-d', strtotime('-3 months'));
                break;
            default:
                $start_date = date('Y-m-d', strtotime('-1 year'));
        }
        $defaults = array('view' => rgget('view'), 'form_id' => absint(rgget('form-id')), 'step_id' => absint(rgget('step-id')), 'category' => sanitize_key(rgget('category')), 'range' => $range, 'start_date' => $start_date, 'assignee' => $assignee_key, 'assignee_type' => $assignee_type, 'assignee_id' => $assignee_id, 'check_permissions' => true, 'base_url' => admin_url('admin.php?page=gravityflow-reports'));
        $args = array_merge($defaults, $args);
        if ($args['check_permissions'] && !GFAPI::current_user_can_any('gravityflow_reports')) {
            esc_html_e("You don't have permission to view this page", 'gravityflow');
            return;
        }
        $filter_vars['config'] = self::get_filter_config_vars();
        $filter_vars['selected'] = array('formId' => $args['form_id'], 'category' => $args['category'], 'stepId' => empty($args['step_id']) ? '' : $args['step_id'], 'assignee' => $args['assignee']);
        ?>
		<script>var gravityflowFilterVars = <?php 
        echo json_encode($filter_vars);
        ?>
;</script>

		<div id="gravityflow-reports-filter" style="margin-bottom:10px;">
		<form method="GET" action="<?php 
        echo esc_url($args['base_url']);
        ?>
">
			<input type="hidden" value="gravityflow-reports" name="page" />
			<?php 
        self::range_drop_down($args['range']);
        ?>
			<?php 
        self::form_drop_down($args['form_id']);
        ?>
			<?php 
        self::category_drop_down($args['category']);
        ?>
			<select id="gravityflow-reports-steps" style="display:none;" name="step-id"></select>
			<select id="gravityflow-reports-assignees" style="display:none;" name="assignee"></select>
			<input type="submit" value="<?php 
        esc_html_e('Filter', 'gravityflow');
        ?>
" class="button-secondary" />
		</form>
		</div>
		<?php 
        if (empty($args['form_id'])) {
            self::report_all_forms($args);
            return;
        }
        $form_id = $args['form_id'];
        if ($args['category'] == 'assignee') {
            if (empty($args['assignee_key'])) {
                self::report_form_by_assignee($form_id, $args);
            }
        } elseif ($args['category'] == 'step') {
            if (empty($args['step_id'])) {
                self::report_form_by_step($form_id, $args);
            } else {
                $step_id = $args['step_id'];
                if (empty($args['assignee_id'])) {
                    self::report_step_by_assignee($step_id, $args);
                } else {
                    $assignee_type = $args['assignee_type'];
                    $assignee_id = $args['assignee_id'];
                    self::report_assignee_by_month($assignee_type, $assignee_id, $args);
                }
            }
        } else {
            self::report_form_by_month($form_id, $args);
        }
    }
开发者ID:jakejackson1,项目名称:gravityflow,代码行数:79,代码来源:class-reports.php

示例12: get_post_fields

 private static function get_post_fields($form, $lead)
 {
     $post_data = array();
     $post_data['post_custom_fields'] = array();
     $post_data['tags_input'] = array();
     $categories = array();
     $images = array();
     foreach ($form['fields'] as $field) {
         if ($field->type == 'post_category') {
             $field = GFCommon::add_categories_as_choices($field, '');
         }
         $value = self::get_post_field_value($field, $lead);
         switch ($field->type) {
             case 'post_title':
             case 'post_excerpt':
             case 'post_content':
                 $post_data[$field->type] = $value;
                 break;
             case 'post_tags':
                 $tags = explode(',', $value);
                 if (is_array($tags) && sizeof($tags) > 0) {
                     $post_data['tags_input'] = array_merge($post_data['tags_input'], $tags);
                 }
                 break;
             case 'post_custom_field':
                 $type = self::get_input_type($field);
                 if ('fileupload' === $type && $field->multipleFiles) {
                     $value = json_decode($value, true);
                 }
                 $meta_name = $field->postCustomFieldName;
                 if (!isset($post_data['post_custom_fields'][$meta_name])) {
                     $post_data['post_custom_fields'][$meta_name] = $value;
                 } else {
                     if (!is_array($post_data['post_custom_fields'][$meta_name])) {
                         $post_data['post_custom_fields'][$meta_name] = array($post_data['post_custom_fields'][$meta_name], $value);
                     } else {
                         $post_data['post_custom_fields'][$meta_name][] = $value;
                     }
                 }
                 break;
             case 'post_category':
                 foreach (explode(',', $value) as $cat_string) {
                     list($cat_name, $cat_id) = rgexplode(':', $cat_string, 2);
                     array_push($categories, $cat_id);
                 }
                 break;
             case 'post_image':
                 $ary = !empty($value) ? explode('|:|', $value) : array();
                 $url = count($ary) > 0 ? $ary[0] : '';
                 $title = count($ary) > 1 ? $ary[1] : '';
                 $caption = count($ary) > 2 ? $ary[2] : '';
                 $description = count($ary) > 3 ? $ary[3] : '';
                 array_push($images, array('field_id' => $field->id, 'url' => $url, 'title' => $title, 'description' => $description, 'caption' => $caption));
                 break;
         }
     }
     $post_data['post_status'] = rgar($form, 'postStatus');
     $post_data['post_category'] = !empty($categories) ? $categories : array(rgar($form, 'postCategory'));
     $post_data['images'] = $images;
     //setting current user as author depending on settings
     $post_data['post_author'] = $form['useCurrentUserAsAuthor'] && !empty($lead['created_by']) ? $lead['created_by'] : $form['postAuthor'];
     return $post_data;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:63,代码来源:forms_model.php

示例13: get_value_save_entry

 public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead)
 {
     //saving last 4 digits of credit card
     list($input_token, $field_id_token, $input_id) = rgexplode('_', $input_name, 3);
     if ($input_id == '1') {
         $value = str_replace(' ', '', $value);
         $card_number_length = strlen($value);
         $value = substr($value, -4, 4);
         $value = str_pad($value, $card_number_length, 'X', STR_PAD_LEFT);
     } elseif ($input_id == '4') {
         $value = rgpost("input_{$field_id_token}_4");
         if (!$value) {
             $card_number = rgpost("input_{$field_id_token}_1");
             $card_type = GFCommon::get_card_type($card_number);
             $value = $card_type ? $card_type['name'] : '';
         }
     } else {
         $value = '';
     }
     return $this->sanitize_entry_value($value, $form['id']);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:21,代码来源:class-gf-field-creditcard.php

示例14: get_parameter_value

 public static function get_parameter_value($name, $field_values, $field)
 {
     $value = stripslashes(rgget($name));
     if (empty($value)) {
         $value = rgget($name, $field_values);
     }
     //converting list format
     if (RGFormsModel::get_input_type($field) == 'list') {
         //transforms this: col1|col2,col1b|col2b into this: col1,col2,col1b,col2b
         $column_count = count($field->choices);
         $rows = explode(',', $value);
         $ary_rows = array();
         if (!empty($rows)) {
             foreach ($rows as $row) {
                 $ary_rows = array_merge($ary_rows, rgexplode('|', $row, $column_count));
             }
             $value = $ary_rows;
         }
     }
     return gf_apply_filters(array('gform_field_value', $name), $value, $field, $name);
 }
开发者ID:arobbins,项目名称:davis,代码行数:21,代码来源:forms_model.php

示例15: leads_page


//.........这里部分代码省略.........
                                //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;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            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 "post_category":
                            $ary = explode(":", $value);
                            $cat_name = count($ary) > 0 ? $ary[0] : "";
                            $value = $cat_name;
                            break;
                        case "fileupload":
                            $file_path = $value;
                            if (!empty($file_path)) {
                                //displaying thumbnail (if file is an image) or an icon based on the extension
                                $thumb = self::get_icon_url($file_path);
                                $file_path = esc_attr($file_path);
                                $value = "<a href='{$file_path}' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
                            }
                            break;
                        case "source_url":
                            $value = "<a href='" . esc_attr($lead["source_url"]) . "' target='_blank' alt='" . esc_attr($lead["source_url"]) . "' title='" . esc_attr($lead["source_url"]) . "'>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>";
                            break;
                        case "textarea":
                        case "post_content":
                        case "post_excerpt":
                            $value = esc_html($value);
                            break;
                        case "date_created":
                        case "payment_date":
                            $value = GFCommon::format_date($value, false);
                            break;
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:67,代码来源:entry_list.php


注:本文中的rgexplode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。