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


PHP edd_get_payment_meta函数代码示例

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


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

示例1: eddrle_send_license_email

    function eddrle_send_license_email($license_id, $d_id, $payment_id, $type)
    {
        // Sanity check! Is EDD 1.2+ active?
        if (!function_exists('edd_get_payment_meta')) {
            return;
        }
        $payment_meta = edd_get_payment_meta($payment_id);
        // Bail early if we don't have an email address. Tough luck, man!
        if (empty($payment_meta['email'])) {
            return;
        }
        $license_key = get_post_meta($license_id, '_edd_sl_key', true);
        // Bail early if we don't have a license key, for some reason.
        if (empty($license_key)) {
            return;
        }
        $download_title = get_the_title($d_id);
        // Bail early if there's no title. There should be, though!
        if (empty($download_title)) {
            return;
        }
        // A quick message. Hey don't forget to change this text!
        $message = 'A license key has been generated for your purchase of ' . $download_title . '. Please use the license key below to take advantage of one-click updates.

' . $license_key . '

Let me know if you have any questions,

Nate Wright
Theme of the Crop
http://themeofthecrop.com';
        // Send the email
        wp_mail($payment_meta['email'], 'License key generated for ' . $download_title, $message);
    }
开发者ID:mintplugins,项目名称:library,代码行数:34,代码来源:edd-retro-license-emails.php

示例2: atcf_pending_purchase

/**
 * Create a log for preapproval payments
 *
 * @since Astoundify Crowdfunding 0.1-alpha
 *
 * @param int $payment_id the ID number of the payment
 * @param string $new_status the status of the payment, probably "publish"
 * @param string $old_status the status of the payment prior to being marked as "complete", probably "pending"
 * @return void
 */
function atcf_pending_purchase($payment_id, $new_status, $old_status)
{
    global $edd_logs;
    // Make sure that payments are only completed once
    if ($old_status == 'publish' || $old_status == 'complete') {
        return;
    }
    // Make sure the payment completion is only processed when new status is complete
    if ($new_status != 'preapproval' && $new_status != 'complete') {
        return;
    }
    if (edd_is_test_mode() && !apply_filters('edd_log_test_payment_stats', false)) {
        return;
    }
    $payment_data = edd_get_payment_meta($payment_id);
    $downloads = maybe_unserialize($payment_data['downloads']);
    $user_info = maybe_unserialize($payment_data['user_info']);
    if (!is_array($downloads)) {
        return;
    }
    foreach ($downloads as $download) {
        if (!isset($download['quantity'])) {
            $download['quantity'] = 1;
        }
        for ($i = 0; $i < $download['quantity']; $i++) {
            $edd_logs->insert_log(array('post_parent' => $download['id'], 'log_type' => 'preapproval'), array('payment_id' => $payment_id));
        }
    }
}
开发者ID:WilliamJamesDalrympleWest,项目名称:crowdfunding,代码行数:39,代码来源:logs.php

示例3: edd_email_purchase_receipt

/**
 * Email the download link(s) and payment confirmation to the buyer in a
 * customizable Purchase 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 edd_email_purchase_receipt($payment_id, $admin_notice = true)
{
    $payment_data = edd_get_payment_meta($payment_id);
    $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
    $from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data);
    $to_email = edd_get_payment_user_email($payment_id);
    $subject = edd_get_option('purchase_subject', __('Purchase Receipt', 'edd'));
    $subject = apply_filters('edd_purchase_subject', wp_strip_all_tags($subject), $payment_id);
    $subject = edd_do_email_tags($subject, $payment_id);
    $heading = edd_get_option('purchase_heading', __('Purchase Receipt', 'edd'));
    $heading = apply_filters('edd_purchase_heading', $heading, $payment_id, $payment_data);
    $attachments = apply_filters('edd_receipt_attachments', array(), $payment_id, $payment_data);
    $message = edd_do_email_tags(edd_get_email_body_content($payment_id, $payment_data), $payment_id);
    $emails = EDD()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', $heading);
    $headers = apply_filters('edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
    $emails->__set('headers', $headers);
    $emails->send($to_email, $subject, $message, $attachments);
    if ($admin_notice && !edd_admin_notices_disabled($payment_id)) {
        do_action('edd_admin_sale_notice', $payment_id, $payment_data);
    }
}
开发者ID:nitun,项目名称:Easy-Digital-Downloads,代码行数:35,代码来源:functions.php

示例4: atcf_update_backer_count

/**
 * Increment the backer count for every download in this payment. 
 *
 * @param 	int 		$payment_id
 * @param 	string 		$direction
 * @return 	void
 * @since 	0.9
 */
