• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP give_get_payment_amount函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: do_action

        ?>
			<tr class="give_purchase_row">
				<?php 
        do_action('give_purchase_history_row_start', $post->ID, $donation_data);
        ?>
				<td class="give_purchase_id">#<?php 
        echo give_get_payment_number($post->ID);
        ?>
</td>
				<td class="give_purchase_date"><?php 
        echo date_i18n(get_option('date_format'), strtotime(get_post_field('post_date', $post->ID)));
        ?>
</td>
				<td class="give_purchase_amount">
					<span class="give_purchase_amount"><?php 
        echo give_currency_filter(give_format_amount(give_get_payment_amount($post->ID)));
        ?>
</span>
				</td>
				<td class="give_purchase_details">
					<?php 
        if ($post->post_status != 'publish') {
            ?>
						<span class="give_purchase_status <?php 
            echo $post->post_status;
            ?>
"><?php 
            echo give_get_payment_status($post, true);
            ?>
</span>
						<a href="<?php 
开发者ID:pantelicnevena,项目名称:newhanan,代码行数:31,代码来源:history-donations.php


示例17: give_process_paypal_refund

/**
 * Process PayPal IPN Refunds
 *
 * @since 1.0
 *
 * @param array $data       IPN Data
 * @param int   $payment_id The payment ID.
 *
 * @return void
 */
function give_process_paypal_refund($data, $payment_id = 0)
{
    // Collect payment details
    if (empty($payment_id)) {
        return;
    }
    if (get_post_status($payment_id) == 'refunded') {
        return;
        // Only refund payments once
    }
    $payment_amount = give_get_payment_amount($payment_id);
    $refund_amount = $data['payment_gross'] * -1;
    if (number_format((double) $refund_amount, 2) < number_format((double) $payment_amount, 2)) {
        give_insert_payment_note($payment_id, sprintf(esc_html__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id']));
        return;
        // This is a partial refund
    }
    give_insert_payment_note($payment_id, sprintf(esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'), $data['parent_txn_id'], $data['reason_code']));
    give_insert_payment_note($payment_id, sprintf(esc_html__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id']));
    give_update_payment_status($payment_id, 'refunded');
}
开发者ID:wordimpress,项目名称:give,代码行数:31,代码来源:paypal-standard.php


示例18: give_get_donation_notification_body_content

/**
 * Sale Notification Template Body
 *
 * @since  1.0
 *
 * @param int   $payment_id   Payment ID
 * @param array $payment_data Payment Data
 *
 * @return string $email_body Body of the email
 */
function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array())
{
    global $give_options;
    $user_info = maybe_unserialize($payment_data['user_info']);
    $email = give_get_payment_user_email($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 = $email;
    }
    $gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
    $default_email_body = __('Hello', 'give') . "\n\n" . __('A donation has been made', 'give') . ".\n\n";
    $default_email_body .= sprintf(__('%s sold:', 'give'), give_get_forms_label_plural()) . "\n\n";
    $default_email_body .= __('Donor: ', 'give') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
    $default_email_body .= __('Amount: ', 'give') . " " . html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8') . "\n";
    $default_email_body .= __('Payment Method: ', 'give') . " " . $gateway . "\n\n";
    $default_email_body .= __('Thank you', 'give');
    $email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body;
    $email_body = give_do_email_tags($email, $payment_id);
    return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
}
开发者ID:helgatheviking,项目名称:Give,代码行数:34,代码来源:template.php


示例19: 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);
             $first_name = isset($user_info['first_name']) ? $user_info['first_name'] : '';
             $last_name = isset($user_info['last_name']) ? $user_info['last_name'] : '';
             $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]['name'] = $first_name . ' ' . $last_name;
             $sales['donations'][$i]['fname'] = $first_name;
             $sales['donations'][$i]['lname'] = $last_name;
             $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_id'] = $price_id;
                     $sales['donations'][$i]['form']['price'] = give_get_price_option_amount($form_id, $price_id);
                 }
             }
             //Add custom meta to API
             foreach ($payment_meta as $meta_key => $meta_value) {
                 $exceptions = array('form_title', 'form_id', 'price_id', 'user_info', 'key', 'email', 'date');
                 //Don't clutter up results with dupes
                 if (in_array($meta_key, $exceptions)) {
                     continue;
                 }
                 $sales['donations'][$i]['payment_meta'][$meta_key] = $meta_value;
             }
             $i++;
         }
     }
     return apply_filters('give_api_donations_endpoint', $sales);
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:70,代码来源:class-give-api.php


示例20: give_offline_send_admin_notice

/**
 * Send Offline Donation Admin Notice
 *
 * @description 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 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP give_get_payment_meta函数代码示例发布时间:2022-05-15
下一篇:
PHP give_get_option函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap