/**
  * Add our extension settings
  *
  * @since 1.0
  *
  * @access public
  * @return array
  */
 public function settings($settings)
 {
     $license_settings = array(array('id' => 'edd_simple_shipping_license_header', 'name' => '<strong>' . __('Simple Shipping', 'edd-simple-shipping') . '</strong>', 'desc' => '', 'type' => 'header', 'size' => 'regular'), array('id' => 'edd_simple_shipping_base_country', 'name' => __('Base Region', 'edd-simple-shipping'), 'desc' => __('Choose the country your store is based in', 'edd-simple-shipping'), 'type' => 'select', 'options' => edd_get_country_list()));
     return array_merge($settings, $license_settings);
 }
</strong><br/>
														<input type="text" name="edd-payment-address[0][zip]" value="<?php 
echo esc_attr($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-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']);
Example #3
0
/**
 * View a customer
 *
 * @since  2.3
 * @param  $customer The Customer object being displayed
 * @return void
 */
function edd_customers_view($customer)
{
    $customer_edit_role = apply_filters('edd_edit_customers_role', 'edit_shop_payments');
    ?>

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

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

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

			<div class="customer-info">

				<div class="avatar-wrap left" id="customer-avatar">
					<?php 
    echo get_avatar($customer->email);
    ?>
<br />
					<?php 
    if (current_user_can($customer_edit_role)) {
        ?>
						<span class="info-item editable customer-edit-link"><a title="<?php 
        _e('Edit Customer', 'edd');
        ?>
" href="#" id="edit-customer"><?php 
        _e('Edit Customer', 'edd');
        ?>
</a></span>
					<?php 
    }
    ?>
				</div>

				<div class="customer-id right">
					#<?php 
    echo $customer->id;
    ?>
				</div>

				<div class="customer-address-wrapper right">
				<?php 
    if (isset($customer->user_id) && $customer->user_id > 0) {
        ?>

					<?php 
        $address = get_user_meta($customer->user_id, '_edd_user_address', true);
        $defaults = array('line1' => '', 'line2' => '', 'city' => '', 'state' => '', 'country' => '', 'zip' => '');
        $address = wp_parse_args($address, $defaults);
        ?>

					<?php 
        if (!empty($address)) {
            ?>
					<strong><?php 
            _e('Customer Address', 'edd');
            ?>
</strong>
					<span class="customer-address info-item editable">
						<span class="info-item" data-key="line1"><?php 
            echo $address['line1'];
            ?>
</span>
						<span class="info-item" data-key="line2"><?php 
            echo $address['line2'];
            ?>
</span>
						<span class="info-item" data-key="city"><?php 
            echo $address['city'];
            ?>
</span>
						<span class="info-item" data-key="state"><?php 
            echo $address['state'];
            ?>
</span>
						<span class="info-item" data-key="country"><?php 
            echo $address['country'];
            ?>
</span>
						<span class="info-item" data-key="zip"><?php 
            echo $address['zip'];
            ?>
</span>
					</span>
					<?php 
        }
        ?>
					<span class="customer-address info-item edit-item">
						<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php 
        _e('Address 1', 'edd');
        ?>
" value="<?php 
        echo $address['line1'];
        ?>
" />
						<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php 
        _e('Address 2', 'edd');
        ?>
" value="<?php 
        echo $address['line2'];
        ?>
" />
						<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php 
        _e('City', 'edd');
        ?>
" value="<?php 
        echo $address['city'];
        ?>
" />
						<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country edd-select edit-item">
							<?php 
        $selected_country = $address['country'];
        $countries = edd_get_country_list();
        foreach ($countries as $country_code => $country) {
            echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>';
        }
        ?>
						</select>
						<?php 
        $selected_state = edd_get_shop_state();
        $states = edd_get_shop_states($selected_country);
        $selected_state = isset($address['state']) ? $address['state'] : $selected_state;
        if (!empty($states)) {
            ?>
						<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state edd-select info-item">
							<?php 
            foreach ($states as $state_code => $state) {
                echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>';
            }
            ?>
						</select>
						<?php 
        } else {
            ?>
						<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state edd-input info-item" placeholder="<?php 
            _e('State / Province', 'edd');
            ?>
"/>
						<?php 
        }
        ?>
						<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php 
        _e('Postal', 'edd');
        ?>
" value="<?php 
        echo $address['zip'];
        ?>
" />
					</span>
				<?php 
    }
    ?>
				</div>

				<div class="customer-main-wrapper left">

					<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php 
    echo esc_attr($customer->name);
    ?>
" placeholder="<?php 
    _e('Customer Name', 'edd');
    ?>
" /></span>
					<span class="customer-name info-item editable"><span data-key="name"><?php 
    echo $customer->name;
    ?>
</span></span>
					<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php 
    echo $customer->email;
    ?>
" placeholder="<?php 
    _e('Customer Email', 'edd');
    ?>
" /></span>
					<span class="customer-email info-item editable" data-key="email"><?php 
    echo $customer->email;
    ?>
</span>
					<span class="customer-since info-item">
						<?php 
    _e('Customer since', 'edd');
    ?>
						<?php 
    echo date_i18n(get_option('date_format'), strtotime($customer->date_created));
    ?>
					</span>
					<span class="customer-user-id info-item edit-item">
						<?php 
    $user_id = $customer->user_id > 0 ? $customer->user_id : '';
    $data_atts = array('key' => 'user_login', 'exclude' => $user_id);
    $user_args = array('name' => 'customerinfo[user_login]', 'class' => 'edd-user-dropdown', 'data' => $data_atts);
    if (!empty($user_id)) {
        $userdata = get_userdata($user_id);
        $user_args['value'] = $userdata->user_login;
    }
    echo EDD()->html->ajax_user_search($user_args);
    ?>
						<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php 
    echo $customer->user_id;
    ?>
" />
					</span>

					<span class="customer-user-id info-item editable">
						<?php 
    _e('User ID', 'edd');
    ?>
:&nbsp;
						<?php 
    if (intval($customer->user_id) > 0) {
        ?>
							<span data-key="user_id"><?php 
        echo $customer->user_id;
        ?>
</span>
						<?php 
    } else {
        ?>
							<span data-key="user_id"><?php 
        _e('none', 'edd');
        ?>
</span>
						<?php 
    }
    ?>
						<?php 
    if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) {
        ?>
							<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php 
        _e('Disconnects the current user ID from this customer record', 'edd');
        ?>
"><?php 
        _e('Disconnect User', 'edd');
        ?>
</a></span>
						<?php 
    }
    ?>
					</span>

				</div>

			</div>

			<span id="customer-edit-actions" class="edit-item">
				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php 
    echo $customer->id;
    ?>
" />
				<?php 
    wp_nonce_field('edit-customer', '_wpnonce', false, true);
    ?>
				<input type="hidden" name="edd_action" value="edit-customer" />
				<input type="submit" id="edd-edit-customer-save" class="button-secondary" value="<?php 
    _e('Update Customer', 'edd');
    ?>
" />
				<a id="edd-edit-customer-cancel" href="" class="delete"><?php 
    _e('Cancel', 'edd');
    ?>
</a>
			</span>

		</form>
	</div>

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

	<div id="customer-stats-wrapper" class="customer-section">
		<ul>
			<li>
				<a title="<?php 
    _e('View All Purchases', 'edd');
    ?>
" href="<?php 
    echo admin_url('edit.php?post_type=download&page=edd-payment-history&user='******'%d Completed Sale', '%d Completed Sales', $customer->purchase_count, 'edd'), $customer->purchase_count);
    ?>
				</a>
			</li>
			<li>
				<span class="dashicons dashicons-chart-area"></span>
				<?php 
    echo edd_currency_filter(edd_format_amount($customer->purchase_value));
    ?>
 <?php 
    _e('Lifetime Value', 'edd');
    ?>
			</li>
			<?php 
    do_action('edd_customer_stats_list', $customer);
    ?>
		</ul>
	</div>

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

	<div id="customer-tables-wrapper" class="customer-section">

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

		<h3><?php 
    _e('Recent Payments', 'edd');
    ?>