function atcf_update_backer_count($payment_id, $direction)
{
    $payment_data = edd_get_payment_meta($payment_id);
    $downloads = maybe_unserialize($payment_data['downloads']);
    if (!is_array($downloads)) {
        return;
    }
    foreach ($downloads as $download) {
        $variable_pricing = edd_get_variable_prices($download['id']);
        foreach ($variable_pricing as $key => $value) {
            $what = isset($download['options']['price_id']) ? intval($download['options']['price_id']) : 0;
            if (!isset($variable_pricing[$what]['bought'])) {
                $variable_pricing[$what]['bought'] = 0;
            }
            $current = $variable_pricing[$what]['bought'];
            if ($key == $what) {
                if ('increase' == $direction) {
                    $variable_pricing[$what]['bought'] = $current + $download['quantity'];
                } else {
                    $variable_pricing[$what]['bought'] = $current - $download['quantity'];
                }
            }
        }
        update_post_meta($download['id'], 'edd_variable_prices', $variable_pricing);
    }
}
开发者ID:unclebrain,项目名称:appthemer-crowdfunding,代码行数:34,代码来源:checkout.php

示例5: trigger

 /**
  * Trigger the tickets email
  *
  * @param int $payment_id
  *
  * @return string
  */
 public function trigger($payment_id = 0)
 {
     global $edd_options;
     $payment_data = edd_get_payment_meta($payment_id);
     $user_id = edd_get_payment_user_id($payment_id);
     $user_info = maybe_unserialize($payment_data['user_info']);
     $email = edd_get_payment_user_email($payment_id);
     if (isset($user_id) && $user_id > 0) {
         $user_data = get_userdata($user_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;
     }
     $message = $this->get_content_html($payment_id);
     $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
     $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
     $subject = !empty($edd_options['ticket_subject']) ? wp_strip_all_tags($edd_options['ticket_subject'], true) : $this->default_subject;
     $subject = apply_filters('edd_ticket_receipt_subject', $subject, $payment_id);
     $subject = edd_email_template_tags($subject, $payment_data, $payment_id);
     $headers = 'From: ' . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
     $headers .= 'Reply-To: ' . $from_email . "\r\n";
     $headers .= "Content-Type: text/html; charset=utf-8\r\n";
     $headers = apply_filters('edd_ticket_receipt_headers', $headers, $payment_id, $payment_data);
     // Allow add-ons to add file attachments
     $attachments = apply_filters('edd_ticket_receipt_attachments', array(), $payment_id, $payment_data);
     if (apply_filters('edd_email_ticket_receipt', true)) {
         wp_mail($email, $subject, $message, $headers, $attachments);
     }
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:38,代码来源:Email.php

示例6: edd_csau_view_order_details_upsells

/**
 * Add upsells to order details screen
 *
 * @since 1.0
*/
function edd_csau_view_order_details_upsells($payment_id)
{
    $item = get_post($payment_id);
    $payment_meta = edd_get_payment_meta($payment_id);
    $cart_items = edd_get_payment_meta_cart_details($payment_id);
    $user_info = edd_get_payment_meta_user_info($payment_id);
    $user_id = edd_get_payment_user_id($payment_id);
    $payment_date = strtotime($item->post_date);
    if (!get_post_meta($payment_id, '_edd_payment_upsell_total', true)) {
        return;
    }
    ?>
<div id="edd-purchased-files" class="postbox">
	<h3 class="hndle"><?php 
    _e('Upsells included with this payment', 'edd-csau');
    ?>
</h3>
	<div class="inside">
		<table class="wp-list-table widefat fixed" cellspacing="0">
			<tbody id="the-list">
				<?php 
    if ($cart_items) {
        $i = 0;
        foreach ($cart_items as $key => $cart_item) {
            $id = isset($payment_meta['cart_details']) ? $cart_item['id'] : $cart_item;
            $price_override = isset($payment_meta['cart_details']) ? $cart_item['price'] : null;
            $price = edd_get_download_final_price($id, $user_info, $price_override);
            if (!isset($cart_item['item_number']['upsell'])) {
                continue;
            }
            ?>
						<tr class="<?php 
            if ($i % 2 == 0) {
                echo 'alternate';
            }
            ?>
">
							<td class="name column-name">
								<?php 
            echo '<a href="' . admin_url('post.php?post=' . $id . '&action=edit') . '">' . get_the_title($id) . '</a>';
            if (isset($cart_items[$key]['item_number'])) {
                $price_options = $cart_items[$key]['item_number']['options'];
                if (isset($price_options['price_id'])) {
                    echo ' - ' . edd_get_price_option_name($id, $price_options['price_id'], $payment_id);
                }
            }
            ?>
							</td>
						</tr>
						<?php 
            $i++;
        }
    }
    ?>
			</tbody>
		</table>
	</div>
</div>
<?php 
}
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:65,代码来源:view-order-details.php

示例7: edd_pup_order_history

/**
 * Add the "Send Product Updates?" option to payment history page
 * 
 * @access public
 * @param mixed $payment_id
 * @return void
 */
function edd_pup_order_history($payment_id)
{
    $payment_meta = edd_get_payment_meta($payment_id);
    $sendupdates = isset($payment_meta['edd_send_prod_updates']) ? $payment_meta['edd_send_prod_updates'] : true;
    ob_start();
    ?>
			<div class="edd-admin-box-inside edd-send-updates">
				<p>
					<span class="label" title="<?php 
    _e('When checked, customer will receive product update emails.', 'edd-pup');
    ?>
"><i data-code="f463" class="dashicons dashicons-update"></i></span>&nbsp;
					<input type="checkbox" name="edd-send-product-updates" id="edd_send_product_updates" value="1"<?php 
    checked(true, $sendupdates, true);
    ?>
/>
					<label class="description" for="edd_send_product_updates"><?php 
    _e('Send Product Updates', 'edd-pup');
    ?>
</label>
				</p>
			</div>
			<?php 
    echo ob_get_clean();
}
开发者ID:CGCookie,项目名称:edd-product-updates,代码行数:32,代码来源:payment.php

示例8: edd_has_user_purchased

/**
 * Has User Purchased
 *
 * Checks to see if a user has purchased a download.
 *
 * @access      public
 * @since       1.0
 * @param       int $user_id - the ID of the user to check
 * @param       array $downloads - Array of IDs to check if purchased. If an int is passed, it will be converted to an array
 * @param       int $variable_price_id - the variable price ID to check for
 * @return      boolean - true if has purchased, false otherwise
*/
function edd_has_user_purchased($user_id, $downloads, $variable_price_id = null)
{
    if (!is_user_logged_in()) {
        return false;
    }
    // at some point this should support email checking
    $users_purchases = edd_get_users_purchases($user_id);
    $return = false;
    if (!is_array($downloads)) {
        $downloads = array($downloads);
    }
    if ($users_purchases) {
        foreach ($users_purchases as $purchase) {
            $purchase_meta = edd_get_payment_meta($purchase->ID);
            $purchased_files = maybe_unserialize($purchase_meta['downloads']);
            if (is_array($purchased_files)) {
                foreach ($purchased_files as $download) {
                    if (in_array($download['id'], $downloads)) {
                        if (!is_null($variable_price_id) && $variable_price_id !== false) {
                            if ($variable_price_id == $download['options']['price_id']) {
                                return true;
                            } else {
                                $return = false;
                            }
                        } else {
                            $return = true;
                        }
                    }
                }
            }
        }
    }
    return $return;
}
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:46,代码来源:user-functions.php

示例9: atcf_email_pending_purchase_receipt

/**
 * Build the purchase email.
 *
 * Figure out who to send to, who it's from, etc.
 *
 * @since Astoundify Crowdfunding 0.1-alpha
 *
 * @param int $payment_id The ID of the payment
 * @param boolean $admin_notice Alert admins, or not
 * @return void
 */
function atcf_email_pending_purchase_receipt($payment_id, $admin_notice = true)
{
    global $edd_options;
    $payment_data = edd_get_payment_meta($payment_id);
    $user_info = maybe_unserialize($payment_data['user_info']);
    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'];
    }
    $message = edd_get_email_body_header();
    $message .= atcf_get_email_body_content($payment_id, $payment_data);
    $message .= edd_get_email_body_footer();
    $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
    $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
    $subject = apply_filters('atcf_pending_purchase_subject', __('Your pledge has been received', 'atcf'), $payment_id);
    $subject = edd_email_template_tags($subject, $payment_data, $payment_id);
    $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
    $headers .= "Reply-To: " . $from_email . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    // Allow add-ons to add file attachments
    $attachments = apply_filters('atcf_pending_receipt_attachments', array(), $payment_id, $payment_data);
    wp_mail($payment_data['email'], $subject, $message, $headers, $attachments);
    if ($admin_notice) {
        do_action('edd_admin_pending_purchase_notice', $payment_id, $payment_data);
    }
}
开发者ID:unclebrain,项目名称:appthemer-crowdfunding,代码行数:42,代码来源:emails.php

示例10: edd_acq_method_payment_details

/**
 * Shows the acquisition method on the payment details in admin
 *
 * @since  1.0
 * @param  int $payment_id The Payment ID
 * @return void
 */
function edd_acq_method_payment_details($payment_id)
{
    $acquisition_method = edd_get_payment_meta($payment_id, '_edd_payment_acquisition_method', true);
    if (!empty($acquisition_method)) {
        $current_methods = edd_acq_get_methods();
        foreach ($current_methods as $method) {
            if ($method['value'] === $acquisition_method) {
                $acquisition_name = $method['name'];
                break;
            }
        }
        if (empty($acquisition_name)) {
            $acquisition_name = $acquisition_method . ' - ' . __('inactive', 'edd-acquisition-survey');
        }
        ?>
		<div class="edd-order-acquisition-method edd-admin-box-inside">
			<p>
				<span class="label"><?php 
        _e('Acquisition:', 'edd-acquisition-survey');
        ?>
</span>&nbsp;
				<span><?php 
        echo $acquisition_name;
        ?>
</span>
			</p>
		</div>
		<?php 
    }
}
开发者ID:SelaInc,项目名称:eassignment,代码行数:37,代码来源:hooks.php

示例11: edd_pre_approval_emails_send_admin_email

/**
 * Admin notification 
 */
function edd_pre_approval_emails_send_admin_email($payment_id = 0, $payment_data = array())
{
    $payment_id = absint($payment_id);
    // get payment data from payment ID
    $payment_data = edd_get_payment_meta($payment_id);
    if (empty($payment_id)) {
        return;
    }
    if (!edd_get_payment_by('id', $payment_id)) {
        return;
    }
    $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
    $from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data);
    $subject = sprintf(__('New pledge - Order #%1$s', 'edd-pre-approval-emails'), $payment_id);
    $subject = wp_strip_all_tags($subject);
    $subject = edd_do_email_tags($subject, $payment_id);
    $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
    $headers .= "Reply-To: " . $from_email . "\r\n";
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    $headers = apply_filters('edd_admin_pledge_notification_headers', $headers, $payment_id, $payment_data);
    $attachments = apply_filters('edd_admin_pledge_notification_attachments', array(), $payment_id, $payment_data);
    $message = edd_pre_approval_emails_get_admin_email_body($payment_id, $payment_data);
    if (class_exists('EDD_Emails')) {
        $emails = EDD()->emails;
        $emails->__set('from_name', $from_name);
        $emails->__set('from_email', $from_email);
        $emails->__set('headers', $headers);
        $emails->__set('heading', __('New Pledge!', 'edd-pre-approval-emails'));
        $emails->send(edd_get_admin_notice_emails(), $subject, $message, $attachments);
    }
}
开发者ID:mintplugins,项目名称:library,代码行数:36,代码来源:pre-approval-emails.php

