本文整理汇总了PHP中edd_get_payment_key函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_payment_key函数的具体用法?PHP edd_get_payment_key怎么用?PHP edd_get_payment_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_payment_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_data
/**
* Get the data being exported
*
* @access public
* @since 1.2
* @return array
*/
public function get_data()
{
global $edd_logs;
$data = array();
$args = array('nopaging' => true, 'post_type' => 'edd_payment', 'meta_key' => '_edd_payment_shipping_status', 'meta_value' => '1', 'fields' => 'ids');
$payments = get_posts($args);
if ($payments) {
foreach ($payments as $payment) {
$user_info = edd_get_payment_meta_user_info($payment);
$downloads = edd_get_payment_meta_cart_details($payment);
$products = '';
if ($downloads) {
foreach ($downloads as $key => $download) {
// Display the Downoad Name
$products .= get_the_title($download['id']);
if ($key != count($downloads) - 1) {
$products .= ' / ';
}
}
}
$data[] = array('id' => $payment, 'date' => get_post_field('post_date', $payment), 'first_name' => $user_info['first_name'], 'last_name' => $user_info['last_name'], 'email' => $user_info['email'], 'address' => $user_info['shipping_info']['address'], 'address2' => !empty($user_info['shipping_info']['address2']) ? $user_info['shipping_info']['address2'] : '', 'city' => $user_info['shipping_info']['city'], 'state' => $user_info['shipping_info']['state'], 'zip' => $user_info['shipping_info']['zip'], 'country' => $user_info['shipping_info']['country'], 'amount' => edd_get_payment_amount($payment), 'tax' => edd_get_payment_tax($payment), 'gateway' => edd_get_payment_gateway($payment), 'key' => edd_get_payment_key($payment), 'products' => $products, 'status' => get_post_field('post_status', $payment));
}
}
$data = apply_filters('edd_export_get_data', $data);
$data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
return $data;
}
示例2: ck_edd_user_download_button
function ck_edd_user_download_button($purchase_form, $args)
{
global $edd_options;
if (!is_user_logged_in()) {
return $purchase_form;
}
$download_id = (string) $args['download_id'];
$current_user_id = get_current_user_id();
// If the user has purchased this item, itterate through their purchases to get the specific
// purchase data and pull out the key and email associated with it. This is necessary for the
// generation of the download link
if (edd_has_user_purchased($current_user_id, $download_id, $variable_price_id = null)) {
$user_purchases = edd_get_users_purchases($current_user_id, -1, false, 'complete');
foreach ($user_purchases as $purchase) {
$cart_items = edd_get_payment_meta_cart_details($purchase->ID);
$item_ids = wp_list_pluck($cart_items, 'id');
if (in_array($download_id, $item_ids)) {
$email = edd_get_payment_user_email($purchase->ID);
$payment_key = edd_get_payment_key($purchase->ID);
}
}
$download_ids = array();
if (edd_is_bundled_product($download_id)) {
$download_ids = edd_get_bundled_products($download_id);
} else {
$download_ids[] = $download_id;
}
// Setup the style and colors associated with the settings
$style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
$color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
$new_purchase_form = '';
foreach ($download_ids as $item) {
// Attempt to get the file data associated with this download
$download_data = edd_get_download_files($item, null);
if ($download_data) {
foreach ($download_data as $filekey => $file) {
// Generate the file URL and then make a link to it
$file_url = edd_get_download_file_url($payment_key, $email, $filekey, $item, null);
$new_purchase_form .= '<a href="' . $file_url . '" class="' . $style . ' ' . $color . ' edd-submit"><span class="edd-add-to-cart-label">Download ' . $file['name'] . '</span></a> ';
}
}
// As long as we ended up with links to show, use them.
if (!empty($new_purchase_form)) {
$purchase_form = '<h4>' . __('You already own this product. Download it now:', 'edd') . '</h4>' . $new_purchase_form;
}
}
}
return $purchase_form;
}
示例3: edd_email_tag_receipt_link
/**
* Email template tag: receipt_link
* Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly
*
* @param $int payment_id
*
* @return string receipt_link
*/
function edd_email_tag_receipt_link($payment_id)
{
return sprintf(__('%1$sView it in your browser.%2$s', 'easy-digital-downloads'), '<a href="' . esc_url(add_query_arg(array('payment_key' => edd_get_payment_key($payment_id), 'edd_action' => 'view_receipt'), home_url())) . '">', '</a>');
}
示例4: edd_get_payment_meta
/**
* Get Payment Meta for a specific Payment
*
* @since 1.2
* @param int $payment_id Payment ID
* @return array $meta Payment Meta
*/
function edd_get_payment_meta($payment_id)
{
$meta = get_post_meta($payment_id, '_edd_payment_meta', true);
// Payment meta was simplified in EDD v1.5, so these are here for backwards compatibility
if (!isset($meta['key'])) {
$meta['key'] = edd_get_payment_key($payment_id);
}
if (!isset($meta['amount'])) {
$meta['amount'] = edd_get_payment_amount($payment_id);
}
if (!isset($meta['email'])) {
$meta['email'] = edd_get_payment_user_email($payment_id);
}
if (!isset($meta['date'])) {
$meta['date'] = get_post_field('post_date', $payment_id);
}
return apply_filters('edd_get_payment_meta', $meta, $payment_id);
}
示例5: edd_get_gateway_admin_label
echo edd_get_gateway_admin_label($gateway);
?>
</p>
</div>
<?php
}
?>
<div class="edd-order-payment-key edd-admin-box-inside">
<p>
<span class="label"><?php
_e('Key:', 'edd');
?>
</span>
<span><?php
echo edd_get_payment_key($payment_id);
?>
</span>
</p>
</div>
<div class="edd-order-ip edd-admin-box-inside">
<p>
<span class="label"><?php
_e('IP:', 'edd');
?>
</span>
<span><?php
echo esc_attr(edd_get_payment_user_ip($payment_id));
?>
</span>
示例6: edd_get_purchase_download_links
/**
* Gets the download links for each item purchased
*
* @since 1.1.5
* @param int $payment_id The ID of the payment to retrieve download links for
* @return string
*/
function edd_get_purchase_download_links($payment_id = 0)
{
$downloads = edd_get_payment_meta_cart_details($payment_id, true);
$payment_key = edd_get_payment_key($payment_id);
$email = edd_get_payment_user_email($payment_id);
$links = '<ul class="edd_download_links">';
foreach ($downloads as $download) {
$links .= '<li>';
$links .= '<h3 class="edd_download_link_title">' . esc_html(get_the_title($download['id'])) . '</h3>';
$price_id = isset($download['options']) && isset($download['options']['price_id']) ? $download['options']['price_id'] : null;
$files = edd_get_download_files($download['id'], $price_id);
if (is_array($files)) {
foreach ($files as $filekey => $file) {
$links .= '<div class="edd_download_link_file">';
$links .= '<a href="' . esc_url(edd_get_download_file_url($payment_key, $email, $filekey, $download['id'], $price_id)) . '">';
if (isset($file['name'])) {
$links .= esc_html($file['name']);
} else {
$links .= esc_html($file['file']);
}
$links .= '</a>';
$links .= '</div>';
}
}
$links .= '</li>';
}
$links .= '</ul>';
return $links;
}
示例7: edd_ajax_generate_file_download_link
/**
* Retrieves a new download link for a purchased file
*
* @since 2.0
* @return string
*/
function edd_ajax_generate_file_download_link()
{
if (!current_user_can('view_shop_reports')) {
die('-1');
}
$payment_id = absint($_POST['payment_id']);
$download_id = absint($_POST['download_id']);
$price_id = absint($_POST['price_id']);
if (empty($payment_id)) {
die('-2');
}
if (empty($download_id)) {
die('-3');
}
$payment_key = edd_get_payment_key($payment_id);
$email = edd_get_payment_user_email($payment_id);
$limit = edd_get_file_download_limit($download_id);
if (!empty($limit)) {
// Increase the file download limit when generating new links
edd_set_file_download_limit_override($download_id, $payment_id);
}
$files = edd_get_download_files($download_id, $price_id);
if (!$files) {
die('-4');
}
$file_urls = '';
foreach ($files as $file_key => $file) {
$file_urls .= edd_get_download_file_url($payment_key, $email, $file_key, $download_id, $price_id);
$file_urls .= "\n\n";
}
die($file_urls);
}
示例8: edd_get_payment_status
<span class="edd_purchase_status <?php
echo $post->post_status;
?>
"><?php
echo edd_get_payment_status($post, true);
?>
</span>
<a href="<?php
echo esc_url(add_query_arg('payment_key', edd_get_payment_key($post->ID), edd_get_success_page_uri()));
?>
">»</a>
<?php
} else {
?>
<a href="<?php
echo esc_url(add_query_arg('payment_key', edd_get_payment_key($post->ID), edd_get_success_page_uri()));
?>
"><?php
_e('View Details and Downloads', 'edd');
?>
</a>
<?php
}
?>
</td>
<?php
do_action('edd_purchase_history_row_end', $post->ID, $purchase_data);
?>
</tr>
<?php
示例9: edd_get_payment_meta
/**
* Get Payment Meta for a specific Payment
*
* @since 1.2
* @param int $payment_id Payment ID
* @param string $meta_key The meta key to pull
* @param bool $single Pull single meta entry or as an object
* @return mixed $meta Payment Meta
*/
function edd_get_payment_meta($payment_id = 0, $meta_key = '_edd_payment_meta', $single = true)
{
$meta = get_post_meta($payment_id, $meta_key, $single);
if ($meta_key === '_edd_payment_meta') {
// Payment meta was simplified in EDD v1.5, so these are here for backwards compatibility
if (empty($meta['key'])) {
$meta['key'] = edd_get_payment_key($payment_id);
}
if (empty($meta['email'])) {
$meta['email'] = edd_get_payment_user_email($payment_id);
}
if (empty($meta['date'])) {
$meta['date'] = get_post_field('post_date', $payment_id);
}
}
$meta = apply_filters('edd_get_payment_meta_' . $meta_key, $meta, $payment_id);
return apply_filters('edd_get_payment_meta', $meta, $payment_id, $meta_key);
}
示例10: edd_process_paypal_web_accept_and_cart
/**
* Process web accept (one time) payment IPNs
*
* @since 1.3.4
* @global $edd_options Array of all the EDD Options
* @param array $data IPN Data
* @return void
*/
function edd_process_paypal_web_accept_and_cart($data)
{
global $edd_options;
if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
return;
}
// Collect payment details
$payment_id = $data['custom'];
$purchase_key = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
$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']);
if (edd_get_payment_gateway($payment_id) != 'paypal') {
return;
// this isn't a PayPal standard IPN
}
// Verify payment recipient
if (strcasecmp($business_email, trim($edd_options['paypal_email'])) != 0) {
edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid business email in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'edd'));
return;
}
// Verify payment currency
if ($currency_code != strtolower(edd_get_currency())) {
edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid currency in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'edd'));
return;
}
if (!edd_get_payment_user_email($payment_id)) {
// This runs when a Buy Now purchase was made. It bypasses checkout so no personal info is collected until PayPal
// No email associated with purchase, so store from PayPal
edd_update_payment_meta($payment_id, '_edd_payment_user_email', $data['payer_email']);
// Setup and store the customers's details
$address = array();
$address['line1'] = !empty($data['address_street']) ? $data['address_street'] : false;
$address['city'] = !empty($data['address_city']) ? $data['address_city'] : false;
$address['state'] = !empty($data['address_state']) ? $data['address_state'] : false;
$address['country'] = !empty($data['address_country_code']) ? $data['address_country_code'] : false;
$address['zip'] = !empty($data['address_zip']) ? $data['address_zip'] : false;
$user_info = array('id' => '-1', 'email' => $data['payer_email'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'discount' => '', 'address' => $address);
$payment_meta = get_post_meta($payment_id, '_edd_payment_meta', true);
$payment_meta['user_info'] = $user_info;
edd_update_payment_meta($payment_id, '_edd_payment_meta', $payment_meta);
}
if ($payment_status == 'refunded' || $payment_status == 'reversed') {
// Process a refund
edd_process_paypal_refund($data);
} else {
if (get_post_status($payment_id) == 'publish') {
return;
// Only complete payments once
}
// Retrieve the total purchase amount (before PayPal)
$payment_amount = edd_get_payment_amount($payment_id);
if (number_format((double) $paypal_amount, 2) < number_format((double) $payment_amount, 2)) {
// The prices don't match
edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid payment amount in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'edd'));
return;
}
if ($purchase_key != edd_get_payment_key($payment_id)) {
// Purchase keys don't match
edd_record_gateway_error(__('IPN Error', 'edd'), sprintf(__('Invalid purchase key in IPN response. IPN data: %s', 'edd'), json_encode($data)), $payment_id);
edd_update_payment_status($payment_id, 'failed');
edd_insert_payment_note($payment_id, __('Payment failed due to invalid purchase key in PayPal IPN.', 'edd'));
return;
}
if ($payment_status == 'completed' || edd_is_test_mode()) {
edd_insert_payment_note($payment_id, sprintf(__('PayPal Transaction ID: %s', 'edd'), $data['txn_id']));
edd_set_payment_transaction_id($payment_id, $data['txn_id']);
edd_update_payment_status($payment_id, 'publish');
}
}
}
示例11: 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.8
* @return object
*/
public function get_payments()
{
do_action('edd_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 = edd_get_payment_amount($payment_id);
$details->subtotal = edd_get_payment_subtotal($payment_id);
$details->tax = edd_get_payment_tax($payment_id);
$details->fees = edd_get_payment_fees($payment_id);
$details->key = edd_get_payment_key($payment_id);
$details->gateway = edd_get_payment_gateway($payment_id);
$details->user_info = edd_get_payment_meta_user_info($payment_id);
$details->cart_details = edd_get_payment_meta_cart_details($payment_id, true);
if (edd_get_option('enable_sequential')) {
$details->payment_number = edd_get_payment_number($payment_id);
}
$this->payments[] = apply_filters('edd_payment', $details, $payment_id, $this);
}
wp_reset_postdata();
}
do_action('edd_post_get_payments', $this);
return $this->payments;
}
示例12: edd_downloads_upgrade_license
function edd_downloads_upgrade_license($license_id, $d_id, $payment_id, $type)
{
$payment_meta = edd_get_payment_meta($payment_id);
if (empty($payment_meta)) {
return true;
}
$remove = 0;
foreach ($payment_meta['cart_details'] as $product) {
if (isset($product['item_number']['upgrade']) && !empty($product['item_number']['upgrade'])) {
$remove = 1;
$old_attachment_id = absint($product['item_number']['upgrade']['old_attachment_id']);
$new_attachment_id = absint($product['item_number']['upgrade']['new_attachment_id']);
$old_product = absint($product['item_number']['upgrade']['old_product']);
//$old_product = get_post_meta( $product['item_number']['upgrade']['upgrade_license'], '_edd_sl_download_id', true );
$payment_id_lic = get_post_meta($product['item_number']['upgrade']['upgrade_license'], '_edd_sl_payment_id', true);
$upgrade_meta = edd_get_payment_meta(absint($payment_id_lic));
//$redirect_key = get_post_meta( $product['item_number']['upgrade']['upgrade_license'], '_edd_payment_purchase_key', true );
$payment_key = edd_get_payment_key(absint($payment_id_lic));
$new_product = get_post($product['item_number']['upgrade']['upgrade_product_to']);
if (isset($upgrade_meta['downloads'])) {
foreach ($upgrade_meta['downloads'] as $row => $download) {
//$log .= $download['id'] ."==". $old_product;
if ($download['id'] == $old_product) {
$upgrade_meta['downloads'][$row]['id'] = $product['item_number']['upgrade']['upgrade_product_to'];
if (isset($product['item_number']['upgrade']['options']) && !empty($product['item_number']['upgrade']['options'])) {
$upgrade_meta['downloads'][$row]['options'] = $product['item_number']['upgrade']['options'];
} else {
$upgrade_meta['downloads'][$row]['options'] = array();
}
if (isset($upgrade_meta['downloads'][$row]['upgrade'])) {
unset($upgrade_meta['downloads'][$row]['upgrade']);
}
$upgrade_meta['cart_details'][$row]['name'] = $new_product->post_title;
$upgrade_meta['cart_details'][$row]['id'] = $product['item_number']['upgrade']['upgrade_product_to'];
$upgrade_meta['cart_details'][$row]['item_number']['id'] = $product['item_number']['upgrade']['upgrade_product_to'];
if (isset($payment_meta['cart_details'])) {
foreach ($payment_meta['cart_details'] as $row_payment => $payment) {
if ($old_product == $payment['item_number']['upgrade']['old_product']) {
$upgrade_meta['cart_details'][$row]['item_price'] = $payment['item_price'];
$upgrade_meta['cart_details'][$row]['quantity'] = $payment['quantity'];
$upgrade_meta['cart_details'][$row]['discount'] = $payment['discount'];
$upgrade_meta['cart_details'][$row]['subtotal'] = $payment['subtotal'];
$upgrade_meta['cart_details'][$row]['tax'] = $payment['tax'];
$upgrade_meta['cart_details'][$row]['price'] = $payment['price'];
}
}
}
if (isset($product['item_number']['upgrade']['options']) && !empty($product['item_number']['upgrade']['options'])) {
$upgrade_meta['cart_details'][$row]['item_number']['options'] = $product['item_number']['upgrade']['options'];
} else {
$upgrade_meta['cart_details'][$row]['item_number']['options'] = array();
}
if (isset($upgrade_meta['cart_details'][$row]['item_number']['upgrade'])) {
unset($upgrade_meta['cart_details'][$row]['item_number']['upgrade']);
}
}
}
}
$sites = edd_software_licensing()->get_sites($product['item_number']['upgrade']['upgrade_license']);
if (array_key_exists($old_attachment_id, $sites)) {
$update_sites = $sites[$old_attachment_id];
unset($sites[$old_attachment_id]);
$sites[$new_attachment_id] = $update_sites;
update_post_meta($product['item_number']['upgrade']['upgrade_license'], '_edd_sl_sites', $sites);
}
update_post_meta($payment_id_lic, 'edd_price', $product['item_number']['upgrade']['upgrade_price']);
update_post_meta($payment_id_lic, '_edd_payment_total', $product['item_number']['upgrade']['upgrade_price']);
update_post_meta($payment_id_lic, '_edd_payment_meta', $upgrade_meta);
// Store the updated user ID in the payment meta
update_post_meta($product['item_number']['upgrade']['upgrade_license'], '_edd_sl_download_id', $product['item_number']['upgrade']['upgrade_product_to']);
}
}
if ($remove == 1) {
wp_delete_post($license_id);
wp_delete_post($payment_id);
//delete_post_meta( $post_id, $field );
global $wpdb;
$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->prefix . "postmeta WHERE post_id = %d OR post_id = %d", $license_id, $payment_id));
}
return true;
}
示例13: edd_pup_unsub_tag_plain
/**
* Email template tag: unsubscribe (for plaintext emails only)
* An unsubscribe link for customers to opt-out of future product updates
*
* @access public
* @param mixed $payment_id
* @return void
*/
function edd_pup_unsub_tag_plain($payment_id)
{
$purchase_data = get_post_meta($payment_id, '_edd_payment_meta', true);
$unsub_link_params = array('order_id' => $payment_id, 'email' => rawurlencode($purchase_data['user_info']['email']), 'purchase_key' => isset($purchase_data['key']) ? $purchase_data['key'] : edd_get_payment_key($payment_id), 'edd_action' => 'prod_update_unsub');
return add_query_arg($unsub_link_params, '' . home_url());
}
示例14: _e
<?php
if (!isset($_GET['order_id'])) {
_e('Access Denied', 'edd_fes');
return;
}
$key = edd_get_payment_key($_GET['order_id']);
if (EDD_FES()->vendors->vendor_can_view_receipt(false, $key)) {
do_action('fes_above_vendor_receipt');
echo '<h1 class="fes-headers" id="fes-edit-order-page-title">' . __('Order: #', 'edd_fes') . $_GET['order_id'] . '</h1>';
echo do_shortcode('[edd_receipt payment_key=' . $key . ']');
do_action('fes_below_vendor_receipt');
} else {
_e('Access Denied', 'edd_fes');
}
示例15: esc_attr_e
esc_attr_e('Extend license', 'edd_sl');
?>
"><?php
_e('Extend license', 'edd_sl');
?>
</a>
<?php
}
?>
<?php
}
?>
</td>
<td>
<a href="<?php
echo esc_url(edd_get_success_page_url('?payment_key=' . edd_get_payment_key($payment_id)));
?>
" title="<?php
esc_attr_e('View Purchase Record', 'edd_sl');
?>
">#<?php
echo edd_get_payment_number($payment_id);
?>
</a>
</td>
<?php
do_action('edd_sl_license_keys_row_end', $license->ID);
?>
</tr>
<?php
}