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


PHP give_format_amount函数代码示例

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


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

示例1: my_give_display_earnings_shortcode

/**
 *  Creates a shortcode to displays a "nag" (which can be styled with CSS targeting a class of 'my-custom-nag')
 *
 *  Sample shortcodes:
 *
 *  [givetotal total_goal="10,000" link="http://example.com"] displays "So far, we have raised $0 toward our goal of $10,000! Donate now"
 *  (where "0" will be replaced with total earnings from all forms, and "Donate Now" is linked to http://example.com)
 *
 *  [givetotal form_id="34" total_goal="10,000"] will display earnings for just form with an ID of 34.
 *
 *  [givetotal total_goal="9,000" message_before="Hey! We've raised " message_between=" of the " message_after=" we are trying to raise for this campaign!" link="http://example.com" link_text="Help Us Reach Our Goal." form_id="245"]
 *
 *  [givetotal total_goal= "5,000" multi_id="34,114,141"] will display earnings for the three forms with IDs 34, 114, and 141.
 *
 *  Note that "multi_id" will override "form_id", so don't use both.
 */
function my_give_display_earnings_shortcode($atts)
{
    $total = get_option('give_earnings_total', false);
    $atts = shortcode_atts(array('total_goal' => '10,000', 'link' => false, 'form_id' => false, 'multi_id' => '', 'message_before' => 'So far, we have raised ', 'message_between' => ' toward our goal of ', 'message_after' => '! ', 'link_text' => 'Donate Now'), $atts, 'givetotal');
    $donate_link = '';
    if ($atts['link'] != false) {
        $donate_link = ' <a href="' . $atts['link'] . '">' . $atts['link_text'] . '</a>';
    }
    if ($atts['form_id'] != false && is_numeric($atts['form_id'])) {
        $total = get_post_meta($atts['form_id'], '_give_form_earnings', true);
    }
    if ($atts['multi_id'] != false) {
        $total = 0;
        $new_array = preg_split("/,/", $atts['multi_id']);
        foreach ($new_array as $value) {
            $total += get_post_meta($value, '_give_form_earnings', true);
        }
    }
    $custom_nag = "<div class='my-custom-nag'>" . $atts['message_before'] . "<span class='my-give-currency'>" . give_currency_symbol(give_get_currency()) . "</span><span class='my-give-raised my-give-amount'>" . give_format_amount($total) . "</span>" . $atts['message_between'] . "<span class='my-give-currency'>" . give_currency_symbol(give_get_currency()) . "</span><span class='my-give-total my-give-amount'>" . $atts['total_goal'] . "</span>" . $atts['message_after'] . $donate_link . "</div>";
    return $custom_nag;
}
开发者ID:WordImpress,项目名称:Give-Snippet-Library,代码行数:37,代码来源:total-earnings-shortcode.php

示例2: give_single_forms_cmb2_metaboxes

/**
 * Define the metabox and field configurations.
 *
 * @param  array $meta_boxes
 *
 * @return array
 */
