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


PHP give_get_payment_amount函数代码示例

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


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

示例1: 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()
 {
     $customer = new Give_Customer($this->customer_id);
     $payments = $this->get_stored_data('give_recount_customer_payments_' . $customer->id, array());
     $offset = ($this->step - 1) * $this->per_step;
     $step_items = array_slice($payments, $offset, $this->per_step);
     if (count($step_items) > 0) {
         $pending_total = (double) $this->get_stored_data('give_stats_customer_pending_total' . $customer->id, 0);
         $step_total = 0;
         $found_payment_ids = $this->get_stored_data('give_stats_found_payments_' . $customer->id, array());
         foreach ($step_items as $payment) {
             $payment = get_post($payment->ID);
             if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) {
                 $missing_payments = $this->get_stored_data('give_stats_missing_payments' . $customer->id, array());
                 $missing_payments[] = $payment->ID;
                 $this->store_data('give_stats_missing_payments' . $customer->id, $missing_payments);
                 continue;
             }
             $should_process_payment = 'publish' == $payment->post_status ? true : false;
             $should_process_payment = apply_filters('give_customer_recount_should_process_payment', $should_process_payment, $payment);
             if (true === $should_process_payment) {
                 $found_payment_ids[] = $payment->ID;
                 if (apply_filters('give_customer_recount_sholud_increase_value', true, $payment)) {
                     $payment_amount = give_get_payment_amount($payment->ID);
                     $step_total += $payment_amount;
                 }
             }
         }
         $updated_total = $pending_total + $step_total;
         $this->store_data('give_stats_customer_pending_total' . $customer->id, $updated_total);
         $this->store_data('give_stats_found_payments_' . $customer->id, $found_payment_ids);
         return true;
     }
     return false;
 }
开发者ID:wordimpress,项目名称:give,代码行数:44,代码来源:class-give-tools-recount-single-customer-stats.php

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

示例3: my_give_google_analytics_event

function my_give_google_analytics_event($payment, $give_receipt_args)
{
    if ($give_receipt_args['payment_id']) {
        // Use a meta value so we only send the beacon once.
        if (get_post_meta($payment->ID, 'give_ga_beacon_sent', true)) {
            return;
        }
        $total = give_get_payment_amount($payment->ID);
        ?>
		<script type="text/javascript">

				ga('require', 'ecommerce', 'ecommerce.js');

				ga('ecommerce:addTransaction', {
					'id': '<?php 
        echo esc_js(give_get_payment_number($payment->ID));
        ?>
', // Transaction ID. Required.
					'affiliation': '<?php 
        echo esc_js(get_bloginfo('name'));
        ?>
', // Affiliation or store name.
					'revenue': '<?php 
        echo esc_js($total);
        ?>
' // donation amount.
				});

				ga('ecommerce:send');

		</script>
		<?php 
        update_post_meta($payment->ID, 'give_ga_beacon_sent', true);
    }
}
开发者ID:WordImpress,项目名称:Give-Snippet-Library,代码行数:35,代码来源:add-google-analytics-ecommerce-tracking.php

示例4: 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()
 {
     if ($this->step == 1) {
         $this->delete_data('give_temp_recount_income');
     }
     $total = get_option('give_temp_recount_income', false);
     if (false === $total) {
         $total = (double) 0;
         $this->store_data('give_temp_recount_income', $total);
     }
     $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
     $args = apply_filters('give_recount_income_args', array('number' => $this->per_step, 'page' => $this->step, 'status' => $accepted_statuses, 'fields' => 'ids'));
     $payments = give_get_payments($args);
     if (!empty($payments)) {
         foreach ($payments as $payment) {
             $total += give_get_payment_amount($payment);
         }
         if ($total < 0) {
             $totals = 0;
         }
         $total = round($total, give_currency_decimal_filter());
         $this->store_data('give_temp_recount_income', $total);
         return true;
     }
     update_option('give_income_total', $total);
     set_transient('give_income_total', $total, 86400);
     return false;
 }
开发者ID:wordimpress,项目名称:give,代码行数:37,代码来源:class-give-tools-recount-income.php

