/**
  * 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;
 }
    /**
     * 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 
    }
/**
 * 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);
    }
}
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;
}
Ejemplo n.º 5
0
/**
 * 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;
}
Ejemplo n.º 6
0
/**
 * 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 
}
Ejemplo n.º 7
0
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');
}
Ejemplo n.º 8
0
/**
 * 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);
}
Ejemplo n.º 9
0
 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
     }
 }
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();
}
Ejemplo n.º 11
0
/**
 * 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')));
    }
}
 /**
  * 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;
     }
 }
Ejemplo n.º 13
0
 /**
  * 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);
         }
     }
 }
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 
}
Ejemplo n.º 15
0
/**
 * 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;
}
 /**
  * Show All Social Login Buttons
  * 
  * Handles to show all social login buttons on the viewing page
  * whereever user put shortcode
  * 
  * @package Easy Digital Downloads - Social Login
  * @since 1.1.0
  */
 public function edd_slg_social_login($atts, $content)
 {
     global $edd_options, $post;
     extract(shortcode_atts(array('title' => '', 'redirect_url' => '', 'showonpage' => false), $atts));
     $showbuttons = true;
     // if show only on inners pages is set and current page is not inner page
     if (!empty($showonpage) && !is_singular()) {
         $showbuttons = false;
     }
     //check show social buttons or not
     if ($showbuttons) {
         //check user is logged in to site or not and any single social login button is enable or not
         if (!is_user_logged_in() && edd_slg_check_social_enable()) {
             // login heading from setting page
             $login_heading = isset($edd_options['edd_slg_login_heading']) ? $edd_options['edd_slg_login_heading'] : '';
             //  check title first from shortcode
             $login_heading = !empty($title) ? $title : $login_heading;
             // 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();
             //redirect url for shortcode
             $defaulturl = isset($redirect_url) && !empty($redirect_url) ? $redirect_url : $defaulturl;
             //session create for access token & secrets
             EDD()->session->set('edd_slg_stcd_redirect_url', $defaulturl);
             // get html for all social login buttons
             ob_start();
             echo '<fieldset id="edd_slg_social_login" class="edd-slg-social-container">';
             if (!empty($login_heading)) {
                 echo '<span><legend>' . $login_heading . '</legend></span>';
             }
             $this->render->edd_slg_social_login_inner_buttons($redirect_url);
             echo '</fieldset><!--#edd_slg_social_login-->';
             $content .= ob_get_clean();
         }
     }
     return $content;
 }
    /**
     * Display shipping details in the View Details popup
     *
     * @since 1.0
     *
     * @access public
     * @return void
     */
    public function show_shipping_details($payment_id = 0)
    {
        if (empty($payment_id)) {
            $payment_id = isset($_GET['id']) ? absint($_GET['id']) : 0;
        }
        $user_info = edd_get_payment_meta_user_info($payment_id);
        $address = !empty($user_info['shipping_info']) ? $user_info['shipping_info'] : false;
        if (!$address) {
            return;
        }
        $status = get_post_meta($payment_id, '_edd_payment_shipping_status', true);
        $shipped = $status == '2' ? true : false;
        ?>
		<div id="edd-shipping-details" class="postbox">
			<h3 class="hndle">
				<span><?php 
        _e('Shipping Address', 'edd');
        ?>
</span>
			</h3>
			<div class="inside edd-clearfix">

				<div id="edd-order-shipping-address">

					<div class="order-data-address">
						<div class="data column-container">
							<div class="column">
								<p>
									<strong class="order-data-address-line"><?php 
        _e('Street Address Line 1:', 'edd');
        ?>
</strong><br/>
									<input type="text" name="edd-payment-shipping-address[0][address]" value="<?php 
        esc_attr_e($address['address']);
        ?>
" class="medium-text" />
								</p>
								<p>
									<strong class="order-data-address-line"><?php 
        _e('Street Address Line 2:', 'edd');
        ?>
</strong><br/>
									<input type="text" name="edd-payment-shipping-address[0][address2]" value="<?php 
        esc_attr_e($address['address2']);
        ?>
" class="medium-text" />
								</p>

							</div>
							<div class="column">
								<p>
									<strong class="order-data-address-line"><?php 
        echo _x('City:', 'Address City', 'edd');
        ?>
</strong><br/>
									<input type="text" name="edd-payment-shipping-address[0][city]" value="<?php 
        esc_attr_e($address['city']);
        ?>
" class="medium-text"/>

								</p>
								<p>
									<strong class="order-data-address-line"><?php 
        echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'edd');
        ?>
