本文整理汇总了PHP中edd_use_skus函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_use_skus函数的具体用法?PHP edd_use_skus怎么用?PHP edd_use_skus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_use_skus函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edd_render_accounting_options
/**
* Render Accounting Options
*
* @since 1.6
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_render_accounting_options($post_id)
{
if (!edd_use_skus()) {
return;
}
$edd_sku = get_post_meta($post_id, 'edd_sku', true);
?>
<p><strong><?php
_e('Accounting Options:', 'edd');
?>
</strong></p>
<p>
<label for="edd_sku">
<?php
echo EDD()->html->text(array('name' => 'edd_sku', 'value' => $edd_sku, 'class' => 'small-text'));
?>
<?php
echo sprintf(__('Enter an SKU for this %s.', 'edd'), strtolower(edd_get_label_singular()));
?>
</label>
</p>
<?php
}
示例2: apply_filters
</ul>
</li>
<?php
}
} else {
echo '<li>' . apply_filters('edd_receipt_no_files_found_text', __('No downloadable files found.', 'easy-digital-downloads'), $item['id']) . '</li>';
}
?>
</ul>
<?php
}
?>
</td>
<?php
if (edd_use_skus()) {
?>
<td><?php
echo edd_get_download_sku($item['id']);
?>
</td>
<?php
}
?>
<?php
if (edd_item_quantities_enabled()) {
?>
<td><?php
echo $item['quantity'];
?>
</td>
示例3: get_data
/**
* Get the Export Data
*
* @access public
* @since 2.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;
$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 H:i:s', strtotime($this->start)), 'before' => date('Y-n-d H:i:s', strtotime($this->end)), 'inclusive' => true));
}
//echo json_encode($args ); exit;
$payments = edd_get_payments($args);
if ($payments) {
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 = edd_get_payment_amount($payment->ID);
$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'], $payment->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, 'seq_id' => edd_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'] : '', 'products' => $products, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_format_amount(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)), 'trans_id' => edd_get_payment_transaction_id($payment->ID), 'key' => $payment_meta['key'], 'date' => $payment->post_date, 'user' => $user ? $user->display_name : __('guest', 'edd'), 'status' => edd_get_payment_status($payment, true));
}
$data = apply_filters('edd_export_get_data', $data);
$data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
return $data;
}
return false;
}
示例4: edd_process_paypal_purchase
/**
* Process PayPal Purchase
*
* @since 1.0
* @param array $purchase_data Purchase Data
* @return void
*/
function edd_process_paypal_purchase($purchase_data)
{
if (!wp_verify_nonce($purchase_data['gateway_nonce'], 'edd-gateway')) {
wp_die(__('Nonce verification has failed', 'edd'), __('Error', 'edd'), array('response' => 403));
}
// Collect payment data
$payment_data = array('price' => $purchase_data['price'], 'date' => $purchase_data['date'], 'user_email' => $purchase_data['user_email'], 'purchase_key' => $purchase_data['purchase_key'], 'currency' => edd_get_currency(), 'downloads' => $purchase_data['downloads'], 'user_info' => $purchase_data['user_info'], 'cart_details' => $purchase_data['cart_details'], 'gateway' => 'paypal', 'status' => !empty($purchase_data['buy_now']) ? 'private' : 'pending');
// Record the pending payment
$payment = edd_insert_payment($payment_data);
// Check payment
if (!$payment) {
// Record the error
edd_record_gateway_error(__('Payment Error', 'edd'), sprintf(__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'edd'), json_encode($payment_data)), $payment);
// Problems? send back
edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
} else {
// Only send to PayPal if the pending payment is created successfully
$listener_url = add_query_arg('edd-listener', 'IPN', home_url('index.php'));
// Get the success url
$return_url = add_query_arg(array('payment-confirmation' => 'paypal', 'payment-id' => $payment), get_permalink(edd_get_option('success_page', false)));
// Get the PayPal redirect uri
$paypal_redirect = trailingslashit(edd_get_paypal_redirect()) . '?';
// Setup PayPal arguments
$paypal_args = array('business' => edd_get_option('paypal_email', false), 'email' => $purchase_data['user_email'], 'first_name' => $purchase_data['user_info']['first_name'], 'last_name' => $purchase_data['user_info']['last_name'], 'invoice' => $purchase_data['purchase_key'], 'no_shipping' => '1', 'shipping' => '0', 'no_note' => '1', 'currency_code' => edd_get_currency(), 'charset' => get_bloginfo('charset'), 'custom' => $payment, 'rm' => '2', 'return' => $return_url, 'cancel_return' => edd_get_failed_transaction_uri('?payment-id=' . $payment), 'notify_url' => $listener_url, 'page_style' => edd_get_paypal_page_style(), 'cbt' => get_bloginfo('name'), 'bn' => 'EasyDigitalDownloads_SP');
if (!empty($purchase_data['user_info']['address'])) {
$paypal_args['address1'] = $purchase_data['user_info']['address']['line1'];
$paypal_args['address2'] = $purchase_data['user_info']['address']['line2'];
$paypal_args['city'] = $purchase_data['user_info']['address']['city'];
$paypal_args['country'] = $purchase_data['user_info']['address']['country'];
}
$paypal_extra_args = array('cmd' => '_cart', 'upload' => '1');
$paypal_args = array_merge($paypal_extra_args, $paypal_args);
// Add cart items
$i = 1;
foreach ($purchase_data['cart_details'] as $item) {
$item_amount = round($item['subtotal'] / $item['quantity'] - $item['discount'] / $item['quantity'], 2);
if ($item_amount <= 0) {
$item_amount = 0;
}
$paypal_args['item_name_' . $i] = stripslashes_deep(html_entity_decode(edd_get_cart_item_name($item), ENT_COMPAT, 'UTF-8'));
$paypal_args['quantity_' . $i] = $item['quantity'];
$paypal_args['amount_' . $i] = $item_amount;
if (edd_use_skus()) {
$paypal_args['item_number_' . $i] = edd_get_download_sku($item['id']);
}
$i++;
}
// Calculate discount
$discounted_amount = 0.0;
if (!empty($purchase_data['fees'])) {
$i = empty($i) ? 1 : $i;
foreach ($purchase_data['fees'] as $fee) {
if (floatval($fee['amount']) > '0') {
// this is a positive fee
$paypal_args['item_name_' . $i] = stripslashes_deep(html_entity_decode(wp_strip_all_tags($fee['label']), ENT_COMPAT, 'UTF-8'));
$paypal_args['quantity_' . $i] = '1';
$paypal_args['amount_' . $i] = edd_sanitize_amount($fee['amount']);
$i++;
} else {
// This is a negative fee (discount)
$discounted_amount += abs($fee['amount']);
}
}
}
if ($discounted_amount > '0') {
$paypal_args['discount_amount_cart'] = edd_sanitize_amount($discounted_amount);
}
// Add taxes to the cart
if (edd_use_taxes()) {
$paypal_args['tax_cart'] = edd_sanitize_amount($purchase_data['tax']);
}
$paypal_args = apply_filters('edd_paypal_redirect_args', $paypal_args, $purchase_data);
// Build query
$paypal_redirect .= http_build_query($paypal_args);
// Fix for some sites that encode the entities
$paypal_redirect = str_replace('&', '&', $paypal_redirect);
// Get rid of cart contents
edd_empty_cart();
// Redirect to PayPal
wp_redirect($paypal_redirect);
exit;
}
}
示例5: edd_email_tag_download_list_plain
/**
* Email template tag: download_list
* A list of download links for each download purchased in plaintext
*
* @since 2.1.1
* @param int $payment_id
*
* @return string download_list
*/
function edd_email_tag_download_list_plain($payment_id)
{
$payment_data = edd_get_payment_meta($payment_id);
$cart_items = edd_get_payment_meta_cart_details($payment_id);
$email = edd_get_payment_user_email($payment_id);
$download_list = '';
if ($cart_items) {
$show_names = apply_filters('edd_email_show_names', true);
$show_links = apply_filters('edd_email_show_links', true);
foreach ($cart_items as $item) {
if (edd_use_skus()) {
$sku = edd_get_download_sku($item['id']);
}
if (edd_item_quantities_enabled()) {
$quantity = $item['quantity'];
}
$price_id = edd_get_cart_item_price_id($item);
if ($show_names) {
$title = get_the_title($item['id']);
if (!empty($quantity) && $quantity > 1) {
$title .= __('Quantity', 'easy-digital-downloads') . ': ' . $quantity;
}
if (!empty($sku)) {
$title .= __('SKU', 'easy-digital-downloads') . ': ' . $sku;
}
if ($price_id !== null) {
$title .= edd_get_price_option_name($item['id'], $price_id, $payment_id);
}
$download_list .= "\n";
$download_list .= apply_filters('edd_email_receipt_download_title', $title, $item, $price_id, $payment_id) . "\n";
}
$files = edd_get_download_files($item['id'], $price_id);
if (!empty($files)) {
foreach ($files as $filekey => $file) {
if ($show_links) {
$download_list .= "\n";
$file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $item['id'], $price_id);
$download_list .= edd_get_file_name($file) . ': ' . $file_url . "\n";
} else {
$download_list .= "\n";
$download_list .= edd_get_file_name($file) . "\n";
}
}
} elseif (edd_is_bundled_product($item['id'])) {
$bundled_products = apply_filters('edd_email_tag_bundled_products', edd_get_bundled_products($item['id']), $item, $payment_id, 'download_list');
foreach ($bundled_products as $bundle_item) {
$download_list .= '<div class="edd_bundled_product"><strong>' . get_the_title($bundle_item) . '</strong></div>';
$files = edd_get_download_files($bundle_item);
foreach ($files as $filekey => $file) {
if ($show_links) {
$file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $bundle_item, $price_id);
$download_list .= $file['name'] . ': ' . $file_url . "\n";
} else {
$download_list .= $file['name'] . "\n";
}
}
}
}
if ('' != edd_get_product_notes($item['id'])) {
$download_list .= "\n";
$download_list .= edd_get_product_notes($item['id']) . "\n";
}
}
}
return $download_list;
}
示例6: get_product_data
/**
* Given a download post object, generate the data for the API output
*
* @since 2.6
* @param object $product_info The Download Post Object
* @return array Array of post data to return back in the API
*/
public function get_product_data($product_info)
{
// Use the parent's get_product_data to reduce code duplication
$product = parent::get_product_data($product_info);
if (edd_use_skus()) {
$product['info']['sku'] = edd_get_download_sku($product['info']['id']);
}
return apply_filters('edd_api_products_product_v2', $product);
}
示例7: edd_currency_filter
?>
</td>
<td><?php
echo edd_currency_filter(edd_format_amount($item['price']));
?>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<td<?php
echo edd_use_skus() ? ' colspan="2"' : '';
?>
><strong><?php
_e('Total Price', 'edd');
?>
:</strong></td>
<td>
<?php
echo edd_payment_amount($payment->ID);
if (edd_use_taxes() && (!edd_prices_show_tax_on_checkout() && $edd_options['prices_include_tax'] == 'yes')) {
echo ' ' . __('(ex. tax)', 'edd');
} else {
if (edd_use_taxes() && $edd_options['checkout_include_tax'] == 'yes') {
printf(' ' . __('(includes %s tax)', 'edd'), edd_payment_tax($payment->ID));
}
示例8: edd_email_template_tags
/**
* Email Template Tags
*
* @since 1.0
*
* @param string $message Message with the template tags
* @param array $payment_data Payment Data
* @param int $payment_id Payment ID
*
* @return string $message Fully formatted message
*/
function edd_email_template_tags($message, $payment_data, $payment_id)
{
global $edd_options;
$has_tags = strpos($message, '{') !== false;
if (!$has_tags) {
return $message;
}
$user_info = maybe_unserialize($payment_data['user_info']);
$fullname = '';
if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
$user_data = get_userdata($user_info['id']);
$name = $user_info['first_name'];
$fullname = $user_info['first_name'] . ' ' . $user_info['last_name'];
$username = $user_data->user_login;
} elseif (isset($user_info['first_name'])) {
$name = $user_info['first_name'];
$fullname = $user_info['first_name'] . ' ' . $user_info['last_name'];
$username = $user_info['first_name'];
} else {
$name = $user_info['email'];
$username = $user_info['email'];
}
$file_urls = '';
$download_list = '<ul>';
$cart_items = edd_get_payment_meta_cart_details($payment_id);
if ($cart_items) {
$show_names = apply_filters('edd_email_show_names', true);
foreach ($cart_items as $item) {
if (edd_use_skus()) {
$sku = edd_get_download_sku($item['id']);
}
$price_id = edd_get_cart_item_price_id($item);
if ($show_names) {
$title = get_the_title($item['id']);
if (!empty($sku)) {
$title .= " – " . __('SKU', 'edd') . ': ' . $sku;
}
if ($price_id !== false) {
$title .= " – " . edd_get_price_option_name($item['id'], $price_id);
}
$download_list .= '<li>' . apply_filters('edd_email_receipt_download_title', $title, $item['id'], $price_id) . '<br/>';
$download_list .= '<ul>';
}
$files = edd_get_download_files($item['id'], $price_id);
if ($files) {
foreach ($files as $filekey => $file) {
$download_list .= '<li>';
$file_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $filekey, $item['id'], $price_id);
$download_list .= '<a href="' . esc_url($file_url) . '">' . $file['name'] . '</a>';
$download_list .= '</li>';
$file_urls .= esc_html($file_url) . '<br/>';
}
}
if ($show_names) {
$download_list .= '</ul>';
}
if ('' != edd_get_product_notes($item['id'])) {
$download_list .= ' — <small>' . edd_get_product_notes($item['id']) . '</small>';
}
if ($show_names) {
$download_list .= '</li>';
}
}
}
$download_list .= '</ul>';
$subtotal = isset($payment_data['subtotal']) ? $payment_data['subtotal'] : $payment_data['amount'];
$subtotal = edd_currency_filter(edd_format_amount($subtotal));
$tax = isset($payment_data['tax']) ? $payment_data['tax'] : 0;
$tax = edd_currency_filter(edd_format_amount($tax));
$price = edd_currency_filter(edd_format_amount($payment_data['amount']));
$gateway = edd_get_gateway_checkout_label(get_post_meta($payment_id, '_edd_payment_gateway', true));
$receipt_id = $payment_data['key'];
$message = str_replace('{name}', $name, $message);
$message = str_replace('{fullname}', $fullname, $message);
$message = str_replace('{username}', $username, $message);
$message = str_replace('{download_list}', $download_list, $message);
$message = str_replace('{file_urls}', $file_urls, $message);
$message = str_replace('{date}', date_i18n(get_option('date_format'), strtotime($payment_data['date'])), $message);
$message = str_replace('{sitename}', get_bloginfo('name'), $message);
$message = str_replace('{subtotal}', $subtotal, $message);
$message = str_replace('{tax}', $tax, $message);
$message = str_replace('{price}', $price, $message);
$message = str_replace('{payment_method}', $gateway, $message);
$message = str_replace('{receipt_id}', $receipt_id, $message);
$message = str_replace('{payment_id}', $payment_id, $message);
$message = str_replace('{receipt_link}', sprintf(__('%1$sView it in your browser.%2$s', 'edd'), '<a href="' . add_query_arg(array('purchase_key' => $receipt_id, 'edd_action' => 'view_receipt'), home_url()) . '">', '</a>'), $message);
$message = apply_filters('edd_email_template_tags', $message, $payment_data, $payment_id);
return $message;
}
示例9: 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) {
// skip over payments that don't have upsells in them
if (!get_post_meta($payment->ID, '_edd_payment_upsell_total', true)) {
continue;
}
$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 = edd_csau_get_payment_amount($payment->ID, 'upsell');
$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) {
// skip over downloads which aren't upsells
if (!isset($download['item_number']['upsell'])) {
continue;
}
// 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;
}
示例10: edd_pup_products_links_tag_plain
/**
* Email template tag: updated_products_links
* A list of updated products with download links included
*
* @access public
* @param mixed $payment_id
* @return void
*/
function edd_pup_products_links_tag_plain($payment_id, $email = null)
{
// Used to generate accurate tag outputs for preview and test emails
if (isset($email) && absint($email) != 0) {
$updated_products = get_post_meta($email, '_edd_pup_updated_products', true);
$updated_products = is_array($updated_products) ? $updated_products : array($updated_products);
foreach ($updated_products as $id => $name) {
$customer_updates[$id] = array('id' => $id, 'name' => $name);
}
} else {
$email = get_transient('edd_pup_sending_email_' . get_current_user_id());
$updated_products = get_post_meta($email, '_edd_pup_updated_products', true);
$updated_products = is_array($updated_products) ? $updated_products : array($updated_products);
$customer_updates = edd_pup_get_customer_updates($payment_id, $email);
$customer_updates = is_array($customer_updates) ? $customer_updates : array($customer_updates);
}
$filters = get_post_meta($email, '_edd_pup_filters', true);
if ($customer_updates) {
$show_names = apply_filters('edd_pup_email_show_names', true);
$payment_data = edd_get_payment_meta($payment_id);
// Set email to most recent email if it's been changed from initial email
if (isset($payment_data['user_info']['email']) && $payment_data['user_info']['email'] != $payment_data['email']) {
$payment_data['email'] = $payment_data['user_info']['email'];
}
// Used for detecting when to place commas
$c = 1;
$download_list = '';
foreach ($customer_updates as $item) {
if (edd_use_skus()) {
$sku = edd_get_download_sku($item['id']);
}
$price_id = edd_get_cart_item_price_id($item);
if ($show_names) {
$title = $c == 1 ? $item['name'] : ', ' . $item['name'];
if (!empty($sku)) {
$title .= " – " . __('SKU', 'edd') . ': ' . $sku;
}
$download_list .= apply_filters('edd_pup_email_products_link_title_plain', $title, $item, $price_id, $payment_id);
}
$files = edd_get_download_files($item['id'], $price_id);
if ($files) {
// $f used for detecting when to place commas
$f = 1;
$download_list .= ' (';
foreach ($files as $filekey => &$file) {
$file_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $filekey, $item['id'], $price_id);
$download_list .= $f == 1 ? edd_get_file_name($file) . ': ' . esc_url($file_url) : ', ' . edd_get_file_name($file) . ': ' . esc_url($file_url);
$f++;
}
$download_list .= ')';
}
if (edd_is_bundled_product($item['id'])) {
$b = 1;
$bundled_products = edd_get_bundled_products($item['id']);
$download_list .= " – ";
foreach ($bundled_products as $bundle_item) {
if ($filters['bundle_1'] == 'all' || isset($updated_products[$bundle_item])) {
$download_list .= $b == 1 ? get_the_title($bundle_item) : '; ' . get_the_title($bundle_item);
$fb = 1;
$bundlefiles = edd_get_download_files($bundle_item);
$download_list .= ' (';
foreach ($bundlefiles as $bundlefilekey => $bundlefile) {
$bundlefile_url = edd_get_download_file_url($payment_data['key'], $payment_data['email'], $bundlefilekey, $bundle_item, $price_id);
$download_list .= $fb == 1 ? $bundlefile['name'] . ': ' . esc_url($bundlefile_url) : ', ' . $bundlefile['name'] . ': ' . esc_url($bundlefile_url);
$fb++;
}
$download_list .= ')';
}
$b++;
}
}
if ('' != edd_get_product_notes($item['id'])) {
$download_list .= ' – ' . edd_get_product_notes($item['id']);
}
$c++;
}
return $download_list;
}
}
示例11: edd_render_accounting_options
/**
* Render Accounting Options
*
* @since 1.6
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_render_accounting_options($post_id)
{
global $edd_options;
if (!edd_use_skus()) {
return;
}
$edd_sku = get_post_meta($post_id, 'edd_sku', true);
?>
<p><strong><?php
_e('Accounting Options:', 'edd');
?>
</strong></p>
<p>
<label for="edd_sku">
<input type="text" name="edd_sku" id="edd_sku" value="<?php
echo esc_attr($edd_sku);
?>
" size="30" style="width: 80px;"/>
<?php
echo sprintf(__('Enter an SKU for this %s.', 'edd'), strtolower(edd_get_label_singular()));
?>
</label>
</p>
<?php
}
示例12: get_data
/**
* Get the Export Data
*
* @access public
* @since 2.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;
$data = array();
$args = array('number' => 30, 'page' => $this->step, 'status' => $this->status, 'order' => 'ASC', 'orderby' => 'date');
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 = edd_get_payments($args);
if ($payments) {
foreach ($payments as $payment) {
$payment = new EDD_Payment($payment->ID);
$payment_meta = $payment->payment_meta;
$user_info = $payment->user_info;
$downloads = $payment->cart_details;
$total = $payment->total;
$user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
$products = '';
$products_raw = '';
$skus = '';
if ($downloads) {
foreach ($downloads as $key => $download) {
// Download ID
$id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
$qty = isset($download['quantity']) ? $download['quantity'] : 1;
if (isset($download['price'])) {
$price = $download['price'];
} else {
// 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);
}
$download_tax = isset($download['tax']) ? $download['tax'] : 0;
/* Set up verbose product column */
$products .= html_entity_decode(get_the_title($id));
if ($qty > 1) {
$products .= html_entity_decode(' (' . $qty . ')');
}
$products .= ' - ';
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']) && !is_null($price_options['price_id'])) {
$products .= html_entity_decode(edd_get_price_option_name($id, $price_options['price_id'], $payment->ID)) . ' - ';
}
}
$products .= html_entity_decode(edd_currency_filter(edd_format_amount($price)));
if ($key != count($downloads) - 1) {
$products .= ' / ';
if (edd_use_skus()) {
$skus .= ' / ';
}
}
/* Set up raw products column - Nothing but product names */
$products_raw .= html_entity_decode(get_the_title($id)) . '|' . $price . '{' . $download_tax . '}';
if ($key != count($downloads) - 1) {
$products_raw .= ' / ';
}
}
}
if (is_numeric($user_id)) {
$user = get_userdata($user_id);
} else {
$user = false;
}
$data[] = array('id' => $payment->ID, 'seq_id' => $payment->number, 'email' => $payment_meta['email'], 'customer_id' => $payment->customer_id, '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'] : '', 'products' => $products, 'products_raw' => $products_raw, 'skus' => $skus, 'amount' => html_entity_decode(edd_format_amount($total)), 'tax' => html_entity_decode(edd_format_amount(edd_get_payment_tax($payment->ID, $payment_meta))), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'easy-digital-downloads'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment->ID, '_edd_payment_gateway', true)), 'trans_id' => $payment->transaction_id, 'key' => $payment_meta['key'], 'date' => $payment->date, 'user' => $user ? $user->display_name : __('guest', 'easy-digital-downloads'), 'currency' => $payment->currency, 'ip' => $payment->ip, 'mode' => $payment->get_meta('_edd_payment_mode', true), 'status' => 'publish' === $payment->status ? 'complete' : $payment->status);
}
$data = apply_filters('edd_export_get_data', $data);
$data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
return $data;
}
return false;
}
示例13: edd_email_tag_download_list
/**
* Email template tag: download_list
* A list of download links for each download purchased
*
* @param int $payment_id
*
* @return string download_list
*/
function edd_email_tag_download_list($payment_id)
{
$payment_data = edd_get_payment_meta($payment_id);
$download_list = '<ul>';
$cart_items = edd_get_payment_meta_cart_details($payment_id);
$email = edd_get_payment_user_email($payment_id);
if ($cart_items) {
$show_names = apply_filters('edd_email_show_names', true);
foreach ($cart_items as $item) {
if (edd_use_skus()) {
$sku = edd_get_download_sku($item['id']);
}
$price_id = edd_get_cart_item_price_id($item);
if ($show_names) {
$title = get_the_title($item['id']);
if (!empty($sku)) {
$title .= " – " . __('SKU', 'edd') . ': ' . $sku;
}
if ($price_id !== false) {
$title .= " – " . edd_get_price_option_name($item['id'], $price_id);
}
$download_list .= '<li>' . apply_filters('edd_email_receipt_download_title', $title, $item, $price_id, $payment_id) . '<br/>';
$download_list .= '<ul>';
}
$files = edd_get_download_files($item['id'], $price_id);
if ($files) {
foreach ($files as $filekey => $file) {
$download_list .= '<li>';
$file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $item['id'], $price_id);
$download_list .= '<a href="' . esc_url($file_url) . '">' . edd_get_file_name($file) . '</a>';
$download_list .= '</li>';
}
} elseif (edd_is_bundled_product($item['id'])) {
$bundled_products = edd_get_bundled_products($item['id']);
foreach ($bundled_products as $bundle_item) {
$download_list .= '<li class="edd_bundled_product"><strong>' . get_the_title($bundle_item) . '</strong></li>';
$files = edd_get_download_files($bundle_item);
foreach ($files as $filekey => $file) {
$download_list .= '<li>';
$file_url = edd_get_download_file_url($payment_data['key'], $email, $filekey, $bundle_item, $price_id);
$download_list .= '<a href="' . esc_url($file_url) . '">' . $file['name'] . '</a>';
$download_list .= '</li>';
}
}
}
if ($show_names) {
$download_list .= '</ul>';
}
if ('' != edd_get_product_notes($item['id'])) {
$download_list .= ' — <small>' . edd_get_product_notes($item['id']) . '</small>';
}
if ($show_names) {
$download_list .= '</li>';
}
}
}
$download_list .= '</ul>';
return $download_list;
}