function give_single_forms_cmb2_metaboxes(array $meta_boxes)
{
    $post_id = give_get_admin_post_id();
    $price = give_get_form_price($post_id);
    $goal = give_get_form_goal($post_id);
    $variable_pricing = give_has_variable_prices($post_id);
    $prices = give_get_variable_prices($post_id);
    //No empty prices - min. 1.00 for new forms
    if (empty($price)) {
        $price = esc_attr(give_format_amount('1.00'));
    }
    // Start with an underscore to hide fields from custom fields list
    $prefix = '_give_';
    /**
     * Repeatable Field Groups
     */
    $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array('id' => 'form_field_options', 'title' => __('Donation Options', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(array('name' => __('Donation Option', 'give'), 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'), 'id' => $prefix . 'price_option', 'type' => 'radio_inline', 'default' => 'set', 'options' => apply_filters('give_forms_price_options', array('set' => __('Set Donation', 'give'), 'multi' => __('Multi-level Donation', 'give')))), array('name' => __('Set Donation', 'give'), 'description' => __('This is the set donation amount for this form.', 'give'), 'id' => $prefix . 'set_price', 'type' => 'text_small', 'row_classes' => 'give-subfield', 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', 'attributes' => array('placeholder' => give_format_amount('1.00'), 'value' => $price, 'class' => 'cmb-type-text-small give-money-field')), array('id' => $prefix . 'levels_header', 'type' => 'levels_repeater_header'), array('id' => $prefix . 'donation_levels', 'type' => 'group', 'row_classes' => 'give-subfield', 'options' => array('add_button' => __('Add Level', 'give'), 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), 'sortable' => true), 'fields' => apply_filters('give_donation_levels_table_row', array(array('name' => __('ID', 'give'), 'id' => $prefix . 'id', 'type' => 'levels_id'), array('name' => __('Amount', 'give'), 'id' => $prefix . 'amount', 'type' => 'text_small', 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', 'attributes' => array('placeholder' => give_format_amount('1.00'), 'class' => 'cmb-type-text-small give-money-field'), 'before' => 'give_format_admin_multilevel_amount'), array('name' => __('Text', 'give'), 'id' => $prefix . 'text', 'type' => 'text', 'attributes' => array('placeholder' => __('Donation Level', 'give'), 'rows' => 3)), array('name' => __('Default', 'give'), 'id' => $prefix . 'default', 'type' => 'give_default_radio_inline')))), array('name' => __('Display Style', 'give'), 'description' => __('Set how the donations levels will display on the form.', 'give'), 'id' => $prefix . 'display_style', 'type' => 'radio_inline', 'default' => 'buttons', 'options' => array('buttons' => __('Buttons', 'give'), 'radios' => __('Radios', 'give'), 'dropdown' => __('Dropdown', 'give'))), array('name' => __('Custom Amount', 'give'), 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), 'id' => $prefix . 'custom_amount', 'type' => 'radio_inline', 'default' => 'no', 'options' => array('yes' => __('Yes', 'give'), 'no' => __('No', 'give'))), array('name' => __('Custom Amount Text', 'give'), 'description' => __('This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give'), 'id' => $prefix . 'custom_amount_text', 'type' => 'text', 'row_classes' => 'give-subfield', 'attributes' => array('rows' => 3, 'placeholder' => __('Give a Custom Amount', 'give'))), array('name' => __('Set Goal?', 'give'), 'description' => __('Do you want to set a donation goal for this form?', 'give'), 'id' => $prefix . 'goal_option', 'type' => 'radio_inline', 'default' => 'no', 'options' => array('yes' => __('Yes', 'give'), 'no' => __('No', 'give'))), array('name' => __('Set Goal', 'give'), 'description' => __('This is the goal you want to achieve for this form.', 'give'), 'id' => $prefix . 'set_goal', 'type' => 'text_small', 'row_classes' => 'give-subfield', 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', 'attributes' => array('placeholder' => give_format_amount('0.00'), 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', 'class' => 'cmb-type-text-small give-money-field')), array('name' => __('Goal Progress Bar Color', 'give'), 'id' => $prefix . 'goal_color', 'type' => 'colorpicker', 'row_classes' => 'give-subfield', 'default' => '#2bc253')))));
    /**
     * Content Field
     */
    $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array('id' => 'form_content_options', 'title' => __('Form Content', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'fields' => apply_filters('give_forms_content_options_metabox_fields', array(array('name' => __('Display Content', 'give'), 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), 'id' => $prefix . 'content_option', 'type' => 'select', 'options' => apply_filters('give_forms_content_options_select', array('none' => __('No content', 'give'), 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'))), 'default' => 'none'), array('name' => __('Content', 'give'), 'description' => __('This content will display on the single give form page.', 'give'), 'id' => $prefix . 'form_content', 'row_classes' => 'give-subfield', 'type' => 'wysiwyg')))));
    /**
     * Display Options
     */
    $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array('id' => 'form_display_options', 'title' => __('Form Display Options', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'fields' => apply_filters('give_forms_display_options_metabox_fields', array(array('name' => __('Payment Fields', 'give'), 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), 'id' => $prefix . 'payment_display', 'type' => 'select', 'options' => array('onpage' => __('Show on Page', 'give'), 'reveal' => __('Reveal Upon Click', 'give'), 'modal' => __('Modal Window Upon Click', 'give')), 'default' => 'onpage'), array('id' => $prefix . 'reveal_label', 'name' => __('Reveal / Modal Open Text', 'give'), 'desc' => __('The button label for completing the donation.', 'give'), 'type' => 'text_small', 'row_classes' => 'give-subfield', 'attributes' => array('placeholder' => __('Donate Now', 'give'))), array('id' => $prefix . 'checkout_label', 'name' => __('Complete Donation Text', 'give'), 'desc' => __('The button label for completing a donation.', 'give'), 'type' => 'text_small', 'attributes' => array('placeholder' => __('Donate Now', 'give'))), array('name' => __('Default Gateway', 'give'), 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), 'id' => $prefix . 'default_gateway', 'type' => 'default_gateway'), array('name' => __('Disable Guest Donations', 'give'), 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), 'id' => $prefix . 'logged_in_only', 'type' => 'checkbox'), array('name' => __('Register / Login Form', 'give'), 'desc' => __('Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give'), 'id' => $prefix . 'show_register_form', 'type' => 'select', 'options' => array('both' => __('Registration and Login Forms', 'give'), 'registration' => __('Registration Form Only', 'give'), 'login' => __('Login Form Only', 'give'), 'none' => __('None', 'give')), 'default' => 'none'), array('name' => __('Floating Labels', 'give'), 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), 'id' => $prefix . 'form_floating_labels', 'type' => 'select', 'options' => array('' => __('Use the global setting', 'give'), 'enabled' => __('Enabled', 'give'), 'disabled' => __('Disabled', 'give')), 'default' => 'none')))));
    /**
     * Terms & Conditions
     */
    $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array('id' => 'form_terms_options', 'title' => __('Terms and Conditions', 'give'), 'object_types' => array('give_forms'), 'context' => 'normal', 'priority' => 'high', 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(array('name' => __('Terms and Conditions', 'give'), 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), 'id' => $prefix . 'terms_option', 'type' => 'select', 'options' => apply_filters('give_forms_content_options_select', array('none' => __('No', 'give'), 'yes' => __('Yes', 'give'))), 'default' => 'none'), array('id' => $prefix . 'agree_label', 'name' => __('Agree to Terms Label', 'give'), 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), 'type' => 'text', 'row_classes' => 'give-subfield', 'size' => 'regular', 'attributes' => array('placeholder' => __('Agree to Terms?', 'give'))), array('id' => $prefix . 'agree_text', 'row_classes' => 'give-subfield', 'name' => __('Agreement Text', 'give'), 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), 'type' => 'wysiwyg')))));
    return $meta_boxes;
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:38,代码来源:metabox.php

示例3: get_data

 /**
  * Get the Export Data.
  *
  * @access public
  * @since 1.5
  * @global object $wpdb Used to query the database using the WordPress database API.
  * @return array $data The data for the CSV file.
  */
 public function get_data()
 {
     global $wpdb;
     $data = array();
     $args = array('number' => 30, 'page' => $this->step, 'status' => $this->status);
     if (!empty($this->start) || !empty($this->end)) {
         $args['date_query'] = array(array('after' => date('Y-n-d 00:00:00', strtotime($this->start)), 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), 'inclusive' => true));
     }
     //echo json_encode($args ); exit;
     $payments = give_get_payments($args);
     if ($payments) {
         foreach ($payments as $payment) {
             $payment_meta = give_get_payment_meta($payment->ID);
             $user_info = give_get_payment_meta_user_info($payment->ID);
             $total = give_get_payment_amount($payment->ID);
             $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
             $products = '';
             $skus = '';
             if (is_numeric($user_id)) {
                 $user = get_userdata($user_id);
             } else {
                 $user = false;
             }
             $data[] = array('id' => $payment->ID, 'seq_id' => give_get_payment_number($payment->ID), 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', 'form_id' => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '', 'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '', 'skus' => $skus, 'amount' => html_entity_decode(give_format_amount($total)), 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), 'trans_id' => give_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'give'), 'status' => give_get_payment_status($payment, true));
         }
         $data = apply_filters('give_export_get_data', $data);
         $data = apply_filters('give_export_get_data_' . $this->export_type, $data);
         return $data;
     }
     return false;
 }
开发者ID:wordimpress,项目名称:give,代码行数:39,代码来源:class-batch-export-payments.php

示例4: give_process_purchase_form

/**
 * Process Purchase Form
 *
 * Handles the purchase form process.
 *
 * @access      private
 * @since       1.0
 * @return      void
 */
function give_process_purchase_form()
{
    do_action('give_pre_process_purchase');
    // Validate the form $_POST data
    $valid_data = give_purchase_form_validate_fields();
    // Allow themes and plugins to hook to errors
    do_action('give_checkout_error_checks', $valid_data, $_POST);
    $is_ajax = isset($_POST['give_ajax']);
    // Process the login form
    if (isset($_POST['give_login_submit'])) {
        give_process_form_login();
    }
    // Validate the user
    $user = give_get_purchase_form_user($valid_data);
    if (give_get_errors() || !$user) {
        if ($is_ajax) {
            do_action('give_ajax_checkout_errors');
            give_die();
        } else {
            return false;
        }
    }
    if ($is_ajax) {
        echo 'success';
        give_die();
    }
    // Setup user information
    $user_info = array('id' => $user['user_id'], 'email' => $user['user_email'], 'first_name' => $user['user_first'], 'last_name' => $user['user_last'], 'address' => $user['address']);
    $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
    // Setup purchase information
    $purchase_data = array('price' => isset($_POST['give-amount']) ? (double) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00', 'purchase_key' => strtolower(md5($user['user_email'] . date('Y-m-d H:i:s') . $auth_key . uniqid('give', true))), 'user_email' => $user['user_email'], 'date' => date('Y-m-d H:i:s', current_time('timestamp')), 'user_info' => stripslashes_deep($user_info), 'post_data' => $_POST, 'gateway' => $valid_data['gateway'], 'card_info' => $valid_data['cc_info']);
    // Add the user data for hooks
    $valid_data['user'] = $user;
    // Allow themes and plugins to hook before the gateway
    do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
    // If the total amount in the cart is 0, send to the manual gateway. This emulates a free purchase
    if (!$purchase_data['price']) {
        // Revert to manual
        $purchase_data['gateway'] = 'manual';
        $_POST['give-gateway'] = 'manual';
    }
    // Allow the purchase data to be modified before it is sent to the gateway
    $purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data);
    // Setup the data we're storing in the purchase session
    $session_data = $purchase_data;
    // Make sure credit card numbers are never stored in sessions
    unset($session_data['card_info']['card_number']);
    // Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data.
    give_set_purchase_session($session_data);
    // Send info to the gateway for payment processing
    give_send_to_gateway($purchase_data['gateway'], $purchase_data);
    give_die();
}
开发者ID:kdclabs,项目名称:Give,代码行数:62,代码来源:process-purchase.php

示例5: column_default

 /**
  * This function renders most of the columns in the list table.
  *
  * @access public
  * @since  1.0
  *
  * @param array  $item        Contains all the data of the discount code
  * @param string $column_name The name of the column
  *
  * @return string Column Name
  */
 public function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'form':
             return '<a href="' . esc_url(add_query_arg('form', $item[$column_name])) . '" >' . get_the_title($item[$column_name]) . '</a>';
         case 'user_id':
             return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&user=' . (!empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))) . '">' . $item['user_name'] . '</a>';
         case 'amount':
             return give_currency_filter(give_format_amount($item['amount']));
         case 'payment_id':
             return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . give_get_payment_number($item['payment_id']) . '</a>';
         default:
             return $item[$column_name];
     }
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:26,代码来源:class-sales-logs-list-table.php

示例6: column_default

 /**
  * This function renders most of the columns in the list table.
  *
  * @access public
  * @since  1.0
  *
  * @param array  $item        Contains all the data of the downloads
  * @param string $column_name The name of the column
  *
  * @return string Column Name
  */
 public function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'earnings':
             return give_currency_filter(give_format_amount($item[$column_name]));
         case 'average_sales':
             return round($item[$column_name]);
         case 'average_earnings':
             return give_currency_filter(give_format_amount($item[$column_name]));
         case 'details':
             return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID']) . '">' . __('View Detailed Report', 'give') . '</a>';
         default:
             return $item[$column_name];
     }
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:26,代码来源:class-form-reports-table.php