</h3>
		<?php 
    $payment_ids = explode(',', $customer->payment_ids);
    $payments = edd_get_payments(array('post__in' => $payment_ids));
    $payments = array_slice($payments, 0, 10);
    ?>
		<table class="wp-list-table widefat striped payments">
			<thead>
				<tr>
					<th><?php 
    _e('ID', 'edd');
    ?>
</th>
					<th><?php 
    _e('Amount', 'edd');
    ?>
</th>
					<th><?php 
    _e('Date', 'edd');
    ?>
</th>
					<th><?php 
    _e('Status', 'edd');
    ?>
</th>
					<th><?php 
    _e('Actions', 'edd');
    ?>
</th>
				</tr>
			</thead>
			<tbody>
				<?php 
    if (!empty($payments)) {
        ?>
					<?php 
        foreach ($payments as $payment) {
            ?>
						<tr>
							<td><?php 
            echo $payment->ID;
            ?>
</td>
							<td><?php 
            echo edd_payment_amount($payment->ID);
            ?>
</td>
							<td><?php 
            echo date_i18n(get_option('date_format'), strtotime($payment->post_date));
            ?>
</td>
							<td><?php 
            echo edd_get_payment_status($payment, true);
            ?>
</td>
							<td>
								<a title="<?php 
            _e('View Details for Payment', 'edd');
            echo ' ' . $payment->ID;
            ?>
" href="<?php 
            echo admin_url('edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $payment->ID);
            ?>
">
									<?php 
            _e('View Details', 'edd');
            ?>
								</a>
								<?php 
            do_action('edd_customer_recent_purcahses_actions', $customer, $payment);
            ?>
							</td>
						</tr>
					<?php 
        }
        ?>
				<?php 
    } else {
        ?>
					<tr><td colspan="5"><?php 
        _e('No Payments Found', 'edd');
        ?>
</td></tr>
				<?php 
    }
    ?>
			</tbody>
		</table>

		<h3><?php 
    printf(__('Purchased %s', 'edd'), edd_get_label_plural());
    ?>
</h3>
		<?php 
    $downloads = edd_get_users_purchased_products($customer->email);
    ?>
		<table class="wp-list-table widefat striped downloads">
			<thead>
				<tr>
					<th><?php 
    echo edd_get_label_singular();
    ?>
</th>
					<th width="120px"><?php 
    _e('Actions', 'edd');
    ?>
</th>
				</tr>
			</thead>
			<tbody>
				<?php 
    if (!empty($downloads)) {
        ?>
					<?php 
        foreach ($downloads as $download) {
            ?>
						<tr>
							<td><?php 
            echo $download->post_title;
            ?>
</td>
							<td>
								<a title="<?php 
            echo esc_attr(sprintf(__('View %s', 'edd'), $download->post_title));
            ?>
" href="<?php 
            echo esc_url(admin_url('post.php?action=edit&post=' . $download->ID));
            ?>
">
									<?php 
            printf(__('View %s', 'edd'), edd_get_label_singular());
            ?>
								</a>
							</td>
						</tr>
					<?php 
        }
        ?>
				<?php 
    } else {
        ?>
					<tr><td colspan="2"><?php 
        printf(__('No %s Found', 'edd'), edd_get_label_plural());
        ?>
</td></tr>
				<?php 
    }
    ?>
			</tbody>
		</table>

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

	</div>

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

	<?php 
}
</strong><br/>
														<input type="text" name="edd-payment-address[0][zip]" value="<?php 
