本文整理汇总了PHP中edd_currency_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_currency_filter函数的具体用法?PHP edd_currency_filter怎么用?PHP edd_currency_filter使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_currency_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: column_default
function column_default($item, $column_name)
{
switch ($column_name) {
case 'rate':
$download = get_post_meta($item['ID'], '_download_id', true);
$type = eddc_get_commission_type($download);
if ('percentage' == $type) {
return $item[$column_name] . '%';
} else {
return edd_currency_filter(edd_sanitize_amount($item[$column_name]));
}
case 'status':
return $item[$column_name];
case 'amount':
return edd_currency_filter(edd_format_amount($item[$column_name]));
case 'date':
return date_i18n(get_option('date_format'), strtotime(get_post_field('post_date', $item['ID'])));
case 'download':
$download = !empty($item['download']) ? $item['download'] : false;
return $download ? '<a href="' . esc_url(add_query_arg('download', $download)) . '" title="' . __('View all commissions for this item', 'eddc') . '">' . get_the_title($download) . '</a>' . (!empty($item['variation']) ? ' - ' . $item['variation'] : '') : '';
case 'payment':
$payment = get_post_meta($item['ID'], '_edd_commission_payment_id', true);
return $payment ? '<a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $payment)) . '" title="' . __('View payment details', 'eddc') . '">#' . $payment . '</a> - ' . edd_get_payment_status(get_post($payment), true) : '';
default:
return print_r($item, true);
//Show the whole array for troubleshooting purposes
}
}
示例2: edd_render_download_columns
/**
* Render Donwload Columns
*
* Render the custom columns content.
*
* @access private
* @since 1.0
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
$sales = edd_get_download_sales_stats($post_id);
$earnings = edd_get_download_earnings_stats($post_id);
$color = get_post_meta($post_id, '_edd_purchase_color', true);
$color = $color ? $color : 'blue';
$purchase_text = get_post_meta($post_id, '_edd_purchase_text', true);
$purchase_text = $purchase_text && '' !== $purchase_text ? $purchase_text : __('Purchase', 'edd');
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
echo edd_price($post_id, false);
if (!edd_has_variable_prices($post_id)) {
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
echo $sales;
break;
case 'earnings':
echo edd_currency_filter($earnings);
break;
case 'shortcode':
echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="button" color="' . esc_attr($color) . '"]';
break;
}
}
}
示例3: column_default
/**
* This function renders most of the columns in the list table.
*
* @access public
* @since 1.4
*
* @param array $item Contains all the data of the log item
* @param string $column_name The name of the column
*
* @return string Column Name
*/
public function column_default($item, $column_name)
{
$return = '';
switch ($column_name) {
case 'download':
$return = '<a href="' . add_query_arg('download', $item[$column_name]) . '" >' . get_the_title($item[$column_name]) . '</a>';
break;
case 'user_id':
$user = !empty($item['user_id']) ? $item['user_id'] : edd_get_payment_user_email($item['payment_id']);
$return = '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&user=' . urlencode($user)) . '">' . $item['user_name'] . '</a>';
break;
case 'item_price':
$return = edd_currency_filter(edd_format_amount($item['item_price']));
break;
case 'amount':
$return = edd_currency_filter(edd_format_amount($item['amount'] / $item['quantity']));
break;
case 'payment_id':
$return = '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $item['payment_id']) . '">' . edd_get_payment_number($item['payment_id']) . '</a>';
break;
default:
$return = $item[$column_name];
break;
}
return $return;
}
示例4: edd_render_download_columns
/**
* Render Download Columns
*
* @since 1.0
* @param string $column_name Column name
* @param int $post_id Download (Post) ID
* @return void
*/
function edd_render_download_columns($column_name, $post_id)
{
if (get_post_type($post_id) == 'download') {
global $edd_options;
$style = isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button';
$color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue';
$purchase_text = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd');
switch ($column_name) {
case 'download_category':
echo get_the_term_list($post_id, 'download_category', '', ', ', '');
break;
case 'download_tag':
echo get_the_term_list($post_id, 'download_tag', '', ', ', '');
break;
case 'price':
if (edd_has_variable_prices($post_id)) {
echo edd_price_range($post_id);
} else {
echo edd_price($post_id, false);
echo '<input type="hidden" class="downloadprice-' . $post_id . '" value="' . edd_get_download_price($post_id) . '" />';
}
break;
case 'sales':
echo edd_get_download_sales_stats($post_id);
break;
case 'earnings':
echo edd_currency_filter(edd_format_amount(edd_get_download_earnings_stats($post_id)));
break;
case 'shortcode':
echo '[purchase_link id="' . absint($post_id) . '" text="' . esc_html($purchase_text) . '" style="' . $style . '" color="' . esc_attr($color) . '"]';
break;
}
}
}
示例5: edd_ajax_add_to_cart_from_wish_list
/**
* Adds item to the cart from the wish list via AJAX. Based off edd_ajax_add_to_cart()
*
* @since 1.0
* @return void
*/
function edd_ajax_add_to_cart_from_wish_list()
{
if (isset($_POST['download_id'])) {
global $post;
$to_add = array();
if (isset($_POST['price_ids']) && is_array($_POST['price_ids'])) {
foreach ($_POST['price_ids'] as $price) {
$to_add[] = array('price_id' => $price);
}
}
foreach ($to_add as $options) {
if ($_POST['download_id'] == $options['price_id']) {
$options = array();
}
parse_str($_POST['post_data'], $post_data);
if (isset($options['price_id']) && isset($post_data['edd_download_quantity_' . $options['price_id']])) {
$options['quantity'] = absint($post_data['edd_download_quantity_' . $options['price_id']]);
} else {
$options['quantity'] = isset($post_data['edd_download_quantity']) ? absint($post_data['edd_download_quantity']) : 1;
}
// call EDD's edd_add_to_cart function
$key = edd_add_to_cart($_POST['download_id'], $options);
$item = array('id' => $_POST['download_id'], 'options' => $options);
$item = apply_filters('edd_wl_ajax_pre_cart_item_template', $item);
$return = array('add_to_cart' => 'Added to Cart', 'subtotal' => html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_cart_subtotal())), ENT_COMPAT, 'UTF-8'), 'cart_item' => html_entity_decode(edd_get_cart_item_template($key, $item, true), ENT_COMPAT, 'UTF-8'));
echo json_encode($return);
}
}
edd_die();
}
示例6: edd_wallet_get_deposit_levels
/**
* Get the allowed deposit levels
*
* @since 1.0.0
* @return array $levels The allowed deposit levels
*/
function edd_wallet_get_deposit_levels()
{
$levels = array();
$initial_levels = apply_filters('edd_wallet_deposit_levels', array('10', '20', '30', '40', '50', '60', '70', '80', '90', '100', '200', '300', '400', '500'));
foreach ($initial_levels as $level) {
$levels[$level] = edd_currency_filter(edd_format_amount($level));
}
return $levels;
}
示例7: download_lowest_price_function
function download_lowest_price_function($atts)
{
$atts = shortcode_atts(array('limit' => -1, 'id' => ''), $atts, 'download_price_lowest');
if ($atts['id'] != '') {
$id = $atts['id'];
} else {
$id = get_the_id();
}
return edd_currency_filter(edd_format_amount(edd_get_download_price($id, false)));
}
示例8: edd_wallet_column_data
/**
* Display column contents
*
* @since 1.0.0
* @param string $value The default value for the column
* @param int $item_id The ID of the row item
* @return string $value The updated value for the column
*/
function edd_wallet_column_data($value, $item_id)
{
$customer = new EDD_Customer($item_id);
if ($customer->user_id < 1) {
return '';
}
$value = edd_wallet()->wallet->balance($customer->user_id);
$value = edd_currency_filter(edd_format_amount((double) $value));
// Build the wallet link
$value = '<a href="' . admin_url('edit.php?post_type=download&page=edd-customers&view=wallet&id=' . $item_id) . '" title="' . __('View user wallet', 'edd-wallet') . '">' . $value . '</a>';
return $value;
}
示例9: 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);
}
}
示例10: get_data
/**
* Get the data being exported
*
* @return array $data
*/
public function get_data()
{
global $wpdb;
$data = array();
$campaign = $this->campaign;
$campaign = atcf_get_campaign($campaign);
$backers = $campaign->backers();
if (empty($backers)) {
return $data;
}
foreach ($backers as $log) {
$payment_id = get_post_meta($log->ID, '_edd_log_payment_id', true);
$payment = get_post($payment_id);
$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 = '';
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 (isset($downloads[$key]['item_number'])) {
$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 (is_numeric($user_id)) {
$user = get_userdata($user_id);
} else {
$user = false;
}
$shipping = isset($payment_meta['shipping']) ? $payment_meta['shipping'] : null;
$data[] = apply_filters('atcf_csv_cols_values', array('id' => $payment_id, 'email' => $payment_meta['email'], 'first' => $user_info['first_name'], 'last' => $user_info['last_name'], 'shipping' => isset($shipping) ? implode("\n", $shipping) : '', 'products' => $products, 'amount' => html_entity_decode(edd_currency_filter(edd_format_amount($total))), 'tax' => html_entity_decode(edd_payment_tax($payment_id, $payment_meta)), 'discount' => isset($user_info['discount']) && $user_info['discount'] != 'none' ? $user_info['discount'] : __('none', 'atcf'), 'gateway' => edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true)), 'key' => $payment_meta['key'], 'date' => date_i18n(get_option('date_format'), strtotime($payment->post_date)), 'user' => $user ? $user->display_name : __('guest', 'atcf'), 'status' => edd_get_payment_status($payment, true)), $payment_id);
}
$data = apply_filters('edd_export_get_data', $data);
$data = apply_filters('edd_export_get_data_' . $this->export_type, $data);
return $data;
}
示例11: column_default
/**
* Output column data
*
* @access private
* @since 1.3
* @return string
*/
function column_default($item, $column_name)
{
switch ($column_name) {
case 'earnings':
return edd_currency_filter(edd_format_amount($item[$column_name]));
case 'average_sales':
return round($item[$column_name]);
case 'average_earnings':
return edd_currency_filter(edd_format_amount($item[$column_name]));
default:
return $item[$column_name];
}
}
示例12: column_default
/**
* Render most columns
*
* @access private
* @since 1.4
* @return string
*/
function column_default($item, $column_name)
{
switch ($column_name) {
case 'name':
return '<a href="' . admin_url('/edit.php?post_type=download&page=edd-payment-history&user=' . urlencode($item['email'])) . '">' . esc_html($item[$column_name]) . '</a>';
case 'amount_spent':
return edd_currency_filter(edd_format_amount($item[$column_name]));
case 'file_downloads':
return '<a href="' . admin_url('/edit.php?post_type=download&page=edd-reports&tab=logs&user=' . urlencode(!empty($item['ID']) ? $item['ID'] : $item['email'])) . '" target="_blank">' . $item['file_downloads'] . '</a>';
default:
return $item[$column_name];
}
}
示例13: column_default
/**
* This function renders most of the columns in the list table.
*
* @access public
* @since 1.4
*
* @param array $item Contains all the data of the discount code
* @param string $column_name The name of the column
*
* @return string Column Name
*/
public function column_default($item, $column_name)
{
switch ($column_name) {
case 'download':
return '<a href="' . add_query_arg('download', $item[$column_name]) . '" >' . get_the_title($item[$column_name]) . '</a>';
case 'user_id':
return '<a href="' . admin_url('edit.php?post_type=download&page=edd-payment-history&user=' . urlencode($item['user_id'])) . '">' . $item['user_name'] . '</a>';
case 'amount':
return edd_currency_filter(edd_format_amount($item['amount']));
default:
return $item[$column_name];
}
}
示例14: download_checkout_item_total_function
function download_checkout_item_total_function($atts)
{
$atts = shortcode_atts(array('id' => ''), $atts, 'download_checkout_item_total');
global $x, $cart_array;
if ($atts['id'] != '') {
$id = $atts['id'];
} else {
$id = get_the_id();
}
$options = $cart_array[get_the_ID()][$x - 1]['options'];
$price = edd_get_cart_item_price($id, $options);
$price += edd_get_cart_item_tax($id, $options, $price);
$price = edd_currency_filter(edd_format_amount($price));
return $price;
}
示例15: column_default
/**
* This function renders most of the columns in the list table.
*
* @access public
* @since 1.5
*
* @param array $item Contains all the data of the downloads
* @param string $column_name The name of the column
*
* @return string Column Name
*/
public function column_default($item, $column_name)
{
switch ($column_name) {
case 'earnings':
return edd_currency_filter(edd_format_amount($item[$column_name]));
case 'average_sales':
return round($item[$column_name]);
case 'average_earnings':
return edd_currency_filter(edd_format_amount($item[$column_name]));
case 'details':
return '<a href="' . admin_url('edit.php?post_type=download&page=edd-reports&view=downloads&download-id=' . $item['ID']) . '">' . __('View Detailed Report', 'easy-digital-downloads') . '</a>';
default:
return $item[$column_name];
}
}