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


PHP give_get_payment_meta函数代码示例

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


在下文中一共展示了give_get_payment_meta函数的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()
 {
     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

示例2: rum_wohh_get_wohh_magic_tag_data

/**
 * Get Magic Tag Conditional Data
 * 
 * @description Example function that returns Custom field data if present, for any form ID
 * @param $payment_id
 *
 * @return string|void
 */
function rum_wohh_get_wohh_magic_tag_data($payment_id)
{
    $form_id = give_get_payment_form_id($payment_id);
    $payment_meta = give_get_payment_meta($payment_id);
    $meta_vals = get_post_custom($payment_id);
    $output = '';
    // Check if this payment's donation form ID matches the donation form we want custom email body copy
    if ($form_id == '1650') {
        // Online Donation form
        $donation_reason = '';
        // get the custom field data for this donation
        if (isset($meta_vals['donation_reason'])) {
            $donation_reason = $meta_vals['donation_reason'][0];
        }
        if ($donation_reason != '') {
            $output = '<strong>Reason for Donation:</strong> ' . $donation_reason;
        }
    }
    // Check if this payment's donation form ID matches the donation form we want custom email body copy
    if ($form_id == '1865') {
        // Annual Memorial Walk Butterfly Campaign
        $in_memory_of = '';
        // get the custom field data for this donation
        if (isset($meta_vals['my_donation_is_in_memory_of'])) {
            $in_memory_of = $meta_vals['my_donation_is_in_memory_of'][0];
        }
        if ($in_memory_of != '') {
            $output = '<strong>In Memory Of:</strong> ' . $in_memory_of;
        }
    }
    return $output;
}
开发者ID:WordImpress,项目名称:Give-Snippet-Library,代码行数:40,代码来源:magic-tag.php

示例3: my123_give_remove_donor_notification

/**
 * Prevent the donor notification email but keep the admin notification email functionality.
 *
 * @param $payment_id
 */
function my123_give_remove_donor_notification($payment_id)
{
    remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1);
    //Remove these lines to stop triggering the admin notification.
    $payment_data = give_get_payment_meta($payment_id);
    if (!give_admin_notices_disabled($payment_id)) {
        do_action('give_admin_donation_email', $payment_id, $payment_data);
    }
}
开发者ID:WordImpress,项目名称:Give-Snippet-Library,代码行数:14,代码来源:disable-donor-notification.php

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

示例5: give_email_donation_receipt

/**
 * Email the payment confirmation to the buyer in a customizable Donation Receipt
 *
 * @since 1.0
 *
 * @param int  $payment_id   Payment ID
 * @param bool $admin_notice Whether to send the admin email notification or not (default: true)
 *
 * @return void
 */
function give_email_donation_receipt($payment_id, $admin_notice = true)
{
    $payment_data = give_get_payment_meta($payment_id);
    $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
    $from_email = give_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
    $to_email = give_get_payment_user_email($payment_id);
    $subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
    $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
    $subject = give_do_email_tags($subject, $payment_id);
    $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
    $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
    $emails = Give()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', __('Donation Receipt', 'give'));
    $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
    $emails->__set('headers', $headers);
    $emails->send($to_email, $subject, $message, $attachments);
    if ($admin_notice && !give_admin_notices_disabled($payment_id)) {
        do_action('give_admin_sale_notice', $payment_id, $payment_data);
    }
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:34,代码来源:functions.php

示例6: give_offline_send_donor_instructions

/**
 * Send Offline Donation Instructions
 *
 * @description Sends a notice to the donor with offline instructions; can be customized per form
 *
 * @param int $payment_id
 *
 * @since       1.0
 * @return void
 */
function give_offline_send_donor_instructions($payment_id = 0)
{
    $payment_data = give_get_payment_meta($payment_id);
    $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
    //Customize email content depending on whether the single form has been customized
    $email_content = give_get_option('global_offline_donation_email');
    if ($post_offline_customization_option === 'yes') {
        $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
    }
    $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
    $from_email = give_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
    $to_email = give_get_payment_user_email($payment_id);
    $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
    if ($post_offline_customization_option === 'yes') {
        $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
    }
    $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
    $subject = give_do_email_tags($subject, $payment_id);
    $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
    $message = give_do_email_tags($email_content, $payment_id);
    $emails = Give()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', __('Offline Donation Instructions', 'give'));
    $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
    $emails->__set('headers', $headers);
    $emails->send($to_email, $subject, $message, $attachments);
}
开发者ID:joedolson,项目名称:Give,代码行数:40,代码来源:offline-donations.php

示例7: wp_die

 *
 * @since 1.0
 * @return void
 */
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
    wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give'));
}
// Setup the variables
$payment_id = absint($_GET['id']);
$number = give_get_payment_number($payment_id);
$item = get_post($payment_id);
// Sanity check... fail if purchase ID is invalid
if (!is_object($item) || $item->post_type != 'give_payment') {
    wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give'));
}
$payment_meta = give_get_payment_meta($payment_id);
$transaction_id = esc_attr(give_get_payment_transaction_id($payment_id));
$user_id = give_get_payment_user_id($payment_id);
$donor_id = give_get_payment_customer_id($payment_id);
$payment_date = strtotime($item->post_date);
$user_info = give_get_payment_meta_user_info($payment_id);
$address = !empty($user_info['address']) ? $user_info['address'] : array('line1' => '', 'line2' => '', 'city' => '', 'country' => '', 'state' => '', 'zip' => '');
$gateway = give_get_payment_gateway($payment_id);
$currency_code = give_get_payment_currency_code($payment_id);
?>
<div class="wrap give-wrap">
	<h2><?php 
