本文整理汇总了PHP中edd_get_gateway_admin_label函数的典型用法代码示例。如果您正苦于以下问题:PHP edd_get_gateway_admin_label函数的具体用法?PHP edd_get_gateway_admin_label怎么用?PHP edd_get_gateway_admin_label使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了edd_get_gateway_admin_label函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例3: do_action
<?php
do_action('edd_view_order_details_payment_meta_before', $payment_id);
?>
<?php
$gateway = edd_get_payment_gateway($payment_id);
if ($gateway) {
?>
<div class="edd-order-gateway edd-admin-box-inside">
<p>
<span class="label"><?php
_e('Gateway:', 'edd');
?>
</span>
<?php
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);
示例4: edd_get_sale_notification_body_content
/**
* Sale Notification Template Body
*
* @since 1.7
* @author Daniel J Griffiths
* @param int $payment_id Payment ID
* @param array $payment_data Payment Data
* @return string $email_body Body of the email
*/
function edd_get_sale_notification_body_content($payment_id = 0, $payment_data = array())
{
global $edd_options;
$user_info = maybe_unserialize($payment_data['user_info']);
$email = edd_get_payment_user_email($payment_id);
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 = $email;
}
$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;
$title = get_the_title($id);
if (isset($download['options'])) {
if (isset($download['options']['price_id'])) {
$title .= ' - ' . edd_get_price_option_name($id, $download['options']['price_id'], $payment_id);
}
}
$download_list .= html_entity_decode($title, ENT_COMPAT, 'UTF-8') . "\n";
}
}
$gateway = edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true));
$default_email_body = __('Hello', 'edd') . "\n\n" . sprintf(__('A %s purchase has been made', 'edd'), edd_get_label_plural()) . ".\n\n";
$default_email_body .= sprintf(__('%s sold:', 'edd'), edd_get_label_plural()) . "\n\n";
$default_email_body .= $download_list . "\n\n";
$default_email_body .= __('Purchased by: ', 'edd') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
$default_email_body .= __('Amount: ', 'edd') . " " . html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8') . "\n";
$default_email_body .= __('Payment Method: ', 'edd') . " " . $gateway . "\n\n";
$default_email_body .= __('Thank you', 'edd');
$email = isset($edd_options['sale_notification']) ? stripslashes($edd_options['sale_notification']) : $default_email_body;
//$email_body = edd_email_template_tags( $email, $payment_data, $payment_id, true );
$email_body = edd_do_email_tags($email, $payment_id);
return apply_filters('edd_sale_notification', wpautop($email_body), $payment_id, $payment_data);
}
示例5: 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;
}
示例6: 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;
}
示例7: edd_dashboard_sales_widget
//.........这里部分代码省略.........
echo ' - ';
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']);
echo ' - ';
}
}
echo edd_currency_filter(edd_format_amount($price));
echo '</li>';
}
}
?>
</ul>
<?php
$payment_date = strtotime($payment->post_date);
?>
<p><?php
echo __('Date and Time:', 'edd') . ' ' . date_i18n(get_option('date_format'), $payment_date) . ' ' . date_i18n(get_option('time_format'), $payment_date);
?>
<p><?php
echo __('Discount used:', 'edd') . ' ';
if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
echo $user_info['discount'];
} else {
_e('none', 'edd');
}
?>
<p><?php
echo __('Total:', 'edd') . ' ' . edd_currency_filter(edd_format_amount(edd_get_payment_amount($payment->ID)));
?>
</p>
<div class="purcase-personal-details">
<h4><?php
_e('Buyer\'s Personal Details:', 'edd');
?>
</h4>
<ul>
<li><?php
echo __('Name:', 'edd') . ' ' . $user_info['first_name'] . ' ' . $user_info['last_name'];
?>
</li>
<li><?php
echo __('Email:', 'edd') . ' ' . $payment_meta['email'];
?>
</li>
<?php
do_action('edd_payment_personal_details_list', $payment_meta, $user_info);
?>
</ul>
</div>
<?php
$gateway = edd_get_payment_gateway($payment->ID);
if ($gateway) {
?>
<div class="payment-method">
<h4><?php
_e('Payment Method:', 'edd');
?>
</h4>
<span class="payment-method-name"><?php
echo edd_get_gateway_admin_label($gateway);
?>
</span>
</div>
<?php
}
?>
<div class="purchase-key-wrap">
<h4><?php
_e('Purchase Key', 'edd');
?>
</h4>
<span class="purchase-key"><?php
echo $payment_meta['key'];
?>
</span>
</div>
<p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php
_e('Close', 'edd');
?>
"><?php
_e('Close', 'edd');
?>
</a></p>
</div>
</td>
</tr>
<?php
}
// end foreach
?>
</tbody>
</table>
</div>
<?php
}
// end if
}
示例8: edd_pre_approval_emails_get_admin_email_body
/**
* Default pre-approval email body for admin
*
* @since 1.0
*/
function edd_pre_approval_emails_get_admin_email_body($payment_id = 0, $payment_data = array())
{
global $edd_options;
$user_info = maybe_unserialize($payment_data['user_info']);
$email = edd_get_payment_user_email($payment_id);
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 = $email;
}
$gateway = edd_get_gateway_admin_label(get_post_meta($payment_id, '_edd_payment_gateway', true));
$email_body = __('Hello', 'edd-pre-approval-emails') . "\n\n" . __('A new pledge has been made', 'edd-pre-approval-emails') . ".\n\n";
$email_body .= sprintf(__('%s pledged:', 'edd-pre-approval-emails'), edd_get_label_plural()) . "\n\n";
$email_body .= edd_pre_approval_emails_get_download_list($payment_data) . "\n\n";
$email_body .= __('Pledged by: ', 'edd-pre-approval-emails') . " " . html_entity_decode($name, ENT_COMPAT, 'UTF-8') . "\n";
$email_body .= __('Amount: ', 'edd-pre-approval-emails') . " " . html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8') . "\n";
$email_body .= __('Payment Method: ', 'edd-pre-approval-emails') . " " . $gateway . "\n\n";
$email_body = edd_do_email_tags($email_body, $payment_id);
return apply_filters('edd_pledge_notification', wpautop($email_body), $payment_id, $payment_data);
}
示例9: meta_box_failed_payments
function meta_box_failed_payments()
{
global $post;
$campaign = atcf_get_campaign($post);
$failed_payments = $campaign->failed_payments();
$count = 0;
foreach ($failed_payments as $gateways) {
foreach ($gateways as $gateway) {
$count = $count + count($gateway);
}
}
echo '<p><strong>' . sprintf(_n('%d payment failed to process.', '%d payments failed to process.', $count, 'atcf'), $count) . '</strong> <a href="' . esc_url(add_query_arg(array('page' => 'edd-reports', 'tab' => 'logs', 'view' => 'gateway_errors', 'post_type' => 'download'), admin_url('edit.php'))) . '">' . __('View gateway errors', 'atcf') . '</a>.</p>';
echo '<ul>';
foreach ($failed_payments as $gateway => $payments) {
echo '<li><strong>' . edd_get_gateway_admin_label($gateway) . '</strong>';
echo '<ul>';
foreach ($payments['payments'] as $payment) {
echo '<li><a href="' . esc_url(admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $payment)) . '">#' . $payment . '</a></li>';
}
echo '</ul>';
echo '</li>';
}
echo '</ul>';
echo '<p><a href="' . wp_nonce_url(add_query_arg(array('action' => 'atcf-collect-funds', 'campaign' => $campaign->ID, 'status' => 'failed'), admin_url()), 'atcf-collect-funds') . '" class="button">' . __('Retry Failed Funds', 'atcf') . '</a></p>';
}
示例10: slackedd_notification
/**
* Slackedd Notification Codes
*
* @since 1.0.0
*/
function slackedd_notification($payment_id)
{
$edd_options = edd_get_settings();
/* Check that the user has all required information added for the plugin to work */
$enable_slack = isset($edd_options['slackedd_enable_notification']) ? $edd_options['slackedd_enable_notification'] : '';
$hide_order_number = isset($edd_options['slackedd_hide_order_number']) ? $edd_options['slackedd_hide_order_number'] : '';
$hide_order_items = isset($edd_options['slackedd_hide_order_items']) ? $edd_options['slackedd_hide_order_items'] : '';
$hide_payment_gateway = isset($edd_options['slackedd_hide_payment_gateway']) ? $edd_options['slackedd_hide_payment_gateway'] : '';
$hide_buyer_information = isset($edd_options['slackedd_hide_buyer_information']) ? $edd_options['slackedd_hide_buyer_information'] : '';
$slack_channel = isset($edd_options['slackedd_channel']) ? $edd_options['slackedd_channel'] : '';
$webhook_url = isset($edd_options['slackedd_webhook_url']) ? $edd_options['slackedd_webhook_url'] : '';
if (!($enable_slack && $slack_channel && $webhook_url)) {
return;
}
$enable_slack = isset($edd_options['slackedd_enable_notification']) ? $edd_options['slackedd_enable_notification'] : '';
$emoji = !empty($edd_options['slackedd_icon_emoji']) ? $edd_options['slackedd_icon_emoji'] : ':moneybag:';
$bot_name = !empty($edd_options['slackedd_bot_name']) ? $edd_options['slackedd_bot_name'] : 'Slackedd';
$order_amount = esc_attr(edd_format_amount(edd_get_payment_amount($payment_id)));
$currency_symbol = edd_currency_symbol($payment_meta['currency']);
$currency_symbol = html_entity_decode($currency_symbol, ENT_QUOTES, 'UTF-8');
$payment_meta = edd_get_payment_meta($payment_id);
$cart_items = edd_get_payment_meta_cart_details($payment_id);
$items_sold = '';
$order_id = edd_get_payment_number($payment_id);
foreach ($cart_items as $key => $cart_item) {
$name = $cart_item['name'];
$price = $cart_item['price'];
$items_sold .= "*Name:* " . $name . " | *Price:* " . $currency_symbol . "" . $price . " \n";
}
$gateway = edd_get_payment_gateway($payment_id);
$payment_method = edd_get_gateway_admin_label($gateway);
$user_data = $payment_meta['user_info'];
/* Display the new sale introduction */
$message = "A new sale has occurred at " . get_bloginfo('name') . " \n\n";
/* Show or hide order number based on user preference in settings page */
if (!$hide_order_number) {
$message .= "*Order* <" . get_bloginfo('home') . "/wp-admin/edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=" . $order_id . "|#" . $order_id . "> \n";
}
/* Show the order total */
$message .= "*Order Total:* " . $currency_symbol . "" . $order_amount . " \n\n";
/* Show or hide payment gateway based on user preference in settings page */
if (!$hide_payment_gateway) {
$message .= "*Payment Method:* " . $payment_method . " \n\n";
}
/* Show or hide order items based on user preference in settings page */
if (!$hide_order_items) {
$message .= "*" . edd_get_cart_quantity() . " ITEM(S):* \n";
$message .= $items_sold;
}
/* Show or hide order number based on user preference in settings page */
if (!$hide_buyer_information) {
$message .= "\n\n *Customer:* " . $user_data['first_name'] . " " . $user_data['last_name'] . " " . $user_data['email'] . "\n";
}
$attachment = array();
$attachment[] = array('color' => 'good', 'fallback' => 'New sale notification of ' . $currency_symbol . '' . $price . ' at ' . get_bloginfo('name'), 'mrkdwn_in' => array('text'), 'text' => $message, 'title' => 'New Sale Notification!');
$payload = array('attachments' => $attachment, 'channel' => $slack_channel, 'icon_emoji' => $emoji, 'username' => $bot_name);
$args = array('body' => json_encode($payload), 'timeout' => 30);
$response = wp_remote_post($webhook_url, $args);
return;
}
示例11: edd_payment_history_page
//.........这里部分代码省略.........
?>
</p>
<div class="purcase-personal-details">
<h4><?php
_e('Buyer\'s Personal Details:', 'edd');
?>
</h4>
<ul>
<li><?php
echo __('Name:', 'edd') . ' ' . $user_info['first_name'] . ' ' . $user_info['last_name'];
?>
</li>
<li><?php
echo __('Email:', 'edd') . ' ' . $payment_meta['email'];
?>
</li>
<?php
do_action('edd_payment_personal_details_list', $payment_meta, $user_info);
?>
</ul>
</div>
<?php
$gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true);
if ($gateway) {
?>
<div class="payment-method">
<h4><?php
_e('Payment Method:', 'edd');
?>
</h4>
<span class="payment-method-name"><?php
echo edd_get_gateway_admin_label($gateway);
?>
</span>
</div>
<?php
}
?>
<div class="purchase-key-wrap">
<h4><?php
_e('Purchase Key', 'edd');
?>
</h4>
<span class="purchase-key"><?php
echo $payment_meta['key'];
?>
</span>
</div>
<p><a id="edd-close-purchase-details" class="button-secondary" onclick="tb_remove();" title="<?php
_e('Close', 'edd');
?>
"><?php
_e('Close', 'edd');
?>
</a></p>
</div>
</td>
<td style="text-transform:uppercase;"><?php
echo edd_currency_filter($payment_meta['amount']);
?>
</td>
<td><?php
echo date(apply_filters('edd_payments_page_date_format', get_option('date_format')), strtotime($payment->post_date));
?>
示例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_admin_email_notice
/**
* Sends the Admin Sale Notification Email
*
* @since 1.4.2
* @param int $payment_id Payment ID (default: 0)
* @param array $payment_data Payment Meta and Data
* @return void
*/
function edd_admin_email_notice($payment_id = 0, $payment_data = array())
{
/* Send an email notification to the admin */
$admin_email = edd_get_admin_notice_emails();
$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'];
}
$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;
$title = get_the_title($id);
if (isset($download['options'])) {
if (isset($download['options']['price_id'])) {
$title .= ' - ' . edd_get_price_option_name($id, $download['options']['price_id'], $payment_id);
}
}
$download_list .= html_entity_decode($title, 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);
}
示例14: edd_export_payment_history
function edd_export_payment_history()
{
global $edd_options;
if (!isset($_GET['export'])) {
return;
}
// get out quick if not required.
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'live';
if (edd_is_test_mode() && !isset($_GET['mode'])) {
$mode = 'test';
}
$orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'ID';
$order = isset($_GET['order']) ? $_GET['order'] : 'DESC';
$order_inverse = $order == 'DESC' ? 'ASC' : 'DESC';
$order_class = strtolower($order_inverse);
$user = isset($_GET['user']) ? $_GET['user'] : null;
$status = isset($_GET['status']) ? $_GET['status'] : null;
$export = isset($_GET['export']) ? $_GET['export'] : null;
if ($export == 'csv') {
// extensible for other formats in future
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=edd-payment-history-' . date('m-d-Y') . '.csv');
header("Pragma: no-cache");
header("Expires: 0");
$payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => $mode, 'orderby' => $orderby, 'order' => $order, 'user' => $user, 'status' => $status));
if ($payments) {
$i = 0;
echo '"' . __('ID', 'edd') . '",';
echo '"' . __('Email', 'edd') . '",';
echo '"' . __('First Name', 'edd') . '",';
echo '"' . __('Last Name', 'edd') . '",';
echo '"' . __('Products', 'edd') . '",';
echo '"' . __('Discounts,', 'edd') . '",';
echo '"' . __('Amount paid', 'edd') . '",';
echo '"' . __('Payment method', 'edd') . '",';
echo '"' . __('Key', 'edd') . '",';
echo '"' . __('Date', 'edd') . '",';
echo '"' . __('User', 'edd') . '",';
echo '"' . __('Status', 'edd') . '"';
echo "\r\n";
foreach ($payments as $payment) {
$payment_meta = edd_get_payment_meta($payment->ID);
$user_info = maybe_unserialize($payment_meta['user_info']);
echo '"' . $payment->ID . '",';
echo '"' . $payment_meta['email'] . '",';
echo '"' . $user_info['first_name'] . '",';
echo '"' . $user_info['last_name'] . '",';
$downloads = isset($payment_meta['cart_details']) ? maybe_unserialize($payment_meta['cart_details']) : false;
if (empty($downloads) || !$downloads) {
$downloads = maybe_unserialize($payment_meta['downloads']);
}
if ($downloads) {
foreach ($downloads as $key => $download) {
// retrieve the ID of the download
$id = isset($payment_meta['cart_details']) ? $download['id'] : $download;
// if download has variable prices, override the default price
$price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
$user_info = unserialize($payment_meta['user_info']);
// calculate the final price
$price = edd_get_download_final_price($id, $user_info, $price_override);
// show name of download
echo get_the_title($id);
echo ' - ';
if (isset($downloads[$key]['item_number'])) {
$price_options = $downloads[$key]['item_number']['options'];
if (isset($price_options['price_id'])) {
echo edd_get_price_option_name($id, $price_options['price_id']);
echo ' - ';
}
}
echo html_entity_decode(edd_currency_filter($price));
if ($key != count($downloads) - 1) {
echo ' / ';
}
}
echo ',';
}
if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
echo '"' . $user_info['discount'] . '",';
} else {
echo '"' . __('none', 'edd') . '",';
}
echo '"' . html_entity_decode(edd_currency_filter($payment_meta['amount'])) . '",';
$gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true);
if ($gateway) {
echo '"' . edd_get_gateway_admin_label($gateway) . '",';
} else {
echo '"' . __('none', 'edd') . '",';
}
echo '"' . $payment_meta['key'] . '",';
echo '"' . date(get_option('date_format'), strtotime($payment->post_date)) . '",';
$user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
echo '"';
echo is_numeric($user_id) ? get_user_by('id', $user_id)->display_name : __('guest', 'edd');
echo '",';
echo '"' . edd_get_payment_status($payment, true) . '"';
echo "\r\n";
$i++;
}
} else {
//.........这里部分代码省略.........
示例15: edd_export_payment_history
/**
* Export all Payment History to CSV
*
* @access private
* @since 1.2
* @return void
*/
function edd_export_payment_history()
{
global $edd_options;
ignore_user_abort(true);
if (!edd_is_func_disabled('set_time_limit') && !ini_get('safe_mode')) {
set_time_limit(0);
}
$mode = edd_is_test_mode() ? 'test' : 'live';
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=edd-payment-history-' . date('m-d-Y') . '.csv');
header("Pragma: no-cache");
header("Expires: 0");
$payments = edd_get_payments(array('offset' => 0, 'number' => -1, 'mode' => $mode));
if ($payments) {
$i = 0;
echo '"' . __('ID', 'edd') . '",';
echo '"' . __('Email', 'edd') . '",';
echo '"' . __('First Name', 'edd') . '",';
echo '"' . __('Last Name', 'edd') . '",';
echo '"' . __('Products', 'edd') . '",';
echo '"' . __('Discounts,', 'edd') . '",';
echo '"' . __('Amount paid', 'edd') . '",';
if (edd_use_taxes()) {
echo '"' . __('Amount taxed', 'edd') . '",';
}
echo '"' . __('Payment method', 'edd') . '",';
echo '"' . __('Key', 'edd') . '",';
echo '"' . __('Date', 'edd') . '",';
echo '"' . __('User', 'edd') . '",';
echo '"' . __('Status', 'edd') . '"';
echo "\r\n";
foreach ($payments as $payment) {
$payment_meta = edd_get_payment_meta($payment->ID);
$user_info = edd_get_payment_meta_user_info($payment->ID);
echo '"' . $payment->ID . '",';
echo '"' . $payment_meta['email'] . '",';
echo '"' . $user_info['first_name'] . '",';
echo '"' . $user_info['last_name'] . '",';
$downloads = edd_get_payment_meta_cart_details($payment->ID);
if (empty($downloads) || !$downloads) {
$downloads = maybe_unserialize($payment_meta['downloads']);
}
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;
$user_info = unserialize($payment_meta['user_info']);
$price = edd_get_download_final_price($id, $user_info, $price_override);
// Display the Downoad Name
echo '"' . get_the_title($id);
echo ' - ';
if (isset($downloads[$key]['item_number'])) {
$price_options = $downloads[$key]['item_number']['options'];
if (isset($price_options['price_id'])) {
echo edd_get_price_option_name($id, $price_options['price_id']);
echo ' - ';
}
}
echo html_entity_decode(edd_currency_filter($price));
if ($key != count($downloads) - 1) {
echo ' / ';
}
}
echo '",';
}
if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
echo '"' . $user_info['discount'] . '",';
} else {
echo '"' . __('none', 'edd') . '",';
}
echo '"' . html_entity_decode(edd_currency_filter(edd_format_amount($payment_meta['amount']))) . '",';
if (edd_use_taxes()) {
echo '"' . html_entity_decode(edd_payment_tax($payment->ID, $payment_meta)) . '",';
}
$gateway = get_post_meta($payment->ID, '_edd_payment_gateway', true);
if ($gateway) {
echo '"' . edd_get_gateway_admin_label($gateway) . '",';
} else {
echo '"' . __('none', 'edd') . '",';
}
echo '"' . $payment_meta['key'] . '",';
echo '"' . date_i18n(get_option('date_format'), strtotime($payment->post_date)) . '",';
$user_id = isset($user_info['id']) && $user_info['id'] != -1 ? $user_info['id'] : $user_info['email'];
echo '"' . is_numeric($user_id) ? get_user_by('id', $user_id)->display_name : __('guest', 'edd') . '",';
echo '"' . edd_get_payment_status($payment, true) . '"';
echo "\r\n";
$i++;
}
} else {
echo __('No payments recorded yet', 'edd');
}
//.........这里部分代码省略.........