本文整理汇总了PHP中EDD函数的典型用法代码示例。如果您正苦于以下问题:PHP EDD函数的具体用法?PHP EDD怎么用?PHP EDD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EDD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: customer_dropdown
/**
* Renders an HTML Dropdown of all customers
*
* @access public
* @since 2.2
* @param array $args
* @return string $output Customer dropdown
*/
public function customer_dropdown($args = array())
{
$defaults = array('name' => 'customers', 'id' => 'customers', 'class' => '', 'multiple' => false, 'selected' => 0, 'chosen' => true, 'placeholder' => __('Select a Customer', 'edd'), 'number' => 30);
$args = wp_parse_args($args, $defaults);
$customers = EDD()->customers->get_customers(array('number' => $args['number']));
$options = array();
if ($customers) {
$options[0] = __('No customer attached', 'edd');
foreach ($customers as $customer) {
$options[absint($customer->id)] = esc_html($customer->name . ' (' . $customer->email . ')');
}
} else {
$options[0] = __('No customers found', 'edd');
}
if (!empty($args['selected'])) {
// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed
if (!array_key_exists($args['selected'], $options)) {
$customer = new EDD_Customer($args['selected']);
if ($customer) {
$options[absint($args['selected'])] = esc_html($customer->name . ' (' . $customer->email . ')');
}
}
}
$output = $this->select(array('name' => $args['name'], 'selected' => $args['selected'], 'id' => $args['id'], 'class' => $args['class'] . ' edd-customer-select', 'options' => $options, 'multiple' => $args['multiple'], 'chosen' => $args['chosen'], 'show_option_all' => false, 'show_option_none' => false));
return $output;
}
示例2: display_tools
/**
* Render the MailChimp Tools
*
* @since 2.5.3
* @return void
*/
public function display_tools()
{
?>
<div class="postbox">
<h3><span><?php
_e('Send sales data to Mailchimp', 'eddmc');
?>
</span></h3>
<div class="inside">
<form id="eddmc-send-data" class="edd-export-form" method="post">
<?php
echo EDD()->html->date_field(array('id' => 'edd-payment-export-start', 'name' => 'start', 'placeholder' => __('Choose start date', 'eddmc')));
?>
<?php
echo EDD()->html->date_field(array('id' => 'edd-payment-export-end', 'name' => 'end', 'placeholder' => __('Choose end date', 'eddmc')));
?>
<?php
wp_nonce_field('edd_ajax_export', 'edd_ajax_export');
?>
<input type="hidden" name="edd-export-class" value="EDD_Batch_Mailchimp_Ecommerce"/>
<span>
<input type="submit" value="<?php
_e('Send Sales Data', 'eddmc');
?>
" class="button-secondary"/>
<span class="spinner"></span>
</span>
</form>
</div><!-- .inside -->
</div><!-- .postbox -->
<?php
}
示例3: wc_edd_email_purchase_receipt
/**
* Helper Functions
*/
function wc_edd_email_purchase_receipt($payment_id, $download_id)
{
$payment_data = edd_get_payment_meta($payment_id);
$download = get_post($download_id);
$license = edd_software_licensing()->get_license_by_purchase($payment_id, $download_id);
$from_name = edd_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
$from_name = apply_filters('edd_purchase_from_name', $from_name, $payment_id, $payment_data);
$from_email = edd_get_option('from_email', get_bloginfo('admin_email'));
$from_email = apply_filters('edd_purchase_from_address', $from_email, $payment_id, $payment_data);
$to_email = edd_get_payment_user_email($payment_id);
$subject = edd_get_option('purchase_subject', __('New License Key', 'edd'));
$subject = apply_filters('edd_purchase_subject', wp_strip_all_tags($subject), $payment_id);
$subject = edd_do_email_tags($subject, $payment_id);
$message = "Dear " . edd_email_tag_first_name($payment_id) . ",\n\n";
$message .= "As you have updated " . $download->post_title . ", please use following new license key to continue getting future updates: \n\n";
$message .= "License Key : " . edd_software_licensing()->get_license_key($license->ID) . "\n\n";
$message .= "Sorry for inconvenience.";
$emails = EDD()->emails;
$emails->__set('from_name', $from_name);
$emails->__set('from_email', $from_email);
$emails->__set('heading', __('Purchase Receipt', 'edd'));
$headers = apply_filters('edd_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
$emails->__set('headers', $headers);
$emails->send($to_email, $subject, $message, array());
if ($admin_notice && !edd_admin_notices_disabled($payment_id)) {
do_action('edd_admin_sale_notice', $payment_id, $payment_data);
}
}
示例4: kfg_check_if_is_renewal
function kfg_check_if_is_renewal($return)
{
if (EDD()->session->get('edd_is_renewal')) {
edd_set_error('edd-discount-error', __('This discount is not valid with renewals.', 'edd'));
return false;
}
return $return;
}
示例5: edd_rp_add_to_cart_item
/**
* Store extra meta information against the download at the time it is added to the cart
* if it's a recommendation
*
* @since 1.2.6
* @param $info the default array of meta information stored with the download
* @return $info the new array of meta information
*
*/
function edd_rp_add_to_cart_item($info)
{
$recommendation_page = EDD()->session->get('edd_has_recommendations');
if (is_numeric($recommendation_page) && $recommendation_page != $info['id']) {
$info['recommendation_source'] = $recommendation_page;
}
return $info;
}
示例6: edd_sl_license_export_box
/**
* Renders the license key export box
*
* @access public
* @since 3.0
*/
function edd_sl_license_export_box()
{
?>
<div class="postbox">
<h3><span><?php
_e('Export License Keys', 'edd_sl');
?>
</span></h3>
<div class="inside">
<p><?php
_e('Use this tool to export license keys to a CSV file.', 'edd_sl');
?>
</p>
<form method="post" action="<?php
echo admin_url('edit.php?post_type=download&page=edd-tools&tab=import_export');
?>
">
<p>
<?php
echo EDD()->html->product_dropdown(array('chosen' => true, 'name' => 'edd_sl_download_id'));
?>
</p>
<p>
<select name="edd_sl_status">
<option value="all"><?php
_e('All License Keys', 'edd_sl');
?>
</option>
<option value="active"><?php
_e('Active License Keys', 'edd_sl');
?>
</option>
<option value="inactive"><?php
_e('Inactive License Keys', 'edd_sl');
?>
</option>
<option value="expired"><?php
_e('Expired License Keys', 'edd_sl');
?>
</option>
</select>
<input type="hidden" name="edd_action" value="sl_export_license_keys" />
</p>
<p>
<?php
wp_nonce_field('edd_sl_export_nonce', 'edd_sl_export_nonce');
?>
<?php
submit_button(__('Export', 'edd_el'), 'secondary', 'submit', false);
?>
</p>
</form>
</div><!-- .inside -->
</div><!-- .postbox -->
<?php
}
示例7: edd_rp_display_checkout
function edd_rp_display_checkout()
{
global $post;
if (edd_is_checkout()) {
// GitHub Issue: https://github.com/pippinsplugins/Easy-Digital-Downloads/issues/1059
add_filter('edd_straight_to_checkout', '__return_true');
}
EDD()->session->set('edd_has_recommendations', $post->ID);
edd_rp_get_template_part('checkout_recommendations');
}
示例8: edd_nod_get_email_body_content
/**
* NOD Email Offer Template Body
*
* @since 0.0.1
* @param int $discount_id Required: Discount ID
* @param int $payment_id Optional: Payment ID
* @param array $payment_data Optional: Payment Data
*
* @return string $email_body Body of the email
*/
function edd_nod_get_email_body_content($discount_id, $payment_id = 0, $payment_data = array())
{
$default_email_body = sprintf(__('Hey %s,', 'edd-next-order-discount'), '{name}') . "\n\n";
$default_email_body .= sprintf(__('To say thanks for your recent purchase at {sitename}, we are offering you a discount of %s off your next purchase.', 'nod'), '{offer_amount}') . "\n\n";
$default_email_body .= sprintf(__('To claim this offer, simply enter the Discount Code %s%s%s during checkout on our website before the discount expires on %s.', 'edd-next-order-discount'), '<strong>', '{offer_code}', '</strong>', '{offer_expiry}') . "\n\n";
$default_email_body .= __('Thank you', 'edd-next-order-discount');
$email = EDD_NOD()->settings->email_content;
$email_body = wpautop($email);
$email_body = apply_filters('nod_offer_email_' . EDD()->emails->get_template(), $email_body, $discount_id, $payment_id, $payment_data);
return apply_filters('nod_offer_email', $email_body, $discount_id, $payment_id, $payment_data);
}
示例9: send_renewal_reminder
public function send_renewal_reminder($license_id = 0, $notice_id = 0)
{
global $edd_options;
if (empty($license_id)) {
return;
}
$send = true;
$license = get_post($license_id);
$send = apply_filters('edd_sl_send_renewal_reminder', $send, $license_id, $notice_id);
if (!$license || 'edd_license' != $license->post_type || !$send || !empty($license->post_parent)) {
return;
}
$customer = false;
if (class_exists('EDD_Customer')) {
$payment_id = get_post_meta($license->ID, '_edd_sl_payment_id', true);
$customer_id = edd_get_payment_customer_id($payment_id);
$customer = new EDD_Customer($customer_id);
}
if (empty($customer->id)) {
// Remove the post title to get just the email
$title = $license->post_title;
$title_pos = strpos($title, '-') + 1;
$length = strlen($title);
$email_to = substr($title, $title_pos, $length);
}
$email_to = !empty($customer->id) ? $customer->email : $email_to;
$notice = edd_sl_get_renewal_notice($notice_id);
$message = !empty($notice['message']) ? $notice['message'] : __("Hello {name},\n\nYour license key for {product_name} is about to expire.\n\nIf you wish to renew your license, simply click the link below and follow the instructions.\n\nYour license expires on: {expiration}.\n\nYour expiring license key is: {license_key}.\n\nRenew now: {renewal_link}.", "edd_sl");
$message = $this->filter_reminder_template_tags($message, $license_id);
$subject = !empty($notice['subject']) ? $notice['subject'] : __('Your License Key is About to Expire', 'edd_sl');
$subject = $this->filter_reminder_template_tags($subject, $license_id);
$message = stripslashes($message);
$subject = stripslashes($subject);
if (class_exists('EDD_Emails')) {
$sent = EDD()->emails->send($email_to, $subject, $message);
} else {
$from_name = get_bloginfo('name');
$from_email = get_bloginfo('admin_email');
$headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
$headers .= "Reply-To: " . $from_email . "\r\n";
$sent = wp_mail($email_to, $subject, $message, $headers);
}
if ($sent) {
$log_id = wp_insert_post(array('post_title' => __('LOG - Renewal Notice Sent', 'edd_sl'), 'post_name' => 'log-notice-sent-' . $license_id . '-' . md5(time()), 'post_type' => 'edd_license_log', 'post_status' => 'publish'));
add_post_meta($log_id, '_edd_sl_log_license_id', $license_id);
add_post_meta($log_id, '_edd_sl_renewal_notice_id', (int) $notice_id);
wp_set_object_terms($log_id, 'renewal_notice', 'edd_log_type', false);
add_post_meta($license_id, sanitize_key('_edd_sl_renewal_sent_' . $notice['send_period']), time());
// Prevent renewal notices from being sent more than once
}
}
示例10: edd_wallet_process_incentive
function edd_wallet_process_incentive()
{
if ($_REQUEST['gateway'] == 'wallet') {
EDD()->session->set('wallet_has_incentives', '1');
} else {
EDD()->session->set('wallet_has_incentives', null);
}
// Refresh the cart
if (empty($_POST['billing_country'])) {
$_POST['billing_country'] = edd_get_shop_country();
}
ob_start();
edd_checkout_cart();
$cart = ob_get_clean();
$response = array('html' => $cart, 'tax_raw' => edd_get_cart_tax(), 'tax' => html_entity_decode(edd_cart_tax(false), ENT_COMPAT, 'UTF-8'), 'tax_rate_raw' => edd_get_tax_rate(), 'tax_rate' => html_entity_decode(edd_get_formatted_tax_rate(), ENT_COMPAT, 'UTF-8'), 'total' => html_entity_decode(edd_cart_total(false), ENT_COMPAT, 'UTF-8'), 'total_raw' => edd_get_cart_total());
echo json_encode($response);
edd_die();
}
示例11: edd_wallet_scripts
/**
* Load frontend scripts
*
* @since 1.0.0
* @return void
*/
function edd_wallet_scripts()
{
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_style('edd-wallet', EDD_WALLET_URL . 'assets/css/edd-wallet' . $suffix . '.css', EDD_WALLET_VER);
wp_enqueue_script('edd-wallet', EDD_WALLET_URL . 'assets/js/edd-wallet' . $suffix . '.js', array('jquery'), EDD_WALLET_VER);
wp_localize_script('edd-wallet', 'edd_wallet_vars', array('custom_deposit_error' => edd_get_option('edd_wallet_custom_deposit_error', __('You must enter a valid deposit amount!', 'edd-wallet'))));
if (edd_get_option('edd_wallet_disable_styles', false) != true) {
wp_enqueue_style('edd-wallet-deposit', EDD_WALLET_URL . 'assets/css/deposit' . $suffix . '.css', EDD_WALLET_VER);
}
$fee = EDD()->fees->get_fee('edd-wallet-deposit');
if ($fee) {
wp_enqueue_script('edd-wallet-fees', EDD_WALLET_URL . 'assets/js/edd-wallet-fees' . $suffix . '.js', array('jquery'), EDD_WALLET_VER);
}
if ((int) edd_get_option('edd_wallet_incentive_amount', 0) > 0) {
wp_enqueue_script('edd-wallet-incentives', EDD_WALLET_URL . 'assets/js/edd-wallet-incentives' . $suffix . '.js', array('jquery'), EDD_WALLET_VER);
wp_localize_script('edd-wallet-incentives', 'edd_wallet_incentives_vars', array('ajaxurl' => admin_url('admin-ajax.php')));
}
}
示例12: widget
/**
* Outputs the content of the widget
*
* Handles to show output of widget
* at front side sidebar
*
* @package Easy Digital Downloads - Social Login
* @since 1.1.0
*
*/
function widget($args, $instance)
{
global $wpdb, $post, $edd_options;
extract($args);
$title = apply_filters('widget_title', $instance['title']);
if (!is_user_logged_in() && edd_slg_check_social_enable()) {
echo $before_widget;
// get redirect url from settings
$defaulturl = isset($edd_options['edd_slg_redirect_url']) && !empty($edd_options['edd_slg_redirect_url']) ? $edd_options['edd_slg_redirect_url'] : edd_slg_get_current_page_url();
//session create for redirect url
EDD()->session->set('edd_slg_stcd_redirect_url_widget', $defaulturl);
echo '<div class="edd-slg-social-container edd-slg-widget-content">';
echo $before_title . $title . $after_title;
$this->render->edd_slg_social_login_inner_buttons();
//end container
echo '</div><!--.edd-slg-widget-content-->';
echo $after_widget;
}
}
示例13: process_nods
/**
* Runs during the edd_nod_schedule_next_order_discount hook.
*
* If the NOD is due, generate the discount code, email content and send the email
*
* @hook edd_nod_schedule_next_order_discount
* @params
*
*
*
* @return void
*/
public function process_nods()
{
$nods = EDD_NOD()->discounts->pending_nods;
// No NODs to process? return
if (empty($nods)) {
return;
}
foreach ($nods as $payment_id => $nod) {
// If the offer is not scheduled yet, skip it
if (!$this->nod_is_ready($nod)) {
continue;
}
$payment_data = edd_get_payment_meta($nod['payment_id']);
// No data, remove the record and continue
if (empty($payment_data)) {
EDD_NOD()->discounts->delete_nod($payment_id);
continue;
}
// Create the discount code
$discount = EDD_NOD()->discounts->generate_discount($nod['payment_id']);
if (empty($discount)) {
return;
}
$email_args = $this->prepare_email($nod, $discount->ID);
apply_filters('nod_email_offer_args', $email_args, $nod, $discount);
$emails = EDD()->emails;
$emails->__set('from_name', $email_args['from_name']);
$emails->__set('from_email', $email_args['from_email']);
$emails->__set('heading', $email_args['heading']);
add_filter('edd_email_headers', array(&$this, 'headers'));
$headers = apply_filters('nod_offer_headers', $emails->get_headers(), $nod['payment_id'], $payment_data);
$emails->__set('headers', $headers);
do_action('nod_before_send_offer', $email_args, $nod, $discount);
$is_sent = $emails->send($email_args['to_email'], $email_args['subject'], $email_args['message'], $email_args['attachments']);
do_action('nod_after_send_offer', $email_args, $nod, $discount);
// If the email was sent, we can remove this instance from pending NODs
if (!empty($is_sent)) {
EDD_NOD()->discounts->delete_nod($payment_id);
}
}
}
示例14: kjm_render_products_field
function kjm_render_products_field($post_id)
{
$type = edd_get_download_type($post_id);
$display = $type == 'bundle' ? '' : ' style="display:none;"';
$products = edd_get_bundled_products($post_id);
?>
<div id="edd_products"<?php
echo $display;
?>
>
<div id="edd_file_fields" class="edd_meta_table_wrap">
<table class="widefat" width="100%" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th><?php
printf(__('Bundled %s:', 'easy-digital-downloads'), edd_get_label_plural());
?>
</th>
<?php
do_action('edd_download_products_table_head', $post_id);
?>
</tr>
</thead>
<tbody>
<tr class="edd_repeatable_product_wrapper">
<td>
<?php
echo EDD()->html->product_dropdown(array('name' => '_edd_bundled_products[]', 'id' => 'edd_bundled_products', 'selected' => $products, 'multiple' => true, 'chosen' => true, 'bundles' => false, 'number' => 2));
?>
</td>
<?php
do_action('edd_download_products_table_row', $post_id);
?>
</tr>
</tbody>
</table>
</div>
</div>
<?php
}
示例15: edd_acq_custom_checkout_fields
/**
* Output the dropdown on the checkout form
*
* @since 1.0
* @return void
*/
function edd_acq_custom_checkout_fields()
{
static $has_displayed = NULL;
// Make sure we don't display more than once.
if (NULL !== $has_displayed) {
return;
}
$methods = edd_acq_get_methods();
$title = edd_get_option('acq_survey_title', __('How did you hear about us?', 'edd-acquisition-survey'));
$required = edd_get_option('acq_require_response', false);
if (empty($methods)) {
return;
}
?>
<p id="edd-acq-wrap">
<label class="edd-label" for="edd-acq-method"><?php
echo $title;
if ($required) {
?>
<span class="edd-required-indicator">*</span><?php
}
?>
</label>
<?php
$options = array();
foreach ($methods as $method) {
$options[$method['value']] = $method['name'];
}
if (!empty($options)) {
$args = array('options' => $options, 'name' => 'edd_acquisition_method', 'class' => 'edd-acq-method', 'id' => '', 'show_option_all' => 0, 'show_option_none' => _x('Select One', 'no dropdown items', 'edd-acquisition-survey'));
echo EDD()->html->select($args);
}
?>
</p>
<?php
$has_displayed = true;
}