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


PHP RGFormsModel::get_lead方法代码示例

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


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

示例1: lpop_gform_get_entry

function lpop_gform_get_entry($attrs)
{
    /* Parse the id */
    $entry = RGFormsModel::get_lead(1);
    $form = GFFormsModel::get_form_meta($entry['form_id']);
    LPOP_Logger::logit("Loading Mini Audits: Form =  " . $form['title'] . ", Entry = " . $entry['id']);
    LPOP_Mini_Audits::process_mini_audit_entry($entry);
    LPOP_Logger::flush();
}
开发者ID:rustyeddy,项目名称:sandbox,代码行数:9,代码来源:gforms-support.php

示例2: 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

示例3: maybe_redirect_to_entry

 /**
  * Maybed redirect to Gravity Forms entry
  */
 public static function maybe_redirect_to_entry()
 {
     if (filter_has_var(INPUT_GET, 'pronamic_gf_lid')) {
         $lead_id = filter_input(INPUT_GET, 'pronamic_gf_lid', FILTER_SANITIZE_STRING);
         $lead = RGFormsModel::get_lead($lead_id);
         if (!empty($lead)) {
             $url = add_query_arg(array('page' => 'gf_entries', 'view' => 'entry', 'id' => $lead['form_id'], 'lid' => $lead_id), admin_url('admin.php'));
             wp_redirect($url);
             exit;
         }
     }
 }
开发者ID:wp-pay-extensions,项目名称:gravityforms,代码行数:15,代码来源:Admin.php