示例7: give_donations_validate_donation_amount

/**
 * Validation donation amount. Note: Give handles validation minimum amount out-of-the-box.
 *
 * Check that a donation is above or below a maximum amount.
 *
 * @param $valid_data
 * @param $data
 */
function give_donations_validate_donation_amount($valid_data, $data)
{
    // Only validate the form with the IDs "754" and "586";
    // Remove "If" statement to validation for all forms
    // For a single form, use this instead:
    //	$forms = array( 1425 );
    //	if ( ! in_array( $data['give-form-id'], $forms ) ) {
    //		return;
    //	}
    $sanitized_amount = (int) give_sanitize_amount($data['give-amount']);
    $max_amount = 1000;
    //Check for message data
    if ($sanitized_amount >= $max_amount) {
        give_set_error('give_message', sprintf(__('Sorry, we can\'t accept donations more than %s.', 'give'), give_currency_filter(give_format_amount($max_amount))));
    }
}
开发者ID:WordImpress,项目名称:Give-Snippet-Library,代码行数:24,代码来源:validate-donation-amount.php

示例8: column_default

 /**
  * This function renders most of the columns in the list table.
  *
  * @access public
  * @since  1.0
  *
  * @param array $item Contains all the data of the discount code
  * @param string $column_name The name of the column
  *
  * @return string Column Name
  */
 public function column_default($item, $column_name)
 {
     $payment = give_get_payment_by('id', $item['payment_id']);
     switch ($column_name) {
         case 'form':
             return '<a href="' . esc_url(add_query_arg('form', $item[$column_name])) . '" >' . get_the_title($item[$column_name]) . '</a>';
         case 'user_id':
             return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&user=' . (!empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))) . '">' . $item['user_name'] . '</a>';
         case 'amount':
             return give_currency_filter(give_format_amount($item['amount']));
         case 'status':
             $value = '<div class="give-donation-status status-' . sanitize_title(give_get_payment_status($payment, true)) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status($payment, true) . '</div>';
             if ($payment->mode == 'test') {
                 $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__('This payment was made in test mode', 'give') . '">' . esc_html__('Test', 'give') . '</span>';
             }
             return $value;
         case 'payment_id':
             return '<a href="' . admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . give_get_payment_number($item['payment_id']) . '</a>';
         default:
             return $item[$column_name];
     }
 }