示例12: wc_edd_email_purchase_receipt

/**
 * Helper Functions
 */
function wc_edd_email_purchase_receipt($payment_id, $download_id)
{
    $payment_data = edd_get_payment_meta($payment_id);
    $download = get_post($download_id);
    $license = edd_software_licensing()->get_license_by_purchase($payment_id, $download_id);
    $from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
    $from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
    $from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
    $from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data);
    $to_email = edd_get_payment_user_email($payment_id);
    $subject = edd_get_option('purchase_subject', __('New License Key', 'edd'));
    $subject = apply_filters('edd_purchase_subject', wp_strip_all_tags($subject), $payment_id);
    $subject = edd_do_email_tags($subject, $payment_id);
    $message = "Dear " . edd_email_tag_first_name($payment_id) . ",\n\n";
    $message .= "As you have updated " . $download->post_title . ", please use following new license key to continue getting future updates: \n\n";
    $message .= "License Key : " . edd_software_licensing()->get_license_key($license->ID) . "\n\n";
    $message .= "Sorry for inconvenience.";
    $emails = EDD()->emails;
    $emails->__set('from_name', $from_name);
    $emails->__set('from_email', $from_email);
    $emails->__set('heading', __('Purchase Receipt', 'edd'));
    $headers = apply_filters('edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
    $emails->__set('headers', $headers);
    $emails->send($to_email, $subject, $message, array());
    if ($admin_notice && !edd_admin_notices_disabled($payment_id)) {
        do_action('edd_admin_sale_notice', $payment_id, $payment_data);
    }
}
开发者ID:kishoresahoo,项目名称:woocommerce-to-easydigitaldownloads,代码行数:31,代码来源:software.php