示例4: save

 /**
  * Save the order and return the order id
  *
  * If the order is new, then save all the order items and manage the inventory.
  * If the order already exists, only the order data is updated. The order items and inventory
  * remain unchanged.
  *
  * @return int The order id (primary key form database)
  */
 public function save()
 {
     // If the order is already in the database, only save the order data, not the ordered items or anything else
     if ($this->id > 0) {
         //prevent null values from being inserted
         foreach ($this->_data as $key => $value) {
             $this->_data[$key] = is_null($value) ? '' : $value;
         }
         $this->_db->update($this->_tableName, $this->_data, array('id' => $this->id));
     } else {
         // This is a new order so save the order items and deduct from inventory if necessary
         $this->_orderInfo['ouid'] = md5($this->_orderInfo['trans_id'] . $this->_orderInfo['bill_address']);
         //prevent null values from being inserted
         foreach ($this->_orderInfo as $key => $value) {
             $this->_orderInfo[$key] = is_null($value) ? '' : $value;
         }
         $this->_db->insert($this->_tableName, $this->_orderInfo);
         $this->id = $this->_db->insert_id;
         if ($this->id == 0 || empty($this->id)) {
             throw new Cart66Exception('The order was not saved.');
             return false;
         }
         $key = $this->_orderInfo['trans_id'] . '-' . $this->id . '-';
         foreach ($this->_items as $item) {
             // Deduct from inventory
             Cart66Product::decrementInventory($item->getProductId(), $item->getOptionInfo(), $item->getQuantity());
             $data = array('order_id' => $this->id, 'product_id' => $item->getProductId(), 'product_price' => $item->getProductPrice(), 'item_number' => $item->getItemNumber(), 'description' => $item->getFullDisplayName(), 'quantity' => $item->getQuantity(), 'duid' => md5($key . $item->getProductId()));
             $formEntryIds = '';
             $fIds = $item->getFormEntryIds();
             if (is_array($fIds) && count($fIds)) {
                 foreach ($fIds as $entryId) {
                     if (class_exists('RGFormsModel')) {
                         if ($lead = RGFormsModel::get_lead($entryId)) {
                             $lead['status'] = 'active';
                             RGFormsModel::update_lead($lead);
                         }
                     }
                 }
                 $formEntryIds = implode(',', $fIds);
             }
             $data['form_entry_ids'] = $formEntryIds;
             if ($item->getCustomFieldInfo()) {
                 $data['description'] .= "\n" . $item->getCustomFieldDesc() . ":\n" . $item->getCustomFieldInfo();
             }
             $orderItems = Cart66Common::getTableName('order_items');
             $this->_db->insert($orderItems, $data);
             $orderItemId = $this->_db->insert_id;
             Cart66Common::log("Saved order item ({$orderItemId}): " . $data['description'] . "\nSQL: " . $this->_db->last_query);
         }
     }
     return $this->id;
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:61,代码来源:Cart66Order.php

示例5: process_ipn

 public static function process_ipn($wp)
 {
     //Ignore requests that are not IPN
     if (RGForms::get("page") != "gf_paypal_ipn") {
         return;
     }
     if (!isset(self::$log)) {
         self::$log = self::create_logger();
     }
     self::$log->LogDebug("IPN request received. Starting to process...");
     self::$log->LogDebug(print_r($_POST, true));
     //Send request to paypal and verify it has not been spoofed
     if (!self::verify_paypal_ipn()) {
         self::$log->LogError("IPN request could not be verified by PayPal. Aborting.");
         return;
     }
     self::$log->LogDebug("IPN message successfully verified by PayPal");
     //Valid IPN requests must have a custom field
     $custom = RGForms::post("custom");
     if (empty($custom)) {
         self::$log->LogError("IPN request does not have a custom field, so it was not created by Gravity Forms. Aborting.");
         return;
     }
     //Getting entry associated with this IPN message (entry id is sent in the "custom" field)
     list($entry_id, $hash) = explode("|", $custom);
     $hash_matches = wp_hash($entry_id) == $hash;
     //Validates that Entry Id wasn't tampered with
     if (!RGForms::post("test_ipn") && !$hash_matches) {
         self::$log->LogError("Entry Id verification failed. Hash does not match. Custom field: {$custom}. Aborting.");
         return;
     }
     self::$log->LogDebug("IPN message has a valid custom field: {$custom}");
     //$entry_id = RGForms::post("custom");
     $entry = RGFormsModel::get_lead($entry_id);
     //Ignore orphan IPN messages (ones without an entry)
     if (!$entry) {
         self::$log->LogError("Entry could not be found. Entry ID: {$entry_id}. Aborting.");
         return;
     }
     self::$log->LogDebug("Entry has been found." . print_r($entry, true));
     $config = self::get_config($entry["form_id"]);
     //Ignore IPN messages from forms that are no longer configured with the PayPal add-on
     if (!$config) {
         self::$log->LogError("Form no longer is configured with PayPal Addon. Form ID: {$entry["form_id"]}. Aborting.");
         return;
     }
     self::$log->LogDebug("Form {$entry["form_id"]} is properly configured.");
     //Only process test messages coming fron SandBox and only process production messages coming from production PayPal
     if ($config["meta"]["mode"] == "test" && !RGForms::post("test_ipn") || $config["meta"]["mode"] == "production" && RGForms::post("test_ipn")) {
         self::$log->LogError("Invalid test/production mode. IPN message mode (test/production) does not match mode configured in the PayPal feed. Configured Mode: {$config["meta"]["mode"]}. IPN test mode: " . RGForms::post("test_ipn"));
         return;
     }
     //Check business email to make sure it matches
     if (strtolower(trim($_POST["business"])) != strtolower(trim($config["meta"]["email"]))) {
         self::$log->LogError("PayPal email does not match. Configured email:" . strtolower(trim($config["meta"]["email"])) . " - Email from IPN message: " . strtolower(trim($_POST["business"])));
         return;
     }
     //Pre IPN processing filter. Allows users to cancel IPN processing
     $cancel = apply_filters("gform_paypal_pre_ipn", false, $_POST, $entry, $config);
     if (!$cancel) {
         self::$log->LogDebug("Setting payment status...");
         self::set_payment_status($config, $entry, RGForms::post("payment_status"), RGForms::post("txn_type"), RGForms::post("txn_id"), RGForms::post("parent_txn_id"), RGForms::post("subscr_id"), RGForms::post("mc_gross"), RGForms::post("pending_reason"), RGForms::post("reason_code"));
     } else {
         self::$log->LogDebug("IPN processing cancelled by the gform_paypal_pre_ipn filter. Aborting.");
     }
     self::$log->LogDebug("Before gform_paypal_post_ipn.");
     //Post IPN processing action
     do_action("gform_paypal_post_ipn", $_POST, $entry, $config, $cancel);
     self::$log->LogDebug("IPN processing complete.");
 }
开发者ID:hscale,项目名称:webento,代码行数:70,代码来源:paypal.php

示例6: resend_notifications

 public static function resend_notifications()
 {
     check_admin_referer('gf_resend_notifications', 'gf_resend_notifications');
     $leads = rgpost('leadIds');
     // may be a single ID or an array of IDs
     $leads = !is_array($leads) ? array($leads) : $leads;
     $form = RGFormsModel::get_form_meta(rgpost('formId'));
     if (empty($leads) || empty($form)) {
         _e("There was an error while resending the notifications.", "gravityforms");
         die;
     }
     $send_admin = rgpost('sendAdmin');
     $send_user = rgpost('sendUser');
     $override_options = array();
     $validation_errors = array();
     if (rgpost('sendTo')) {
         if (rgpost('sendTo') && GFCommon::is_invalid_or_empty_email(rgpost('sendTo'))) {
             $validation_errors[] = __("The <strong>Send To</strong> email address provided is not valid.", "gravityforms");
         }
         if (!empty($validation_errors)) {
             echo count($validation_errors) > 1 ? '<ul><li>' . implode('</li><li>', $validation_errors) . '</li></ul>' : $validation_errors[0];
             die;
         }
         $override_options['to'] = rgpost('sendTo');
         $override_options['bcc'] = '';
         // overwrite bcc settings
     }
     foreach ($leads as $lead_id) {
         $lead = RGFormsModel::get_lead($lead_id);
         if ($send_admin) {
             GFCommon::send_admin_notification($form, $lead, $override_options);
         }
         if ($send_user) {
             GFCommon::send_user_notification($form, $lead, $override_options);
         }
     }
     die;
 }
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:38,代码来源:gravityforms.php

示例7: get_value_save_entry

 public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead)
 {
     $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
     $value = GFCommon::get_order_total($form, $lead);
     return $value;
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:6,代码来源:class-gf-field-total.php

示例8: foreach

			text-align: ;  page-break-after:avoid; }
		h6 {	font-weight: bold; font-size: 9.5pt; color: #333333; 
			font-family: DejaVuSansCondensed; margin-top: 6pt; margin-bottom: ; 
			text-align: ;  page-break-after:avoid; }