开发者ID:wordimpress,项目名称:give,代码行数:33,代码来源:class-sales-logs-list-table.php

示例9: pre_fetch

 /**
  * Zero out the data on step one
  *
  * @access public
  * @since 1.5
  * @return void
  */
 public function pre_fetch()
 {
     if ($this->step === 1) {
         $allowed_payment_status = apply_filters('give_recount_customer_payment_statuses', give_get_payment_status_keys());
         // Before we start, let's zero out the customer's data
         $customer = new Give_Customer($this->customer_id);
         $customer->update(array('purchase_value' => give_format_amount(0), 'purchase_count' => 0));
         $attached_payment_ids = explode(',', $customer->payment_ids);
         $attached_args = array('post__in' => $attached_payment_ids, 'number' => -1, 'status' => $allowed_payment_status);
         $attached_payments = give_get_payments($attached_args);
         $unattached_args = array('post__not_in' => $attached_payment_ids, 'number' => -1, 'status' => $allowed_payment_status, 'meta_query' => array(array('key' => '_give_payment_user_email', 'value' => $customer->email)));
         $unattached_payments = give_get_payments($unattached_args);
         $payments = array_merge($attached_payments, $unattached_payments);
         $this->store_data('give_recount_customer_payments_' . $customer->id, $payments);
     }
 }