echo esc_attr($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', 'easy-digital-downloads');
?>
</strong><br/>
														<?php 
echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'edd-payment-address[0][country]', 'id' => 'edd-payment-address-country', 'selected' => $address['country'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a country', 'easy-digital-downloads'), 'data' => array('search-type' => 'no_ajax')));
?>
													</p>
													<p id="edd-order-address-state-wrap">
														<strong class="order-data-address-line"><?php 
echo _x('State / Province:', 'State / province of address', 'easy-digital-downloads');
?>
</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]', 'id' => 'edd-payment-address-state', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => true, 'placeholder' => __('Select a state', 'easy-digital-downloads'), 'data' => array('search-type' => 'no_ajax')));
} else {
    ?>
															<input type="text" name="edd-payment-address[0][state]" value="<?php 
    echo esc_attr($address['state']);
/**
 * Outputs the default credit card address fields
 *
 * @since 1.0
 * @return void
 */
function edd_default_cc_address_fields()
{
    $logged_in = is_user_logged_in();
    $customer = EDD()->session->get('customer');
    $customer = wp_parse_args($customer, array('address' => array('line1' => '', 'line2' => '', 'city' => '', 'zip' => '', 'state' => '', 'country' => '')));
    $customer['address'] = array_map('sanitize_text_field', $customer['address']);
    if ($logged_in) {
        $user_address = get_user_meta(get_current_user_id(), '_edd_user_address', true);
        foreach ($customer['address'] as $key => $field) {
            if (empty($field) && !empty($user_address[$key])) {
                $customer['address'][$key] = $user_address[$key];
            } else {
                $customer['address'][$key] = '';
            }
        }
    }
    ob_start();
    ?>
	<fieldset id="edd_cc_address" class="cc-address">
		<span><legend><?php 
    _e('Billing Details', 'edd');
    ?>
</legend></span>
		<?php 
    do_action('edd_cc_billing_top');
    ?>
		<p id="edd-card-address-wrap">
			<label for="card_address" class="edd-label">
				<?php 
    _e('Billing Address', 'edd');
    ?>
				<?php 
    if (edd_field_is_required('card_address')) {
        ?>
					<span class="edd-required-indicator">*</span>
				<?php 
    }
    ?>
			</label>
			<span class="edd-description"><?php 
    _e('The primary billing address for your credit card.', 'edd');
    ?>
</span>
			<input type="text" id="card_address" name="card_address" class="card-address edd-input<?php 
    if (edd_field_is_required('card_address')) {
        echo ' required';
    }
    ?>
" placeholder="<?php 
    _e('Address line 1', 'edd');
    ?>
" value="<?php 
    echo $customer['address']['line1'];
    ?>
"/>
		</p>
		<p id="edd-card-address-2-wrap">
			<label for="card_address_2" class="edd-label">
				<?php 
    _e('Billing Address Line 2 (optional)', 'edd');
    ?>
				<?php 
    if (edd_field_is_required('card_address_2')) {
        ?>
					<span class="edd-required-indicator">*</span>
				<?php 
    }
    ?>
			</label>
			<span class="edd-description"><?php 
    _e('The suite, apt no, PO box, etc, associated with your billing address.', 'edd');
    ?>
</span>
			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 edd-input<?php 
    if (edd_field_is_required('card_address_2')) {
        echo ' required';
    }
    ?>
" placeholder="<?php 
    _e('Address line 2', 'edd');
    ?>
" value="<?php 
    echo $customer['address']['line2'];
    ?>
"/>
		</p>
		<p id="edd-card-city-wrap">
			<label for="card_city" class="edd-label">
				<?php 
    _e('Billing City', 'edd');
    ?>
				<?php 
    if (edd_field_is_required('card_city')) {
        ?>
					<span class="edd-required-indicator">*</span>
				<?php 
    }
    ?>
			</label>
			<span class="edd-description"><?php 
    _e('The city for your billing address.', 'edd');
    ?>
</span>
			<input type="text" id="card_city" name="card_city" class="card-city edd-input<?php 
    if (edd_field_is_required('card_city')) {
        echo ' required';
    }
    ?>
" placeholder="<?php 
    _e('City', 'edd');
    ?>
" value="<?php 
    echo $customer['address']['city'];
    ?>
"/>
		</p>
		<p id="edd-card-zip-wrap">
			<label for="card_zip" class="edd-label">
				<?php 
    _e('Billing Zip / Postal Code', 'edd');
    ?>
				<?php 
    if (edd_field_is_required('card_zip')) {
        ?>
					<span class="edd-required-indicator">*</span>
				<?php 
    }
    ?>
			</label>
			<span class="edd-description"><?php 
    _e('The zip or postal code for your billing address.', 'edd');
    ?>
</span>
			<input type="text" size="4" name="card_zip" class="card-zip edd-input<?php 
    if (edd_field_is_required('card_zip')) {
        echo ' required';
    }
    ?>
" placeholder="<?php 
    _e('Zip / Postal code', 'edd');
    ?>
" value="<?php 
    echo $customer['address']['zip'];
    ?>
"/>
		</p>
		<p id="edd-card-country-wrap">
			<label for="billing_country" class="edd-label">
				<?php 
    _e('Billing Country', 'edd');
    ?>
				<?php 
    if (edd_field_is_required('billing_country')) {
        ?>
					<span class="edd-required-indicator">*</span>
				<?php 
    }
    ?>
			</label>
			<span class="edd-description"><?php 
    _e('The country for your billing address.', 'edd');
    ?>
</span>
			<select name="billing_country" id="billing_country" class="billing_country edd-select<?php 
    if (edd_field_is_required('billing_country')) {
        echo ' required';
    }
    ?>
">
				<?php 
    $selected_country = edd_get_shop_country();
    if (!empty($customer['address']['country']) && '*' !== $customer['address']['country']) {
        $selected_country = $customer['address']['country'];
    }
    $countries = edd_get_country_list();
    foreach ($countries as $country_code => $country) {
        echo '<option value="' . esc_attr($country_code) . '"' . selected($country_code, $selected_country, false) . '>' . $country . '</option>';
    }
    ?>
			</select>
		</p>
		<p id="edd-card-state-wrap">
			<label for="card_state" class="edd-label">
				<?php 
    _e('Billing State / Province', 'edd');
    ?>
				<?php 
    if (edd_field_is_required('card_state')) {
        ?>
					<span class="edd-required-indicator">*</span>
				<?php 
    }
    ?>
			</label>
			<span class="edd-description"><?php 
    _e('The state or province for your billing address.', 'edd');
    ?>
</span>
            <?php 
    $selected_state = edd_get_shop_state();
    $states = edd_get_shop_states($selected_country);
    if (!empty($customer['address']['state'])) {
        $selected_state = $customer['address']['state'];
    }
    if (!empty($states)) {
        ?>
            <select name="card_state" id="card_state" class="card_state edd-select<?php 
        if (edd_field_is_required('card_state')) {
            echo ' required';
        }
        ?>
">
                <?php 
        foreach ($states as $state_code => $state) {
            echo '<option value="' . $state_code . '"' . selected($state_code, $selected_state, false) . '>' . $state . '</option>';
        }
        ?>
            </select>
        	<?php 
    } else {
        ?>
			<input type="text" size="6" name="card_state" id="card_state" class="card_state edd-input" placeholder="<?php 
        _e('State / Province', 'edd');
        ?>
"/>
			<?php 
    }
    ?>
		</p>
		<?php 
    do_action('edd_cc_billing_bottom');
    ?>
	</fieldset>
	<?php 
    echo ob_get_clean();
}
			<p id="edd_profile_billing_address_wrap">
				<label for="edd_address_line1"><?php _e( 'Line 1', 'edd' ); ?></label>
				<input name="edd_address_line1" id="edd_address_line1" class="text edd-input" type="text" value="<?php echo esc_attr( $address['line1'] ); ?>" />
				<br/>
				<label for="edd_address_line2"><?php _e( 'Line 2', 'edd' ); ?></label>
				<input name="edd_address_line2" id="edd_address_line2" class="text edd-input" type="text" value="<?php echo esc_attr( $address['line2'] ); ?>" />
				<br/>
				<label for="edd_address_city"><?php _e( 'City', 'edd' ); ?></label>
				<input name="edd_address_city" id="edd_address_city" class="text edd-input" type="text" value="<?php echo esc_attr( $address['city'] ); ?>" />
				<br/>
				<label for="edd_address_zip"><?php _e( 'Zip / Postal Code', 'edd' ); ?></label>
				<input name="edd_address_zip" id="edd_address_zip" class="text edd-input" type="text" value="<?php echo esc_attr( $address['zip'] ); ?>" />
				<br/>
				<label for="edd_address_country"><?php _e( 'Country', 'edd' ); ?></label>
				<select name="edd_address_country" id="edd_address_country" class="select edd-select">
					<?php foreach( edd_get_country_list() as $key => $country ) : ?>
					<option value="<?php echo $key; ?>"<?php selected( $address['country'], $key ); ?>><?php echo esc_html( $country ); ?></option>
					<?php endforeach; ?>
				</select>
				<br/>
				<label for="edd_address_state"><?php _e( 'State / Province', 'edd' ); ?></label>
				<input name="edd_address_state" id="edd_address_state" class="text edd-input" type="text" value="<?php echo esc_attr( $address['state'] ); ?>" />
				<br/>
				<?php do_action( 'edd_profile_editor_address' ); ?>
			</p>
			<?php do_action( 'edd_profile_editor_after_address' ); ?>
			<span id="edd_profile_password_label"><legend><?php _e( 'Change your Password', 'edd' ); ?></legend></span>
			<p id="edd_profile_password_wrap">
				<label for="edd_user_pass"><?php _e( 'New Password', 'edd' ); ?></label>
				<input name="edd_new_user_pass1" id="edd_new_user_pass1" class="password edd-input" type="password"/>
				<br />
/**
 * Tax Rates Callback
 *
 * Renders tax rates table
 *
 * @since 1.6
 * @param array $args Arguments passed by the setting
 * @global $edd_options Array of all the EDD Options
 * @return void
 */
function edd_tax_rates_callback($args)
{
    global $edd_options;
    $rates = edd_get_tax_rates();
    ob_start();
    ?>
	<p><?php 
    echo $args['desc'];
    ?>
</p>
	<table id="edd_tax_rates" class="wp-list-table widefat fixed posts">
		<thead>
			<tr>
				<th scope="col" class="edd_tax_country"><?php 
    _e('Country', 'easy-digital-downloads');
    ?>
</th>
				<th scope="col" class="edd_tax_state"><?php 
    _e('State / Province', 'easy-digital-downloads');
    ?>
</th>
				<th scope="col" class="edd_tax_global" title="<?php 
    _e('Apply rate to whole country, regardless of state / province', 'easy-digital-downloads');
    ?>
"><?php 
    _e('Country Wide', 'easy-digital-downloads');
    ?>
</th>
				<th scope="col" class="edd_tax_rate"><?php 
    _e('Rate', 'easy-digital-downloads');
    ?>
</th>
				<th scope="col"><?php 
    _e('Remove', 'easy-digital-downloads');
    ?>
</th>
			</tr>
		</thead>
		<?php 
    if (!empty($rates)) {
        ?>
			<?php 
        foreach ($rates as $key => $rate) {
            ?>
			<tr>
				<td class="edd_tax_country">
					<?php 
            echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'tax_rates[' . $key . '][country]', 'selected' => $rate['country'], 'show_option_all' => false, 'show_option_none' => false, 'class' => 'edd-select edd-tax-country', 'chosen' => false, 'placeholder' => __('Choose a country', 'easy-digital-downloads')));
            ?>
				</td>
				<td class="edd_tax_state">
					<?php 
            $states = edd_get_shop_states($rate['country']);
            if (!empty($states)) {
                echo EDD()->html->select(array('options' => $states, 'name' => 'tax_rates[' . $key . '][state]', 'selected' => $rate['state'], 'show_option_all' => false, 'show_option_none' => false, 'chosen' => false, 'placeholder' => __('Choose a state', 'easy-digital-downloads')));
            } else {
                echo EDD()->html->text(array('name' => 'tax_rates[' . $key . '][state]', $rate['state'], 'value' => !empty($rate['state']) ? $rate['state'] : ''));
            }
            ?>
				</td>
				<td class="edd_tax_global">
					<input type="checkbox" name="tax_rates[<?php 
            echo $key;
            ?>
][global]" id="tax_rates[<?php 
            echo $key;
            ?>
][global]" value="1"<?php 
            checked(true, !empty($rate['global']));
            ?>
/>
					<label for="tax_rates[<?php 
            echo $key;
            ?>
][global]"><?php 
            _e('Apply to whole country', 'easy-digital-downloads');
            ?>