</strong><br/>
									<input type="text" name="edd-payment-shipping-address[0][zip]" value="<?php 
        esc_attr_e($address['zip']);
        ?>
" class="medium-text"/>

								</p>
							</div>
							<div class="column">
								<p id="edd-order-address-country-wrap">
									<strong class="order-data-address-line"><?php 
        echo _x('Country:', 'Address country', 'edd');
        ?>
</strong><br/>
									<?php 
        echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'edd-payment-shipping-address[0][country]', 'selected' => $address['country'], 'show_option_all' => false, 'show_option_none' => false));
        ?>
								</p>
								<p id="edd-order-address-state-wrap">
									<strong class="order-data-address-line"><?php 
        echo _x('State / Province:', 'State / province of address', 'edd');
        ?>
</strong><br/>
									<?php 
        $states = edd_get_shop_states($address['country']);
        if (!empty($states)) {
            echo EDD()->html->select(array('options' => $states, 'name' => 'edd-payment-shipping-address[0][state]', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false));
        } else {
            ?>
										<input type="text" name="edd-payment-shipping-address[0][state]" value="<?php 
            esc_attr_e($address['state']);
            ?>
" class="medium-text"/>
										<?php 
        }
        ?>
								</p>
							</div>
						</div>
						<label for="edd-payment-shipped">
							<input type="checkbox" id="edd-payment-shipped" name="edd-payment-shipped" value="1"<?php 
        checked($shipped, true);
        ?>
/>
							<?php 
        _e('Check if this purchase has been shipped.', 'edd-simple-shipping');
        ?>
						</label>
					</div>
				</div><!-- /#edd-order-address -->

				<?php 
        do_action('edd_payment_shipping_details', $payment_id);
        ?>

			</div><!-- /.inside -->
		</div><!-- /#edd-shipping-details -->
<?php 
    }
Ejemplo n.º 18
0
 public function display_fes_dashboard($atts)
 {
     global $post;
     $view = !empty($_REQUEST['view']) ? $_REQUEST['view'] : 'login-register';
     if ($view && !EDD_FES()->vendors->vendor_is_vendor()) {
         ob_start();
         switch ($view) {
             case 'login':
                 echo EDD_FES()->forms->render_login_form();
                 break;
             case 'register':
                 echo EDD_FES()->forms->render_register_form();
                 break;
             case 'login-register':
                 echo EDD_FES()->forms->render_login_registration_form();
                 break;
             default:
                 echo EDD_FES()->forms->render_login_registration_form();
                 break;
         }
         return ob_get_clean();
     } else {
         extract(shortcode_atts(array('user_id' => get_current_user_id()), $atts));
         //Session set for upload watermarking
         $fes_post_id = isset($post->ID) ? $post->ID : '';
         EDD()->session->set('edd_fes_post_id', $fes_post_id);
         $task = !empty($_GET['task']) ? $_GET['task'] : '';
         ob_start();
         /* Load Menu */
         $custom = apply_filters('fes_signal_custom_task', false, $task);
         EDD_FES()->templates->fes_get_template_part('frontend', 'menu');
         echo '<div id="fes-vendor-dashboard">';
         /* Get page options */
         switch ($task) {
             case 'dashboard':
                 EDD_FES()->templates->fes_get_template_part('frontend', 'dashboard');
                 break;
             case 'products':
                 global $products;
                 $status = isset($_GET['status']) ? $_GET['status'] : false;
                 $products = EDD_FES()->vendors->get_products(get_current_user_id(), $status);
                 EDD_FES()->templates->fes_get_template_part('frontend', 'products');
                 break;
             case 'new-product':
                 echo EDD_FES()->forms->render_submission_form();
                 break;
             case 'edit-product':
                 echo EDD_FES()->forms->render_submission_form();
                 break;
             case 'delete-product':
                 EDD_FES()->templates->fes_get_template_part('frontend', 'delete-product');
                 break;
             case 'earnings':
                 EDD_FES()->templates->fes_get_template_part('frontend', 'earnings');
                 break;
             case 'orders':
                 global $orders;
                 // if no permission to view, send to dashboard
                 if (!EDD_FES()->vendors->vendor_can_view_orders()) {
                     EDD_FES()->templates->fes_get_template_part('frontend', 'dashboard');
                     break;
                 }
                 $orders = EDD_FES()->vendors->get_all_orders(get_current_user_id(), array());
                 EDD_FES()->templates->fes_get_template_part('frontend', 'orders');
                 break;
             case 'edit-order':
                 // if no permission to view, send to dashboard
                 if (!EDD_FES()->vendors->vendor_can_view_orders()) {
                     EDD_FES()->templates->fes_get_template_part('frontend', 'dashboard');
                     break;
                 }
                 EDD_FES()->templates->fes_get_template_part('frontend', 'edit-order');
                 break;
             case 'profile':
                 echo EDD_FES()->forms->render_profile_form();
                 break;
             case '':
                 EDD_FES()->templates->fes_get_template_part('frontend', 'dashboard');
                 break;
             case $custom:
                 do_action('fes_custom_task_' . $task);
                 break;
             default:
                 EDD_FES()->templates->fes_get_template_part('frontend', 'dashboard');
                 break;
         }
         echo '</div>';
         return ob_get_clean();
     }
 }