示例13: edd_ti_metabox

function edd_ti_metabox($payment_id)
{
    $tracking_id = edd_ti_get_payment_tracking_id($payment_id);
    $was_sent = edd_get_payment_meta($payment_id, 'edd_tracking_info_sent', true);
    ?>
	<div id="edd-payment-tracking" class="postbox">
		<h3 class="hndle"><span><?php 
    _e('Tracking Info', 'edd-tracking-info');
    ?>
</span></h3>
		<div class="inside">
			<strong class="order-data-tracking-id"><?php 
    _e('Tracking ID:', 'edd-tracking-info');
    ?>
</strong><br/>
			<input type="text" name="edd_payment_tracking_id" value="<?php 
    echo $tracking_id;
    ?>
" class="regular-text" />
			<?php 
    if (!empty($tracking_id)) {
        ?>
			<?php 
        wp_nonce_field('edd-ti-send-tracking', 'edd-ti-send-tracking', false, true);
        ?>
			<?php 
        $notify_button_text = empty($was_sent) ? __('Send Tracking Info', 'edd-tracking-info') : __('Resend Tracking Info', 'edd-tracking-info');
        ?>
			<span class="button-secondary" id="edd-tracking-info-notify-customer" data-payment="<?php 
        echo $payment_id;
        ?>
"><?php 
        echo $notify_button_text;
        ?>
</span>
			<span class="edd-tracking-info-email-message"></span>
			<span class="spinner"></span>
			<p>
				<?php 
        _e('Track shipment', 'edd-tracking-info');
        ?>
:&nbsp;<a href="<?php 
        echo edd_ti_get_payment_tracking_link($payment_id);
        ?>
" target="_blank"><?php 
        echo $tracking_id;
        ?>
</a>
			</p>
			<?php 
    }
    ?>
			<div class="clear"></div>
		</div><!-- /.inside -->
	</div><!-- /#edd-payment-notes -->
	<?php 
}
开发者ID:cklosowski,项目名称:edd-tracking-info,代码行数:57,代码来源:metabox.php