示例5: 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()
 {
     $args = array('number' => $this->per_step, 'offset' => $this->per_step * ($this->step - 1), 'orderby' => 'id', 'order' => 'DESC');
     $customers = Give()->customers->get_customers($args);
     if ($customers) {
         $allowed_payment_status = apply_filters('give_recount_customer_payment_statuses', give_get_payment_status_keys());
         foreach ($customers as $customer) {
             $attached_payment_ids = explode(',', $customer->payment_ids);
             $attached_args = array('post__in' => $attached_payment_ids, 'number' => -1, 'status' => $allowed_payment_status);
             $attached_payments = (array) 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, 'compare' => '=')));
             $unattached_payments = give_get_payments($unattached_args);
             $payments = array_merge($attached_payments, $unattached_payments);
             $purchase_value = 0.0;
             $purchase_count = 0;
             $payment_ids = array();
             if ($payments) {
                 foreach ($payments as $payment) {
                     $should_process_payment = 'publish' == $payment->post_status ? true : false;
                     $should_process_payment = apply_filters('give_customer_recount_should_process_payment', $should_process_payment, $payment);
                     if (true === $should_process_payment) {
                         if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) {
                             $purchase_value += give_get_payment_amount($payment->ID);
                         }
                         if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
                             $purchase_count++;
                         }
                     }
                     $payment_ids[] = $payment->ID;
                 }
             }
             $payment_ids = implode(',', $payment_ids);
             $customer_update_data = array('purchase_count' => $purchase_count, 'purchase_value' => $purchase_value, 'payment_ids' => $payment_ids);
             $customer_instance = new Give_Customer($customer->id);
             $customer_instance->update($customer_update_data);
         }
         return true;
     }
     return false;
 }
开发者ID:wordimpress,项目名称:give,代码行数:49,代码来源:class-give-tools-recount-customer-stats.php

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

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

示例8: give_get_gateway_admin_label

/**
 * Returns the admin label for the specified gateway
 *
 * @since 1.0.8.3
 *
 * @param string $gateway Name of the gateway to retrieve a label for
 *
 * @return string Gateway admin label
 */
function give_get_gateway_admin_label($gateway)
{
    $gateways = give_get_enabled_payment_gateways();
    $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
    $payment = isset($_GET['id']) ? absint($_GET['id']) : false;
    if ($gateway == 'manual' && $payment) {
        if (give_get_payment_amount($payment) == 0) {
            $label = __('Test Donation', 'give');
        }
    }
    return apply_filters('give_gateway_admin_label', $label, $gateway);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:21,代码来源:functions.php

示例9: get_payments

 /**
  * Retrieve payments.
  *
  * The query can be modified in two ways; either the action before the
  * query is run, or the filter on the arguments (existing mainly for backwards
  * compatibility).
  *
  * @access public
  * @since  1.0
  * @return object
  */
 public function get_payments()
 {
     do_action('give_pre_get_payments', $this);
     $query = new WP_Query($this->args);
     if ('payments' != $this->args['output']) {
         return $query->posts;
     }
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $details = new stdClass();
             $payment_id = get_post()->ID;
             $details->ID = $payment_id;
             $details->date = get_post()->post_date;
             $details->post_status = get_post()->post_status;
             $details->total = give_get_payment_amount($payment_id);
             $details->fees = give_get_payment_fees($payment_id);
             $details->key = give_get_payment_key($payment_id);
             $details->gateway = give_get_payment_gateway($payment_id);
             $details->user_info = give_get_payment_meta_user_info($payment_id);
             if (give_get_option('enable_sequential')) {
                 $details->payment_number = give_get_payment_number($payment_id);
             }
             $this->payments[] = apply_filters('give_payment', $details, $payment_id, $this);
         }
         wp_reset_postdata();
     }
     do_action('give_post_get_payments', $this);
     return $this->payments;
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:41,代码来源:class-payments-query.php