开发者ID:wordimpress,项目名称:give,代码行数:23,代码来源:class-give-tools-recount-single-customer-stats.php

示例10: give_show_goal_progress

/**
 * Show Give Goals
 * @since 1.0
 *
 * @param int $form_id
 *
 * @return bool
 */
function give_show_goal_progress($form_id)
{
    $goal_option = get_post_meta($form_id, '_give_goal_option', true);
    $form = new Give_Donate_Form($form_id);
    $goal = $form->goal;
    $income = $form->get_earnings();
    $color = get_post_meta($form_id, '_give_goal_color', true);
    if (empty($form->ID) || $goal_option !== 'yes' || $goal == 0) {
        return false;
    }
    $progress = round($income / $goal * 100, 2);
    if ($income > $goal) {
        $progress = 100;
    }
    $output = '<div class="goal-progress">';
    $output .= '<div class="raised">';
    $output .= sprintf(_x('%s of %s raised', 'give', 'This text displays the amount of income raised compared to the goal.'), '<span class="income">' . give_currency_filter(give_format_amount($income)) . '</span>', '<span class="goal-text">' . give_currency_filter(give_format_amount($goal))) . '</span>';
    $output .= '</div>';
    $output .= '<div class="progress-bar">';
    $output .= '<span style="width: ' . esc_attr($progress) . '%;';
    if (!empty($color)) {
        $output .= 'background-color:' . $color;
    }
    $output .= '"></span>';
    $output .= '</div></div><!-- /.goal-progress -->';
    echo apply_filters('give_goal_output', $output);
}
开发者ID:pantelicnevena,项目名称:hanan,代码行数:35,代码来源:template.php