示例14: get_data

 /**
  * Get the Export Data
  *
  * @access public
  * @since 1.4.4
  * @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, $edd_options;
     $data = array();
     $payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => edd_is_test_mode() ? 'test' : 'live', 'status' => isset($_POST['edd_export_payment_status']) ? $_POST['edd_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 = edd_get_payment_meta($payment->ID);
         $user_info = edd_get_payment_meta_user_info($payment->ID);
         $downloads = edd_get_payment_meta_cart_details($payment->ID);
         $total = isset($payment_meta['amount']) ? $payment_meta['amount'] : 0.0;
         $user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
         $products = '';
         $skus = '';
         if ($downloads) {
             foreach ($downloads as $key => $download) {
                 // Download ID
                 $id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
                 // If the download has variable prices, override the default price
                 $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
                 $price = edd_get_download_final_price($id, $user_info, $price_override);
                 // Display the Downoad Name
                 $products .= get_the_title($id) . ' - ';
                 if (edd_use_skus()) {
                     $sku = edd_get_download_sku($id);
                     if (!empty($sku)) {
                         $skus .= $sku;
                     }
                 }
                 if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) {
                     $price_options = $downloads[$key]['item_number']['options'];
                     if (isset($price_options['price_id'])) {
                         $products .= edd_get_price_option_name($id, $price_options['price_id']) . ' - ';
                     }
                 }
                 $products .= html_entity_decode(edd_currency_filter($price));
                 if ($key != count($downloads) - 1) {
                     $products .= ' / ';
                     if (edd_use_skus()) {
                         $skus .= ' / ';
                     }
                 }
             }
         }
         if (is_numeric($user_id)) {
             $user = get_userdata($user_id);
         } else {
             $user = false;
         }
         $data[] = array('id' => $payment->ID, 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'products' => $products, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_get_payment_tax($payment->ID, $payment_meta)), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'edd'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'edd'), 'status' => edd_get_payment_status($payment, true));
         if (!edd_use_skus()) {
             unset($data['skus']);
         }
     }
     $data = apply_filters('edd_export_get_data', $data);
     $data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
     return $data;
 }
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:66,代码来源:class-export-payments.php

示例15: edd_email_purchase_receipt

/**
 * Email Download Purchase Receipt
 *
 * Email the download link(s) and payment confirmation to the buyer.
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_email_purchase_receipt($payment_id, $admin_notice = true)
{
    global $edd_options;
    $payment_data = edd_get_payment_meta($payment_id);
    $user_info = maybe_unserialize($payment_data['user_info']);
    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'];
    }
    $message = edd_get_email_body_header();
    $message .= edd_get_email_body_content($payment_id, $payment_data);
    $message .= edd_get_email_body_footer();
    $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
    $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
    $subject = isset($edd_options['purchase_subject']) && strlen(trim($edd_options['purchase_subject'])) > 0 ? edd_email_template_tags($edd_options['purchase_subject'], $payment_data, $payment_id) : __('Purchase Receipt', 'edd');
    $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
    $headers .= "Reply-To: " . $from_email . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    // allow add-ons to add file attachments
    $attachments = apply_filters('edd_receipt_attachments', array(), $payment_id, $payment_data);
    wp_mail($payment_data['email'], $subject, $message, $headers, $attachments);
    if ($admin_notice) {
        /* send an email notification to the admin */
        $admin_email = edd_get_admin_notice_emails();
        $admin_subject = apply_filters('edd_admin_purchase_notification_subject', __('New download purchase', 'edd'), $payment_id, $payment_data);
        $admin_message = __('Hello', 'edd') . "\n\n" . sprintf(__('A %s purchase has been made', 'edd'), edd_get_label_plural()) . ".\n\n";
        $admin_message .= sprintf(__('%s sold:', 'edd'), edd_get_label_plural()) . "\n\n";
        $download_list = '';
        $downloads = maybe_unserialize($payment_data['downloads']);
        if (is_array($downloads)) {
            foreach ($downloads as $download) {
                $id = isset($payment_data['cart_details']) ? $download['id'] : $download;
                $download_list .= html_entity_decode(get_the_title($id), ENT_COMPAT, 'UTF-8') . "\n";
            }
        }
        $gateway = edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true));
        $admin_message .= $download_list . "\n";
        $admin_message .= __('Purchased by: ', 'edd') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
        $admin_message .= __('Amount: ', 'edd') . " " . html_entity_decode(edd_currency_filter(edd_format_amount($payment_data['amount'])), ENT_COMPAT, 'UTF-8') . "\n\n";
        $admin_message .= __('Payment Method: ', 'edd') . " " . $gateway . "\n\n";
        $admin_message .= __('Thank you', 'edd');
        $admin_message = apply_filters('edd_admin_purchase_notification', $admin_message, $payment_id, $payment_data);
        $admin_headers = apply_filters('edd_admin_purchase_notification_headers', array(), $payment_id, $payment_data);
        $admin_attachments = apply_filters('edd_admin_purchase_notification_attachments', array(), $payment_id, $payment_data);
        wp_mail($admin_email, $admin_subject, $admin_message, $admin_headers, $admin_attachments);
    }
}
开发者ID:vheidari,项目名称:Easy-Digital-Downloads,代码行数:61,代码来源:functions.php


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