示例10: get_earnings

 /**
  * Retrieve earning stats
  *
  * @access public
  * @since  1.0
  *
  * @param $form_id    INT The donation form to retrieve stats for. If false, gets stats for all forms
  * @param $start_date string|bool The starting date for which we'd like to filter our donation earnings stats. If false, we'll use the default start date of `this_month`
  * @param $end_date   string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month`
  *
  * @return float|int
  */
 public function get_earnings($form_id = 0, $start_date = false, $end_date = false)
 {
     global $wpdb;
     $this->setup_dates($start_date, $end_date);
     // Make sure start date is valid
     if (is_wp_error($this->start_date)) {
         return $this->start_date;
     }
     // Make sure end date is valid
     if (is_wp_error($this->end_date)) {
         return $this->end_date;
     }
     add_filter('posts_where', array($this, 'payments_where'));
     if (empty($form_id)) {
         // Global earning stats
         $args = array('post_type' => 'give_payment', 'nopaging' => true, 'post_status' => array('publish', 'revoked'), 'fields' => 'ids', 'update_post_term_cache' => false, 'suppress_filters' => false, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'give_transient_type' => 'give_earnings');
         $args = apply_filters('give_stats_earnings_args', $args);
         $key = 'give_stats_' . substr(md5(serialize($args)), 0, 15);
         $earnings = get_transient($key);
         if (false === $earnings) {
             $sales = get_posts($args);
             $earnings = 0;
             if ($sales) {
                 $sales = implode(',', $sales);
                 $earnings += $wpdb->get_var("SELECT SUM(meta_value) FROM {$wpdb->postmeta} WHERE meta_key = '_give_payment_total' AND post_id IN({$sales})");
             }
             // Cache the results for one hour
             set_transient($key, $earnings, HOUR_IN_SECONDS);
         }
     } else {
         // Donation form specific earning stats
         global $give_logs, $wpdb;
         $args = array('post_parent' => $form_id, 'nopaging' => true, 'log_type' => 'sale', 'fields' => 'ids', 'suppress_filters' => false, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'give_transient_type' => 'give_earnings');
         $args = apply_filters('give_stats_earnings_args', $args);
         $key = 'give_stats_' . substr(md5(serialize($args)), 0, 15);
         //Set transient for faster stats
         $earnings = get_transient($key);
         if (false === $earnings) {
             $log_ids = $give_logs->get_connected_logs($args, 'sale');
             $earnings = 0;
             if ($log_ids) {
                 $log_ids = implode(',', $log_ids);
                 $payment_ids = $wpdb->get_col("SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key='_give_log_payment_id' AND post_id IN ({$log_ids});");
                 foreach ($payment_ids as $payment_id) {
                     $earnings += give_get_payment_amount($payment_id);
                 }
             }
             // Cache the results for one hour
             set_transient($key, $earnings, 60 * 60);
         }
     }
     //remove our filter
     remove_filter('posts_where', array($this, 'payments_where'));
     //return earnings
     return round($earnings, give_currency_decimal_filter());
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:68,代码来源:class-payment-stats.php

示例11: give_offline_send_admin_notice

/**
 * Send Offline Donation Admin Notice
 *
 * Sends a notice to site admins about the pending donation
 *
 * @since       1.0
 *
 * @param int $payment_id
 *
 * @return void
 *
 */
function give_offline_send_admin_notice($payment_id = 0)
{
    /* Send an email notification to the admin */
    $admin_email = give_get_admin_notice_emails();
    $user_info = give_get_payment_meta_user_info($payment_id);
    if (isset($user_info['id']) && $user_info['id'] > 0) {
        $user_data = get_userdata($user_info['id']);
        $name = $user_data->display_name;
    } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
        $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
    } else {
        $name = $user_info['email'];
    }
    $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
    $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
    $admin_message = esc_attr__('Dear Admin,', 'give') . "\n\n";
    $admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give') . get_bloginfo('name') . ' ';
    $admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give') . "\n\n";
    $admin_message .= '<strong>' . esc_attr__('Donor: ', 'give') . '</strong>' . '{fullname}' . "\n";
    $admin_message .= '<strong>' . esc_attr__('Amount: ', 'give') . '</strong>' . '{amount}' . "\n\n";
    $admin_message .= sprintf('<a href="%1$s">%2$s</a>', admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id), esc_html__('Click Here to View and/or Update Donation Details', 'give')) . "\n\n";
    $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
    $admin_message = give_do_email_tags($admin_message, $payment_id);
    $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
    $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
    //Send Email
    $emails = Give()->emails;
    if (!empty($admin_headers)) {
        $emails->__set('headers', $admin_headers);
    }
    $emails->send($admin_email, $admin_subject, $admin_message, $attachments);
}
开发者ID:wordimpress,项目名称:give,代码行数:44,代码来源:offline-donations.php

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

示例13: give_payment_amount

