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


PHP GFCommon::get_fields_by_type方法代码示例

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


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

示例1: has_docs_field

 /**
  * Check if the form has a text field with a Custom CSS Class that contains 'helpscout-docs'
  *
  * @param array $form
  *
  * @return bool True: yes, it does. False: nope.
  */
 private function has_docs_field($form)
 {
     $text_fields = GFCommon::get_fields_by_type($form, 'text');
     foreach ($text_fields as $text_field) {
         if (strpos(rgar($text_field, 'cssClass'), self::field_css_class) !== false) {
             return true;
         }
     }
     return false;
 }
开发者ID:easydigitaldownloads,项目名称:gravity-forms-help-scout-search,代码行数:17,代码来源:gravity-forms-help-scout-search.php

示例2: GFUEA_custom_notification_attachments

function GFUEA_custom_notification_attachments($notification, $form, $entry)
{
    $log = 'rw_notification_attachments() - ';
    GFCommon::log_debug($log . 'starting.');
    #    mail("greg@wpcms.ninja","Notification Fire" . date("Y-m-d h:i:s"), print_r($notification, true) . print_r($form,true) . print_r($entry,true));
    if (substr($notification["name"], -5) == "GFUEA") {
        //mail("greg@wpcms.ninja","Notification Fire" . date("Y-m-d h:i:s"), print_r($notification, true) . print_r($form,true) . print_r($entry,true));
        $fileupload_fields = GFCommon::get_fields_by_type($form, array('fileupload'));
        if (!is_array($fileupload_fields)) {
            return $notification;
        }
        $attachments = array();
        $upload_root = RGFormsModel::get_upload_root();
        foreach ($fileupload_fields as $field) {
            $url = $entry[$field['id']];
            if (empty($url)) {
                continue;
            } elseif ($field['multipleFiles']) {
                $uploaded_files = json_decode(stripslashes($url), true);
                $zip = new ZipArchive();
                //$filetext = date("Y-m-d his");
                $filename = $upload_root . "/uploaded_files" . $entry['id'] . ".zip";
                if ($zip->open($filename, ZipArchive::CREATE) !== TRUE) {
                    foreach ($uploaded_files as $uploaded_file) {
                        $attachment = preg_replace('|^(.*?)/gravity_forms/|', $upload_root, $uploaded_file);
                        GFCommon::log_debug($log . 'attaching the file: ' . print_r($attachment, true));
                        $attachments[] = $attachment;
                    }
                } else {
                    foreach ($uploaded_files as $uploaded_file) {
                        $attachment = preg_replace('|^(.*?)/gravity_forms/|', $upload_root, $uploaded_file);
                        GFCommon::log_debug($log . 'attaching the file: ' . print_r($attachment, true));
                        $new_filename = substr($attachment, strrpos($attachment, '/') + 1);
                        $zip->addFile($attachment, $new_filename);
                        //$attachments[] = $attachment;
                    }
                    $zip->close();
                    $attachments[] = $filename;
                    add_filter('gform_confirmation', 'gfuea_clean_zips', 10, 4);
                }
            } else {
                $attachment = preg_replace('|^(.*?)/gravity_forms/|', $upload_root, $url);
                GFCommon::log_debug($log . 'attaching the file: ' . print_r($attachment, true));
                $attachments[] = $attachment;
            }
        }
        $notification['attachments'] = $attachments;
    }
    //mail("greg@wpcms.ninja","Notification Fire" . date("Y-m-d h:i:s"), "Attach IDs:\n" . print_r($attachIds, true) . "\nNotification:\n" . print_r($notification, true) . "\nForm:\n" .print_r($form,true) . "\nEntry:\n" .print_r($entry,true));
    GFCommon::log_debug($log . 'stopping.');
    return $notification;
}
开发者ID:WPCMSNinja,项目名称:gf-upload-to-email-attachment,代码行数:52,代码来源:gf-upload-to-email-attachment.php

