/** * Get Cart Amount * * Gets the total price amount in the cart. * uses edd_get_cart_contents(). * * @access public * @since 1.0 * @param $add_taxes bool Whether to apply taxes (if enabled) * @param $local_override bool Force the local opt-in param - used for when not reading $_POST * @return float the total amount */ function edd_get_cart_amount($add_taxes = true, $local_override = false) { $amount = edd_get_cart_subtotal(); if (isset($_POST['edd-discount']) && $_POST['edd-discount'] != '') { // discount is validated before this function runs, so no need to check for it $amount = edd_get_discounted_amount($_POST['edd-discount'], $amount); } if (edd_use_taxes() && $add_taxes) { if (edd_local_taxes_only() && (isset($_POST['edd_tax_opt_in']) || $local_override)) { // add the tax amount for a local resident $tax = edd_get_cart_tax(); $amount += $tax; } elseif (!edd_local_taxes_only()) { // add the global tax amount $tax = edd_get_cart_tax(); $amount += $tax; } } return apply_filters('edd_get_cart_amount', $amount, $add_taxes, $local_override); }
/** * Is the cart taxed? * * @since 1.5 * @return bool */ function edd_is_cart_taxed() { return edd_use_taxes() && (edd_local_tax_opted_in() && edd_local_taxes_only() || !edd_local_taxes_only()); }
/** * Stores the tax info in the payment meta * * @access public * @since 1.3.3 * @param $payment_meta array The meta data to store with the payment * @param $payment_data array The info sent from process-purchase.php * @return array */ function edd_record_taxed_amount($payment_meta, $payment_data) { if (!edd_use_taxes()) { return $payment_meta; } if (edd_local_taxes_only() && isset($_POST['edd_tax_opt_in'])) { // calculate local taxes $payment_meta['subtotal'] = edd_get_cart_amount(false); $payment_meta['tax'] = edd_get_cart_tax(); } elseif (!edd_local_taxes_only()) { // calculate global taxes $payment_meta['subtotal'] = edd_get_cart_amount(false); $payment_meta['tax'] = edd_get_cart_tax(); } return $payment_meta; }
?> : <span class="edd_cart_subtotal"><?php echo edd_cart_subtotal(); ?> </span> </th> <?php do_action('edd_checkout_table_subtotal_last'); ?> </tr> <?php if (!edd_prices_show_tax_on_checkout()) { ?> <tr class="edd_cart_footer_row edd_cart_tax_row"<?php if (edd_local_taxes_only() && !edd_local_tax_opted_in()) { echo ' style="display:none;"'; } ?> > <?php do_action('edd_checkout_table_tax_first'); ?> <th colspan="3" class="edd_cart_tax"> <?php _e('Tax', 'edd'); ?> : <span class="edd_cart_tax_amount" data-tax="<?php echo edd_get_cart_tax(false); ?> "><?php
?> <th colspan="3" class="edd_cart_subtotal"> <?php _e('Subtotal', 'edd'); ?> : <span class="edd_cart_subtotal"><?php echo edd_cart_subtotal(); ?> </span> </th> <?php do_action('edd_checkout_table_subtotal_last'); ?> </tr> <tr class="edd_cart_footer_row edd_cart_tax_row"<?php if (edd_local_taxes_only()) { echo ' style="display:none;"'; } ?> > <?php do_action('edd_checkout_table_tax_first'); ?> <th colspan="3" class="edd_cart_tax"> <?php _e('Tax', 'edd'); ?> : <span class="edd_cart_tax_amount" data-tax="<?php echo edd_get_cart_tax(); ?> "><?php
/** * Get Cart Amount * * @since 1.0 * @param bool $add_taxes Whether to apply taxes (if enabled) (default: true) * @param bool $local_override Force the local opt-in param - used for when not reading $_POST (default: false) * @return float Total amount */ function edd_get_cart_amount($add_taxes = true, $local_override = false) { $amount = edd_get_cart_subtotal(false); if (!empty($_POST['edd-discount']) || edd_get_cart_discounts() !== false) { // Retrieve the discount stored in cookies $discounts = edd_get_cart_discounts(); // Check for a posted discount $posted_discount = isset($_POST['edd-discount']) ? trim($_POST['edd-discount']) : ''; if ($posted_discount && !in_array($posted_discount, $discounts)) { // This discount hasn't been applied, so apply it $amount = edd_get_discounted_amount($posted_discount, $amount); } if (!empty($discounts)) { // Apply the discounted amount from discounts already applied $amount -= edd_get_cart_discounted_amount(); } } if (edd_use_taxes() && $add_taxes) { if (edd_local_taxes_only() && (isset($_POST['edd_tax_opt_in']) || $local_override)) { // Add the tax amount for a local resident $tax = edd_get_cart_tax(); $amount += $tax; } elseif (!edd_local_taxes_only()) { // Add the global tax amount $tax = edd_get_cart_tax(); $amount += $tax; } } return apply_filters('edd_get_cart_amount', $amount, $add_taxes, $local_override); }
/** * System info * * Shows the system info panel which contains version data and debug info. * The data for the system info is generated by the Browser class. * * @since 1.4 * @global $wpdb * @global object $wpdb Used to query the database using the WordPress * Database API * @global $edd_options Array of all the EDD Options * @author Chris Christoff * @return void */ function edd_system_info() { global $wpdb, $edd_options; if (!class_exists('Browser')) { require_once EDD_PLUGIN_DIR . 'includes/libraries/browser.php'; } $browser = new Browser(); ?> <div class="wrap"> <h2><?php _e('System Information', 'edd'); ?> </h2><br/> <form action="<?php echo esc_url(admin_url('edit.php?post_type=download&page=edd-system-info')); ?> " method="post"> <textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="edd-sysinfo" title="<?php _e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'edd'); ?> "> ### Begin System Info ### ## Please include this information when posting support requests ## Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n"; ?> SITE_URL: <?php echo site_url() . "\n"; ?> HOME_URL: <?php echo home_url() . "\n"; ?> EDD Version: <?php echo EDD_VERSION . "\n"; ?> Upgraded From: <?php echo get_option('edd_version_upgraded_from', 'None') . "\n"; ?> WordPress Version: <?php echo get_bloginfo('version') . "\n"; ?> Test Mode Enabled: <?php echo edd_is_test_mode() ? "Yes\n" : "No\n"; ?> Ajax Enabled: <?php echo edd_is_ajax_enabled() ? "Yes\n" : "No\n"; ?> Guest Checkout Enabled: <?php echo edd_no_guest_checkout() ? "No\n" : "Yes\n"; ?> Symlinks Enabled: <?php echo apply_filters('edd_symlink_file_downloads', isset($edd_options['symlink_file_downloads'])) && function_exists('symlink') ? "Yes\n" : "No\n"; ?> Checkout: <?php echo !empty($edd_options['purchase_page']) ? "Valid\n" : "Invalid\n"; ?> Taxes Enabled: <?php echo edd_use_taxes() ? "Yes\n" : "No\n"; ?> Local Taxes Only: <?php echo edd_local_taxes_only() ? "Yes\n" : "No\n"; ?> Taxes After Discounts: <?php echo edd_taxes_after_discounts() ? "Yes\n" : "No\n"; ?> <?php echo $browser; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> MySQL Version: <?php echo mysql_get_server_info() . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> PHP Safe Mode: <?php echo ini_get('safe_mode') ? "Yes" : "No\n"; ?> PHP Memory Limit: <?php echo ini_get('memory_limit') . "\n"; ?> PHP Post Max Size: <?php echo ini_get('post_max_size') . "\n"; ?> PHP Time Limit: <?php echo ini_get('max_execution_time') . "\n"; ?> WP_DEBUG: <?php echo defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n"; ?> WP Table Prefix: <?php echo "Length: " . strlen($wpdb->prefix); echo " Status:"; if (strlen($wpdb->prefix) > 16) { echo " ERROR: Too Long"; } else { echo " Acceptable"; } echo "\n"; ?> Show On Front: <?php echo get_option('show_on_front') . "\n"; ?> Page On Front: <?php $id = get_option('page_on_front'); echo get_the_title($id) . ' #' . $id . "\n"; ?> Page For Posts: <?php $id = get_option('page_for_posts'); echo get_the_title($id) . ' #' . $id . "\n"; ?> Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; echo "\n"; ?> Session Name: <?php echo esc_html(ini_get('session.name')); echo "\n"; ?> Cookie Path: <?php echo esc_html(ini_get('session.cookie_path')); echo "\n"; ?> Save Path: <?php echo esc_html(ini_get('session.save_path')); echo "\n"; ?> Use Cookies: <?php echo ini_get('session.use_cookies') ? 'On' : 'Off'; echo "\n"; ?> Use Only Cookies: <?php echo ini_get('session.use_only_cookies') ? 'On' : 'Off'; echo "\n"; ?> UPLOAD_MAX_FILESIZE: <?php if (function_exists('phpversion')) { echo edd_let_to_num(ini_get('upload_max_filesize')) / (1024 * 1024) . "MB"; } echo "\n"; ?> POST_MAX_SIZE: <?php if (function_exists('phpversion')) { echo edd_let_to_num(ini_get('post_max_size')) / (1024 * 1024) . "MB"; } echo "\n"; ?> WordPress Memory Limit: <?php echo edd_let_to_num(WP_MEMORY_LIMIT) / (1024 * 1024) . "MB"; echo "\n"; ?> DISPLAY ERRORS: <?php echo ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A'; echo "\n"; ?> FSOCKOPEN: <?php echo function_exists('fsockopen') ? __('Your server supports fsockopen.', 'edd') : __('Your server does not support fsockopen.', 'edd'); echo "\n"; ?> ACTIVE PLUGINS: <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, don't show it. if (!in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name']; ?> : <?php echo $plugin['Version'] . "\n"; } ?> CURRENT THEME: <?php if (get_bloginfo('version') < '3.4') { $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css'); echo $theme_data['Name'] . ': ' . $theme_data['Version']; } else { $theme_data = wp_get_theme(); echo $theme_data->Name . ': ' . $theme_data->Version; } ?> ### End System Info ### </textarea> <p class="submit"> <input type="hidden" name="edd-action" value="download_sysinfo" /> <?php submit_button(__('Download System Info File', 'edd'), 'primary', 'edd-download-sysinfo', false); ?> </p> </form> </div> </div> <?php }