</label>
				</td>
				<td class="edd_tax_rate"><input type="number" class="small-text" step="0.0001" min="0.0" max="99" name="tax_rates[<?php 
            echo $key;
            ?>
][rate]" value="<?php 
            echo $rate['rate'];
            ?>
"/></td>
				<td><span class="edd_remove_tax_rate button-secondary"><?php 
            _e('Remove Rate', 'easy-digital-downloads');
            ?>
</span></td>
			</tr>
			<?php 
        }
        ?>
		<?php 
    } else {
        ?>
			<tr>
				<td class="edd_tax_country">
					<?php 
        echo EDD()->html->select(array('options' => edd_get_country_list(), 'name' => 'tax_rates[0][country]', 'show_option_all' => false, 'show_option_none' => false, 'class' => 'edd-select edd-tax-country', 'chosen' => false, 'placeholder' => __('Choose a country', 'easy-digital-downloads')));
        ?>
				</td>
				<td class="edd_tax_state">
					<?php 
        echo EDD()->html->text(array('name' => 'tax_rates[0][state]'));
        ?>
				</td>
				<td class="edd_tax_global">
					<input type="checkbox" name="tax_rates[0][global]" value="1"/>
					<label for="tax_rates[0][global]"><?php 
        _e('Apply to whole country', 'easy-digital-downloads');
        ?>
</label>
				</td>
				<td class="edd_tax_rate"><input type="number" class="small-text" step="0.0001" min="0.0" name="tax_rates[0][rate]" value=""/></td>
				<td><span class="edd_remove_tax_rate button-secondary"><?php 
        _e('Remove Rate', 'easy-digital-downloads');
        ?>
</span></td>
			</tr>
		<?php 
    }
    ?>
	</table>
	<p>
		<span class="button-secondary" id="edd_add_tax_rate"><?php 
    _e('Add Tax Rate', 'easy-digital-downloads');
    ?>
</span>
	</p>
	<?php 
    echo ob_get_clean();
}
/**
 * Outputs the default credit card address fields
 *
 * @since 1.0
 * @return void
 */