printf(__('Payment %s', 'give'), $number);
?>
</h2>
	<?php 
开发者ID:lots0logs,项目名称:Give,代码行数:31,代码来源:view-order-details.php

示例8: give_process_paypal_web_accept_and_cart

/**
 * Process web accept (one time) payment IPNs.
 *
 * @since 1.0
 *
 * @param array $data       IPN Data
 * @param int   $payment_id The payment ID from Give.
 *
 * @return void
 */
function give_process_paypal_web_accept_and_cart($data, $payment_id)
{
    //Only allow through these transaction types.
    if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') {
        return;
    }
    //Need $payment_id to continue.
    if (empty($payment_id)) {
        return;
    }
    // Collect donation payment details.
    $paypal_amount = $data['mc_gross'];
    $payment_status = strtolower($data['payment_status']);
    $currency_code = strtolower($data['mc_currency']);
    $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
    $payment_meta = give_get_payment_meta($payment_id);
    // Must be a PayPal standard IPN.
    if (give_get_payment_gateway($payment_id) != 'paypal') {
        return;
    }
    // Verify payment recipient
    if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
        give_record_gateway_error(esc_html__('IPN Error', 'give'), sprintf(esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
        give_update_payment_status($payment_id, 'failed');
        give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
        return;
    }
    // Verify payment currency.
    if ($currency_code != strtolower($payment_meta['currency'])) {
        give_record_gateway_error(esc_html__('IPN Error', 'give'), sprintf(esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
        give_update_payment_status($payment_id, 'failed');
        give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
        return;
    }
    //Process refunds & reversed.
    if ($payment_status == 'refunded' || $payment_status == 'reversed') {
        give_process_paypal_refund($data, $payment_id);
        return;
    }
    // Only complete payments once.
    if (get_post_status($payment_id) == 'publish') {
        return;
    }
    // Retrieve the total donation amount (before PayPal).
    $payment_amount = give_get_payment_amount($payment_id);
    //Check that the donation PP and local db amounts match.
    if (number_format((double) $paypal_amount, 2) < number_format((double) $payment_amount, 2)) {
        // The prices don't match
        give_record_gateway_error(esc_html__('IPN Error', 'give'), sprintf(esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data)), $payment_id);
        give_update_payment_status($payment_id, 'failed');
        give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
        return;
    }
    //Process completed donations.
    if ($payment_status == 'completed' || give_is_test_mode()) {
        give_insert_payment_note($payment_id, sprintf(esc_html__('PayPal Transaction ID: %s', 'give'), $data['txn_id']));
        give_set_payment_transaction_id($payment_id, $data['txn_id']);
        give_update_payment_status($payment_id, 'publish');
    } elseif ('pending' == $payment_status && isset($data['pending_reason'])) {
        // Look for possible pending reasons, such as an echeck.
        $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
        if (!empty($note)) {
            give_insert_payment_note($payment_id, $note);
        }
    }
}
开发者ID:wordimpress,项目名称:give,代码行数:76,代码来源:paypal-standard.php

示例9: give_email_tag_donation

/**
 * Email template tag: donation
 * The form submitted to make the donation
 *
 * @param int $payment_id
 *
 * @return string $form_title
 */
function give_email_tag_donation($payment_id)
{
    $payment_data = give_get_payment_meta($payment_id);
    $form_title = !empty($payment_data['form_title']) ? $payment_data['form_title'] : __('There was an error retrieving this donation title', 'give');
    return $form_title;
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:14,代码来源:class-give-email-tags.php

示例10: _e

</th>
			<th class="give_purchase_details"><?php 
    _e('Details', 'give');
    ?>
</th>
			<?php 
    do_action('give_purchase_history_header_after');
    ?>
		</tr>
		</thead>
		<?php 
    foreach ($donations as $post) {
        setup_postdata($post);
        ?>
			<?php 
        $donation_data = give_get_payment_meta($post->ID);
        ?>
			<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 
开发者ID:pantelicnevena,项目名称:newhanan,代码行数:31,代码来源:history-donations.php

示例11: give_can_view_receipt

/**
 * Determines the receipt visibility status
 *
 * @since 1.3.2
 *
 * @param string $payment_key
 *
 * @return bool Whether the receipt is visible or not.
 */
function give_can_view_receipt($payment_key = '')
{
    $return = false;
    if (empty($payment_key)) {
        return $return;
    }
    global $give_receipt_args;
    $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
    $user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
    $payment_meta = give_get_payment_meta($give_receipt_args['id']);
    if (is_user_logged_in()) {
        if ($user_id === (int) get_current_user_id()) {
            $return = true;
        } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
            $return = true;
        } elseif (current_user_can('view_give_sensitive_data')) {
            $return = true;
        }
    }
    $session = give_get_purchase_session();
    if (!empty($session) && !is_user_logged_in()) {
        if ($session['purchase_key'] === $payment_meta['key']) {
            $return = true;
        }
    }
    return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
}
开发者ID:lots0logs,项目名称:Give,代码行数:36,代码来源:misc-functions.php

示例12: give_do_email_tags

/**
 * Search content for email tags and filter email tags through their hooks.
 *
 * @param string $content    Content to search for email tags.
 * @param int    $payment_id The payment id.
 *
 * @since 1.0
 *
 * @return string Content with email tags filtered out.
 */
function give_do_email_tags($content, $payment_id)
{
    // Replace all tags
    $content = Give()->email_tags->do_tags($content, $payment_id);
    // Maintaining backwards compatibility
    $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id);
    // Return content
    return $content;
}
开发者ID:wordimpress,项目名称:give,代码行数:19,代码来源:class-give-email-tags.php

示例13: give_add_past_purchases_to_new_user

/**
 * Looks up purchases by email that match the registering user
 *
 * This is for users that purchased as a guest and then came
 * back and created an account.
 *
 * @access      public
 * @since       1.0
 *
 * @param       $user_id INT - the new user's ID
 *
 * @return      void
 */
function give_add_past_purchases_to_new_user($user_id)
{
    $email = get_the_author_meta('user_email', $user_id);
    $payments = give_get_payments(array('s' => $email));
    if ($payments) {
        foreach ($payments as $payment) {
            if (intval(give_get_payment_user_id($payment->ID)) > 0) {
                continue;
            }
            // This payment already associated with an account
            $meta = give_get_payment_meta($payment->ID);
            $meta['user_info'] = maybe_unserialize($meta['user_info']);
            $meta['user_info']['id'] = $user_id;
            $meta['user_info'] = $meta['user_info'];
            // Store the updated user ID in the payment meta
            give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
            give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
        }
    }
}
开发者ID:lots0logs,项目名称:Give,代码行数:33,代码来源:user-functions.php

示例14: give_update_old_payments_with_totals

/**
 * Updates all old payments, prior to 1.2, with new
 * meta for the total purchase amount
 *
 * This is so that payments can be queried by their totals
 *
 * @since 1.0
 *
 * @param array $data Arguments passed
 *
 * @return void
 */
function give_update_old_payments_with_totals($data)
{
    if (!wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
        return;
    }
    if (get_option('give_payment_totals_upgraded')) {
        return;
    }
    $payments = give_get_payments(array('offset' => 0, 'number' => -1, 'mode' => 'all'));
    if ($payments) {
        foreach ($payments as $payment) {
            $meta = give_get_payment_meta($payment->ID);
            give_update_payment_meta($payment->ID, '_give_payment_total', $meta['amount']);
        }
    }
    add_option('give_payment_totals_upgraded', 1);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:29,代码来源:actions.php

示例15: my_custom_prefix_get_donation_referral_data

/**
 * Get Donation Referral Data 
 * 
 * @description Example function that returns Custom field data if present in payment_meta; the example used here is in conjunction with the Give documentation tutorials
 * @param $payment_id
 *
 * @return string|void
 */
function my_custom_prefix_get_donation_referral_data($payment_id, $payment_meta)
{
    $payment_meta = give_get_payment_meta($payment_id);
    $output = __('No referral data found.', 'give');
    if (!empty($payment_meta['message'])) {
        $output = $payment_meta['message'];
    }
    return $output;
}
开发者ID:WordImpress,项目名称:Give-Snippet-Library,代码行数:17,代码来源:custom-fields-plugin.php


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