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


PHP RGFormsModel::get_input_type方法代码示例

本文整理汇总了PHP中RGFormsModel::get_input_type方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::get_input_type方法的具体用法?PHP RGFormsModel::get_input_type怎么用?PHP RGFormsModel::get_input_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGFormsModel的用法示例。


在下文中一共展示了RGFormsModel::get_input_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: acquirer_field_input

 /**
  * Acquirrer field input
  *
  * @param string $field_content
  * @param string $field
  * @param string $value
  * @param string $lead_id
  * @param string $form_id
  */
 public static function acquirer_field_input($field_content, $field, $value, $lead_id, $form_id)
 {
     $type = RGFormsModel::get_input_type($field);
     if (Pronamic_WP_Pay_Extensions_GravityForms_IssuerDropDown::TYPE === $type) {
         $id = $field['id'];
         $field_id = IS_ADMIN || 0 === $form_id ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
         $class_suffix = RG_CURRENT_VIEW === 'entry' ? '_admin' : '';
         $size = rgar($field, 'size');
         $class = $size . $class_suffix;
         $css_class = trim(esc_attr($class) . ' gfield_ideal_acquirer_select');
         $tab_index = GFCommon::get_tabindex();
         $disabled_text = IS_ADMIN && 'entry' !== RG_CURRENT_VIEW ? "disabled='disabled'" : '';
         $html = '';
         $feed = get_pronamic_gf_pay_conditioned_feed_by_form_id($form_id, true);
         /**
          * Developing warning:
          * Don't use single quotes in the HTML you output, it is buggy in combination with SACK
          */
         if (IS_ADMIN) {
             if (null === $feed) {
                 $html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", add_query_arg('post_type', 'pronamic_pay_gf', admin_url('post-new.php')), __('Create iDEAL feed', 'pronamic_ideal'));
             } else {
                 $html .= sprintf("<a class='ideal-edit-link' href='%s' target='_blank'>%s</a>", get_edit_post_link($feed->id), __('Edit iDEAL feed', 'pronamic_ideal'));
             }
         }
         $html_input = '';
         $html_error = '';
         if (null !== $feed) {
             $gateway = Pronamic_WP_Pay_Plugin::get_gateway($feed->config_id);
             if ($gateway) {
                 $issuer_field = $gateway->get_issuer_field();
                 $error = $gateway->get_error();
                 if (is_wp_error($error)) {
                     $html_error .= Pronamic_WP_Pay_Plugin::get_default_error_message();
                     $html_error .= '<br /><em>' . $error->get_error_message() . '</em>';
                 } elseif ($issuer_field) {
                     $choices = $issuer_field['choices'];
                     $options = Pronamic_WP_HTML_Helper::select_options_grouped($choices, $value);
                     // Double quotes are not working, se we replace them with an single quote
                     $options = str_replace('"', '\'', $options);
                     $html_input = '';
                     $html_input .= sprintf("<select name='input_%d' id='%s' class='%s' %s %s>", $id, $field_id, $css_class, $tab_index, $disabled_text);
                     $html_input .= sprintf('%s', $options);
                     $html_input .= sprintf('</select>');
                 }
             }
         }
         if ($html_error) {
             $html .= sprintf("<div class='gfield_description validation_message'>");
             $html .= sprintf('%s', $html_error);
             $html .= sprintf('</div>');
         } else {
             $html .= sprintf("<div class='ginput_container ginput_ideal'>");
             $html .= sprintf('%s', $html_input);
             $html .= sprintf('</div>');
         }
         $field_content = $html;
     }
     return $field_content;
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:69,代码来源:Fields.php

示例2: output_data

function output_data($pdf, $lead = array(), $form = array(), $fieldData = array())
{
    $pdf->AddPage();
    $dataArray = array(array('Project ID #', 3), array('Project Name', 28), array('Name of person responsible for fire safety at your exhibit', 5), array('Their Email', 15), array('Their phone', 16), array('Description', 19), array('Describe your safety concerns', 12), array('Describe how you plan to keep your exhibit safe', 20), array('Who will be assisting at your exhibit to keep it safe', 11), array('Placement Requirements', 7), array('Do you have Insurance', 9), array('Additional Comments', 13), array('Are you 18 years or older?', 23), array('Signed', 25), array('I am the Parent and/or Legal Guardian of', 26), array('Date', 27));
    $pdf->SetFillColor(190, 210, 247);
    $lineheight = 6;
    foreach ($dataArray as $data) {
        $fieldID = $data[1];
        if (isset($fieldData[$fieldID])) {
            $field = $fieldData[$fieldID];
            $value = RGFormsModel::get_lead_field_value($lead, $field);
            if (RGFormsModel::get_input_type($field) != 'email') {
                $display_value = GFCommon::get_lead_field_display($field, $value);
                $display_value = apply_filters('gform_entry_field_value', $display_value, $field, $lead, $form);
            } else {
                $display_value = $value;
            }
        } else {
            $display_value = '';
        }
        $pdf->MultiCell(0, $lineheight, $data[0] . ': ');
        $pdf->MultiCell(0, $lineheight, $display_value, 0, 'L', true);
        $pdf->Ln();
    }
}
开发者ID:hansstam,项目名称:makerfaire,代码行数:25,代码来源:GSP.php

示例3: output_data

function output_data($pdf, $lead = array(), $form = array(), $fieldData = array())
{
    $pdf->AddPage();
    $dataArray = array(array('Project ID #', 3, 'text'), array('Project Name', 38, 'text'), array('Name of person responsible for fire safety at your exhibit', 21, 'text'), array('Their Email', 23, 'text'), array('Their Phone', 24, 'text'), array('Description', 37, 'textarea'), array('Describe your fire safety concerns', 19, 'textarea'), array('Describe how you plan to keep your exhibit safe', 27, 'textarea'), array('Who will be assisting at your exhibit to keep it safe', 20, 'text'), array('Placement Requirements', 7, 'textarea'), array('What is burning', 10, 'text'), array('What is the fuel source', 11, 'text'), array('how much is fuel is burning and in what time period', 12, 'textarea'), array('how much fuel will you have at the event, including tank sizes', 13, 'textarea'), array('where and how is the fuel stored', 14, 'text'), array('Does the valve have an electronic propane sniffer', 15, 'text'), array('Other suppression devices', 16, 'textarea'), array('Do you have insurance?', 18, 'text'), array('Additional comments', 28, 'textarea'), array('Are you 18 years or older?', 30, 'text'), array('Signed', 32, 'text'), array('I am the Parent and/or Legal Guardian of', 33, 'text'), array('Date', 34, 'text'));
    $pdf->SetFillColor(190, 210, 247);
    $lineheight = 6;
    foreach ($dataArray as $data) {
        $fieldID = $data[1];
        if (isset($fieldData[$fieldID])) {
            $field = $fieldData[$fieldID];
            $value = RGFormsModel::get_lead_field_value($lead, $field);
            if (RGFormsModel::get_input_type($field) != 'email') {
                $display_value = GFCommon::get_lead_field_display($field, $value);
                $display_value = apply_filters('gform_entry_field_value', $display_value, $field, $lead, $form);
            } else {
                $display_value = $value;
            }
        } else {
            $display_value = '';
        }
        $pdf->MultiCell(0, $lineheight, $data[0] . ': ');
        $pdf->MultiCell(0, $lineheight, $display_value, 0, 'L', true);
        $pdf->Ln();
    }
}
开发者ID:hansstam,项目名称:makerfaire,代码行数:25,代码来源:FSP.php

示例4: create_post

 public static function create_post($form, &$lead)
 {
     GFCommon::log_debug('GFFormsModel::create_post(): Starting.');
     $has_post_field = false;
     foreach ($form['fields'] as $field) {
         $is_hidden = self::is_field_hidden($form, $field, array(), $lead);
         if (!$is_hidden && in_array($field->type, array('post_category', 'post_title', 'post_content', 'post_excerpt', 'post_tags', 'post_custom_field', 'post_image'))) {
             $has_post_field = true;
             break;
         }
     }
     //if this form does not have any post fields, don't create a post
     if (!$has_post_field) {
         GFCommon::log_debug("GFFormsModel::create_post(): Stopping. The form doesn't have any post fields.");
         return $lead;
     }
     //processing post fields
     GFCommon::log_debug('GFFormsModel::create_post(): Getting post fields.');
     $post_data = self::get_post_fields($form, $lead);
     //allowing users to change post fields before post gets created
     $post_data = gf_apply_filters('gform_post_data', $form['id'], $post_data, $form, $lead);
     //adding default title if none of the required post fields are in the form (will make sure wp_insert_post() inserts the post)
     if (empty($post_data['post_title']) && empty($post_data['post_content']) && empty($post_data['post_excerpt'])) {
         $post_data['post_title'] = self::get_default_post_title();
     }
     // remove original post status and save it for later
     $post_status = $post_data['post_status'];
     // replace original post status with 'draft' so other plugins know this post is not fully populated yet
     $post_data['post_status'] = 'draft';
     // inserting post
     GFCommon::log_debug('GFFormsModel::create_post(): Inserting post via wp_insert_post().');
     $post_id = wp_insert_post($post_data);
     GFCommon::log_debug("GFFormsModel::create_post(): Result from wp_insert_post(): {$post_id}.");
     //adding form id and entry id hidden custom fields
     add_post_meta($post_id, '_gform-form-id', $form['id']);
     add_post_meta($post_id, '_gform-entry-id', $lead['id']);
     //creating post images
     GFCommon::log_debug('GFFormsModel::create_post(): Creating post images.');
     $post_images = array();
     foreach ($post_data['images'] as $image) {
         $image_meta = array('post_excerpt' => $image['caption'], 'post_content' => $image['description']);
         //adding title only if it is not empty. It will default to the file name if it is not in the array
         if (!empty($image['title'])) {
             $image_meta['post_title'] = $image['title'];
         }
         if (!empty($image['url'])) {
             GFCommon::log_debug('GFFormsModel::create_post(): Adding image: ' . $image['url']);
             $media_id = self::media_handle_upload($image['url'], $post_id, $image_meta);
             if ($media_id) {
                 //save media id for post body/title template variable replacement (below)
                 $post_images[$image['field_id']] = $media_id;
                 $lead[$image['field_id']] .= "|:|{$media_id}";
                 // set featured image
                 $field = RGFormsModel::get_field($form, $image['field_id']);
                 if ($field->postFeaturedImage) {
                     set_post_thumbnail($post_id, $media_id);
                 }
             }
         }
     }
     //adding custom fields
     GFCommon::log_debug('GFFormsModel::create_post(): Adding custom fields.');
     foreach ($post_data['post_custom_fields'] as $meta_name => $meta_value) {
         if (!is_array($meta_value)) {
             $meta_value = array($meta_value);
         }
         $meta_index = 0;
         foreach ($meta_value as $value) {
             GFCommon::log_debug('GFFormsModel::create_post(): Getting custom field: ' . $meta_name);
             $custom_field = self::get_custom_field($form, $meta_name, $meta_index);
             //replacing template variables if template is enabled
             if ($custom_field && rgget('customFieldTemplateEnabled', $custom_field)) {
                 //replacing post image variables
                 GFCommon::log_debug('GFFormsModel::create_post(): Replacing post image variables.');
                 $value = GFCommon::replace_variables_post_image($custom_field['customFieldTemplate'], $post_images, $lead);
                 //replacing all other variables
                 $value = GFCommon::replace_variables($value, $form, $lead, false, false, false);
                 // replace conditional shortcodes
                 $value = do_shortcode($value);
             }
             switch (RGFormsModel::get_input_type($custom_field)) {
                 case 'list':
                     $value = maybe_unserialize($value);
                     if (is_array($value)) {
                         foreach ($value as $item) {
                             if (is_array($item)) {
                                 $item = implode('|', $item);
                             }
                             if (!rgblank($item)) {
                                 add_post_meta($post_id, $meta_name, $item);
                             }
                         }
                     }
                     break;
                 case 'multiselect':
                 case 'checkbox':
                     $value = explode(',', $value);
                     if (is_array($value)) {
                         foreach ($value as $item) {
                             if (!rgblank($item)) {
//.........这里部分代码省略.........
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:101,代码来源:forms_model.php

示例5: has_currency_format_number_field

 private static function has_currency_format_number_field($form)
 {
     if (is_array($form['fields'])) {
         foreach ($form['fields'] as $field) {
             $input_type = RGFormsModel::get_input_type($field);
             if ($input_type == 'number' && $field->numberFormat == 'currency') {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:timk85,项目名称:DIT,代码行数:12,代码来源:form_display.php

示例6: get_field_map_choices

 public static function get_field_map_choices($form_id)
 {
     $form = RGFormsModel::get_form_meta($form_id);
     $fields = array();
     // Adding default fields
     $fields[] = array("value" => "", "label" => "");
     $fields[] = array("value" => "date_created", "label" => __("Entry Date", "gravityforms"));
     $fields[] = array("value" => "ip", "label" => __("User IP", "gravityforms"));
     $fields[] = array("value" => "source_url", "label" => __("Source Url", "gravityforms"));
     $fields[] = array("value" => "form_title", "label" => __("Form Title", "gravityforms"));
     // Populate entry meta
     $entry_meta = GFFormsModel::get_entry_meta($form["id"]);
     foreach ($entry_meta as $meta_key => $meta) {
         $fields[] = array('value' => $meta_key, 'label' => rgars($entry_meta, "{$meta_key}/label"));
     }
     // Populate form fields
     if (is_array($form["fields"])) {
         foreach ($form["fields"] as $field) {
             if (is_array(rgar($field, "inputs"))) {
                 //If this is an address field, add full name to the list
                 if (RGFormsModel::get_input_type($field) == "address") {
                     $fields[] = array('value' => $field["id"], 'label' => GFCommon::get_label($field) . " (" . __("Full", "gravityforms") . ")");
                 }
                 //If this is a name field, add full name to the list
                 if (RGFormsModel::get_input_type($field) == "name") {
                     $fields[] = array('value' => $field["id"], 'label' => GFCommon::get_label($field) . " (" . __("Full", "gravityforms") . ")");
                 }
                 //If this is a checkbox field, add to the list
                 if (RGFormsModel::get_input_type($field) == "checkbox") {
                     $fields[] = array('value' => $field["id"], 'label' => GFCommon::get_label($field) . " (" . __("Selected", "gravityforms") . ")");
                 }
                 foreach ($field['inputs'] as $input) {
                     if (RGFormsModel::get_input_type($field) == 'creditcard') {
                         //only include the credit card type (field_id.4) and number (field_id.1)
                         if ($input['id'] == $field['id'] . '.1' || $input['id'] == $field['id'] . '.4') {
                             $fields[] = array('value' => $input["id"], 'label' => GFCommon::get_label($field, $input['id']));
                         }
                     } else {
                         $fields[] = array('value' => $input["id"], 'label' => GFCommon::get_label($field, $input["id"]));
                     }
                 }
             } else {
                 if (!rgar($field, "displayOnly")) {
                     $fields[] = array('value' => $field["id"], 'label' => GFCommon::get_label($field));
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:BisongT,项目名称:Myevent_website,代码行数:50,代码来源:class-gf-addon.php

示例7: 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;
//.........这里部分代码省略.........
开发者ID:hansstam,项目名称:makerfaire,代码行数:101,代码来源:export-makerfaire-changes.php

示例8: lead_detail_grid

    public static function lead_detail_grid($form, $lead, $allow_display_empty_fields = false)
    {
        $form_id = $form["id"];
        $display_empty_fields = false;
        if ($allow_display_empty_fields) {
            $display_empty_fields = rgget("gf_display_empty_fields", $_COOKIE);
        }
        ?>
        <table cellspacing="0" class="widefat fixed entry-detail-view">
            <thead>
                <tr>
                    <th id="details">
                    <?php 
        echo $form["title"];
        ?>
 : <?php 
        _e("Entry # ", "gravityforms");
        ?>
 <?php 
        echo $lead["id"];
        ?>
                    </th>
                    <th style="width:140px; font-size:10px; text-align: right;">
                    <?php 
        if ($allow_display_empty_fields) {
            ?>
                            <input type="checkbox" id="gentry_display_empty_fields" <?php 
            echo $display_empty_fields ? "checked='checked'" : "";
            ?>
 onclick="ToggleShowEmptyFields();"/>&nbsp;&nbsp;<label for="gentry_display_empty_fields"><?php 
            _e("show empty fields", "gravityforms");
            ?>
</label>
                            <?php 
        }
        ?>
                    </th>
                </tr>
            </thead>
            <tbody>
                <?php 
        $count = 0;
        $field_count = sizeof($form["fields"]);
        $has_product_fields = false;
        foreach ($form["fields"] as $field) {
            switch (RGFormsModel::get_input_type($field)) {
                case "section":
                    if (!GFCommon::is_section_empty($field, $form, $lead) || $display_empty_fields) {
                        $count++;
                        $is_last = $count >= $field_count ? true : false;
                        ?>
                                <tr>
                                    <td colspan="2" class="entry-view-section-break<?php 
                        echo $is_last ? " lastrow" : "";
                        ?>
"><?php 
                        echo esc_html(GFCommon::get_label($field));
                        ?>
</td>
                                </tr>
                                <?php 
                    }
                    break;
                case "captcha":
                case "html":
                case "password":
                case "page":
                    //ignore captcha, html, password, page field
                    break;
                default:
                    //ignore product fields as they will be grouped together at the end of the grid
                    if (GFCommon::is_product_field($field["type"])) {
                        $has_product_fields = true;
                        continue;
                    }
                    $value = RGFormsModel::get_lead_field_value($lead, $field);
                    $display_value = GFCommon::get_lead_field_display($field, $value, $lead["currency"]);
                    $display_value = apply_filters("gform_entry_field_value", $display_value, $field, $lead, $form);
                    if ($display_empty_fields || !empty($display_value) || $display_value === "0") {
                        $count++;
                        $is_last = $count >= $field_count && !$has_product_fields ? true : false;
                        $last_row = $is_last ? " lastrow" : "";
                        $display_value = empty($display_value) && $display_value !== "0" ? "&nbsp;" : $display_value;
                        $content = '
                                <tr>
                                    <td colspan="2" class="entry-view-field-name">' . esc_html(GFCommon::get_label($field)) . '</td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="entry-view-field-value' . $last_row . '">' . $display_value . '</td>
                                </tr>';
                        $content = apply_filters("gform_field_content", $content, $field, $value, $lead["id"], $form["id"]);
                        echo $content;
                    }
                    break;
            }
        }
        $products = array();
        if ($has_product_fields) {
            $products = GFCommon::get_product_fields($form, $lead);
            if (!empty($products["products"])) {
//.........这里部分代码省略.........
开发者ID:JSpier,项目名称:smacamp,代码行数:101,代码来源:entry_detail.php

示例9: get_field_type

 /**
  * Returns the GF Form field type for a certain field(id) of a form
  * @param  object $form     Gravity Forms form
  * @param  mixed $field_id Field ID or Field array
  * @return string field type
  */
 public static function get_field_type($form = null, $field_id = '')
 {
     if (!empty($field_id) && !is_array($field_id)) {
         $field = self::get_field($form, $field_id);
     } else {
         $field = $field_id;
     }
     return class_exists('RGFormsModel') ? RGFormsModel::get_input_type($field) : '';
 }
开发者ID:roarmoser,项目名称:gv1,代码行数:15,代码来源:class-common.php

示例10: get_lead_field_display

 public static function get_lead_field_display($field, $value, $currency = "", $use_text = false)
 {
     switch (RGFormsModel::get_input_type($field)) {
         case "name":
             if (is_array($value)) {
                 $prefix = trim($value[$field["id"] . ".2"]);
                 $first = trim($value[$field["id"] . ".3"]);
                 $last = trim($value[$field["id"] . ".6"]);
                 $suffix = trim($value[$field["id"] . ".8"]);
                 $name = $prefix;
                 $name .= !empty($name) && !empty($first) ? " {$first}" : $first;
                 $name .= !empty($name) && !empty($last) ? " {$last}" : $last;
                 $name .= !empty($name) && !empty($suffix) ? " {$suffix}" : $suffix;
                 return $name;
             } else {
                 return $value;
             }
             break;
         case "address":
             if (is_array($value)) {
                 $street_value = trim($value[$field["id"] . ".1"]);
                 $street2_value = trim($value[$field["id"] . ".2"]);
                 $city_value = trim($value[$field["id"] . ".3"]);
                 $state_value = trim($value[$field["id"] . ".4"]);
                 $zip_value = trim($value[$field["id"] . ".5"]);
                 $country_value = trim($value[$field["id"] . ".6"]);
                 $address_display_format = apply_filters("gform_address_display_format", "street,city,state,zip,country");
                 if ($address_display_format == "zip_before_city") {
                     /*
                     Sample:
                     3333 Some Street
                     suite 16
                     2344 City, State
                     Country
                     */
                     $addr_ary = array();
                     $addr_ary[] = $street_value;
                     if (!empty($street2_value)) {
                         $addr_ary[] = $street2_value;
                     }
                     $zip_line = trim($zip_value . " " . $city_value);
                     $zip_line .= !empty($zip_line) && !empty($state_value) ? ", {$state_value}" : $state_value;
                     $zip_line = trim($zip_line);
                     if (!empty($zip_line)) {
                         $addr_ary[] = $zip_line;
                     }
                     if (!empty($country_value)) {
                         $addr_ary[] = $country_value;
                     }
                     $address = implode("<br />", $addr_ary);
                 } else {
                     $address = $street_value;
                     $address .= !empty($address) && !empty($street2_value) ? "<br />{$street2_value}" : $street2_value;
                     $address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? "<br />{$city_value}" : $city_value;
                     $address .= !empty($address) && !empty($city_value) && !empty($state_value) ? ", {$state_value}" : $state_value;
                     $address .= !empty($address) && !empty($zip_value) ? " {$zip_value}" : $zip_value;
                     $address .= !empty($address) && !empty($country_value) ? "<br />{$country_value}" : $country_value;
                 }
                 //adding map link
                 if (!empty($address)) {
                     $address_qs = str_replace("<br />", " ", $address);
                     //replacing <br/> with spaces
                     $address_qs = urlencode($address_qs);
                     $address .= "<br/><a href='http://maps.google.com/maps?q={$address_qs}' target='_blank' class='map-it-link'>Map It</a>";
                 }
                 return $address;
             } else {
                 return "";
             }
             break;
         case "email":
             return GFCommon::is_valid_email($value) ? "<a href='mailto:{$value}'>{$value}</a>" : $value;
             break;
         case "website":
             return GFCommon::is_valid_url($value) ? "<a href='{$value}' target='_blank'>{$value}</a>" : $value;
             break;
         case "checkbox":
             if (is_array($value)) {
                 foreach ($value as $key => $item) {
                     if (!empty($item)) {
                         $items .= "<li>" . GFCommon::selection_display($item, $field, $currency, $use_text) . "</li>";
                     }
                 }
                 return empty($items) ? "" : "<ul class='bulleted'>{$items}</ul>";
             } else {
                 return $value;
             }
             break;
         case "post_image":
             list($url, $title, $caption, $description) = explode("|:|", $value);
             if (!empty($url)) {
                 $url = str_replace(" ", "%20", $url);
                 $value = "<a href='{$url}' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$url}' width='100' /></a>";
                 $value .= !empty($title) ? "<div>Title: {$title}</div>" : "";
                 $value .= !empty($caption) ? "<div>Caption: {$caption}</div>" : "";
                 $value .= !empty($description) ? "<div>Description: {$description}</div>" : "";
             }
             return $value;
         case "fileupload":
             $file_path = $value;
//.........这里部分代码省略.........
开发者ID:novuscory,项目名称:ACH,代码行数:101,代码来源:common.php

示例11: export_feed

 public static function export_feed($entry, $form, $feed, $api)
 {
     $email_field_id = $feed["meta"]["field_map"]["email_address"];
     $email = $entry[$email_field_id];
     $merge_vars = array('');
     foreach ($feed["meta"]["field_map"] as $var_tag => $field_id) {
         $field = RGFormsModel::get_field($form, $field_id);
         $field_type = RGFormsModel::get_input_type($field);
         if ($field_id == intval($field_id) && $field_type == "address") {
             //handling full address
             $merge_vars[$var_tag] = self::get_address($entry, $field_id);
         } elseif ($field_type == 'date') {
             $merge_vars[$var_tag] = apply_filters('gravityforms_constant_contact_change_date_format', $entry[$field_id]);
         } else {
             $merge_vars[$var_tag] = $entry[$field_id];
         }
     }
     $retval = $api->listSubscribe($feed["meta"]["contact_list_id"], $merge_vars, "html");
     if (!is_wp_error($retval) && !empty($retval)) {
         self::add_note($entry["id"], __('Successfully added/updated in Constant Contact.', 'gravity-forms-constant-contact'));
     } else {
         $error = '';
         if (is_wp_error($retval)) {
             $error = ': ' . $retval->get_error_message();
         }
         self::add_note($entry["id"], __('Errors when adding/updating in Constant Contact', 'gravity-forms-constant-contact') . $error);
     }
 }
开发者ID:NerdyDillinger,项目名称:ovrride,代码行数:28,代码来源:constantcontact.php

示例12: export_feed

 public function export_feed($entry, $form, $feed)
 {
     //$email       = $entry[ $feed['meta']['listFields_email'] ];
     //$name        = '';
     if (!empty($feed['meta']['listFields_first_name'])) {
         $name = $this->get_name($entry, $feed['meta']['listFields_first_name']);
     }
     $merge_vars = array();
     $field_maps = $this->get_field_map_fields($feed, 'listFields');
     foreach ($field_maps as $var_key => $field_id) {
         $field = RGFormsModel::get_field($form, $field_id);
         if (GFCommon::is_product_field($field['type']) && rgar($field, 'enablePrice')) {
             $ary = explode('|', $entry[$field_id]);
             $product_name = count($ary) > 0 ? $ary[0] : '';
             $merge_vars[] = array('name' => $var_key, 'value' => $product_name);
         } else {
             if (RGFormsModel::get_input_type($field) == 'checkbox') {
                 foreach ($field['inputs'] as $input) {
                     $index = (string) $input['id'];
                     $merge_vars[] = array('name' => $var_key, 'value' => apply_filters('gform_crm_field_value', rgar($entry, $index), $form['id'], $field_id, $entry));
                 }
             } else {
                 $merge_vars[] = array('name' => $var_key, 'value' => apply_filters('gform_crm_field_value', rgar($entry, $field_id), $form['id'], $field_id, $entry));
             }
         }
     }
     $override_custom_fields = apply_filters('gform_crm_override_blank_custom_fields', false, $entry, $form, $feed);
     if (!$override_custom_fields) {
         $merge_vars = $this->remove_blank_custom_fields($merge_vars);
     }
     $settings = $this->get_plugin_settings();
     if (isset($settings['gf_fd_accountname'])) {
         $accountname = $settings['gf_fd_accountname'];
     } else {
         $accountname = "";
     }
     if (isset($settings['gf_fd_apipassword'])) {
         $apipassword = $settings['gf_fd_apipassword'];
     } else {
         $apipassword = "";
     }
     $id = $this->facturadirecta_createlead($accountname, $apipassword, $merge_vars);
     //Sends email if it does not create a lead
     //if ($id == false)
     //    $this->send_emailerrorlead($crm_type);
     $this->debugcrm($id);
 }
开发者ID:davidperezgar,项目名称:gravityforms-facturadirecta,代码行数:47,代码来源:class-gf-facturadirecta.php

示例13: export_feed

 public static function export_feed($entry, $form, $feed, $api)
 {
     $double_optin = $feed["meta"]["double_optin"] ? true : false;
     $send_welcome = $feed["meta"]["welcome_email"] ? true : false;
     $email_field_id = $feed["meta"]["field_map"]["EMAIL"];
     $email = rgar($entry, $email_field_id);
     $merge_vars = array('');
     foreach ($feed["meta"]["field_map"] as $var_tag => $field_id) {
         $field = RGFormsModel::get_field($form, $field_id);
         if ($field_id == intval($field_id) && RGFormsModel::get_input_type($field) == "address") {
             //handling full address
             $merge_vars[$var_tag] = self::get_address($entry, $field_id);
         } else {
             if ($var_tag != "EMAIL") {
                 //ignoring email field as it will be handled separatelly
                 $merge_vars[$var_tag] = rgar($entry, $field_id);
             }
         }
     }
     $groupings = $feed["meta"]["groups"];
     if (is_array($groupings)) {
         $keys = array_keys($groupings);
         $i = 0;
         foreach ($feed["meta"]["groups"] as $grouping_name => $groups) {
             $group_list = "";
             $grouping_label = "";
             foreach ($groups as $group_name => $group) {
                 $group_label = $group["group_label"];
                 $grouping_label = $group["grouping_label"];
                 if (self::assign_group_allowed($form, $feed, $grouping_name, $group_name)) {
                     $group_list .= $group_label . ",";
                 }
             }
             if (!empty($group_list)) {
                 $merge_vars["GROUPINGS"][$i]["name"] = $grouping_label;
                 $merge_vars["GROUPINGS"][$i]["groups"] = substr($group_list, 0, -1);
             }
             $i++;
         }
     }
     self::log("Checking to see if {$email} is already on the list", "debug");
     $member_info = $api->listMemberInfo($feed["meta"]["contact_list_id"], $email);
     if ($member_info["errors"] > 0) {
         self::log("{$email} is not on the list; adding to list", "debug");
         self::log("Calling - listSubscribe, Parameters - List ID: " . $feed["meta"]["contact_list_id"] . ", Email: {$email}, " . " Merge_Vars: " . print_r($merge_vars, true) . ", Email Type: html, Double Opt In: {$double_optin}, Update Existing: false, Replace Interests: true, Send Welcome: {$send_welcome}", "debug");
         $retval = $api->listSubscribe($feed["meta"]["contact_list_id"], $email, $merge_vars, "html", $double_optin, false, true, $send_welcome);
     } else {
         //see if subscription is pending, unsubscribed, or cleaned for email; do not update because an error will be thrown by mailchimp
         $status_check = $member_info["data"];
         if ($status_check[0]["status"] != "subscribed") {
             self::log("{$email} is already on the list but the status is currently " . $status_check[0]["status"] . "; not updating info", "debug");
             $retval = true;
         } else {
             self::log("{$email} is already on the list; updating info", "debug");
             self::log("Calling - listUpdateMember, Parameters - List ID: " . $feed["meta"]["contact_list_id"] . ", Email: {$email}, " . " Merge_Vars: " . print_r($merge_vars, true) . ", Email Type: html, Replace Interests: true", "debug");
             $retval = $api->listUpdateMember($feed["meta"]["contact_list_id"], $email, $merge_vars, "html", true);
         }
     }
     //listSubscribe and listUpdateMember return true/false
     if ($retval) {
         self::log("Transaction successful", "debug");
     } else {
         self::log("Transaction failed. Error " . $api->errorCode . " - " . $api->errorMessage, "error");
     }
 }
开发者ID:hscale,项目名称:webento,代码行数:65,代码来源:mailchimp.php

示例14: export_feed

 public static function export_feed($entry, $form, $feed, $api)
 {
     $double_optin = $feed["meta"]["double_optin"] ? true : false;
     $send_welcome = $feed["meta"]["welcome_email"] ? true : false;
     $email_field_id = $feed["meta"]["field_map"]["EMAIL"];
     $email = rgar($entry, $email_field_id);
     $merge_vars = array('');
     foreach ($feed["meta"]["field_map"] as $var_tag => $field_id) {
         switch (strtolower($field_id)) {
             case "date_created":
                 $merge_vars[$var_tag] = rgar($entry, "date_created");
                 break;
             case "form_title":
                 $merge_vars[$var_tag] = rgar($form, "title");
                 break;
             case "ip":
                 $merge_vars[$var_tag] = rgar($entry, "ip");
                 break;
             case "source_url":
                 $merge_vars[$var_tag] = rgar($entry, "source_url");
                 break;
             default:
                 $field = RGFormsModel::get_field($form, $field_id);
                 if ($field_id == intval($field_id) && RGFormsModel::get_input_type($field) == "address") {
                     //handling full address
                     $merge_vars[$var_tag] = self::get_address($entry, $field_id);
                 } else {
                     if ($field_id == intval($field_id) && RGFormsModel::get_input_type($field) == "name") {
                         //handling full name
                         $merge_vars[$var_tag] = self::get_name($entry, $field_id);
                     } else {
                         if ($field_id == intval($field_id) && RGFormsModel::get_input_type($field) == "phone" && $field["phoneFormat"] == "standard") {
                             //reformat phone to go to mailchimp when standard format (US/CAN), needs to be in the format NPA-NXX-LINE 404-555-1212 when US/CAN
                             $phone = rgar($entry, $field_id);
                             if (preg_match('/^\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/', $phone, $matches)) {
                                 $phone = sprintf("%s-%s-%s", $matches[1], $matches[2], $matches[3]);
                             }
                             $merge_vars[$var_tag] = $phone;
                         } else {
                             if ($var_tag != "EMAIL") {
                                 //ignoring email field as it will be handled separatelly
                                 $merge_vars[$var_tag] = apply_filters("gform_mailchimp_field_value", rgar($entry, $field_id), $form["id"], $field_id, $entry);
                             }
                         }
                     }
                 }
                 break;
         }
     }
     $groupings = $feed["meta"]["groups"];
     if (is_array($groupings)) {
         $keys = array_keys($groupings);
         $i = 0;
         foreach ($feed["meta"]["groups"] as $grouping_name => $groups) {
             $group_list = "";
             $grouping_label = "";
             foreach ($groups as $group_name => $group) {
                 //replace commas in the group name because commas to mailchimp indicate multiple groups
                 $group_label = str_replace(",", "\\,", $group["group_label"]);
                 $grouping_label = $group["grouping_label"];
                 if (self::assign_group_allowed($form, $feed, $grouping_name, $group_name, $entry)) {
                     $group_list .= $group_label . ",";
                 }
             }
             $merge_vars["GROUPINGS"][$i]["name"] = $grouping_label;
             $merge_vars["GROUPINGS"][$i]["groups"] = empty($group_list) ? "" : substr($group_list, 0, -1);
             $i++;
         }
     }
     self::log_debug("Checking to see if {$email} is already on the list");
     $member_info = $api->listMemberInfo($feed["meta"]["contact_list_id"], $email);
     if (absint($member_info["errors"]) > 0 || rgar($member_info["data"][0], "status") != "subscribed") {
         $allow_resubscription = apply_filters('gform_mailchimp_allow_resubscription', apply_filters("gform_mailchimp_allow_resubscription_{$form['id']}", true, $form, $entry, $feed), $form, $entry, $feed);
         if (rgar($member_info["data"][0], "status") == "unsubscribed" && !$allow_resubscription) {
             self::log_debug("User is unsubscribed and resubscription is not allowed.");
             return true;
         }
         //adding member to list, statuses of rgar($member_info["data"][0], "status") != "subscribed", pending, cleaned need to be "re-subscribed" to send out confirmation email
         self::log_debug("{$email} is either not on the list or on the list but the status is not subscribed - status: " . rgar($member_info["data"][0], "status") . "; adding to list");
         self::log_debug("Calling - listSubscribe, Parameters - List ID: " . $feed["meta"]["contact_list_id"] . ", Email: {$email}, " . " Merge_Vars: " . print_r($merge_vars, true) . ", Email Type: html, Double Opt In: {$double_optin}, Update Existing: false, Replace Interests: true, Send Welcome: {$send_welcome}");
         $retval = $api->listSubscribe($feed["meta"]["contact_list_id"], $email, $merge_vars, "html", $double_optin, false, true, $send_welcome);
     } else {
         //updating member
         self::log_debug("{$email} is already on the list; updating info");
         //retrieve existing groups for subscribers; add existing groups to selected groups from form so that existing groups are maintained for that subscriber
         $current_groups = $member_info["data"][0]["merges"]["GROUPINGS"];
         $keep_existing_groups = apply_filters("gform_mailchimp_keep_existing_groups_{$form["id"]}", apply_filters("gform_mailchimp_keep_existing_groups", true, $form, $entry, $feed), $form, $entry, $feed);
         if (is_array($current_groups) && $keep_existing_groups) {
             self::log_debug("Appending existing groups.");
             $merge_vars = self::append_groups($merge_vars, $current_groups);
         }
         self::log_debug("Calling - listUpdateMember, Parameters - List ID: " . $feed["meta"]["contact_list_id"] . ", Email: {$email}, " . " Merge_Vars: " . print_r($merge_vars, true) . ", Email Type: html, Replace Interests: true");
         $retval = $api->listUpdateMember($feed["meta"]["contact_list_id"], $email, $merge_vars, "html", true);
     }
     //listSubscribe and listUpdateMember return true/false
     if ($retval) {
         self::log_debug("Transaction successful");
     } else {
         self::log_error("Transaction failed. Error " . $api->errorCode . " - " . $api->errorMessage);
     }
//.........这里部分代码省略.........
开发者ID:simgooder,项目名称:blaycation,代码行数:101,代码来源:mailchimp.php

示例15: select_columns_page


//.........这里部分代码省略.........
</p>
			</div>
			<div class="clear"></div>
			<div class="gcolumn_wrapper">
				<div class="gcolumn_container_left">
					<div class="gform_select_column_heading"><?php 
        esc_html_e("Visible Columns", "gravity-forms-addons");
        ?>
</div>
					<ul id="sortable_selected" class="sortable_connected">
						<?php 
        foreach ($columns as $field_id => $field_info) {
            ?>
							<li id="<?php 
            echo $field_id;
            ?>
"><?php 
            echo esc_html($field_info["label"]);
            ?>
</li>
							<?php 
        }
        ?>
					</ul>
				</div>

				<div class="column-arrow-mid"></div>

				<div class="gcolumn_container_right" id="available_column">
					<div class="gform_select_column_heading"> <?php 
        esc_html_e("Hidden Columns", "gravity-forms-addons");
        ?>
</div>
					<ul id="sortable_available" class="sortable_connected">
						<?php 
        $approvedcolumn = GFDirectory::get_approved_column($form);
        foreach ($form["fields"] as $field) {
            if (in_array(RGFormsModel::get_input_type($field), array("checkbox", 'address', 'radio', 'name')) && !in_array($field["id"], $field_ids) && floatval($field['id']) !== floor(floatval($approvedcolumn))) {
                ?>
								<li id="<?php 
                echo $field["id"];
                ?>
"><?php 
                echo esc_html(rgar($field, "label"));
                ?>
</li>
								<?php 
            }
            if (is_array(rgar($field, "inputs"))) {
                foreach ($field["inputs"] as $input) {
                    if (!in_array($input["id"], $field_ids) && !($field["type"] == "creditcard" && in_array($input["id"], array(floatval("{$field["id"]}.2"), floatval("{$field["id"]}.3"))))) {
                        ?>
										<li id="<?php 
                        echo $input["id"];
                        ?>
"><?php 
                        echo esc_html(GFDirectory::get_label($field, $input["id"]));
                        ?>
 <span class="description">(<?php 
                        echo esc_html(rgar($field, "label"));
                        ?>
)</span></li>
										<?php 
                    }
                }
            } else {
                if (!rgar($field, "displayOnly") && !in_array($field["id"], $field_ids)) {
                    ?>
								<li id="<?php 
                    echo $field["id"];
                    ?>
"><?php 
                    echo esc_html($field["label"]);
                    ?>
</li>
								<?php 
                }
            }
        }
        ?>
					</ul>
				</div>
			</div>

			<div class="panel-buttons">
				<input type="button" value="<?php 
        esc_attr_e("Save", "gravity-forms-addons");
        ?>
  " class="button-primary" onclick="SelectColumns();"/>&nbsp;
				<input type="button" value="<?php 
        esc_html_e("Cancel", "gravity-forms-addons");
        ?>
" class="button" onclick="self.parent.tb_remove();"/>
			</div>
		</div>
		</body>
	</html>

	<?php 
    }
开发者ID:healthcommcore,项目名称:osnap,代码行数:101,代码来源:select_directory_columns.php


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