Ejemplo n.º 19
0
/**
 * Renders an HTML Dropdown of all the available languages
 *
 * @param  array  $args   Arguments for the dropdown
 *
 * @return string $output Languages dropdown
 *
 * @since 0.1.0
 */
function edd_lp_language_dropdown($args = array())
{
    $defaults = array('name' => 'languages', 'id' => 'languages', 'class' => '', 'multiple' => false, 'selected' => 0, 'chosen' => false, 'placeholder' => __('Select a language', 'edd-language-packs'));
    $args = wp_parse_args($args, $defaults);
    require_once ABSPATH . 'wp-admin/includes/translation-install.php';
    $translations = wp_get_available_translations();
    $options = array();
    if ($translations) {
        $options[0] = __('Select a language', 'edd-language-packs');
        foreach ($translations as $translation) {
            $options[$translation['language']] = esc_html($translation['english_name']);
        }
    } else {
        $options[0] = __('No languages found', 'edd-language-packs');
    }
    // This ensures that any selected products are included in the drop down
    if (is_array($args['selected'])) {
        foreach ($args['selected'] as $language => $english_name) {
            if (!in_array($language, $options)) {
                $options[$language] = $english_name;
            }
        }
    } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
        if (!in_array($args['selected'], $options)) {
            $options[key($args['selected'])] = $args['selected'];
        }
    }
    $output = EDD()->html->select(array('name' => $args['name'], 'selected' => $args['selected'], 'id' => $args['id'], 'class' => $args['class'], 'options' => $options, 'chosen' => $args['chosen'], 'multiple' => $args['multiple'], 'placeholder' => $args['placeholder'], 'show_option_all' => false, 'show_option_none' => false));
    return $output;
}
Ejemplo n.º 20
0
function edd_customers_delete_view($customer)
{
    $customer_edit_role = apply_filters('edd_edit_customers_role', 'edit_shop_payments');
    ?>

	<?php 
    do_action('edd_customer_delete_top', $customer);
    ?>

	<div class="info-wrapper customer-section">

		<form id="delete-customer" method="post" action="<?php 
    echo admin_url('edit.php?post_type=download&page=edd-customers&view=delete&id=' . $customer->id);
    ?>
">

			<div class="customer-notes-header">
				<?php 
    echo get_avatar($customer->email, 30);
    ?>
 <span><?php 
    echo $customer->name;
    ?>
</span>
			</div>


			<div class="customer-info delete-customer">

				<span class="delete-customer-options">
					<p>
						<?php 
    echo EDD()->html->checkbox(array('name' => 'edd-customer-delete-confirm'));
    ?>
						<label for="edd-customer-delete-confirm"><?php 
    _e('Are you sure you want to delete this customer?', 'edd');
    ?>
</label>
					</p>

					<p>
						<?php 
    echo EDD()->html->checkbox(array('name' => 'edd-customer-delete-records', 'options' => array('disabled' => true)));
    ?>
						<label for="edd-customer-delete-records"><?php 
    _e('Delete all associated payments and records?', 'edd');
    ?>
</label>
					</p>

					<?php 
    do_action('edd_customer_delete_inputs', $customer);
    ?>
				</span>

				<span id="customer-edit-actions">
					<input type="hidden" name="customer_id" value="<?php 
    echo $customer->id;
    ?>
" />
					<?php 
    wp_nonce_field('delete-customer', '_wpnonce', false, true);
    ?>
					<input type="hidden" name="edd_action" value="delete-customer" />
					<input type="submit" disabled="disabled" id="edd-delete-customer" class="button-primary" value="<?php 
    _e('Delete Customer', 'edd');
    ?>
" />
					<a id="edd-delete-customer-cancel" href="<?php 
    echo admin_url('edit.php?post_type=download&page=edd-customers&view=overview&id=' . $customer->id);
    ?>
" class="delete"><?php 
    _e('Cancel', 'edd');
    ?>
</a>
				</span>

			</div>

		</form>
	</div>

	<?php 
    do_action('edd_customer_delete_bottom', $customer);
}
    public static function footer()
    {
        global $edd_receipt_args;
        ?>
        <!-- start Mixpanel -->
        <script type="text/javascript">(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user".split(" ");
                for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f)}})(document,window.mixpanel||[]);
            mixpanel.init("<?php 
        echo FT_MP_API_KEY;
        ?>
");</script>
        <!-- end Mixpanel -->
        <?php 
        if (!$edd_receipt_args['id']) {
            return;
        }
        $sent = EDD()->session->get('ft_mp_sent_' . $edd_receipt_args['id']);
        if ($sent) {
            return;
        }
        // global $edd_receipt_args;
        $success_page = edd_get_option('success_page') ? is_page(edd_get_option('success_page')) : false;
        if (!$success_page || !edd_is_success_page()) {
            return;
        }
        $session = edd_get_purchase_session();
        $price = $session['price'];
        $cart_items = $session['cart_details'];
        if (isset($edd_receipt_args['id'])) {
            EDD()->session->set('ft_mp_sent_' . $edd_receipt_args['id'], true);
        }
        //  $session['user_info']['id']
        ?>
        <script type="text/javascript">

            mixpanel.identify( <?php 
        echo $session['user_info']['id'];
        ?>
 );
            mixpanel.people.set( {
                '$first_name' : '<?php 
        echo esc_attr($session['user_info']['first_name']);
        ?>
',
                '$last_name'  : '<?php 
        echo esc_attr($session['user_info']['last_name']);
        ?>
',
                '$email'      : "<?php 
        echo esc_attr($session['user_info']['email']);
        ?>
",
            });
            <?php 
        foreach ($cart_items as $product) {
            ?>
            mixpanel.people.track_charge( <?php 
            echo floatval($product["price"]);
            ?>
, { "Product Name": '<?php 
            echo esc_attr($product["name"]);
            ?>
' } );
            mixpanel.track( 'Purchase', {"Amount": <?php 
            echo floatval($product["price"]);
            ?>
, "Product Name":<?php 
            echo json_encode($product["name"]);
            ?>
 } );
            mixpanel.people.append( 'Product Name', '<?php 
            echo esc_attr($product["name"]);
            ?>
' );
            <?php 
        }
        ?>
        </script>
        <?php 
    }
Ejemplo n.º 22
0
/**
 * Render Disable Button
 *
 * @since 1.0
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_render_disable_button($post_id)
{
    $hide_button = get_post_meta($post_id, '_edd_hide_purchase_link', true) ? 1 : 0;
    $behavior = get_post_meta($post_id, '_edd_button_behavior', true);
    ?>
	<p><strong><?php 
    _e('Button Options:', 'edd');
    ?>
</strong></p>
	<p>
		<label for="_edd_hide_purchase_link">
			<?php 
    echo EDD()->html->checkbox(array('name' => '_edd_hide_purchase_link', 'current' => $hide_button));
    ?>
			<?php 
    _e('Disable the automatic output of the purchase button', 'edd');
    ?>
		</label>
	</p>
	<?php 
    if (edd_shop_supports_buy_now()) {
        ?>
	<p>
		<label for="_edd_button_behavior">
			<?php 
        echo EDD()->html->select(array('name' => '_edd_button_behavior', 'options' => array('add_to_cart' => __('Add to Cart', 'edd'), 'direct' => __('Buy Now', 'edd')), 'show_option_all' => null, 'show_option_none' => null, 'selected' => $behavior));
        ?>
			<?php 
        _e('Purchase button behavior', 'edd');
        ?>
		</label>
	</p>
<?php 
    }
}
Ejemplo n.º 23
0
/**
 * Admin Footer For Thickbox
 *
 * Prints the footer code needed for the Insert Download
 * TinyMCE button.
 *
 * @since 1.0
 * @global $pagenow
 * @global $typenow
 * @return void
 */
function edd_admin_footer_for_thickbox()
{
    global $pagenow, $typenow;
    // Only run in post/page creation and edit screens
    if (in_array($pagenow, array('post.php', 'page.php', 'post-new.php', 'post-edit.php')) && $typenow != 'download') {
        ?>
		<script type="text/javascript">
            function insertDownload() {
                var id = jQuery('#products').val(),
                    direct = jQuery('#select-edd-direct').val(),
                    style = jQuery('#select-edd-style').val(),
                    color = jQuery('#select-edd-color').is(':visible') ? jQuery('#select-edd-color').val() : '',
                    text = jQuery('#edd-text').val() || '<?php 
        _e("Purchase", "edd");
        ?>
';

                // Return early if no download is selected
                if ('' === id) {
                    alert('<?php 
        _e("You must choose a download", "edd");
        ?>
');
                    return;
                }

                if( '2' == direct ) {
                	direct = ' direct="true"';
                } else {
                	direct = '';
                }

                // Send the shortcode to the editor
                window.send_to_editor('[purchase_link id="' + id + '" style="' + style + '" color="' + color + '" text="' + text + '"' + direct +']');
            }
            jQuery(document).ready(function ($) {
                $('#select-edd-style').change(function () {
                    if ($(this).val() === 'button') {
                        $('#edd-color-choice').slideDown();
                    } else {
                        $('#edd-color-choice').slideUp();
                    }
                });
            });
		</script>

		<div id="choose-download" style="display: none;">
			<div class="wrap" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">
				<p><?php 
        echo sprintf(__('Use the form below to insert the short code for purchasing a %s', 'edd'), edd_get_label_singular());
        ?>
</p>
				<div>
					<?php 
        echo EDD()->html->product_dropdown(array('chosen' => true));
        ?>
				</div>
				<?php 
        if (edd_shop_supports_buy_now()) {
            ?>
					<div>
						<select id="select-edd-direct" style="clear: both; display: block; margin-bottom: 1em; margin-top: 1em;">
							<option value="0"><?php 
            _e('Choose the button behavior', 'edd');
            ?>
</option>
							<option value="1"><?php 
            _e('Add to Cart', 'edd');
            ?>
</option>
							<option value="2"><?php 
            _e('Direct Purchase Link', 'edd');
            ?>
</option>
						</select>
					</div>
				<?php 
        }
        ?>
				<div>
					<select id="select-edd-style" style="clear: both; display: block; margin-bottom: 1em; margin-top: 1em;">
						<option value=""><?php 
        _e('Choose a style', 'edd');
        ?>
</option>
						<?php 
        $styles = array('button', 'text link');
        foreach ($styles as $style) {
            echo '<option value="' . $style . '">' . $style . '</option>';
        }
        ?>
					</select>
				</div>
				<?php 
        $colors = edd_get_button_colors();
        if ($colors) {
            ?>
				<div id="edd-color-choice" style="display: none;">
					<select id="select-edd-color" style="clear: both; display: block; margin-bottom: 1em;">
						<option value=""><?php 
            _e('Choose a button color', 'edd');
            ?>
</option>
						<?php 
            foreach ($colors as $key => $color) {
                echo '<option value="' . str_replace(' ', '_', $key) . '">' . $color['label'] . '</option>';
            }
            ?>
					</select>
				</div>
				<?php 
        }
        ?>
				<div>
					<input type="text" class="regular-text" id="edd-text" value="" placeholder="<?php 
        _e('Link text . . .', 'edd');
        ?>
"/>
				</div>
				<p class="submit">
					<input type="button" id="edd-insert-download" class="button-primary" value="<?php 
        echo sprintf(__('Insert %s', 'edd'), edd_get_label_singular());
        ?>
" onclick="insertDownload();" />
					<a id="edd-cancel-download-insert" class="button-secondary" onclick="tb_remove();" title="<?php 
        _e('Cancel', 'edd');
        ?>
"><?php 
        _e('Cancel', 'edd');
        ?>
</a>
				</p>
			</div>
		</div>
	<?php 
    }
}
        function load_old_textdomain($mofile, $textdomain)
        {
            if ($textdomain === 'easy-digital-downloads' && !file_exists($mofile)) {
                $mofile = dirname($mofile) . DIRECTORY_SEPARATOR . str_replace($textdomain, 'edd', basename($mofile));
            }
            return $mofile;
        }
    }
}
// End if class_exists check.
/**
* The main function for that returns Easy_Digital_Downloads
*
* The main function responsible for returning the one true Easy_Digital_Downloads
* Instance to functions everywhere.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* Example: <?php $edd = EDD(); ?>
*
* @since 1.4
* @return object|Easy_Digital_Downloads The one true Easy_Digital_Downloads Instance.
*/
function EDD()
{
    return Easy_Digital_Downloads::instance();
}
// Get EDD Running.
EDD();
 /**
  * Attaches the category filter to the log views
  *
  * @access public
  * @since 1.5.2
  * @return void
  */
 public function category_filter()
 {
     if (get_terms('download_category')) {
         echo EDD()->html->category_dropdown('category', $this->get_category());
     }
 }
Ejemplo n.º 26
0
 /**
  * Get Instagram user's Data
  * 
  * @param Easy Digital Downloads - Social Login
  * @since 1.5.0
  */
 public function edd_slg_get_instagram_user_data()
 {
     $user_data = '';
     $user_data = EDD()->session->get('edd_slg_instagram_user_cache');
     return $user_data;
 }
/**
 * Process the Cart Restoration
 *
 * @since 1.8
 * @return mixed || false Returns false if cart saving is disabled
 */
function edd_restore_cart()
{
    if (edd_is_cart_saving_disabled()) {
        return false;
    }
    $user_id = get_current_user_id();
    $saved_cart = get_user_meta($user_id, 'edd_saved_cart', true);
    $token = edd_get_cart_token();
    if (is_user_logged_in() && $saved_cart) {
        $messages = EDD()->session->get('edd_cart_messages');
        if (!$messages) {
            $messages = array();
        }
        if (isset($_GET['edd_cart_token']) && $_GET['edd_cart_token'] != $token) {
            $messages['edd_cart_restoration_failed'] = sprintf('<strong>%1$s</strong>: %2$s', __('Error', 'edd'), __('Cart restoration failed. Invalid token.', 'edd'));
            EDD()->session->set('edd_cart_messages', $messages);
        }
        delete_user_meta($user_id, 'edd_saved_cart');
        delete_user_meta($user_id, 'edd_cart_token');
        if (isset($_GET['edd_cart_token']) && $_GET['edd_cart_token'] != $token) {
            return new WP_Error('invalid_cart_token', __('The cart cannot be restored. Invalid token.', 'edd'));
        }
    } elseif (!is_user_logged_in() && isset($_COOKIE['edd_saved_cart']) && $token) {
        $saved_cart = $_COOKIE['edd_saved_cart'];
        if ($_GET['edd_cart_token'] != $token) {
            $messages['edd_cart_restoration_failed'] = sprintf('<strong>%1$s</strong>: %2$s', __('Error', 'edd'), __('Cart restoration failed. Invalid token.', 'edd'));
            EDD()->session->set('edd_cart_messages', $messages);
            return new WP_Error('invalid_cart_token', __('The cart cannot be restored. Invalid token.', 'edd'));
        }
        $saved_cart = maybe_unserialize(stripslashes($saved_cart));
        setcookie('edd_saved_cart', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN);
        setcookie('edd_cart_token', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN);
    }
    $messages['edd_cart_restoration_successful'] = sprintf('<strong>%1$s</strong>: %2$s', __('Success', 'edd'), __('Cart restored successfully.', 'edd'));
    EDD()->session->set('edd_cart', $saved_cart);
    EDD()->session->set('edd_cart_messages', $messages);
    return true;
}
Ejemplo n.º 28
0
/**
 * Renders the 'Export' tab on the Reports Page
 *
 * @since 1.3
 * @return void
 */
function edd_reports_tab_export()
{
    if (!current_user_can('view_shop_reports')) {
        return;
    }
    ?>
	<div id="edd-dashboard-widgets-wrap">
		<div class="metabox-holder">
			<div id="post-body">
				<div id="post-body-content">

					<?php 
    do_action('edd_reports_tab_export_content_top');
    ?>

					<div class="postbox edd-export-pdf-sales-earnings">
						<h3><span><?php 
    _e('Export PDF of Sales and Earnings', 'easy-digital-downloads');
    ?>
</span></h3>
						<div class="inside">
							<p><?php 
    _e('Download a PDF of Sales and Earnings reports for all products for the current year.', 'easy-digital-downloads');
    ?>
 <?php 
    _e('Date range reports will be coming soon.', 'easy-digital-downloads');
    ?>
</p>
							<p><a class="button" href="<?php 
    echo wp_nonce_url(add_query_arg(array('edd-action' => 'generate_pdf')), 'edd_generate_pdf');
    ?>
"><?php 
    _e('Generate PDF', 'easy-digital-downloads');
    ?>
</a></p>
						</div><!-- .inside -->
					</div><!-- .postbox -->

					<div class="postbox edd-export-sales-earnings">
						<h3><span><?php 
    _e('Export Earnings and Sales Stats', 'easy-digital-downloads');
    ?>
</span></h3>
						<div class="inside">
							<p><?php 
    _e('Download a CSV of earnings and sales over time.', 'easy-digital-downloads');
    ?>
</p>
							<p>
								<form method="post">
									<?php 
    echo EDD()->html->year_dropdown('start_year');
    ?>
									<?php 
    echo EDD()->html->month_dropdown('start_month');
    ?>
									<?php 
    echo _x('to', 'Date one to date two', 'easy-digital-downloads');
    ?>
									<?php 
    echo EDD()->html->year_dropdown('end_year');
    ?>
									<?php 
    echo EDD()->html->month_dropdown('end_month');
    ?>
									<?php 
    wp_nonce_field('edd_ajax_export', 'edd_ajax_export');
    ?>
									<input type="hidden" name="edd-action" value="earnings_export"/>
									<input type="submit" value="<?php 
    _e('Generate CSV', 'easy-digital-downloads');
    ?>
" class="button-secondary"/>
								</form>
							</p>
						</div><!-- .inside -->
					</div><!-- .postbox -->

					<div class="postbox edd-export-payment-history">
						<h3><span><?php 
    _e('Export Payment History', 'easy-digital-downloads');
    ?>
</span></h3>
						<div class="inside">
							<p><?php 
    _e('Download a CSV of all payments recorded.', 'easy-digital-downloads');
    ?>
</p>
							<p>
								<form id="edd-export-payments" class="edd-export-form" method="post">
									<?php 
    echo EDD()->html->date_field(array('id' => 'edd-payment-export-start', 'name' => 'start', 'placeholder' => __('Choose start date', 'easy-digital-downloads')));
    ?>
									<?php 
    echo EDD()->html->date_field(array('id' => 'edd-payment-export-end', 'name' => 'end', 'placeholder' => __('Choose end date', 'easy-digital-downloads')));
    ?>
									<select name="status">
										<option value="any"><?php 
    _e('All Statuses', 'easy-digital-downloads');
    ?>
</option>
										<?php 
    $statuses = edd_get_payment_statuses();
    foreach ($statuses as $status => $label) {
        echo '<option value="' . $status . '">' . $label . '</option>';
    }
    ?>
									</select>
									<?php 
    wp_nonce_field('edd_ajax_export', 'edd_ajax_export');
    ?>
									<input type="hidden" name="edd-export-class" value="EDD_Batch_Payments_Export"/>
									<span>
										<input type="submit" value="<?php 
    _e('Generate CSV', 'easy-digital-downloads');
    ?>
" class="button-secondary"/>
										<span class="spinner"></span>
									</span>
								</form>
							</p>
						</div><!-- .inside -->
					</div><!-- .postbox -->

					<div class="postbox edd-export-customers">
						<h3><span><?php 
    _e('Export Customers in CSV', 'easy-digital-downloads');
    ?>
</span></h3>
						<div class="inside">
							<p><?php 
    _e('Download a CSV of customers.', 'easy-digital-downloads');
    ?>
</p>
							<p>
								<form id="edd-export-customers" class="edd-export-form" method="post">
									<?php 
    echo EDD()->html->product_dropdown(array('name' => 'download', 'id' => 'edd_customer_export_download', 'chosen' => true));
    ?>
									<?php 
    wp_nonce_field('edd_ajax_export', 'edd_ajax_export');
    ?>
									<input type="hidden" name="edd-export-class" value="EDD_Batch_Customers_Export"/>
									<input type="submit" value="<?php 
    _e('Generate CSV', 'easy-digital-downloads');
    ?>
" class="button-secondary"/>
								</form>
							</p>
						</div><!-- .inside -->
					</div><!-- .postbox -->

					<div class="postbox edd-export-downloads">
						<h3><span><?php 
    _e('Export Download Products in CSV', 'easy-digital-downloads');
    ?>
</span></h3>
						<div class="inside">
							<p><?php 
    _e('Download a CSV of download products.', 'easy-digital-downloads');
    ?>
</p>
							<p>
								<form id="edd-export-file-downloads" class="edd-export-form" method="post">
									<?php 
    wp_nonce_field('edd_ajax_export', 'edd_ajax_export');
    ?>
									<input type="hidden" name="edd-export-class" value="EDD_Batch_Downloads_Export"/>
									<input type="submit" value="<?php 
    _e('Generate CSV', 'easy-digital-downloads');
    ?>
" class="button-secondary"/>
								</form>
							</p>
						</div><!-- .inside -->
					</div><!-- .postbox -->

					<div class="postbox edd-export-download-history">
						<h3><span><?php 
    _e('Export Download History in CSV', 'easy-digital-downloads');
    ?>
</span></h3>
						<div class="inside">
							<p><?php 
    _e('Download a CSV of file downloads.', 'easy-digital-downloads');
    ?>
</p>
							<p>
								<form id="edd-export-file-downloads" class="edd-export-form" method="post">
									<?php 
    echo EDD()->html->date_field(array('id' => 'edd-file-download-export-start', 'name' => 'start', 'placeholder' => __('Choose start date', 'easy-digital-downloads')));
    ?>
									<?php 
    echo EDD()->html->date_field(array('id' => 'edd-file-download-export-end', 'name' => 'end', 'placeholder' => __('Choose end date', 'easy-digital-downloads')));
    ?>
									<?php 
    wp_nonce_field('edd_ajax_export', 'edd_ajax_export');
    ?>
									<input type="hidden" name="edd-export-class" value="EDD_Batch_File_Downloads_Export"/>
									<input type="submit" value="<?php 
    _e('Generate CSV', 'easy-digital-downloads');
    ?>
" class="button-secondary"/>
								</form>
							</p>
						</div><!-- .inside -->
					</div><!-- .postbox -->

					<?php 
    do_action('edd_reports_tab_export_content_bottom');
    ?>

				</div><!-- .post-body-content -->
			</div><!-- .post-body -->
		</div><!-- .metabox-holder -->
	</div><!-- #edd-dashboard-widgets-wrap -->
	<?php 
}
 /**
  * Calculate Points using cartdata
  * 
  * Handles to calculate points using cartdata
  * and return
  * 
  * @package Easy Digital Downloads - Points and Rewards
  * @since 1.0.0
  **/
 public function edd_points_get_user_checkout_points($cartdata, $discount = 0)
 {
     global $edd_options;
     //initial total points
     $totalpoints = 0;
     //check conversion rate & points for earning should not empty & cartdata should not empty
     if (!empty($cartdata)) {
         foreach ($cartdata as $key => $item) {
             //check item of options set then consider that
             if (isset($item['options'])) {
                 $itemoptions = $item['options'];
             } elseif (isset($item['item_number']['options'])) {
                 $itemoptions = $item['item_number']['options'];
             } else {
                 $itemoptions = array();
             }
             //get individual points for the item on checkout page
             $points = $this->edd_points_get_earning_points($item['id'], $itemoptions, true);
             //calculate total points for item in cart
             $itemtotalpoints = !empty($points) ? $points * edd_get_cart_item_quantity($item['id']) : 0;
             //increase total points
             $totalpoints += $itemtotalpoints;
         }
         //end foreach loop
         if (!empty($discount)) {
             $totalpointsdiscountgot = $discount;
         } else {
             //get discount got by user via points
             $gotdiscount = EDD()->fees->get_fee('points_redeem');
             $totalpointsdiscountgot = !empty($gotdiscount) ? abs($gotdiscount['amount']) : 0;
         }
         // reduce by any discounts.  One minor drawback: if the discount includes a discount on tax and/or shipping
         //it will cost the customer points, but this is a better solution than granting full points for discounted orders
         $totalpoints -= min($this->edd_points_calculate_earn_points_from_price($totalpointsdiscountgot), $totalpoints);
     }
     //end if to check conversion points & rate should not empty
     //return total points user will get
     return intval($totalpoints);
 }
echo _x('Country:', 'Address country', 'edd');
?>
</strong><br/>
														<?php 
echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'edd-payment-address[0][country]', 'selected' => $address['country'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a country', 'edd')));
?>
													</p>
													<p id="edd-order-address-state-wrap">
														<strong class="order-data-address-line"><?php 
echo _x('State / Province:', 'State / province of address', 'edd');
?>
</strong><br/>
														<?php 
$states = edd_get_shop_states($address['country']);
if (!empty($states)) {
    echo EDD()->html->select(array('options' => $states, 'name' => 'edd-payment-address[0][state]', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a state', 'edd')));
} else {
    ?>
															<input type="text" name="edd-payment-address[0][state]" value="<?php 
    echo esc_attr($address['state']);
    ?>
" class="medium-text"/>
															<?php 
}
?>
													</p>
												</div>
											</div>
										</div>
									</div><!-- /#edd-order-address -->