示例11: give_price_range

/**
 * Retrieves a price from from low to high of a variable priced form
 *
 * @since 1.0
 *
 * @param int $form_id ID of the form
 *
 * @return string $range A fully formatted price range
 */
function give_price_range($form_id = 0)
{
    $low = give_get_lowest_price_option($form_id);
    $high = give_get_highest_price_option($form_id);
    $range = '<span class="give_price_range_low">' . give_currency_filter(give_format_amount($low)) . '</span>';
    $range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
    $range .= '<span class="give_price_range_high">' . give_currency_filter(give_format_amount($high)) . '</span>';
    return apply_filters('give_price_range', $range, $form_id, $low, $high);
}
开发者ID:helgatheviking,项目名称:Give,代码行数:18,代码来源:functions.php

示例12: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since  1.0
  * @global object $wpdb Used to query the database using the WordPress
  *                      Database API
  * @return array $data The data for the CSV file
  */
 public function get_data()
 {
     global $wpdb, $give_options;
     $data = array();
     $payments = give_get_payments(array('offset' => 0, 'number' => -1, 'mode' => give_is_test_mode() ? 'test' : 'live', 'status' => isset($_POST['give_export_payment_status']) ? $_POST['give_export_payment_status'] : 'any', 'month' => isset($_POST['month']) ? absint($_POST['month']) : date('n'), 'year' => isset($_POST['year']) ? absint($_POST['year']) : date('Y')));
     foreach ($payments as $payment) {
         $payment_meta = give_get_payment_meta($payment->ID);
         $user_info = give_get_payment_meta_user_info($payment->ID);
         $total = give_get_payment_amount($payment->ID);
         $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
         $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '';
         $form_title = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
         if (is_numeric($user_id)) {
             $user = get_userdata($user_id);
         } else {
             $user = false;
         }
         $data[] = array('id' => $payment->ID, 'seq_id' => give_get_payment_number($payment->ID), 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', 'amount' => html_entity_decode(give_format_amount($total)), 'form_id' => $form_id, 'form' => $form_title, 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), 'trans_id' => give_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'give'), 'status' => give_get_payment_status($payment, true));
     }
     $data = apply_filters('give_export_get_data', $data);
     $data = apply_filters('give_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:lots0logs,项目名称:Give,代码行数:32,代码来源:class-export-payments.php

示例13: get_permalink

											</td>
											<td>
												<a href="<?php 
echo get_permalink($payment_meta['form_id']);
?>
"><?php 
echo $payment_meta['form_title'];
?>
</a>
											</td>
											<td><?php 
echo date('m/d/Y', $payment_date) . ' ' . date_i18n('H:i', $payment_date);
?>
</td>
											<td><?php 
echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))));
?>
</td>
											<?php 