function edd_default_cc_address_fields()
{
    ob_start();
    ?>
	<fieldset id="edd_cc_address" class="cc-address">
		<?php 
    do_action('edd_cc_billing_top');
    ?>
		<p id="edd-card-address-wrap">
			<label class="edd-label"><?php 
    _e('Billing Address', 'edd');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('The primary billing address for your credit card.', 'edd');
    ?>
</span>
			<input type="text" name="card_address" class="card-address edd-input required" placeholder="<?php 
    _e('Address line 1', 'edd');
    ?>
"/>
		</p>
		<p id="edd-card-address-2-wrap">
			<label class="edd-label"><?php 
    _e('Billing Address Line 2 (optional)', 'edd');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('The suite, apt no, PO box, etc, associated with your billing address.', 'edd');
    ?>
</span>
			<input type="text" name="card_address_2" class="card-address-2 edd-input" placeholder="<?php 
    _e('Address line 2', 'edd');
    ?>
"/>
		</p>
		<p id="edd-card-city-wrap">
			<label class="edd-label"><?php 
    _e('Billing City', 'edd');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('The city for your billing address.', 'edd');
    ?>
</span>
			<input type="text" name="card_city" class="card-city edd-input required" placeholder="<?php 
    _e('City', 'edd');
    ?>
"/>
		</p>
		<p id="edd-card-country-wrap">
			<label class="edd-label"><?php 
    _e('Billing Country', 'edd');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('The country for your billing address.', 'edd');
    ?>
</span>
			<select name="billing_country" class="billing-country edd-select required">
				<?php 
    $countries = edd_get_country_list();
    foreach ($countries as $country_code => $country) {
        echo '<option value="' . $country_code . '">' . $country . '</option>';
    }
    ?>
			</select>
		</p>
		<p id="edd-card-state-wrap">
			<label class="edd-label"><?php 
    _e('Billing State / Province', 'edd');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('The state or province for your billing address.', 'edd');
    ?>
</span>
			<input type="text" size="6" name="card_state_other" id="card_state_other" class="card-state edd-input" placeholder="<?php 
    _e('State / Province', 'edd');
    ?>
" style="display:none;"/>
            <select name="card_state_us" id="card_state_us" class="card-state edd-select required">
                <?php 
    $states = edd_get_states_list();
    foreach ($states as $state_code => $state) {
        echo '<option value="' . $state_code . '">' . $state . '</option>';
    }
    ?>
            </select>
            <select name="card_state_ca" id="card_state_ca" class="card-state edd-select required" style="display: none;">
                <?php 
    $provinces = edd_get_provinces_list();
    foreach ($provinces as $province_code => $province) {
        echo '<option value="' . $province_code . '">' . $province . '</option>';
    }
    ?>
            </select>
		</p>
		<p id="edd-card-zip-wrap">
			<label class="edd-label"><?php 
    _e('Billing Zip / Postal Code', 'edd');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('The zip or postal code for your billing address.', 'edd');
    ?>
</span>
			<input type="text" size="4" name="card_zip" class="card-zip edd-input required" placeholder="<?php 
    _e('Zip / Postal code', 'edd');
    ?>
"/>
		</p>
		<?php 
    do_action('edd_cc_billing_bottom');
    ?>
	</fieldset>
	<?php 
    echo ob_get_clean();
}
</strong><br/>
														<input type="text" name="edd-payment-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-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-address[0][state]', 'selected' => $address['state'], 'show_option_all' => false, 'show_option_none' => false));
} else {
    ?>
															<input type="text" name="edd-payment-address[0][state]" value="<?php 
    esc_attr_e($address['state']);
function eddpdfi_pdf_template_vat($eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $eddpdfi_payment_gateway, $eddpdfi_payment_method, $address_line_2_line_height, $company_name, $eddpdfi_payment_date, $eddpdfi_payment_status)
{
    global $edd_options;
    if (!isset($edd_options['eddpdfi_templates'])) {
        $edd_options['eddpdfi_templates'] = 'default';
    }
    $color = empty($edd_options['edd_vat_pdf_colors']) ? "blue" : $edd_options['edd_vat_pdf_colors'];
    switch ($color) {
        case 'blue':
            $colors = array('body' => array(8, 75, 110), 'emphasis' => array(71, 155, 198), 'title' => array(0, 127, 192), 'header' => array(202, 226, 238), 'sub' => array(234, 242, 245), 'border' => array(166, 205, 226), 'notes' => array(7, 46, 66));
            break;
        case 'red':
            $colors = array('body' => array(110, 8, 8), 'emphasis' => array(198, 71, 71), 'title' => array(192, 0, 0), 'header' => array(238, 202, 202), 'sub' => array(245, 243, 243), 'border' => array(226, 166, 166), 'notes' => array(66, 7, 7));
            break;
        case 'green':
            $colors = array('body' => array(8, 110, 39), 'emphasis' => array(71, 198, 98), 'title' => array(0, 192, 68), 'header' => array(202, 238, 212), 'sub' => array(243, 245, 244), 'border' => array(166, 226, 179), 'notes' => array(7, 66, 28));
            break;
        case 'orange':
            $colors = array('body' => array(110, 54, 8), 'emphasis' => array(198, 134, 71), 'title' => array(192, 81, 0), 'header' => array(238, 219, 202), 'sub' => array(245, 245, 243), 'border' => array(226, 224, 166), 'notes' => array(65, 66, 7));
            break;
        case 'yellow':
            $colors = array('body' => array(109, 110, 8), 'emphasis' => array(197, 198, 71), 'title' => array(192, 190, 0), 'header' => array(238, 238, 202), 'sub' => array(245, 244, 243), 'border' => array(226, 193, 166), 'notes' => array(66, 38, 7));
            break;
        case 'purple':
            $colors = array('body' => array(66, 8, 110), 'emphasis' => array(137, 71, 198), 'title' => array(72, 0, 192), 'header' => array(208, 202, 238), 'sub' => array(244, 243, 245), 'border' => array(189, 166, 226), 'notes' => array(35, 7, 66));
            break;
        case 'pink':
            $colors = array('body' => array(110, 8, 82), 'emphasis' => array(198, 71, 152), 'title' => array(92, 0, 65), 'header' => array(238, 202, 232), 'sub' => array(245, 243, 245), 'border' => array(226, 166, 213), 'notes' => array(66, 7, 51));
            break;
    }
    $eddpdfi_pdf->AddFont('opensans', '');
    $eddpdfi_pdf->AddFont('opensansb', '');
    $font = isset($edd_options['eddpdfi_enable_char_support']) ? 'freesans' : 'opensans';
    $fontb = isset($edd_options['eddpdfi_enable_char_support']) ? 'freesans' : 'opensansb';
    $eddpdfi_pdf->SetMargins(8, 8, 8);
    $eddpdfi_pdf->SetX(8);
    $eddpdfi_pdf->AddPage();
    $eddpdfi_pdf->Ln(5);
    $eddpdfi_logo_size = 0;
    if (isset($eddpdfi_logo_size) && isset($edd_options['eddpdfi_logo_upload']) && !empty($edd_options['eddpdfi_logo_upload'])) {
        // $file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array()
        $eddpdfi_pdf->Image($edd_options['eddpdfi_logo_upload'], 8, 10, 0, '25', '', false, 'LTR', false, 96);
    } else {
        $eddpdfi_pdf->SetFont($font, '', 22);
        $eddpdfi_pdf->SetTextColor(50, 50, 50);
        $eddpdfi_pdf->Cell(0, 0, $company_name, 0, 2, 'L', false);
    }
    $eddpdfi_pdf->SetFont($font, '', 18);
    $eddpdfi_pdf->SetTextColor($colors['title'][0], $colors['title'][1], $colors['title'][2]);
    $eddpdfi_pdf->SetY(45);
    if ($eddpdfi_payment_status === 'Refunded') {
        $eddpdfi_pdf->Cell(0, 0, 'Invoice Correction', 0, 2, 'L', false);
    } else {
        $eddpdfi_pdf->Cell(0, 0, __('Invoice', 'eddpdfi'), 0, 2, 'L', false);
    }
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->SetXY(8, 60);
    $eddpdfi_pdf->SetFont($fontb, '', 10);
    $eddpdfi_pdf->Cell(0, 6, __('From', 'eddpdfi'), 0, 2, 'L', false);
    $eddpdfi_pdf->SetFont($font, '', 10);
    if (!empty($edd_options['edd_vat_company_name'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['edd_vat_company_name']), $edd_options['edd_vat_company_name'], 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_name'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_name']), eddpdfi_get_settings($eddpdfi_pdf, 'name'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_address_line1'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_line1']), eddpdfi_get_settings($eddpdfi_pdf, 'addr_line1'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_address_line2'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_line2']), eddpdfi_get_settings($eddpdfi_pdf, 'addr_line2'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_address_city_state_zip'])) {
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_address_city_state_zip']), eddpdfi_get_settings($eddpdfi_pdf, 'city_state_zip'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['base_country'])) {
        $countries = edd_get_country_list();
        $countries['UK'] = $countries['GB'];
        $country = $countries[$edd_options['base_country']];
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($country), $country, 0, 2, 'L', false);
    }
    if (!empty($edd_options['eddpdfi_email_address'])) {
        $eddpdfi_pdf->SetTextColor(41, 102, 152);
        $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($edd_options['eddpdfi_email_address']), eddpdfi_get_settings($eddpdfi_pdf, 'email'), 0, 2, 'L', false);
    }
    if (isset($edd_options['eddpdfi_url']) && $edd_options['eddpdfi_url']) {
        $eddpdfi_pdf->SetTextColor(41, 102, 152);
        $eddpdfi_pdf->Cell(0, 6, get_option('siteurl'), 0, 2, 'L', false);
    }
    if (!empty($edd_options['edd_vat_number'])) {
        $vat_number = maybe_unserialize($edd_options['edd_vat_number']);
        if (!empty($vat_number['number'])) {
            //$vat_number = __(sprintf('%s ID ', apply_filters('lsl_tax_label','Tax')), 'edd_vat') . $vat_number['number'];
            $vat_number = 'VAT No. ' . $vat_number['number'];
            $eddpdfi_pdf->Cell(0, eddpdfi_calculate_line_height($vat_number), $vat_number, 0, 2, 'L', false);
        }
    }
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Ln(12);
    $eddpdfi_pdf->Ln();
    $eddpdfi_pdf->SetXY(60, 60);
    $eddpdfi_pdf->SetFont($fontb, '', 10);
    $eddpdfi_pdf->Cell(0, 6, __('To', 'eddpdfi'), 0, 2, 'L', false);
    $eddpdfi_pdf->SetFont($font, '', 10);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_buyer_info['first_name'] . ' ' . $eddpdfi_buyer_info['last_name'], 0, 2, 'L', false);
    $eddpdfi_pdf->SetTextColor(41, 102, 152);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_meta['email'], 0, 2, 'L', false);
    $eddpdfi_pdf->SetTextColor(50, 50, 50);
    $eddpdfi_pdf->Ln(4);
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Invoice Date', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_date, 0, 2, 'L', false);
    $eddpdfi_pdf->SetXY(60, 92);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Invoice ID', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    if (function_exists('eddpdfi_get_payment_number') && isset($edd_options['edd_vat_invoice_number'])) {
        $eddpdfi_pdf->Cell(0, 6, eddpdfi_get_payment_number($eddpdfi_payment->ID), 0, 2, 'L', false);
    } else {
        $eddpdfi_pdf->Cell(0, 6, '#' . $eddpdfi_payment->ID, 0, 2, 'L', false);
    }
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Purchase Key', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_meta['key'], 0, 2, 'L', false);
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Payment Status', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_status, 0, 2, 'L', false);
    $eddpdfi_pdf->SetX(60);
    $eddpdfi_pdf->SetTextColor($colors['emphasis'][0], $colors['emphasis'][1], $colors['emphasis'][2]);
    $eddpdfi_pdf->Cell(30, 6, __('Payment Method', 'eddpdfi'), 0, 0, 'L', false);
    $eddpdfi_pdf->SetTextColor($colors['body'][0], $colors['body'][1], $colors['body'][2]);
    $eddpdfi_pdf->Cell(0, 6, $eddpdfi_payment_method, 0, 2, 'L', false);
    $offset = apply_filters('eddpdfi_pdf_template_extra_fields', 0, 'color', $eddpdfi_pdf, $eddpdfi_payment, $eddpdfi_payment_meta, $eddpdfi_buyer_info, $colors);
    $eddpdfi_pdf->SetXY(61, 120 + $offset);
    $eddpdfi_pdf->SetFillColor($colors['header'][0], $colors['header'][1], $colors['header'][2]);
    $eddpdfi_pdf->SetDrawColor($colors['border'][0], $colors['border'][1], $colors['border'][2]);
    $eddpdfi_pdf->SetFont($fontb, '', 10);
    $eddpdfi_pdf->Cell(140, 8, __('Invoice Items', 'eddpdfi'), 1, 2, 'C', true);
    $eddpdfi_pdf->Ln(0.2);
    $eddpdfi_pdf->SetX(61);
    $eddpdfi_pdf->SetFillColor($colors['sub'][0], $colors['sub'][1], $colors['sub'][2]);
    $eddpdfi_pdf->SetFont($font, '', 9);
    $qenabled = version_compare(EDD_VERSION, "1.9") >= 0 ? true : (function_exists('edd_item_quanities_enabled') ? edd_item_quanities_enabled() : false);
    $eddpdfi_pdf->Cell($qenabled ? 95 : 102, 7, __('PRODUCT NAME', 'eddpdfi'), 'BL', 0, 'L', true);
    if ($qenabled) {
        $eddpdfi_pdf->Cell(10, 7, __('#', 'eddpdfi'), 'B', 0, 0, true);
    }
    $eddpdfi_pdf->Cell($qenabled ? 35 : 38, 7, __('PRICE', 'eddpdfi'), 'BR', 0, 'R', true);
    $eddpdfi_pdf->Ln(0.2);
    $eddpdfi_pdf_downloads = isset($eddpdfi_payment_meta['cart_details']) ? maybe_unserialize($eddpdfi_payment_meta['cart_details']) : false;
    $eddpdfi_pdf->Ln();
    if ($eddpdfi_pdf_downloads) {
        $eddpdfi_pdf->SetX(61);
        $includes_taxes = edd_prices_include_tax();
        foreach ($eddpdfi_pdf_downloads as $key => $download) {
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->SetFont($font, '', 10);
            $eddpdfi_download_id = isset($eddpdfi_payment_meta['cart_details']) ? $download['id'] : $download;
            $eddpdfi_price_override = isset($eddpdfi_payment_meta['cart_details']) ? $download['price'] : null;
            $user_info = maybe_unserialize($eddpdfi_payment_meta['user_info']);
            $eddpdfi_final_download_price = edd_get_download_final_price($eddpdfi_download_id, $user_info, $eddpdfi_price_override);
            if (isset($user_info['discount']) && $user_info['discount'] != 'none') {
                $eddpdfi_discount = $user_info['discount'];
            } else {
                $eddpdfi_discount = __('None', 'eddpdfi');
            }
            // $eddpdfi_total_price = html_entity_decode( edd_currency_filter( edd_format_amount( $eddpdfi_payment_meta['amount'] ) ) );
            $eddpdfi_download_title = html_entity_decode(get_the_title($eddpdfi_download_id), ENT_COMPAT, 'UTF-8');
            if (edd_has_variable_prices($eddpdfi_download_id)) {
                $eddpdfi_download_title .= ' - ' . edd_get_cart_item_price_name($download);
                $options = $download['item_number']['options'];
            }
            // error_log(print_r($download,true));
            $options['is_item'] = $eddpdfi_download_id;
            $price = edd_get_cart_item_price($eddpdfi_download_id, $options, $includes_taxes);
            $eddpdfi_download_price = ' ' . html_entity_decode(edd_currency_filter(edd_format_amount($price)), ENT_COMPAT, 'UTF-8');
            //			$eddpdfi_download_price = ' ' . html_entity_decode( edd_currency_filter( edd_format_amount( $eddpdfi_final_download_price ) ), ENT_COMPAT, 'UTF-8' );
            $eddpdfi_pdf->Cell($qenabled ? 95 : 102, 8, $eddpdfi_download_title, 'B', 0, 'L', false);
            if ($qenabled) {
                $quantity = is_array($download) ? $download['quantity'] : 1;
                $eddpdfi_pdf->Cell(10, 8, $quantity, 'B', 0, 'C', false);
            }
            $eddpdfi_pdf->Cell($qenabled ? 35 : 38, 8, $eddpdfi_download_price, 'B', 2, 'R', false);
        }
        $eddpdfi_pdf->Ln(5);
        $eddpdfi_pdf->SetX(61);
        $eddpdfi_pdf->SetFillColor($colors['header'][0], $colors['header'][1], $colors['header'][2]);
        $eddpdfi_pdf->SetFont($fontb, '', 10);
        $eddpdfi_pdf->Cell(140, 8, __('Invoice Totals', 'eddpdfi'), 1, 2, 'C', true);
        $eddpdfi_pdf->Ln(0.2);
        $eddpdfi_pdf->SetX(61);
        if (edd_use_taxes()) {
            //$taxrate = (edd_get_payment_amount( $eddpdfi_payment->ID ) - round(edd_get_payment_subtotal( $eddpdfi_payment->ID ))) / round(edd_get_payment_subtotal( $eddpdfi_payment->ID )) * 100;
            switch ($eddpdfi_buyer_info['address']['country']) {
                case 'BE':
                    $taxrate = '21%';
                    break;
                case 'BG':
                    $taxrate = '20%';
                    break;
                case 'CZ':
                    $taxrate = '21%';
                    break;
                case 'DK':
                    $taxrate = '25%';
                    break;
                case 'GB':
                    $taxrate = '20%';
                    break;
                case 'UK':
                    $taxrate = '20%';
                    break;
                case 'DE':
                    $taxrate = '19%';
                    break;
                case 'EE':
                    $taxrate = '20%';
                    break;
                case 'EL':
                    $taxrate = '23%';
                    break;
                case 'ES':
                    $taxrate = '21%';
                    break;
                case 'FR':
                    $taxrate = '20%';
                    break;
                case 'HR':
                    $taxrate = '25%';
                    break;
                case 'IE':
                    $taxrate = '23%';
                    break;
                case 'IT':
                    $taxrate = '22%';
                    break;
                case 'CY':
                    $taxrate = '19%';
                    break;
                case 'LV':
                    $taxrate = '21%';
                    break;
                case 'LT':
                    $taxrate = '21%';
                    break;
                case 'LU':
                    $taxrate = '17%';
                    break;
                case 'HU':
                    $taxrate = '27%';
                    break;
                case 'MT':
                    $taxrate = '18%';
                    break;
                case 'NL':
                    $taxrate = '21%';
                    break;
                case 'AT':
                    $taxrate = '20%';
                    break;
                case 'PL':
                    $taxrate = '23%';
                    break;
                case 'PT':
                    $taxrate = '23%';
                    break;
                case 'RO':
                    $taxrate = '24%';
                    break;
                case 'SI':
                    $taxrate = '22%';
                    break;
                case 'SK':
                    $taxrate = '20%';
                    break;
                case 'FI':
                    $taxrate = '24%';
                    break;
                case 'SE':
                    $taxrate = '25%';
                    break;
                default:
                    $taxrate = '0%';
            }
            $eddpdfi_pdf->Cell(102, 8, __('Subtotal', 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_payment_subtotal($eddpdfi_payment->ID), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->Cell(102, 8, __(apply_filters('lsl_tax_label', 'Tax'), 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_payment_tax($eddpdfi_payment->ID), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->Cell(102, 8, __('VAT RATE', 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, $taxrate, 'B', 2, 'R', false);
        }
        $fees = edd_get_payment_fees($eddpdfi_payment->ID);
        if (!empty($fees)) {
            foreach ($fees as $fee) {
                $eddpdfi_pdf->SetX(61);
                $eddpdfi_pdf->Cell(102, 8, $fee['label'], 'B', 0, 'L', false);
                $eddpdfi_pdf->Cell(38, 8, html_entity_decode(edd_currency_filter($fee['amount']), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', true);
            }
        }
        if ($eddpdfi_discount !== __('None', 'eddpdfi')) {
            $eddpdfi_pdf->SetX(61);
            $eddpdfi_pdf->Cell(102, 8, __('Discount Used', 'eddpdfi'), 'B', 0, 'L', false);
            $eddpdfi_pdf->Cell(38, 8, $eddpdfi_discount, 'B', 2, 'R', false);
        }
        $eddpdfi_pdf->SetX(61);
        $eddpdfi_pdf->SetFont($fontb, '', 11);
        $eddpdfi_pdf->Cell(102, 10, __('Total Due', 'eddpdfi'), 'B', 0, 'L', false);
        if ($eddpdfi_payment_status === 'Refunded') {
            $eddpdfi_pdf->Cell(38, 10, '-' . html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($eddpdfi_payment->ID))), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
        } else {
            $eddpdfi_pdf->Cell(38, 10, html_entity_decode(edd_currency_filter(edd_format_amount(edd_get_payment_amount($eddpdfi_payment->ID))), ENT_COMPAT, 'UTF-8'), 'B', 2, 'R', false);
        }
        $eddpdfi_pdf->Ln(10);
        if (isset($edd_options['eddpdfi_additional_notes']) && !empty($edd_options['eddpdfi_additional_notes'])) {
            $eddpdfi_pdf->SetX(60);
            $eddpdfi_pdf->SetFont($font, '', 13);
            $eddpdfi_pdf->Cell(0, 6, __('Additional Notes', 'eddpdfi'), 0, 2, 'L', false);
            $eddpdfi_pdf->Ln(2);
            $eddpdfi_pdf->SetX(60);
            $eddpdfi_pdf->SetFont($font, '', 10);
            $eddpdfi_pdf->SetTextColor($colors['notes'][0], $colors['notes'][1], $colors['notes'][2]);
            $eddpdfi_pdf->MultiCell(0, 6, eddpdfi_get_settings($eddpdfi_pdf, 'notes'), 0, 'L', false);
        }
    }
}
/**
 * Default CC Address fields
 *
 * Outputs the default credit card address fields
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_default_cc_address_fields()
{
    ob_start();
    ?>
	<fieldset id="edd_cc_address" class="cc-address">
		<?php 
    do_action('edd_cc_billing_top');
    ?>
		<p>
			<input type="text" name="card_address" class="card-address edd-input required" placeholder="<?php 
    _e('Address line 1', 'edd');
    ?>
"/>
			<label class="edd-label"><?php 
    _e('Billing Address', 'edd');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="card_address_2" class="card-address-2 edd-input" placeholder="<?php 
    _e('Address line 2', 'edd');
    ?>
"/>
			<label class="edd-label"><?php 
    _e('Billing Address Line 2', 'edd');
    ?>
</label>
		</p>
		<p>
			<input type="text" name="card_city" class="card-city edd-input required" placeholder="<?php 
    _e('City', 'edd');
    ?>
"/>
			<label class="edd-label"><?php 
    _e('Billing City', 'edd');
    ?>
</label>
		</p>
		<p>
			<select name="billing_country" class="billing-country edd-select required">
				<?php 
    $countries = edd_get_country_list();
    foreach ($countries as $country_code => $country) {
        echo '<option value="' . $country_code . '">' . $country . '</option>';
    }
    ?>
			</select>
			<label class="edd-label"><?php 
    _e('Billing Country', 'edd');
    ?>
</label>
		</p>
		<p>
			<input type="text" size="6" name="card_state_other" id="card_state_other" class="card-state edd-input" placeholder="<?php 
    _e('State / Province', 'edd');
    ?>
" style="display:none;"/>
            <select name="card_state_us" id="card_state_us" class="card-state edd-select required">
                <?php 
    $states = edd_get_states_list();
    foreach ($states as $state_code => $state) {
        echo '<option value="' . $state_code . '">' . $state . '</option>';
    }
    ?>
            </select>
            <select name="card_state_ca" id="card_state_ca" class="card-state edd-select required" style="display: none;">
                <?php 
    $provinces = edd_get_provinces_list();
    foreach ($provinces as $province_code => $province) {
        echo '<option value="' . $province_code . '">' . $province . '</option>';
    }
    ?>
            </select>
			<label class="edd-label"><?php 
    _e('Billing State / Province', 'edd');
    ?>
</label>
		</p>
		<p>
			<input type="text" size="4" name="card_zip" class="card-zip edd-input required" placeholder="<?php 
    _e('Zip / Postal code', 'edd');
    ?>
"/>
			<label class="edd-label"><?php 
    _e('Billing Zip / Postal Code', 'edd');
    ?>
</label>
		</p>
		<?php 
    do_action('edd_cc_billing_bottom');
    ?>
	</fieldset>
	<?php 
    echo ob_get_clean();
}
    public static function country($field_id, $label, $values = array(), $removeable = true, $force_required = false)
    {
        $first_name = sprintf('%s[%d][first]', 'fes_input', $field_id);
        $first_value = $values && isset($values['first']) ? $values['first'] : ' - select -';
        $values['options'] = empty($values['options']) ? edd_get_country_list() : $values['options'];
        $values['label'] = empty($label) || empty($values['label']) ? __('Vendor Country', 'edd_fes') : $values['label'];
        $values['name'] = empty($values['name']) ? 'vendor_country' : $values['name'];
        $help = esc_attr(__('First element of the select dropdown. Leave this empty if you don\'t want to show this field', 'edd_fes'));
        ?>
        <li class="custom-field country">
            <?php 
        self::legend($label, $values, $removeable);
        ?>
            <?php 
        self::hidden_field("[{$field_id}][input_type]", 'select');
        ?>
            <?php 
        self::hidden_field("[{$field_id}][template]", 'country');
        ?>

            <div class="fes-form-holder">
                <?php 
        self::common($field_id, '', true, $values, $force_required, 'select');
        ?>

                <div class="fes-form-rows">
                    <label><?php 
        _e('Select Text', 'edd_fes');
        ?>
</label>
                    <input type="text" class="smallipopInput" name="<?php 
        echo $first_name;
        ?>
" value="<?php 
        echo $first_value;
        ?>
" title="<?php 
        echo $help;
        ?>
">
                </div> <!-- .fes-form-rows -->

                <div class="fes-form-rows">
                    <label><?php 
        _e('Countries', 'edd_fes');
        ?>
</label>

                    <div class="fes-form-sub-fields">
                        <?php 
        self::radio_fields($field_id, 'options', $values);
        ?>
                    </div> <!-- .fes-form-sub-fields -->
                </div> <!-- .fes-form-rows -->
            </div> <!-- .fes-form-holder -->
        </li>
        <?php 
    }
echo esc_attr($customer['address']['zip']);
?>
" class="card-zip edd-input edd-input-small" />
	</p>

	<div class="clear"></div>

	<p id="edd-card-country-wrap">
		<label for="billing_country" class="edd-label">
			<?php 
_e('Country', 'yoast-theme');
?>
		</label>
		<select data-placeholder="Choose your country..." id="billing_country" name="billing_country" class="billing_country edd-select chosen-select">
			<?php 
$countries = edd_get_country_list();
// This United States always first thing is bloody annoying.
foreach ($countries as $country_code => $country) {
    if ('*' === $country_code) {
        echo '<option></option>';
        continue;
    }
    echo '<option value="' . $country_code . '"' . selected($country_code, $customer['address']['country'], false) . '>' . $country . '</option>';
}
?>
		</select>
	</p>

	<p id="edd-card-state-wrap">
	<label for="card_state" class="edd-label">
		<?php 
/**
 * Add the HTML fields.
 *
 * @since Astoundify Crowdfunding 0.1-alpha
 *
 * @return void
 */
function atcf_shipping_address_fields()
{
    if (!atcf_shipping_cart_shipping()) {
        return;
    }
    ob_start();
    ?>
	<script>
		jQuery(document).ready(function($) {
			$( 'body' ).change( 'select[name=shipping_country]', function() {
				if( $('select[name=shipping_country]').val() == 'US') {
					$('#shipping_state_other').css('display', 'none');
					$('#shipping_state_us').css('display', '');
					$('#shipping_state_ca').css('display', 'none');
				} else if( $('select[name=shipping_country]').val() == 'CA') {
					$('#shipping_state_other').css('display', 'none');
					$('#shipping_state_us').css('display', 'none');
					$('#shipping_state_ca').css('display', '');
				} else {
					$('#shipping_state_other').css('display', '');
					$('#shipping_state_us').css('display', 'none');
					$('#shipping_state_ca').css('display', 'none');
				}
			});
		});
    </script>

	<fieldset id="atcf_shipping_address" class="atcf-shipping-address">
		<legend><?php 
    _e('Shipping Address', 'atcf');
    ?>
</legend>

		<p id="atcf-edd-address-1-wrap">
			<label class="edd-label"><?php 
    _e('Shipping Address', 'atcf');
    ?>
</label>
			<span class="edd-description"><?php 
    _e('Where should we send any physical goods?', 'atcf');
    ?>
</span>
			<input type="text" name="shipping_address" class="shipping-address edd-input required" placeholder="<?php 
    _e('Address line 1', 'atcf');
    ?>
"/>
		</p>

		<p id="atcf-edd-address-2-wrap">
			<label class="edd-label"><?php 
    _e('Shipping Address Line 2', 'atcf');
    ?>
</label>
			<input type="text" name="shipping_address_2" class="shipping-address-2 edd-input required" placeholder="<?php 
    _e('Address line 2', 'atcf');
    ?>
"/>
		</p>

		<p id="atcf-edd-address-city">
			<label class="edd-label"><?php 
    _e('Shipping City', 'atcf');
    ?>
</label>
			<input type="text" name="shipping_city" class="shipping-city edd-input required" placeholder="<?php 
    _e('City', 'atcf');
    ?>
"/>
		</p>

		<p>
			<label class="edd-label"><?php 
    _e('Shipping Country', 'atcf');
    ?>
</label>
			<select name="shipping_country" class="shipping-country edd-select required">
				<?php 
    $countries = edd_get_country_list();
    foreach ($countries as $country_code => $country) {
        echo '<option value="' . $country_code . '">' . $country . '</option>';
    }
    ?>
			</select>
		</p>

		<p>
			<label class="edd-label"><?php 
    _e('Shipping State / Province', 'atcf');
    ?>
</label>
			<input type="text" size="6" name="shipping_state_other" id="shipping_state_other" class="shipping-state edd-input" placeholder="<?php 
    _e('State / Province', 'atcf');
    ?>
" style="display:none;"/>
            <select name="shipping_state_us" id="shipping_state_us" class="shipping-state edd-select required">
                <?php 
    $states = edd_get_states_list();
    foreach ($states as $state_code => $state) {
        echo '<option value="' . $state_code . '">' . $state . '</option>';
    }
    ?>
            </select>
            <select name="shipping_state_ca" id="shipping_state_ca" class="shipping-state edd-select required" style="display: none;">
                <?php 
    $provinces = edd_get_provinces_list();
    foreach ($provinces as $province_code => $province) {
        echo '<option value="' . $province_code . '">' . $province . '</option>';
    }
    ?>
            </select>
		</p>
		<p>
			<label class="edd-label"><?php 
    _e('Shipping Zip / Postal Code', 'atcf');
    ?>
</label>
			<input type="text" size="4" name="shipping_zip" class="shipping-zip edd-input required" placeholder="<?php 
    _e('Zip / Postal code', 'atcf');
    ?>
"/>
		</p>

	</fieldset>
	<?php 
    echo ob_get_clean();
}