/**
 * Get Payment Amount
 *
 * Get the fully formatted payment amount. The payment amount is retrieved using give_get_payment_amount() and is then sent through give_currency_filter() and  give_format_amount() to format the amount correctly.
 *
 * @since       1.0
 *
 * @param int $payment_id Payment ID
 *
 * @return string $amount Fully formatted payment amount
 */
function give_payment_amount($payment_id = 0)
{
    $amount = give_get_payment_amount($payment_id);
    return give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment_id));
}
开发者ID:wordimpress,项目名称:give,代码行数:16,代码来源:functions.php

示例14: give_undo_donation_on_refund

/**
 * Reduces earnings and donation stats when a donation is refunded
 *
 * @since 1.0
 *
 * @param $payment_id
 * @param $new_status
 * @param $old_status
 *
 * @return void
 */
function give_undo_donation_on_refund($payment_id, $new_status, $old_status)
{
    if ('publish' != $old_status && 'revoked' != $old_status) {
        return;
    }
    if ('refunded' != $new_status) {
        return;
    }
    // Set necessary vars
    $payment_meta = give_get_payment_meta($payment_id);
    $amount = give_get_payment_amount($payment_id);
    // Undo this purchase
    give_undo_purchase($payment_meta['form_id'], $payment_id);
    // Decrease total earnings
    give_decrease_total_earnings($amount);
    // Decrement the stats for the donor
    $donor_id = give_get_payment_customer_id($payment_id);
    if ($donor_id) {
        Give()->customers->decrement_stats($donor_id, $amount);
    }
    // Clear the This Month earnings (this_monththis_month is NOT a typo)
    delete_transient(md5('give_earnings_this_monththis_month'));
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:34,代码来源:actions.php

示例15: get_recent_donations

 /**
  * Retrieves Recent Sales
  *
  * @access public
  * @since  1.1
  * @return array
  */
 public function get_recent_donations()
 {
     global $wp_query;
     $sales = array();
     if (!user_can($this->user_id, 'view_give_reports') && !$this->override) {
         return $sales;
     }
     if (isset($wp_query->query_vars['id'])) {
         $query = array();
         $query[] = give_get_payment_by('id', $wp_query->query_vars['id']);
     } elseif (isset($wp_query->query_vars['purchasekey'])) {
         $query = array();
         $query[] = give_get_payment_by('key', $wp_query->query_vars['purchasekey']);
     } elseif (isset($wp_query->query_vars['email'])) {
         $query = give_get_payments(array('meta_key' => '_give_payment_user_email', 'meta_value' => $wp_query->query_vars['email'], 'number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     } else {
         $query = give_get_payments(array('number' => $this->per_page(), 'page' => $this->get_paged(), 'status' => 'publish'));
     }
     if ($query) {
         $i = 0;
         foreach ($query as $payment) {
             $payment_meta = give_get_payment_meta($payment->ID);
             $user_info = give_get_payment_meta_user_info($payment->ID);
             $sales['donations'][$i]['ID'] = give_get_payment_number($payment->ID);
             $sales['donations'][$i]['transaction_id'] = give_get_payment_transaction_id($payment->ID);
             $sales['donations'][$i]['key'] = give_get_payment_key($payment->ID);
             $sales['donations'][$i]['total'] = give_get_payment_amount($payment->ID);
             $sales['donations'][$i]['gateway'] = give_get_payment_gateway($payment->ID);
             $sales['donations'][$i]['email'] = give_get_payment_user_email($payment->ID);
             $sales['donations'][$i]['date'] = $payment->post_date;
             $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : $payment_meta;
             $price = isset($payment_meta['form_id']) ? give_get_form_price($payment_meta['form_id']) : false;
             $price_id = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
             $sales['donations'][$i]['form']['id'] = $form_id;
             $sales['donations'][$i]['form']['name'] = get_the_title($payment_meta['form_id']);
             $sales['donations'][$i]['form']['price'] = $price;
             if (give_has_variable_prices($form_id)) {
                 if (isset($payment_meta['price_id'])) {
                     $price_name = give_get_price_option_name($form_id, $payment_meta['price_id'], $payment->ID);
                     $sales['donations'][$i]['form']['price_name'] = $price_name;
                     $sales['donations'][$i]['form']['price'] = give_get_price_option_amount($form_id, $price_id);
                 }
             }
             $i++;
         }
     }
     return $sales;
 }
开发者ID:pantelicnevena,项目名称:newhanan,代码行数:55,代码来源:class-give-api.php


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