do_action('give_donation_details_tbody_after', $payment_id);
?>

										</tr>
									</table>

								</div>
								<!-- /.inside -->


							</div>
							<!-- /#give-donation-overview -->
开发者ID:lots0logs,项目名称:Give,代码行数:31,代码来源:view-order-details.php

示例14: give_email_tag_price

/**
 * Email template tag: price
 * The total price of the donation
 *
 * @param int $payment_id
 *
 * @return string price
 */
function give_email_tag_price($payment_id)
{
    $price = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)), give_get_payment_currency_code($payment_id));
    return html_entity_decode($price, ENT_COMPAT, 'UTF-8');
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:13,代码来源:class-give-email-tags.php

示例15: give_show_goal_progress

/**
 * Show Give Goals
 * @since 1.0
 *
 * @param int   $form_id
 * @param array $args
 *
 * @return mixed
 */
function give_show_goal_progress($form_id, $args)
{
    $goal_option = get_post_meta($form_id, '_give_goal_option', true);
    $form = new Give_Donate_Form($form_id);
    $goal = $form->goal;
    $income = $form->get_earnings();
    $color = get_post_meta($form_id, '_give_goal_color', true);
    $show_text = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
    $show_bar = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
    //Sanity check - respect shortcode args
    if (isset($args['show_goal']) && $args['show_goal'] === false) {
        return false;
    }
    //Sanity check - ensure form has goal set to output
    if (empty($form->ID) || is_singular('give_forms') && $goal_option !== 'yes' || $goal_option !== 'yes' || $goal == 0) {
        //not this form, bail
        return false;
    }
    $progress = round($income / $goal * 100, 2);
    if ($income > $goal) {
        $progress = 100;
    }
    $output = '<div class="goal-progress">';
    //Goal Progress Text
    if (!empty($show_text)) {
        $output .= '<div class="raised">';
        $output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">' . give_currency_filter(give_format_amount($income)) . '</span>', '<span class="goal-text">' . give_currency_filter(give_format_amount($goal))) . '</span>';
        $output .= '</div>';
    }
    //Goal Progress Bar
    if (!empty($show_bar)) {
        $output .= '<div class="progress-bar">';
        $output .= '<span style="width: ' . esc_attr($progress) . '%;';
        if (!empty($color)) {
            $output .= 'background-color:' . $color;
        }
        $output .= '"></span>';
        $output .= '</div><!-- /.progress-bar -->';
    }
    $output .= '</div><!-- /.goal-progress -->';
    echo apply_filters('give_goal_output', $output);
    return false;
}
开发者ID:joedolson,项目名称:Give,代码行数:52,代码来源:template.php


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