示例3: pre_render_frontend

 /**
  * @inheritDoc
  *
  * @since 1.8
  */
 public function pre_render_frontend()
 {
     if (!class_exists('GFPolls')) {
         $return = false;
         do_action('gravityview_log_error', 'Poll Widget not displayed; the Poll Addon is not loaded');
     } else {
         $return = parent::pre_render_frontend();
         $poll_fields = GFCommon::get_fields_by_type(GravityView_View::getInstance()->getForm(), array('poll'));
         if (empty($poll_fields)) {
             do_action('gravityview_log_error', 'Poll Widget not displayed; there are no poll fields for the form');
             $return = false;
         }
     }
     return $return;
 }
开发者ID:psdes,项目名称:GravityView,代码行数:20,代码来源:class-gravityview-widget-poll.php

示例4: has_multifile_fileupload_field

 public static function has_multifile_fileupload_field($form)
 {
     $fileupload_fields = GFCommon::get_fields_by_type($form, array('fileupload', 'post_custom_field'));
     if (is_array($fileupload_fields)) {
         foreach ($fileupload_fields as $field) {
             if ($field->multipleFiles) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:12,代码来源:common.php

示例5: delete_passwords

 public static function delete_passwords($entry, $form)
 {
     $password_fields = GFCommon::get_fields_by_type($form, array('password'));
     foreach ($password_fields as $password_field) {
         GFAPI::update_entry_field($entry['id'], $password_field['id'], '');
     }
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:7,代码来源:class-gf-field-password.php

示例6: _field_condition_matches

 private function _field_condition_matches($field_types, $form)
 {
     if (!is_array($field_types)) {
         $field_types = array($field_types);
     }
     $fields = GFCommon::get_fields_by_type($form, $field_types);
     if (count($fields) > 0) {
         return true;
     }
     return false;
 }
开发者ID:BisongT,项目名称:Myevent_website,代码行数:11,代码来源:class-gf-addon.php

示例7: get_coupon_field

 /**
  * Retrieves the coupon field object or false.
  *
  * @param array $form The form object currently being processed.
  *
  * @return object|false
  */
 public function get_coupon_field($form)
 {
     $coupons = GFCommon::get_fields_by_type($form, array('coupon'));
     return count($coupons) > 0 ? $coupons[0] : false;
 }
开发者ID:wp-premium,项目名称:gravityformscoupons,代码行数:12,代码来源:class-gf-coupons.php

示例8: get_akismet_field

 private static function get_akismet_field($field_type, $form, $lead)
 {
     $fields = GFCommon::get_fields_by_type($form, array($field_type));
     if (empty($fields)) {
         return "";
     }
     $value = RGFormsModel::get_lead_field_value($lead, $fields[0]);
     switch ($field_type) {
         case "name":
             $value = GFCommon::get_lead_field_display($fields[0], $value);
             break;
     }
     return $value;
 }
开发者ID:ipman3,项目名称:Mediassociates-wp,代码行数:14,代码来源:common.php

示例9: delete_password

 public static function delete_password($entry, $form)
 {
     $password_fields = GFCommon::get_fields_by_type($form, array('password'));
     if (empty($password_fields)) {
         return;
     }
     $field_ids = array();
     foreach ($password_fields as $password_field) {
         $field_ids[] = $password_field['id'];
     }
     $field_id_list = implode(',', $field_ids);
     global $wpdb;
     $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}rg_lead_detail\n\t\t\t\t\t\t\t\t\t WHERE lead_id = %d AND form_id = %d\n\t\t\t\t\t\t\t\t\t AND CAST(field_number as DECIMAL(4,2)) IN ({$field_id_list})", $entry['id'], $form['id']));
 }
开发者ID:BisongT,项目名称:Myevent_website,代码行数:14,代码来源:forms_model.php

示例10: display_confirmation

 public function display_confirmation($confirmation, $form, $lead, $ajax)
 {
     $poll_fields = GFCommon::get_fields_by_type($form, array('poll'));
     $display_confirmation = false;
     $display_results = false;
     if (empty($poll_fields)) {
         return $confirmation;
     }
     $form_id = $form['id'];
     $override = false;
     $field_values = array();
     if (isset($_POST['gform_field_values'])) {
         $field_values = wp_parse_args($_POST['gform_field_values']);
     }
     // shortcode attributes override form settings
     if (rgar($field_values, 'gpoll_enabled') == '1') {
         $field_values = wp_parse_args($_POST['gform_field_values']);
         $show_results_link = rgar($field_values, 'gpoll_show_results_link');
         $show_results_link = $show_results_link == '1' ? true : false;
         $style = rgar($field_values, 'gpoll_style');
         $percentages = rgar($field_values, 'gpoll_percentages');
         $percentages = $percentages == '1' ? true : false;
         $counts = rgar($field_values, 'gpoll_counts');
         $counts = $counts == '1' ? true : false;
         $cookie = rgar($field_values, 'gpoll_cookie');
         $display_results = rgar($field_values, 'gpoll_display_results');
         $display_results = $display_results == '1' ? true : false;
         $display_confirmation = rgar($field_values, 'gpoll_confirmation');
         $display_confirmation = $display_confirmation == '1' ? true : false;
         $checksum = rgar($field_values, 'gpoll_checksum');
         if ($checksum == $this->generate_checksum($display_results, $show_results_link, $cookie, $display_confirmation, $percentages, $counts, $style)) {
             $override = true;
         }
     }
     if (false === $override) {
         $style = $this->get_form_setting($form, 'style');
         $percentages = $this->get_form_setting($form, 'showPercentages');
         $counts = $this->get_form_setting($form, 'showCounts');
         $display_results = $this->get_form_setting($form, 'displayResults');
         $display_confirmation = true;
     }
     $submitted_fields = array();
     foreach ($poll_fields as $field) {
         $field_id = $field['id'];
         $entry_value = RGFormsModel::get_lead_field_value($lead, $field);
         if (is_array($entry_value)) {
             $entry_value = implode('', $entry_value);
         }
         if (false === empty($entry_value)) {
             $submitted_fields[] = $field_id;
         }
     }
     if ($display_confirmation && $display_results) {
         //confirmation message plus results
         //override in the case of headers already sent or ajax = true
         if (is_array($confirmation) && array_key_exists('redirect', $confirmation)) {
             $confirmation = '';
         }
         //override confirmation if it's a redirect
         $str_pos = strpos($confirmation, 'gformRedirect');
         if (false !== $str_pos) {
             $confirmation = '';
         }
         $has_confirmation_wrapper = false !== strpos($confirmation, 'gform_confirmation_wrapper') ? true : false;
         if ($has_confirmation_wrapper) {
             $confirmation = substr($confirmation, 0, strlen($confirmation) - 6);
         }
         //remove the closing div of the wrapper
         $has_confirmation_message = false !== strpos($confirmation, 'gforms_confirmation_message') ? true : false;
         if ($has_confirmation_message) {
             $confirmation = substr($confirmation, 0, strlen($confirmation) - 6);
         } else {
             $confirmation .= "<div id='gforms_confirmation_message' class='gform_confirmation_message_{$form_id}'>";
         }
         $results = $this->gpoll_get_results($form['id'], $submitted_fields, $style, $percentages, $counts, $lead);
         $confirmation .= $results['summary'] . '</div>';
         if ($has_confirmation_wrapper) {
             $confirmation .= '</div>';
         }
     } elseif (!$display_confirmation && $display_results) {
         //only the results without the confirmation message
         $results = $this->gpoll_get_results($form['id'], $submitted_fields, $style, $percentages, $counts, $lead);
         $results_summary = $results['summary'];
         $confirmation = sprintf("<div id='gforms_confirmation_message' class='gform_confirmation_message_{$form_id}'>%s</div>", $results_summary);
     } elseif (!$display_confirmation && !$display_results) {
         $confirmation = "<div id='gforms_confirmation_message' class='gform_confirmation_message_{$form_id}'></div>";
     }
     return $confirmation;
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:89,代码来源:polls.php

示例11: has_price_field

 private static function has_price_field($form){
     $price_fields = GFCommon::get_fields_by_type($form, array("product", "donation"));
     return !empty($price_fields);
 }
开发者ID:bmontague,项目名称:sct,代码行数:4,代码来源:form_display.php

示例12: add_merge_tags

    public function add_merge_tags($form)
    {
        $survey_fields = GFCommon::get_fields_by_type($form, array('survey'));
        if (empty($survey_fields)) {
            return $form;
        }
        $scoring_enabled = false;
        $merge_tags = array();
        foreach ($form['fields'] as $field) {
            $type = GFFormsModel::get_input_type($field);
            if ('likert' == $type && rgar($field, 'gsurveyLikertEnableScoring')) {
                $scoring_enabled = true;
                $field_id = $field['id'];
                $field_label = $field['label'];
                $group = rgar($field, 'isRequired') ? 'required' : 'optional';
                $merge_tags[] = array('group' => $group, 'label' => 'Survey Field Score: ' . $field_label, 'tag' => "{score:id={$field_id}}");
            }
        }
        if ($scoring_enabled) {
            $merge_tags[] = array('group' => 'other', 'label' => 'Survey Total Score', 'tag' => '{survey_total_score}');
        }
        ?>
		<script type="text/javascript">
			if (window.gform)
				gform.addFilter("gform_merge_tags", "gsurvey_add_merge_tags");
			function gsurvey_add_merge_tags(mergeTags, elementId, hideAllFields, excludeFieldTypes, isPrepop, option) {
				if (isPrepop)
					return mergeTags;
				var customMergeTags = <?php 
        echo json_encode($merge_tags);
        ?>
;
				jQuery.each(customMergeTags, function (i, customMergeTag) {
					mergeTags[customMergeTag.group].tags.push({ tag: customMergeTag.tag, label: customMergeTag.label });
				});

				return mergeTags;
			}
		</script>
		<?php 
        //return the form object from the php hook
        return $form;
    }
开发者ID:qhuit,项目名称:dcosta,代码行数:43,代码来源:class-gf-survey.php

示例13: fileupload_fields_for_feed_setting

 /**
  * Get file upload fields for feed settings field.
  * 
  * @access public
  * @return array $choices
  */
 public function fileupload_fields_for_feed_setting()
 {
     /* Setup choices array. */
     $choices = array();
     /* Get the form file fields. */
     $form = GFAPI::get_form(rgget('id'));
     $file_fields = GFCommon::get_fields_by_type($form, array('fileupload'));
     if (!empty($file_fields)) {
         foreach ($file_fields as $field) {
             $choices[] = array('name' => 'attachments[' . $field->id . ']', 'label' => $field->label, 'default_value' => 0);
         }
     }
     return $choices;
 }
开发者ID:amprog,项目名称:gravity-forms-slack,代码行数:20,代码来源:class-gf-slack.php

示例14: get_credit_card

 public function get_credit_card()
 {
     $credit_card = null;
     $credit_card_fields = GFCommon::get_fields_by_type($this->form, array('creditcard'));
     $credit_card_field = array_shift($credit_card_fields);
     if ($credit_card_field) {
         $credit_card = new Pronamic_Pay_CreditCard();
         // Number
         $variable_name = sprintf('input_%s_1', $credit_card_field['id']);
         $number = filter_input(INPUT_POST, $variable_name, FILTER_SANITIZE_STRING);
         $credit_card->set_number($number);
         // Expiration date
         $variable_name = sprintf('input_%s_2', $credit_card_field['id']);
         $expiration_date = filter_input(INPUT_POST, $variable_name, FILTER_VALIDATE_INT, FILTER_FORCE_ARRAY);
         $month = array_shift($expiration_date);
         $year = array_shift($expiration_date);
         $credit_card->set_expiration_month($month);
         $credit_card->set_expiration_year($year);
         // Security code
         $variable_name = sprintf('input_%s_3', $credit_card_field['id']);
         $security_code = filter_input(INPUT_POST, $variable_name, FILTER_SANITIZE_STRING);
         $credit_card->set_security_code($security_code);
         // Name
         $variable_name = sprintf('input_%s_5', $credit_card_field['id']);
         $name = filter_input(INPUT_POST, $variable_name, FILTER_SANITIZE_STRING);
         $credit_card->set_name($name);
     }
     return $credit_card;
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:29,代码来源:PaymentData.php

示例15: has_pricing_field

 public static function has_pricing_field($form)
 {
     $fields = GFCommon::get_fields_by_type($form, array("product"));
     return count($fields) > 0;
 }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:5,代码来源:freshbooks.php


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