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


PHP GFCommon::to_money方法代码示例

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


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

示例1: leads_page


//.........这里部分代码省略.........
/images/star<?php 
                    echo intval($lead['is_starred']);
                    ?>
.png" onclick="ToggleStar(this, '<?php 
                    echo esc_js($lead['id']);
                    ?>
','<?php 
                    echo esc_js($filter);
                    ?>
');" />
					</td>
				<?php 
                }
                $is_first_column = true;
                $nowrap_class = 'entry_nowrap';
                foreach ($field_ids as $field_id) {
                    $field = RGFormsModel::get_field($form, $field_id);
                    $value = rgar($lead, $field_id);
                    if (!empty($field) && $field->type == 'post_category') {
                        $value = GFCommon::prepare_post_category_value($value, $field, 'entry_list');
                    }
                    //filtering lead value
                    $value = apply_filters('gform_get_field_value', $value, $lead, $field);
                    $input_type = !empty($columns[$field_id]['inputType']) ? $columns[$field_id]['inputType'] : $columns[$field_id]['type'];
                    switch ($input_type) {
                        case 'source_url':
                            $value = "<a href='" . esc_attr($lead['source_url']) . "' target='_blank' alt='" . esc_attr($lead['source_url']) . "' title='" . esc_attr($lead['source_url']) . "'>.../" . esc_attr(GFCommon::truncate_url($lead['source_url'])) . '</a>';
                            break;
                        case 'date_created':
                        case 'payment_date':
                            $value = GFCommon::format_date($value, false);
                            break;
                        case 'payment_amount':
                            $value = GFCommon::to_money($value, $lead['currency']);
                            break;
                        case 'created_by':
                            if (!empty($value)) {
                                $userdata = get_userdata($value);
                                if (!empty($userdata)) {
                                    $value = $userdata->user_login;
                                }
                            }
                            break;
                        default:
                            if ($field !== null) {
                                $value = $field->get_value_entry_list($value, $lead, $field_id, $columns, $form);
                            } else {
                                $value = esc_html($value);
                            }
                    }
                    $value = apply_filters('gform_entries_field_value', $value, $form_id, $field_id, $lead);
                    /* ^ maybe move to function */
                    $query_string = "gf_entries&view=entry&id={$form_id}&lid={$lead['id']}{$search_qs}{$sort_qs}{$dir_qs}{$filter_qs}&paged=" . ($page_index + 1);
                    if ($is_first_column) {
                        ?>
						<td class="column-title">
							<a href="admin.php?page=gf_entries&view=entry&id=<?php 
                        echo absint($form_id);
                        ?>
&lid=<?php 
                        echo esc_attr($lead['id'] . $search_qs . $sort_qs . $dir_qs . $filter_qs);
                        ?>
&paged=<?php 
                        echo $page_index + 1;
                        ?>
&pos=<?php 
开发者ID:kidaak,项目名称:gravityforms,代码行数:67,代码来源:entry_list.php

示例2: get_value_merge_tag

 public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format, $nl2br)
 {
     $use_value = $modifier == 'value';
     $use_price = in_array($modifier, array('price', 'currency'));
     $format_currency = $modifier == 'currency';
     if (is_array($raw_value) && (string) intval($input_id) != $input_id) {
         $items = array($input_id => $value);
         //float input Ids. (i.e. 4.1 ). Used when targeting specific checkbox items
     } elseif (is_array($raw_value)) {
         $items = $raw_value;
     } else {
         $items = array($input_id => $raw_value);
     }
     $ary = array();
     foreach ($items as $input_id => $item) {
         if ($use_value) {
             list($val, $price) = rgexplode('|', $item, 2);
         } elseif ($use_price) {
             list($name, $val) = rgexplode('|', $item, 2);
             if ($format_currency) {
                 $val = GFCommon::to_money($val, rgar($entry, 'currency'));
             }
         } elseif ($this->type == 'post_category') {
             $use_id = strtolower($modifier) == 'id';
             $item_value = GFCommon::format_post_category($item, $use_id);
             $val = RGFormsModel::is_field_hidden($form, $this, array(), $entry) ? '' : $item_value;
         } else {
             $val = RGFormsModel::is_field_hidden($form, $this, array(), $entry) ? '' : RGFormsModel::get_choice_text($this, $raw_value, $input_id);
         }
         $ary[] = GFCommon::format_variable_value($val, $url_encode, $esc_html, $format);
     }
     return GFCommon::implode_non_blank(', ', $ary);
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:33,代码来源:class-gf-field-select.php

示例3: replace_merge_tag

 /**
  * Add {payment_amount} merge tag
  *
  * @since 1.16
  **
  * @param array $matches Array of Merge Tag matches found in text by preg_match_all
  * @param string $text Text to replace
  * @param array $form Gravity Forms form array
  * @param array $entry Entry array
  * @param bool $url_encode Whether to URL-encode output
  *
  * @return string Original text if {date_created} isn't found. Otherwise, replaced text.
  */
 public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false)
 {
     $return = $text;
     foreach ($matches as $match) {
         $full_tag = $match[0];
         $modifier = isset($match[1]) ? $match[1] : false;
         $amount = rgar($entry, 'payment_amount');
         $formatted_amount = 'raw' === $modifier ? $amount : GFCommon::to_money($amount, rgar($entry, 'currency'));
         $return = str_replace($full_tag, $formatted_amount, $return);
     }
     unset($formatted_amount, $amount, $full_tag, $matches);
     return $return;
 }
开发者ID:mgratch,项目名称:GravityView,代码行数:26,代码来源:class-gravityview-field-payment-amount.php

示例4: get_field_input

 public function get_field_input($form, $value = '', $entry = null)
 {
     $form_id = $form['id'];
     $is_entry_detail = $this->is_entry_detail();
     $is_form_editor = $this->is_form_editor();
     $id = (int) $this->id;
     $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_{$id}" : 'input_' . $form_id . "_{$id}";
     $product_name = !is_array($value) || empty($value[$this->id . '.1']) ? esc_attr($this->label) : esc_attr($value[$this->id . '.1']);
     $price = !is_array($value) || empty($value[$this->id . '.2']) ? $this->basePrice : esc_attr($value[$this->id . '.2']);
     $quantity = is_array($value) ? esc_attr($value[$this->id . '.3']) : '';
     if (empty($price)) {
         $price = 0;
     }
     $has_quantity = sizeof(GFCommon::get_product_fields_by_type($form, array('quantity'), $this->id)) > 0;
     if ($has_quantity) {
         $this->disableQuantity = true;
     }
     $currency = $is_entry_detail && !empty($entry) ? $entry['currency'] : '';
     $quantity_field = '';
     $qty_input_type = GFFormsModel::is_html5_enabled() ? 'number' : 'text';
     $qty_min_attr = GFFormsModel::is_html5_enabled() ? "min='0'" : '';
     $product_quantity_sub_label = apply_filters("gform_product_quantity_{$form_id}", apply_filters('gform_product_quantity', __('Quantity:', 'gravityforms'), $form_id), $form_id);
     if ($is_entry_detail || $is_form_editor) {
         $disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
         $style = $this->disableQuantity ? "style='display:none;'" : '';
         $quantity_field = " <span class='ginput_quantity_label' {$style}>{$product_quantity_sub_label}</span> <input type='{$qty_input_type}' name='input_{$id}.3' value='{$quantity}' id='ginput_quantity_{$form_id}_{$this->id}' class='ginput_quantity' size='10' {$disabled_text}/>";
     } else {
         if (!$this->disableQuantity) {
             $tabindex = $this->get_tabindex();
             $quantity_field .= " <span class='ginput_quantity_label'>" . $product_quantity_sub_label . "</span> <input type='{$qty_input_type}' name='input_{$id}.3' value='{$quantity}' id='ginput_quantity_{$form_id}_{$this->id}' class='ginput_quantity' size='10' {$qty_min_attr} {$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}_{$this->id} gform_hidden' />";
             }
         }
     }
     return "<div class='ginput_container'>\n\t\t\t\t\t<input type='hidden' name='input_{$id}.1' value='{$product_name}' class='gform_hidden' />\n\t\t\t\t\t<span class='ginput_product_price_label'>" . apply_filters("gform_product_price_{$form_id}", apply_filters('gform_product_price', __('Price', 'gravityforms'), $form_id), $form_id) . ":</span> <span class='ginput_product_price' id='{$field_id}'>" . esc_html(GFCommon::to_money($price, $currency)) . "</span>\n\t\t\t\t\t<input type='hidden' name='input_{$id}.2' id='ginput_base_price_{$form_id}_{$this->id}' class='gform_hidden' value='" . esc_attr($price) . "'/>\n\t\t\t\t\t{$quantity_field}\n\t\t\t\t</div>";
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:41,代码来源:class-gf-field-singleproduct.php

示例5: leads_page


//.........这里部分代码省略.........
                                //displaying thumbnail (if file is an image) or an icon based on the extension
                                $thumb = self::get_icon_url($file_path);
                                $file_path = esc_attr($file_path);
                                $value = "<a href='{$file_path}' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
                            }
                            break;
                        case "source_url":
                            $value = "<a href='" . esc_attr($lead["source_url"]) . "' target='_blank' alt='" . esc_attr($lead["source_url"]) . "' title='" . esc_attr($lead["source_url"]) . "'>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>";
                            break;
                        case "textarea":
                        case "post_content":
                        case "post_excerpt":
                            $value = esc_html($value);
                            break;
                        case "date_created":
                        case "payment_date":
                            $value = GFCommon::format_date($value, false);
                            break;
                        case "date":
                            $field = RGFormsModel::get_field($form, $field_id);
                            $value = GFCommon::date_display($value, rgar($field, "dateFormat"));
                            break;
                        case "radio":
                        case "select":
                            $field = RGFormsModel::get_field($form, $field_id);
                            $value = GFCommon::selection_display($value, $field, $lead["currency"]);
                            break;
                        case "number":
                            $field = RGFormsModel::get_field($form, $field_id);
                            $value = GFCommon::format_number($value, rgar($field, "numberFormat"));
                            break;
                        case "total":
                        case "payment_amount":
                            $value = GFCommon::to_money($value, $lead["currency"]);
                            break;
                        case "created_by":
                            if (!empty($value)) {
                                $userdata = get_userdata($value);
                                $value = $userdata->user_login;
                            }
                            break;
                        case "multiselect":
                            // add space after comma-delimited values
                            $value = implode(', ', explode(',', $value));
                            break;
                        default:
                            $value = esc_html($value);
                    }
                    $value = apply_filters("gform_entries_field_value", $value, $form_id, $field_id, $lead);
                    /* ^ maybe move to function */
                    $query_string = "gf_entries&view=entry&id={$form_id}&lid={$lead["id"]}{$search_qs}{$sort_qs}{$dir_qs}{$filter_qs}&paged=" . ($page_index + 1);
                    if ($is_first_column) {
                        ?>
                                        <td class="column-title" >
                                            <a href="admin.php?page=gf_entries&view=entry&id=<?php 
                        echo $form_id;
                        ?>
&lid=<?php 
                        echo $lead["id"] . $search_qs . $sort_qs . $dir_qs . $filter_qs;
                        ?>
&paged=<?php 
                        echo $page_index + 1;
                        ?>
&pos=<?php 
                        echo $position;
                        ?>
开发者ID:nikibrown,项目名称:2014-Nerd-presentation,代码行数:67,代码来源:entry_list.php

示例6: get_sales_summary

 protected function get_sales_summary($form_id)
 {
     global $wpdb;
     $tz_offset = $this->get_mysql_tz_offset();
     $summary = $wpdb->get_results($wpdb->prepare("\n                    SELECT lead.date, lead.orders, lead.subscriptions, transaction.revenue\n                    FROM (\n                       SELECT  date( CONVERT_TZ(date_created, '+00:00', '" . $tz_offset . "') ) as date,\n                               sum( if(transaction_type = 1,1,0) ) as orders,\n                               sum( if(transaction_type = 2,1,0) ) as subscriptions\n                       FROM {$wpdb->prefix}rg_lead\n                       WHERE form_id = %d and datediff(now(), CONVERT_TZ(date_created, '+00:00', '" . $tz_offset . "') ) <= 30\n                       GROUP BY date\n                     ) AS lead\n\n                     LEFT OUTER JOIN(\n                       SELECT  date( CONVERT_TZ(t.date_created, '+00:00', '" . $tz_offset . "') ) as date,\n                               sum(t.amount) as revenue\n                       FROM {$wpdb->prefix}gf_addon_payment_transaction t\n                         INNER JOIN {$wpdb->prefix}rg_lead l ON l.id = t.lead_id\n                       WHERE l.form_id=%d\n                       GROUP BY date\n                     ) AS transaction on lead.date = transaction.date\n                    ORDER BY date desc", $form_id, $form_id), ARRAY_A);
     $total_summary = $wpdb->get_results($wpdb->prepare("\n                    SELECT sum( if(transaction_type = 1,1,0) ) as orders,\n                         sum( if(transaction_type = 2,1,0) ) as subscriptions\n                    FROM {$wpdb->prefix}rg_lead\n                    WHERE form_id=%d", $form_id), ARRAY_A);
     $total_revenue = $wpdb->get_var($wpdb->prepare("\n                    SELECT sum(t.amount) as revenue\n                    FROM {$wpdb->prefix}gf_addon_payment_transaction t\n                    INNER JOIN {$wpdb->prefix}rg_lead l ON l.id = t.lead_id\n                    WHERE l.form_id=%d", $form_id));
     $result = array("today" => array("revenue" => GFCommon::to_money(0), "orders" => 0, "subscriptions" => 0), "yesterday" => array("revenue" => GFCommon::to_money(0), "orders" => 0, "subscriptions" => 0), "last30" => array("revenue" => 0, "orders" => 0, "subscriptions" => 0), "total" => array("revenue" => GFCommon::to_money($total_revenue), "orders" => $total_summary[0]["orders"], "subscriptions" => $total_summary[0]["subscriptions"]));
     $local_time = GFCommon::get_local_timestamp();
     $today = gmdate("Y-m-d", $local_time);
     $yesterday = gmdate("Y-m-d", strtotime("-1 day", $local_time));
     foreach ($summary as $day) {
         if ($day["date"] == $today) {
             $result["today"]["revenue"] = GFCommon::to_money($day["revenue"]);
             $result["today"]["orders"] = $day["orders"];
             $result["today"]["subscriptions"] = $day["subscriptions"];
         } else {
             if ($day["date"] == $yesterday) {
                 $result["yesterday"]["revenue"] = GFCommon::to_money($day["revenue"]);
                 $result["yesterday"]["orders"] = $day["orders"];
                 $result["yesterday"]["subscriptions"] = $day["subscriptions"];
             }
         }
         $is_within_30_days = strtotime($day["date"]) >= strtotime($local_time . " -30 days");
         if ($is_within_30_days) {
             $result["last30"]["revenue"] += floatval($day["revenue"]);
             $result["last30"]["orders"] += floatval($day["orders"]);
             $result["last30"]["subscriptions"] += floatval($day["subscriptions"]);
         }
     }
     $result["last30"]["revenue"] = GFCommon::to_money($result["last30"]["revenue"]);
     return $result;
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:33,代码来源:class-gf-payment-addon.php

示例7: lead_detail


//.........这里部分代码省略.........
                    ?>
</div>
                                                    <ul class="product_options">
                                                        <?php 
                    $price = GFCommon::to_number($product["price"]);
                    if (is_array(rgar($product, "options"))) {
                        $count = sizeof($product["options"]);
                        $index = 1;
                        foreach ($product["options"] as $option) {
                            $price += GFCommon::to_number($option["price"]);
                            $class = $index == $count ? " class='lastitem'" : "";
                            $index++;
                            ?>
                                                                <li<?php 
                            echo $class;
                            ?>
><?php 
                            echo $option["option_label"];
                            ?>
</li>
                                                                <?php 
                        }
                    }
                    $subtotal = floatval($product["quantity"]) * $price;
                    $total += $subtotal;
                    ?>
                                                    </ul>
                                                </td>
                                                <td class="textcenter"><?php 
                    echo $product["quantity"];
                    ?>
</td>
                                                <td><?php 
                    echo GFCommon::to_money($price, $lead["currency"]);
                    ?>
</td>
                                                <td><?php 
                    echo GFCommon::to_money($subtotal, $lead["currency"]);
                    ?>
</td>
                                            </tr>
                                            <?php 
                }
                $total += floatval($products["shipping"]["price"]);
                ?>
                                    </tbody>
                                    <tfoot>
                                        <?php 
                if (!empty($products["shipping"]["name"])) {
                    ?>
                                            <tr>
                                                <td colspan="2" rowspan="2" class="emptycell">&nbsp;</td>
                                                <td class="textright shipping"><?php 
                    echo $products["shipping"]["name"];
                    ?>
</td>
                                                <td class="shipping_amount"><?php 
                    echo GFCommon::to_money($products["shipping"]["price"], $lead["currency"]);
                    ?>
&nbsp;</td>
                                            </tr>
                                        <?php 
                }
                ?>
                                        <tr>
                                            <?php 
开发者ID:healthcommcore,项目名称:osnap,代码行数:67,代码来源:gravity-forms-addons.php

示例8: sanitize_settings

 public function sanitize_settings()
 {
     parent::sanitize_settings();
     $price_number = GFCommon::to_number($this->basePrice);
     $this->basePrice = GFCommon::to_money($price_number);
 }
开发者ID:nomadicmarc,项目名称:goodbay,代码行数:6,代码来源:class-gf-field-singleshipping.php

示例9: replace_merge_tags

 /**
  * Replace merge tags
  *
  * @param string $text
  * @param array $form
  * @param array $entry
  * @param boolean $url_encode
  * @param boolean $esc_html
  * @param boolean $nl2br
  * @param string $format
  */
 public function replace_merge_tags($text, $form, $entry, $url_encode, $esc_html, $nl2br, $format)
 {
     $search = array('{payment_status}', '{payment_date}', '{transaction_id}', '{payment_amount}');
     $replace = array(rgar($entry, 'payment_status'), rgar($entry, 'payment_date'), rgar($entry, 'transaction_id'), GFCommon::to_money(rgar($entry, 'payment_amount'), rgar($entry, 'currency')));
     if ($url_encode) {
         foreach ($replace as &$value) {
             $value = urlencode($value);
         }
     }
     $text = str_replace($search, $replace, $text);
     return $text;
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:23,代码来源:Extension.php

示例10: payment_details_box

    /**
     * @param $lead
     * @param $form
     * @return mixed
     */
    public static function payment_details_box($lead, $form)
    {
        ?>
        <!-- PAYMENT BOX -->
        <div id="submitdiv" class="stuffbox">
            <h3>
                <span
                    class="hndle"><?php 
        echo $lead["transaction_type"] == 2 ? __("Subscription Details", "gravityforms") : __("Payment Details", "gravityforms");
        ?>
</span>
            </h3>

            <div class="inside">
                <div id="submitcomment" class="submitbox">
                    <div id="minor-publishing" style="padding:10px;">
                        <br/>
                        <?php 
        if (!empty($lead["payment_status"])) {
            echo __("Status", "gravityforms");
            ?>
: <span
                                id="gform_payment_status"><?php 
            echo apply_filters("gform_payment_status", $lead["payment_status"], $form, $lead);
            ?>
</span>
                            <br/><br/>
                            <?php 
            if (!empty($lead["payment_date"])) {
                echo $lead["transaction_type"] == 2 ? __("Start Date", "gravityforms") : __("Date", "gravityforms");
                ?>
: <?php 
                echo GFCommon::format_date($lead["payment_date"], false, "Y/m/d", $lead["transaction_type"] != 2);
                ?>
                                <br/><br/>
                            <?php 
            }
            if (!empty($lead["transaction_id"])) {
                echo $lead["transaction_type"] == 2 ? __("Subscription Id", "gravityforms") : __("Transaction Id", "gravityforms");
                ?>
: <?php 
                echo $lead["transaction_id"];
                ?>
                                <br/><br/>
                            <?php 
            }
            if (!rgblank($lead["payment_amount"])) {
                echo $lead["transaction_type"] == 2 ? __("Recurring Amount", "gravityforms") : __("Amount", "gravityforms");
                ?>
: <?php 
                echo GFCommon::to_money($lead["payment_amount"], $lead["currency"]);
                ?>
                                <br/><br/>
                            <?php 
            }
        }
        do_action("gform_payment_details", $form["id"], $lead);
        ?>
                    </div>
                </div>
            </div>
        </div>
        <?php 
    }
开发者ID:JSpier,项目名称:smacamp,代码行数:69,代码来源:entry_detail.php

示例11: set_payment_status

 public static function set_payment_status($config, $entry, $status, $transaction_type, $transaction_id, $parent_transaction_id, $subscriber_id, $amount, $pending_reason, $reason)
 {
     global $current_user;
     $user_id = 0;
     $user_name = "System";
     if ($current_user && ($user_data = get_userdata($current_user->ID))) {
         $user_id = $current_user->ID;
         $user_name = $user_data->display_name;
     }
     self::$log->LogDebug("Payment status: {$status} - Transaction Type: {$transaction_type} - Transaction ID: {$transaction_id} - Parent Transaction: {$parent_transaction_id} - Subscriber ID: {$subscriber_id} - Amount: {$amount} - Pending reason: {$pending_reason} - Reason: {$reason}");
     self::$log->LogDebug("Entry: " . print_r($entry, true));
     switch (strtolower($transaction_type)) {
         case "subscr_payment":
             if ($entry["payment_status"] != "Active") {
                 self::$log->LogDebug("Starting subscription");
                 self::start_subscription($entry, $subscriber_id, $amount, $user_id, $user_name);
             } else {
                 self::$log->LogDebug("Payment status is already active, so simply adding a Note");
                 RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription payment has been made. Amount: %s. Transaction Id: %s", "gravityforms"), GFCommon::to_money($amount, $entry["currency"]), $transaction_id));
             }
             self::$log->LogDebug("Inserting payment transaction");
             GFPayPalData::insert_transaction($entry["id"], "payment", $subscriber_id, $transaction_id, $parent_transaction_id, $amount);
             break;
         case "subscr_signup":
             $trial_amount = GFCommon::to_number($config["meta"]["trial_amount"]);
             //Starting subscription if there is a free trial period. Otherwise, subscription will be started when payment is received (i.e. sbscr_payment)
             if ($entry["payment_status"] != "Active" && $config["meta"]["trial_period_enabled"] && empty($trial_amount)) {
                 self::$log->LogDebug("Starting subscription");
                 self::start_subscription($entry, $subscriber_id, $amount, $user_id, $user_name);
             }
             break;
         case "subscr_cancel":
             if ($entry["payment_status"] != "Cancelled") {
                 $entry["payment_status"] = "Cancelled";
                 self::$log->LogDebug("Cancelling subscription");
                 RGFormsModel::update_lead($entry);
                 RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has been cancelled. Subscriber Id: %s", "gravityforms"), $subscriber_id));
                 if ($config["meta"]["update_post_action"] == "draft" && !empty($entry["post_id"])) {
                     $post = get_post($entry["post_id"]);
                     $post->post_status = 'draft';
                     wp_update_post($post);
                     self::$log->LogDebug("Marking associated post as a Draft");
                 }
                 if ($config["meta"]["update_post_action"] == "delete" && !empty($entry["post_id"])) {
                     wp_delete_post($entry["post_id"]);
                     self::$log->LogDebug("Deleting associated post");
                 }
                 do_action("gform_subscription_canceled", $entry, $config, $transaction_id);
             }
             break;
         case "subscr_eot":
             if ($entry["payment_status"] != "Expired") {
                 $entry["payment_status"] = "Expired";
                 self::$log->LogDebug("Setting entry as expired");
                 RGFormsModel::update_lead($entry);
                 RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription has expired. Subscriber Id: %s", "gravityforms"), $subscriber_id));
             }
             break;
         case "subscr_failed":
             if ($entry["payment_status"] != "Failed") {
                 $entry["payment_status"] = "Failed";
                 self::$log->LogDebug("Marking entry as Failed");
                 RGFormsModel::update_lead($entry);
                 RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Subscription signup has failed. Subscriber Id: %s", "gravityforms"), $subscriber_id));
             }
             break;
         default:
             //handles products and donation
             switch (strtolower($status)) {
                 case "completed":
                     self::$log->LogDebug("Processing a completed payment");
                     if ($entry["payment_status"] != "Approved") {
                         self::$log->LogDebug("Entry is not already approved. Proceeding...");
                         $entry["payment_status"] = "Approved";
                         $entry["payment_amount"] = $amount;
                         $entry["payment_date"] = gmdate("y-m-d H:i:s");
                         $entry["transaction_id"] = $transaction_id;
                         $entry["transaction_type"] = 1;
                         //payment
                         if (!$entry["is_fulfilled"]) {
                             self::$log->LogDebug("Payment has been made. Fulfilling order.");
                             self::fulfill_order($entry, $transaction_id, $amount);
                             self::$log->LogDebug("Order has been fulfilled");
                             $entry["is_fulfilled"] = true;
                         }
                         self::$log->LogDebug("Updating entry.");
                         RGFormsModel::update_lead($entry);
                         self::$log->LogDebug("Adding note.");
                         RGFormsModel::add_note($entry["id"], $user_id, $user_name, sprintf(__("Payment has been approved. Amount: %s. Transaction Id: %s", "gravityforms"), GFCommon::to_money($entry["payment_amount"], $entry["currency"]), $transaction_id));
                     }
                     self::$log->LogDebug("Inserting transaction.");
                     GFPayPalData::insert_transaction($entry["id"], "payment", "", $transaction_id, $parent_transaction_id, $amount);
                     break;
                 case "reversed":
                     self::$log->LogDebug("Processing reversal.");
                     if ($entry["payment_status"] != "Reversed") {
                         if ($entry["transaction_type"] == 1) {
                             $entry["payment_status"] = "Reversed";
                             self::$log->LogDebug("Setting entry as Reversed");
                             RGFormsModel::update_lead($entry);
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:paypal.php

示例12: get_value_merge_tag

 public function get_value_merge_tag($value, $input_id, $entry, $form, $modifier, $raw_value, $url_encode, $esc_html, $format)
 {
     $format_numeric = $modifier == 'price';
     $value = $format_numeric ? GFCommon::to_number($value) : GFCommon::to_money($value);
     return GFCommon::format_variable_value($value, $url_encode, $esc_html, $format);
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:6,代码来源:class-gf-field-total.php

示例13: authorize

 public function authorize($feed, $submission_data, $form, $entry)
 {
     $this->populateCreditCardLastFour($form);
     $this->includeSecureSubmitSDK();
     if ($this->getSecureSubmitJsError()) {
         return $this->authorization_error($this->getSecureSubmitJsError());
     }
     $isAuth = $this->getAuthorizeOrCharge($feed) == 'authorize';
     $config = new HpsServicesConfig();
     $config->secretApiKey = $this->getSecretApiKey($feed);
     $config->developerId = '002914';
     $config->versionNumber = '1916';
     $service = new HpsCreditService($config);
     $cardHolder = $this->buildCardHolder($feed, $submission_data, $entry);
     try {
         $response = $this->getSecureSubmitJsResponse();
         $token = new HpsTokenData();
         $token->tokenValue = $response != null ? $response->token_value : '';
         $transaction = null;
         if ($isAuth) {
             $transaction = $service->authorize($submission_data['payment_amount'], GFCommon::get_currency(), $token, $cardHolder);
         } else {
             $transaction = $service->charge($submission_data['payment_amount'], GFCommon::get_currency(), $token, $cardHolder);
         }
         self::get_instance()->transaction_response = $transaction;
         if ($this->getSendEmail() == 'yes') {
             $this->sendEmail($form, $entry, $transaction, $cardHolder);
         }
         $type = $isAuth ? 'Authorization' : 'Payment';
         $amount_formatted = GFCommon::to_money($submission_data['payment_amount'], GFCommon::get_currency());
         $note = sprintf(__('%s has been completed. Amount: %s. Transaction Id: %s.', 'gravityforms-securesubmit'), $type, $amount_formatted, $transaction->transactionId);
         if ($isAuth) {
             $note .= sprintf(__(' Authorization Code: %s', 'gravityforms-securesubmit'), $transaction->authorizationCode);
         }
         $auth = array('is_authorized' => true, 'captured_payment' => array('is_success' => true, 'transaction_id' => $transaction->transactionId, 'amount' => $submission_data['payment_amount'], 'payment_method' => $response->card_type, 'securesubmit_payment_action' => $this->getAuthorizeOrCharge($feed), 'note' => $note));
     } catch (HpsException $e) {
         $auth = $this->authorization_error($e->getMessage());
     }
     return $auth;
 }
开发者ID:ChessMess,项目名称:heartland-gravity-forms-addon,代码行数:40,代码来源:class-gf-securesubmit.php

示例14: leads_page


//.........这里部分代码省略.........
                            break;
                        case "fileupload":
                            $file_path = $value;
                            if (!empty($file_path)) {
                                //displaying thumbnail (if file is an image) or an icon based on the extension
                                $thumb = self::get_icon_url($file_path);
                                $file_path = esc_attr($file_path);
                                $value = "<a href='{$file_path}' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='{$thumb}'/></a>";
                            }
                            break;
                        case "source_url":
                            $value = "<a href='" . esc_attr($lead["source_url"]) . "' target='_blank' alt='" . esc_attr($lead["source_url"]) . "' title='" . esc_attr($lead["source_url"]) . "'>.../" . esc_attr(GFCommon::truncate_url($lead["source_url"])) . "</a>";
                            break;
                        case "textarea":
                        case "post_content":
                        case "post_excerpt":
                            $value = esc_html($value);
                            break;
                        case "date_created":
                        case "payment_date":
                            $value = GFCommon::format_date($value, false);
                            break;
                        case "date":
                            $field = RGFormsModel::get_field($form, $field_id);
                            $value = GFCommon::date_display($value, $field["dateFormat"]);
                            break;
                        case "radio":
                        case "select":
                            $field = RGFormsModel::get_field($form, $field_id);
                            $value = GFCommon::selection_display($value, $field, $lead["currency"]);
                            break;
                        case "total":
                        case "payment_amount":
                            $value = GFCommon::to_money($value, $lead["currency"]);
                            break;
                        case "created_by":
                            if (!empty($value)) {
                                $userdata = get_userdata($value);
                                $value = $userdata->user_login;
                            }
                            break;
                        default:
                            $value = esc_html($value);
                    }
                    $value = apply_filters("gform_entries_field_value", $value, $form_id, $field_id, $lead);
                    $query_string = "gf_entries&view=entry&id={$form_id}&lid={$lead["id"]}{$search_qs}{$sort_qs}{$dir_qs}&paged=" . $page_index + 1;
                    if ($is_first_column) {
                        ?>
                                        <td class="column-title" >
                                            <a href="admin.php?page=gf_entries&view=entry&id=<?php 
                        echo $form_id;
                        ?>
&lid=<?php 
                        echo $lead["id"] . $search_qs . $sort_qs . $dir_qs;
                        ?>
&paged=<?php 
                        echo $page_index + 1;
                        ?>
"><?php 
                        echo $value;
                        ?>
</a>
                                            <div class="row-actions">
                                                <span class="edit">
                                                    <a title="<?php 
                        _e("View this entry", "gravityforms");
开发者ID:hypenotic,项目名称:slowfood,代码行数:67,代码来源:entry_list.php

示例15: meta_box_payment_details

    public static function meta_box_payment_details($args)
    {
        $entry = $args['entry'];
        $form = $args['form'];
        ?>

		<div id="submitcomment" class="submitbox">
			<div id="minor-publishing">
				<?php 
        $payment_status = apply_filters('gform_payment_status', $entry['payment_status'], $form, $entry);
        if (!empty($payment_status)) {
            ?>
					<div id="gf_payment_status" class="gf_payment_detail">
						<?php 
            esc_html_e('Status', 'gravityforms');
            ?>
:
						<span id="gform_payment_status"><?php 
            echo $payment_status;
            // May contain HTML
            ?>
</span>
					</div>

					<?php 
            /**
             * Allows for modification on the form payment date format
             *
             * @param array $form The Form object to filter through
             * @param array $entry The Lead object to filter through
             */
            $payment_date = apply_filters('gform_payment_date', GFCommon::format_date($entry['payment_date'], false, 'Y/m/d', $entry['transaction_type'] != 2), $form, $entry);
            if (!empty($payment_date)) {
                ?>
						<div id="gf_payment_date" class="gf_payment_detail">
							<?php 
                echo $entry['transaction_type'] == 2 ? esc_html__('Start Date', 'gravityforms') : esc_html__('Date', 'gravityforms');
                ?>
:
							<span id='gform_payment_date'><?php 
                echo $payment_date;
                // May contain HTML
                ?>
</span>
						</div>
						<?php 
            }
            /**
             * Allows filtering through a payment transaction ID
             *
             * @param int   $entry['transaction_id'] The transaction ID that can be modified
             * @param array $form                   The Form object to be filtered when modifying the transaction ID
             * @param array $entry                   The Lead object to be filtered when modifying the transaction ID
             */
            $transaction_id = apply_filters('gform_payment_transaction_id', $entry['transaction_id'], $form, $entry);
            if (!empty($transaction_id)) {
                ?>
						<div id="gf_payment_transaction_id" class="gf_payment_detail">
							<?php 
                echo $entry['transaction_type'] == 2 ? esc_html__('Subscription Id', 'gravityforms') : esc_html__('Transaction Id', 'gravityforms');
                ?>
:
							<span id='gform_payment_transaction_id'><?php 
                echo $transaction_id;
                // May contain HTML
                ?>
</span>
						</div>
						<?php 
            }
            /**
             * Filter through the way the Payment Amount is rendered
             *
             * @param string $entry['payment_amount'] The payment amount taken from the lead object
             * @param string $entry['currency']       The payment currency taken from the lead object
             * @param array  $form                   The Form object to filter through
             * @param array  $entry                   The lead object to filter through
             */
            $payment_amount = apply_filters('gform_payment_amount', GFCommon::to_money($entry['payment_amount'], $entry['currency']), $form, $entry);
            if (!rgblank($payment_amount)) {
                ?>
						<div id="gf_payment_amount" class="gf_payment_detail">
							<?php 
                echo $entry['transaction_type'] == 2 ? esc_html__('Recurring Amount', 'gravityforms') : esc_html__('Amount', 'gravityforms');
                ?>
:
							<span id='gform_payment_amount'><?php 
                echo $payment_amount;
                // May contain HTML
                ?>
</span>
						</div>
						<?php 
            }
        }
        /**
         * Fires after the Form Payment Details (The type of payment, the cost, the ID, etc)
         *
         * @param int   $form['id'] The current Form ID
         * @param array $entry       The current Lead object
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:entry_detail.php


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