</style>
    <title>Gravity Forms PDF Extended</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
	<body>
        <?php 
foreach ($lead_ids as $lead_id) {
    $lead = RGFormsModel::get_lead($lead_id);
    do_action("gform_print_entry_header", $form, $lead);
    $form_data = GFPDFEntryDetail::lead_detail_grid_array($form, $lead);
    /*
     * Add &data=1 when viewing the PDF via the admin area to view the $form_data array
     */
    PDF_Common::view_data($form_data);
    /* get all the form values */
    /*$date_created		= $form_data['date_created'];
    
    			$first_name 		= $form_data['1.Name']['first'];
    			$last_name 			= $form_data['1.Name']['last'];*/
    //echo print_r($form_data['field'], true);
    $fundName = $form_data['field']['Fund Name'];
    $trusteeType = $form_data['field']['Trustee Type'];
    $attendedBy = "";
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:inv-strategy.php

示例9: handle_submission

 public static function handle_submission($form, &$lead, $ajax = false)
 {
     //creating entry in DB
     RGFormsModel::save_lead($form, $lead);
     //reading entry that was just saved
     $lead = RGFormsModel::get_lead($lead["id"]);
     $lead = GFFormsModel::set_entry_meta($lead, $form);
     do_action('gform_entry_created', $lead, $form);
     //if Akismet plugin is installed, run lead through Akismet and mark it as Spam when appropriate
     $is_spam = false;
     if (GFCommon::akismet_enabled($form['id']) && GFCommon::is_akismet_spam($form, $lead)) {
         $is_spam = true;
     }
     if (!$is_spam) {
         GFCommon::create_post($form, $lead);
         //send auto-responder and notification emails
         self::send_emails($form, $lead);
     } else {
         //marking entry as spam
         RGFormsModel::update_lead_property($lead["id"], "status", "spam", false, true);
         $lead["status"] = "spam";
     }
     //display confirmation message or redirect to confirmation page
     return self::handle_confirmation($form, $lead, $ajax);
 }
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:25,代码来源:form_display.php

示例10: update_entry_status

 public function update_entry_status($lead_id)
 {
     $lead = RGFormsModel::get_lead($lead_id);
     $form_id = $lead["form_id"];
     $form = GFFormsModel::get_form_meta($form_id);
     $this->maybe_update_results_cache_meta($form);
 }
开发者ID:tlandn,项目名称:akvo-web,代码行数:7,代码来源:webapi.php

示例11: lead_detail_page

    public static function lead_detail_page()
    {
        global $wpdb;
        global $current_user;
        if (!GFCommon::ensure_wp_version()) {
            return;
        }
        echo GFCommon::get_remote_message();
        $form = RGFormsModel::get_form_meta($_GET["id"]);
        $form_id = $form["id"];
        $form = apply_filters("gform_admin_pre_render_" . $form["id"], apply_filters("gform_admin_pre_render", $form));
        $lead_id = rgget('lid');
        $filter = rgget("filter");
        $status = in_array($filter, array("trash", "spam")) ? $filter : "active";
        $position = rgget('pos') ? rgget('pos') : 0;
        $sort_direction = rgget('dir') ? rgget('dir') : 'DESC';
        $sort_field = empty($_GET["sort"]) ? 0 : $_GET["sort"];
        $sort_field_meta = RGFormsModel::get_field($form, $sort_field);
        $is_numeric = $sort_field_meta["type"] == "number";
        $star = $filter == "star" ? 1 : null;
        $read = $filter == "unread" ? 0 : null;
        $search_criteria["status"] = $status;
        if ($star) {
            $search_criteria["field_filters"][] = array("key" => "is_starred", "value" => (bool) $star);
        }
        if (!is_null($read)) {
            $search_criteria["field_filters"][] = array("key" => "is_read", "value" => (bool) $read);
        }
        $search_field_id = rgget("field_id");
        if (isset($_GET["field_id"]) && $_GET["field_id"] !== '') {
            $key = $search_field_id;
            $val = rgget("s");
            $strpos_row_key = strpos($search_field_id, "|");
            if ($strpos_row_key !== false) {
                //multi-row likert
                $key_array = explode("|", $search_field_id);
                $key = $key_array[0];
                $val = $key_array[1] . ":" . $val;
            }
            $type = rgget("type");
            if (empty($type)) {
                $type = rgget("field_id") == "0" ? "global" : "field";
            }
            $search_criteria["field_filters"][] = array("key" => $key, "type" => $type, "operator" => rgempty("operator", $_GET) ? "is" : rgget("operator"), "value" => $val);
        }
        $paging = array('offset' => $position, 'page_size' => 1);
        if (!empty($sort_field)) {
            $sorting = array('key' => $_GET["sort"], 'direction' => $sort_direction, 'is_numeric' => $is_numeric);
        } else {
            $sorting = array();
        }
        $total_count = 0;
        $leads = GFAPI::get_entries($form['id'], $search_criteria, $sorting, $paging, $total_count);
        $prev_pos = !rgblank($position) && $position > 0 ? $position - 1 : false;
        $next_pos = !rgblank($position) && $position < $total_count - 1 ? $position + 1 : false;
        // unread filter requires special handling for pagination since entries are filter out of the query as they are read
        if ($filter == 'unread') {
            $next_pos = $position;
            if ($next_pos + 1 == $total_count) {
                $next_pos = false;
            }
        }
        if (!$lead_id) {
            $lead = !empty($leads) ? $leads[0] : false;
        } else {
            $lead = GFAPI::get_entry($lead_id);
        }
        if (!$lead) {
            _e("Oops! We couldn't find your entry. Please try again", "gravityforms");
            return;
        }
        RGFormsModel::update_lead_property($lead["id"], "is_read", 1);
        switch (RGForms::post("action")) {
            case "update":
                check_admin_referer('gforms_save_entry', 'gforms_save_entry');
                //Loading files that have been uploaded to temp folder
                $files = GFCommon::json_decode(stripslashes(RGForms::post("gform_uploaded_files")));
                if (!is_array($files)) {
                    $files = array();
                }
                GFFormsModel::$uploaded_files[$form_id] = $files;
                GFFormsModel::save_lead($form, $lead);
                do_action("gform_after_update_entry", $form, $lead["id"]);
                do_action("gform_after_update_entry_{$form["id"]}", $form, $lead["id"]);
                $lead = RGFormsModel::get_lead($lead["id"]);
                $lead = GFFormsModel::set_entry_meta($lead, $form);
                break;
            case "add_note":
                check_admin_referer('gforms_update_note', 'gforms_update_note');
                $user_data = get_userdata($current_user->ID);
                RGFormsModel::add_note($lead["id"], $current_user->ID, $user_data->display_name, stripslashes($_POST["new_note"]));
                //emailing notes if configured
                if (rgpost("gentry_email_notes_to")) {
                    $email_to = $_POST["gentry_email_notes_to"];
                    $email_from = $current_user->user_email;
                    $email_subject = stripslashes($_POST["gentry_email_subject"]);
                    $headers = "From: \"{$email_from}\" <{$email_from}> \r\n";
                    $result = wp_mail($email_to, $email_subject, stripslashes($_POST["new_note"]), $headers);
                }
                break;
//.........这里部分代码省略.........
开发者ID:JSpier,项目名称:smacamp,代码行数:101,代码来源:entry_detail.php

示例12: after_update

 /**
  * Perform actions normally performed after updating a lead
  *
  * @since 1.8
  *
  * @see GFEntryDetail::lead_detail_page()
  *
  * @return void
  */
 function after_update()
 {
     do_action('gform_after_update_entry', $this->form, $this->entry['id']);
     do_action("gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id']);
     // Re-define the entry now that we've updated it.
     $entry = RGFormsModel::get_lead($this->entry['id']);
     $entry = GFFormsModel::set_entry_meta($entry, $this->form);
     // We need to clear the cache because Gravity Forms caches the field values, which
     // we have just updated.
     foreach ($this->form['fields'] as $key => $field) {
         GFFormsModel::refresh_lead_field_value($entry['id'], $field->id);
     }
     $this->entry = $entry;
 }
开发者ID:robinsutherland223,项目名称:gravity,代码行数:23,代码来源:class-edit-entry-render.php

示例13: try_restore_saved_state

 public function try_restore_saved_state($form)
 {
     if (!isset($form['enableFormState']) || !$form['enableFormState']) {
         return $form;
     }
     /**
      * We are currently unable to restore values of a saved form
      * when a different form on the page is being navigated, saved or
      * submitted. See issue #27.
      */
     if (isset($_POST['gform_submit']) && $_POST['gform_submit'] != $form['id']) {
         return $form;
     }
     $user = wp_get_current_user();
     $lead_id = get_user_meta($user->ID, 'has_pending_form_' . $form['id'], true);
     if (!$lead_id) {
         return $form;
     }
     $lead = RGFormsModel::get_lead($lead_id);
     /* populate the available values */
     foreach ($form['fields'] as $form_part) {
         if ($form_part['inputs'] === null || $form_part['inputs'] === '') {
             /* single-part */
             $input_id = $form_part['id'];
             if (!isset($lead[strval($input_id)])) {
                 continue;
             }
             $input_name = 'input_' . str_replace('.', '_', strval($input_id));
             // only add value from saved lead if new value is not entered
             if (isset($_POST[$input_name]) && !empty($_POST[$input_name])) {
                 continue;
             }
             $_POST[$input_name] = $this->maybe_transform_data($lead[strval($input_id)], $lead, $form_part, $form);
         } else {
             foreach ($form_part['inputs'] as $input) {
                 /* multi-part */
                 if (!isset($lead[strval($input['id'])])) {
                     continue;
                 }
                 $input_name = 'input_' . str_replace('.', '_', strval($input['id']));
                 // only add value from saved lead if new value is not entered
                 if (isset($_POST[$input_name]) && !empty($_POST[$input_name])) {
                     continue;
                 }
                 $_POST[$input_name] = $this->maybe_transform_data($lead[strval($input['id'])], $lead, $form_part, $form);
             }
         }
     }
     $_POST['is_submit_' . $form['id']] = '1';
     /* force the form to be poisoned */
     return $form;
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:52,代码来源:gravityforms-savedforms.php

示例14: get_field_input

 public static function get_field_input($field, $value = "", $lead_id = 0, $form_id = 0)
 {
     $id = $field["id"];
     $field_id = IS_ADMIN || $form_id == 0 ? "input_{$id}" : "input_" . $form_id . "_{$id}";
     $form_id = IS_ADMIN && empty($form_id) ? $_GET["id"] : $form_id;
     $size = $field["size"];
     $disabled_text = IS_ADMIN && RG_CURRENT_VIEW != "entry" ? "disabled='disabled'" : "";
     $class_suffix = RG_CURRENT_VIEW == "entry" ? "_admin" : "";
     $class = $size . $class_suffix;
     $currency = "";
     if (RG_CURRENT_VIEW == "entry") {
         $lead = RGFormsModel::get_lead($lead_id);
         $post_id = $lead["post_id"];
         $post_link = "";
         if (is_numeric($post_id) && self::is_post_field($field)) {
             $post_link = "You can <a href='post.php?action=edit&post={$post_id}'>edit this post</a> from the post page.";
         }
         $currency = $lead["currency"];
     }
     $field_input = apply_filters("gform_field_input", "", $field, $value, $lead_id, $form_id);
     if ($field_input) {
         return $field_input;
     }
     //product fields are not editable
     if (RG_CURRENT_VIEW == "entry" && self::is_product_field($field["type"])) {
         return "<div class='ginput_container'>" . _e("Product fields are not editable", "gravityforms") . "</div>";
     } else {
         if (RG_CURRENT_VIEW == "entry" && $field["type"] == "donation") {
             return "<div class='ginput_container'>" . _e("Donations are not editable", "gravityforms") . "</div>";
         }
     }
     $max_length = "";
     $html5_attributes = "";
     switch (RGFormsModel::get_input_type($field)) {
         case "total":
             if (RG_CURRENT_VIEW == "entry") {
                 return "<div class='ginput_container'><input type='text' name='input_{$id}' value='{$value}' /></div>";
             } else {
                 return "<div class='ginput_container'><span class='ginput_total ginput_total_{$form_id}'>" . self::to_money("0") . "</span><input type='hidden' name='input_{$id}' id='{$field_id}' class='gform_hidden'/></div>";
             }
             break;
         case "singleproduct":
             $product_name = !is_array($value) || empty($value[$field["id"] . ".1"]) ? esc_attr($field["label"]) : esc_attr($value[$field["id"] . ".1"]);
             $price = !is_array($value) || empty($value[$field["id"] . ".2"]) ? $field["basePrice"] : esc_attr($value[$field["id"] . ".2"]);
             $quantity = is_array($value) ? esc_attr($value[$field["id"] . ".3"]) : "";
             if (empty($price)) {
                 $price = 0;
             }
             $form = RGFormsModel::get_form_meta($form_id);
             $has_quantity = sizeof(GFCommon::get_product_fields_by_type($form, array("quantity"), $field["id"])) > 0;
             if ($has_quantity) {
                 $field["disableQuantity"] = true;
             }
             $quantity_field = "";
             if (IS_ADMIN) {
                 $style = $field["disableQuantity"] ? "style='display:none;'" : "";
                 $quantity_field = " <span class='ginput_quantity_label' {$style}>" . __("Quantity:", "gravityformspaypal") . "</span> <input type='text' name='input_{$id}.3' value='{$quantity}' id='ginput_quantity_{$form_id}_{$field["id"]}' class='ginput_quantity' size='10' />";
             } else {
                 if (!$field["disableQuantity"]) {
                     $tabindex = self::get_tabindex();
                     $quantity_field .= " <span class='ginput_quantity_label'>" . __("Quantity:", "gravityformspaypal") . "</span> <input type='text' name='input_{$id}.3' value='{$quantity}' id='ginput_quantity_{$form_id}_{$field["id"]}' class='ginput_quantity' size='10' {$tabindex}/>";
                 } else {
                     if (!is_numeric($quantity)) {
                         $quantity = 1;
                     }
                     if (!$has_quantity) {
                         $quantity_field .= "<input type='hidden' name='input_{$id}.3' value='{$quantity}' class='ginput_quantity_{$form_id}_{$field["id"]} gform_hidden' />";
                     }
                 }
             }
             return "<div class='ginput_container'><input type='hidden' name='input_{$id}.1' value='{$product_name}' class='gform_hidden' /><span class='ginput_product_price_label'>" . __("Price:", "gravityformspaypal") . "</span> <span class='ginput_product_price' id='{$field_id}'>" . GFCommon::to_money($price, $currency) . "</span><input type='hidden' name='input_{$id}.2' id='ginput_base_price_{$form_id}_{$field["id"]}' class='gform_hidden' value='{$price}'/>{$quantity_field}</div>";
             break;
         case "singleshipping":
             $price = !empty($value) ? $value : $field["basePrice"];
             if (empty($price)) {
                 $price = 0;
             }
             return "<div class='ginput_container'><input type='hidden' name='input_{$id}' value='{$price}' class='gform_hidden'/><span class='ginput_shipping_price' id='{$field_id}'>" . GFCommon::to_money($price, $currency) . "</span></div>";
             break;
         case "website":
             $is_html5 = RGFormsModel::is_html5_enabled();
             $value = empty($value) && !$is_html5 ? "http://" : $value;
             $html_input_type = $is_html5 ? "url" : "text";
             $html5_attributes = $is_html5 ? "placeholder='http://'" : "";
         case "text":
             if (empty($html_input_type)) {
                 $html_input_type = "text";
             }
             if ($field["enablePasswordInput"] && RG_CURRENT_VIEW != "entry") {
                 $html_input_type = "password";
             }
             if (is_numeric($field["maxLength"])) {
                 $max_length = "maxlength='{$field["maxLength"]}'";
             }
             if (!empty($post_link)) {
                 return $post_link;
             }
             $tabindex = self::get_tabindex();
             return sprintf("<div class='ginput_container'><input name='input_%d' id='%s' type='%s' value='%s' class='%s' {$max_length} {$tabindex} {$html5_attributes} %s/></div>", $id, $field_id, $html_input_type, esc_attr($value), esc_attr($class), $disabled_text);
             break;
//.........这里部分代码省略.........
开发者ID:novuscory,项目名称:ACH,代码行数:101,代码来源:common.php

示例15: get_value_save_entry

 public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead)
 {
     $value = GFCommon::maybe_add_leading_zero($value);
     $lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
     $value = $this->has_calculation() ? GFCommon::round_number(GFCommon::calculate($this, $form, $lead), $this->calculationRounding) : $this->clean_number($value);
     //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 ($this->has_calculation() && $value == 0) {
         $value = '0';
     }
     return $value;
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:11,代码来源:class-gf-field-number.php


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