Пример #1
0
/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_load_scripts()
{
    global $edd_options, $post;
    wp_enqueue_script('jquery');
    // Get position in cart of current download
    if (isset($post->ID)) {
        $position = edd_get_item_position_in_cart($post->ID);
    }
    // Load AJAX scripts, if enabled
    if (edd_is_ajax_enabled()) {
        wp_enqueue_script('edd-ajax', EDD_PLUGIN_URL . 'assets/js/edd-ajax.js', array('jquery'), EDD_VERSION);
        wp_localize_script('edd-ajax', 'edd_scripts', array('ajaxurl' => edd_get_ajax_url(), 'ajax_nonce' => wp_create_nonce('edd_ajax_nonce'), 'no_discount' => __('Please enter a discount code', 'edd'), 'discount_applied' => __('Discount Applied', 'edd'), 'no_email' => __('Please enter an email address before applying a discount code', 'edd'), 'no_username' => __('Please enter a username before applying a discount code', 'edd'), 'position_in_cart' => isset($position) ? $position : -1, 'already_in_cart_message' => __('You have already added this item to your cart', 'edd'), 'empty_cart_message' => __('Your cart is empty', 'edd'), 'loading' => __('Loading', 'edd'), 'ajax_loader' => EDD_PLUGIN_URL . 'assets/images/loading.gif', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0'));
    }
    // Load jQuery validation
    if (isset($edd_options['jquery_validation']) && edd_is_checkout()) {
        wp_enqueue_script('jquery-validation', EDD_PLUGIN_URL . 'assets/js/jquery.validate.min.js');
        wp_enqueue_script('edd-validation', EDD_PLUGIN_URL . 'assets/js/form-validation.js', array('jquery', 'jquery-validation'), EDD_VERSION);
        $required = array('firstname' => true, 'lastname' => true);
        wp_localize_script('edd-validation', 'edd_scripts_validation', apply_filters('edd_scripts_validation', $required));
    }
    if (edd_is_checkout()) {
        if (edd_is_cc_verify_enabled()) {
            wp_enqueue_script('creditCardValidator', EDD_PLUGIN_URL . 'assets/js/jquery.creditCardValidator.js', array('jquery'), EDD_VERSION);
        }
        wp_enqueue_script('edd-checkout-global', EDD_PLUGIN_URL . 'assets/js/edd-checkout-global.js', array('jquery'), EDD_VERSION);
        wp_localize_script('edd-checkout-global', 'edd_global_vars', array('currency_sign' => edd_currency_filter(''), 'currency_pos' => isset($edd_options['currency_position']) ? $edd_options['currency_position'] : 'before', 'no_gateway' => __('Please select a payment method', 'edd')));
    }
}
 /**
  * Get EDD details
  *
  * ## OPTIONS
  *
  * None. Returns basic info regarding your EDD instance.
  *
  * ## EXAMPLES
  *
  * wp edd details
  *
  * @access		public
  * @param		array $args
  * @param		array $assoc_args
  * @return		void
  */
 public function details($args, $assoc_args)
 {
     $symlink_file_downloads = edd_get_option('symlink_file_downloads', false);
     $purchase_page = edd_get_option('purchase_page', '');
     $success_page = edd_get_option('success_page', '');
     $failure_page = edd_get_option('failure_page', '');
     WP_CLI::line(sprintf(__('You are running EDD version: %s', 'easy-digital-downloads'), EDD_VERSION));
     WP_CLI::line("\n" . sprintf(__('Test mode is: %s', 'easy-digital-downloads'), edd_is_test_mode() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Ajax is: %s', 'easy-digital-downloads'), edd_is_ajax_enabled() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Guest checkouts are: %s', 'easy-digital-downloads'), edd_no_guest_checkout() ? __('Disabled', 'easy-digital-downloads') : __('Enabled', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Symlinks are: %s', 'easy-digital-downloads'), apply_filters('edd_symlink_file_downloads', isset($symlink_file_downloads)) && function_exists('symlink') ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
     WP_CLI::line("\n" . sprintf(__('Checkout page is: %s', 'easy-digital-downloads'), !edd_get_option('purchase_page', false) ? __('Valid', 'easy-digital-downloads') : __('Invalid', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Checkout URL is: %s', 'easy-digital-downloads'), !empty($purchase_page) ? get_permalink($purchase_page) : __('Undefined', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Success URL is: %s', 'easy-digital-downloads'), !empty($success_page) ? get_permalink($success_page) : __('Undefined', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Failure URL is: %s', 'easy-digital-downloads'), !empty($failure_page) ? get_permalink($failure_page) : __('Undefined', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Downloads slug is: %s', 'easy-digital-downloads'), defined('EDD_SLUG') ? '/' . EDD_SLUG : '/downloads'));
     WP_CLI::line("\n" . sprintf(__('Taxes are: %s', 'easy-digital-downloads'), edd_use_taxes() ? __('Enabled', 'easy-digital-downloads') : __('Disabled', 'easy-digital-downloads')));
     WP_CLI::line(sprintf(__('Tax rate is: %s', 'easy-digital-downloads'), edd_get_tax_rate() * 100 . '%'));
     $rates = edd_get_tax_rates();
     if (!empty($rates)) {
         foreach ($rates as $rate) {
             WP_CLI::line(sprintf(__('Country: %s, State: %s, Rate: %s', 'easy-digital-downloads'), $rate['country'], $rate['state'], $rate['rate']));
         }
     }
 }
Пример #3
0
/**
 * Show discount field by default
 * If you want a button, simply add <a class="edd-submit button" href="#">Apply discount</a> after the input field.
 * Because the discount is applied when you click outside the field, it will work in the exact same way
*/
function sumobi_edd_show_discount_field()
{
    if (!isset($_GET['payment-mode']) && count(edd_get_enabled_payment_gateways()) > 1 && !edd_is_ajax_enabled()) {
        return;
    }
    // Only show once a payment method has been selected if ajax is disabled
    if (edd_has_active_discounts() && edd_get_cart_total()) {
        ?>
	<fieldset id="edd_discount_code">
		<p>
			<label class="edd-label" for="edd-discount">
				<?php 
        _e('Discount', 'my-child-theme');
        ?>
				<img src="<?php 
        echo EDD_PLUGIN_URL;
        ?>
assets/images/loading.gif" id="edd-discount-loader" style="display:none;"/>
			</label>
			<span class="edd-description"><?php 
        _e('Enter a coupon code if you have one.', 'my-child-theme');
        ?>
</span>
			<input class="edd-input" type="text" id="edd-discount" name="edd-discount" placeholder="<?php 
        _e('Enter discount', 'my-child-theme');
        ?>
"/>
			
		</p>
	</fieldset>
	<?php 
    }
}
/**
 * Prevents items from being added to the cart multiple times
 *
 */
function pw_edd_prevent_duplicate_cart_items($download_id, $options)
{
    if (edd_item_in_cart($download_id, $options)) {
        if (edd_is_ajax_enabled()) {
            die('1');
        } else {
            wp_redirect(edd_get_checkout_uri());
            exit;
        }
    }
}
Пример #5
0
/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @access      private
 * @since       1.0 
 * @return      void
*/
function edd_load_scripts()
{
    global $edd_options, $post;
    wp_enqueue_script('jquery');
    // Get position in cart of current download
    if (isset($post->ID)) {
        $position = edd_get_item_position_in_cart($post->ID);
    }
    // Load AJAX scripts, if enabled
    if (edd_is_ajax_enabled()) {
        wp_enqueue_script('edd-ajax', EDD_PLUGIN_URL . 'includes/js/edd-ajax.js');
        wp_localize_script('edd-ajax', 'edd_scripts', array('ajaxurl' => admin_url('admin-ajax.php'), 'ajax_nonce' => wp_create_nonce('edd_ajax_nonce'), 'no_discount' => __('Please enter a discount code', 'edd'), 'discount_applied' => __('Discount Applied', 'edd'), 'no_email' => __('Please enter an email address before applying a discount code', 'edd'), 'position_in_cart' => isset($position) ? $position : -1, 'already_in_cart_message' => __('You have already added this item to your cart', 'edd'), 'empty_cart_message' => __('Your cart is empty', 'edd'), 'loading' => __('Loading', 'edd'), 'ajax_loader' => EDD_PLUGIN_URL . 'includes/images/loading.gif', 'checkout_page' => isset($edd_options['purchase_page']) ? get_permalink($edd_options['purchase_page']) : '', 'permalinks' => get_option('permalink_structure') ? '1' : '0'));
    }
    // Load jQuery validation
    if (isset($edd_options['jquery_validation']) && is_page($edd_options['purchase_page'])) {
        wp_enqueue_script('jquery-validation', EDD_PLUGIN_URL . 'includes/js/jquery.validate.min.js');
        wp_enqueue_script('edd-validation', EDD_PLUGIN_URL . 'includes/js/form-validation.js');
        $required = array('firstname' => true, 'lastname' => true);
        wp_localize_script('edd-validation', 'edd_scripts_validation', apply_filters('edd_scripts_validation', $required));
    }
    wp_enqueue_script('edd-checkout-global', EDD_PLUGIN_URL . 'includes/js/edd-checkout-global.js');
}
/**
 * Load Scripts
 *
 * Enqueues the required scripts.
 *
 * @since 1.0
 * @global $edd_options
 * @global $post
 * @return void
 */
function edd_load_scripts()
{
    global $edd_options, $post;
    $js_dir = EDD_PLUGIN_URL . 'assets/js/';
    wp_enqueue_script('jquery');
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    // Get position in cart of current download
    if (isset($post->ID)) {
        $position = edd_get_item_position_in_cart($post->ID);
    }
    if (edd_is_checkout()) {
        if (edd_is_cc_verify_enabled()) {
            wp_enqueue_script('creditCardValidator', $js_dir . 'jquery.creditCardValidator' . $suffix . '.js', array('jquery'), EDD_VERSION);
        }
        wp_enqueue_script('edd-checkout-global', $js_dir . 'edd-checkout-global' . $suffix . '.js', array('jquery'), EDD_VERSION);
        wp_localize_script('edd-checkout-global', 'edd_global_vars', array('ajaxurl' => edd_get_ajax_url(), 'checkout_nonce' => wp_create_nonce('edd_checkout_nonce'), 'currency_sign' => edd_currency_filter(''), 'currency_pos' => isset($edd_options['currency_position']) ? $edd_options['currency_position'] : 'before', 'no_gateway' => __('Please select a payment method', 'edd'), 'no_discount' => __('Please enter a discount code', 'edd'), 'discount_applied' => __('Discount Applied', 'edd'), 'no_email' => __('Please enter an email address before applying a discount code', 'edd'), 'no_username' => __('Please enter a username before applying a discount code', 'edd'), 'purchase_loading' => __('Please Wait...', 'edd'), 'complete_purchasse' => __('Purchase', 'edd')));
    }
    // Load AJAX scripts, if enabled
    if (edd_is_ajax_enabled()) {
        wp_enqueue_script('edd-ajax', $js_dir . 'edd-ajax' . $suffix . '.js', array('jquery'), EDD_VERSION);
        wp_localize_script('edd-ajax', 'edd_scripts', array('ajaxurl' => edd_get_ajax_url(), 'ajax_nonce' => wp_create_nonce('edd_ajax_nonce'), 'position_in_cart' => isset($position) ? $position : -1, 'already_in_cart_message' => __('You have already added this item to your cart', 'edd'), 'empty_cart_message' => __('Your cart is empty', 'edd'), 'loading' => __('Loading', 'edd'), 'select_option' => __('Please select an option', 'edd'), 'ajax_loader' => EDD_PLUGIN_URL . 'assets/images/loading.gif', 'is_checkout' => edd_is_checkout() ? '1' : '0', 'default_gateway' => edd_get_default_gateway(), 'redirect_to_checkout' => edd_straight_to_checkout() || edd_is_checkout() ? '1' : '0', 'checkout_page' => edd_get_checkout_uri(), 'permalinks' => get_option('permalink_structure') ? '1' : '0'));
    }
}
/**
 * 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 
}
Пример #8
0
/**
 * Override the add to cart button if the max purchase limit has been reached
 *
 * @since       1.0.0
 * @param       string $purchase_form the actual purchase form code
 * @param       array $args the info for the specific download
 * @global      string $user_email The email address of the current user
 * @global      boolean $edd_prices_sold_out Variable price sold out check
 * @return      string $purchase_form if conditions are not met
 * @return      string $sold_out if conditions are met
 */
function edd_pl_override_purchase_button($purchase_form, $args)
{
    global $user_email, $edd_prices_sold_out;
    // Get options
    $sold_out_label = edd_get_option('edd_purchase_limit_sold_out_label') ? edd_get_option('edd_purchase_limit_sold_out_label') : __('Sold Out', 'edd-purchase-limit');
    $scope = edd_get_option('edd_purchase_limit_scope') ? edd_get_option('edd_purchase_limit_scope') : 'site-wide';
    $form_id = !empty($args['form_id']) ? $args['form_id'] : 'edd_purchase_' . $args['download_id'];
    // Get purchase limits
    $max_purchases = edd_pl_get_file_purchase_limit($args['download_id']);
    $is_sold_out = false;
    $date_range = edd_pl_is_date_restricted($args['download_id']);
    if ($scope == 'site-wide') {
        $purchases = edd_get_download_sales_stats($args['download_id']);
        if ($max_purchases && $purchases >= $max_purchases || !empty($edd_prices_sold_out)) {
            $is_sold_out = true;
        }
    } elseif (is_user_logged_in()) {
        $purchases = edd_pl_get_user_purchase_count(get_current_user_id(), $args['download_id']);
        if ($max_purchases && $purchases >= $max_purchases || !empty($edd_prices_sold_out)) {
            $is_sold_out = true;
        }
    }
    if ($is_sold_out) {
        $purchase_form = '<form id="' . $form_id . '" class="edd_download_purchase_form">';
        $purchase_form .= '<div class="edd_purchase_submit_wrapper">';
        if (edd_is_ajax_enabled()) {
            $purchase_form .= sprintf('<div class="edd-add-to-cart %1$s"><span>%2$s</span></a>', implode(' ', array($args['style'], $args['color'], trim($args['class']))), esc_attr($sold_out_label));
            $purchase_form .= '</div>';
        } else {
            $purchase_form .= sprintf('<input type="submit" class="edd-no-js %1$s" name="edd_purchase_download" value="%2$s" disabled />', implode(' ', array($args['style'], $args['color'], trim($args['class']))), esc_attr($sold_out_label));
        }
        $purchase_form .= '</div></form>';
    } elseif (is_array($date_range)) {
        $now = date('YmdHi');
        $date_label = null;
        if (isset($date_range['start'])) {
            $start_time = date('YmdHi', strtotime($date_range['start'][0] . $date_range['start'][1]));
            if ($start_time > $now) {
                $date_label = edd_get_option('edd_purchase_limit_pre_date_label') ? edd_get_option('edd_purchase_limit_pre_date_label') : __('This product is not yet available!', 'edd-purchase-limit');
            }
        }
        if (isset($date_range['end'])) {
            $end_time = date('YmdHi', strtotime($date_range['end'][0] . $date_range['end'][1]));
            if ($end_time < $now) {
                $date_label = edd_get_option('edd_purchase_limit_post_date_label') ? edd_get_option('edd_purchase_limit_post_date_label') : __('This product is no longer available!', 'edd-purchase-limit');
            }
        }
        if (isset($date_label)) {
            $purchase_form = '<form id="' . $form_id . '" class="edd_download_purchase_form">';
            $purchase_form .= '<div class="edd_purchase_submit_wrapper">';
            if (edd_is_ajax_enabled()) {
                $purchase_form .= sprintf('<div class="edd-add-to-cart %1$s"><span>%2$s</span></div>', implode(' ', array($args['style'], $args['color'], trim($args['class']))), esc_attr($date_label));
            } else {
                $purchase_form .= sprintf('<input type="submit" class="edd-no-js %1$s" name="edd_purchase_download" value="%2$s" disabled />', implode(' ', array($args['style'], $args['color'], trim($args['class']))), esc_attr($date_label));
            }
            $purchase_form .= '</div></form>';
        } elseif (edd_get_option('edd_purchase_limit_show_counts')) {
            $label = edd_get_option('add_to_cart_text') ? edd_get_option('add_to_cart_text') : __('Purchase', 'edd');
            $remaining_label = edd_get_option('edd_purchase_limit_remaining_label') ? edd_get_option('edd_purchase_limit_remaining_label') : __('Remaining', 'edd-purchase-limit');
            $variable_pricing = edd_has_variable_prices($args['download_id']);
            if (!$variable_pricing) {
                $remaining = $max_purchases - $purchases;
                if ($remaining > '0') {
                    $purchase_form = str_replace($label . '</span>', $label . '</span> <span class="edd-pl-remaining-label">(' . $remaining . ' ' . $remaining_label . ')</span>', $purchase_form);
                }
            }
        }
    } elseif (edd_get_option('edd_purchase_limit_show_counts')) {
        $label = edd_get_option('add_to_cart_text') ? edd_get_option('add_to_cart_text') : __('Purchase', 'edd');
        $remaining_label = edd_get_option('edd_purchase_limit_remaining_label') ? edd_get_option('edd_purchase_limit_remaining_label') : __('Remaining', 'edd-purchase-limit');
        $variable_pricing = edd_has_variable_prices($args['download_id']);
        if (!$variable_pricing) {
            $remaining = $max_purchases - $purchases;
            if ($remaining > '0') {
                $purchase_form = str_replace($label . '</span>', $label . '</span> <span class="edd-pl-remaining-label">(' . $remaining . ' ' . $remaining_label . ')</span>', $purchase_form);
            }
        }
    }
    return $purchase_form;
}
Пример #9
0
/**
 * Get the URL of the Checkout page
 *
 * @since 1.0.8
 * @param array $args Extra query args to add to the URI
 * @return mixed Full URL to the checkout page, if present | null if it doesn't exist
 */
function edd_get_checkout_uri($args = array())
{
    $uri = edd_get_option('purchase_page', false);
    $uri = isset($uri) ? get_permalink($uri) : NULL;
    if (!empty($args)) {
        // Check for backward compatibility
        if (is_string($args)) {
            $args = str_replace('?', '', $args);
        }
        $args = wp_parse_args($args);
        $uri = add_query_arg($args, $uri);
    }
    $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
    $ajax_url = admin_url('admin-ajax.php', $scheme);
    if (!preg_match('/^https/', $uri) && preg_match('/^https/', $ajax_url) && edd_is_ajax_enabled() || edd_is_ssl_enforced()) {
        $uri = preg_replace('/^http:/', 'https:', $uri);
    }
    if (edd_get_option('no_cache_checkout', false) && edd_is_caching_plugin_active()) {
        $uri = add_query_arg('nocache', 'true', $uri);
    }
    return apply_filters('edd_get_checkout_uri', $uri);
}
Пример #10
0
/**
 * Load our javascript
 *
 * @access      public
 * @since       1.0
 * @return      void
 */
function edd_stripe_js($override = false)
{
    if (function_exists('edd_is_checkout')) {
        global $edd_options;
        if (isset($edd_options['stripe_js_fallback'])) {
            return;
        }
        // in fallback mode
        $publishable_key = NULL;
        if (edd_is_test_mode()) {
            $publishable_key = trim($edd_options['test_publishable_key']);
        } else {
            $publishable_key = trim($edd_options['live_publishable_key']);
        }
        if ((edd_is_checkout() || $override) && edd_is_gateway_active('stripe')) {
            wp_enqueue_script('stripe-js', 'https://js.stripe.com/v2/', array('jquery'));
            wp_enqueue_script('edd-stripe-js', EDDSTRIPE_PLUGIN_URL . 'edd-stripe.js', array('jquery', 'stripe-js'), EDD_STRIPE_VERSION);
            $stripe_vars = array('publishable_key' => $publishable_key, 'is_ajaxed' => edd_is_ajax_enabled() ? 'true' : 'false');
            wp_localize_script('edd-stripe-js', 'edd_stripe_vars', $stripe_vars);
        }
    }
}
<?php

global $post;
?>
<table id="edd_checkout_cart" <?php 
if (edd_is_ajax_enabled()) {
    echo 'class="ajaxed"';
}
?>
>
	<thead>
		<tr class="edd_cart_header_row">
			<?php 
do_action('edd_checkout_table_header_first');
?>
			<th class="edd_cart_item_name"><?php 
_e('Item Name', 'edd');
?>
</th>
			<th class="edd_cart_item_price"><?php 
_e('Item Price', 'edd');
?>
</th>
			<th class="edd_cart_actions"><?php 
_e('Actions', 'edd');
?>
</th>
			<?php 
do_action('edd_checkout_table_header_last');
?>
		</tr>
/**
 * Get Purchase Link
 *
 * Returns the purchase link.
 *
 * $download_id = null, $link_text = null, $style = null, $color = null, $class = null
 *
 * @access      public
 * @since       1.0
 * @return      string
 */
function edd_get_purchase_link($args = array())
{
    global $edd_options, $post;
    if (!isset($edd_options['purchase_page']) || $edd_options['purchase_page'] == 0) {
        edd_set_error('set_checkout', sprintf(__('No checkout page has been configured. Visit <a href="%s">Settings</a> to set one.', 'edd'), admin_url('edit.php?post_type=download&page=edd-settings')));
        edd_print_errors();
        return false;
    }
    $defaults = array('download_id' => $post->ID, 'price' => (bool) true, 'text' => isset($edd_options['add_to_cart_text']) && $edd_options['add_to_cart_text'] != '' ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd'), 'style' => isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button', 'color' => isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue', 'class' => 'edd-submit');
    $args = wp_parse_args($args, $defaults);
    $variable_pricing = edd_has_variable_prices($args['download_id']);
    $data_variable = $variable_pricing ? ' data-variable-price="yes"' : '';
    if ($args['price'] && !$variable_pricing) {
        $price = edd_get_download_price($args['download_id']);
        if (edd_use_taxes() && edd_taxes_on_prices()) {
            $price += edd_calculate_tax($price);
        }
        $args['text'] = edd_currency_filter(edd_format_amount($price)) . '&nbsp;&ndash;&nbsp;' . $args['text'];
    }
    if (edd_item_in_cart($args['download_id'])) {
        $button_display = 'style="display:none;"';
        $checkout_display = '';
    } else {
        $button_display = '';
        $checkout_display = 'style="display:none;"';
    }
    ob_start();
    ?>
	<form id="edd_purchase_<?php 
    echo $args['download_id'];
    ?>
" class="edd_download_purchase_form" method="post">

		<?php 
    do_action('edd_purchase_link_top', $args['download_id']);
    ?>

		<div class="edd_purchase_submit_wrapper">
			<?php 
    printf('<input type="submit" class="edd-add-to-cart %1$s" name="edd_purchase_download" value="%2$s" data-action="edd_add_to_cart" data-download-id="%3$s" %4$s %5$s/>', implode(' ', array($args['style'], $args['color'], trim($args['class']))), esc_attr($args['text']), esc_attr($args['download_id']), esc_attr($data_variable), $button_display);
    printf('<a href="%1$s" class="%2$s %3$s" %4$s>' . __('Checkout', 'edd') . '</a>', esc_url(edd_get_checkout_uri()), esc_attr('edd_go_to_checkout'), implode(' ', array($args['style'], $args['color'], trim($args['class']))), $checkout_display);
    ?>

			<?php 
    if (edd_is_ajax_enabled()) {
        ?>
				<span class="edd-cart-ajax-alert">
					<img src="<?php 
        echo esc_url(EDD_PLUGIN_URL . 'assets/images/loading.gif');
        ?>
" class="edd-cart-ajax" style="display: none;" />
					<span class="edd-cart-added-alert" style="display: none;">&mdash;<?php 
        _e('Item successfully added to your cart.', 'edd');
        ?>
</span>
				</span>
			<?php 
    }
    ?>
		</div><!--end .edd_purchase_submit_wrapper-->

		<input type="hidden" name="download_id" value="<?php 
    echo esc_attr($args['download_id']);
    ?>
">
		<input type="hidden" name="edd_action" value="add_to_cart">

		<?php 
    do_action('edd_purchase_link_end', $args['download_id']);
    ?>

	</form><!--end #edd_purchase_<?php 
    echo esc_attr($args['download_id']);
    ?>
-->
<?php 
    $purchase_form = ob_get_clean();
    return apply_filters('edd_purchase_download_form', $purchase_form, $args);
}
/**
 * Renders the Checkout Submit section
 *
 * @since 1.3.3
 * @return void
 */
function edd_checkout_submit()
{
    ?>
	<fieldset id="edd_purchase_submit">
		<?php 
    do_action('edd_purchase_form_before_submit');
    ?>

		<?php 
    edd_checkout_hidden_fields();
    ?>

		<?php 
    echo edd_checkout_button_purchase();
    ?>

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

		<?php 
    if (!edd_is_ajax_enabled()) {
        ?>
			<p class="edd-cancel"><a href="javascript:history.go(-1)"><?php 
        _e('Go back', 'edd');
        ?>
</a></p>
		<?php 
    }
    ?>
	</fieldset>
<?php 
}
/**
 * Get Purchase Link
 *
 * Returns the purchase link.
 *
 * @access      public
 * @since       1.0 
 * @return      string
*/
function edd_get_purchase_link($download_id = null, $link_text = null, $style = null, $color = null, $class = '')
{
    global $edd_options, $post, $user_ID;
    if (!isset($edd_options['purchase_page']) || $edd_options['purchase_page'] == 0) {
        edd_set_error('set_checkout', sprintf(__('No checkout page has been configured. Visit <a href="%s">Settings</a> to set one.', 'edd'), admin_url('edit.php?post_type=download&page=edd-settings')));
        edd_print_errors();
        return false;
    }
    $page = get_permalink($post->ID);
    // current page
    $link_args = array('download_id' => $download_id, 'edd_action' => 'add_to_cart');
    $link = add_query_arg($link_args, $page);
    $checkout_url = get_permalink($edd_options['purchase_page']);
    $variable_pricing = edd_has_variable_prices($download_id);
    if (is_null($link_text)) {
        $link_text = get_post_meta($post->ID, '_edd_purchase_text', true) ? get_post_meta($post->ID, '_edd_purchase_text', true) : __('Purchase', 'edd');
    }
    if (is_null($style)) {
        $style = get_post_meta($post->ID, '_edd_purchase_style', true) ? get_post_meta($post->ID, '_edd_purchase_style', true) : 'button';
    }
    if (is_null($color)) {
        $color = get_post_meta($post->ID, '_edd_purchase_color', true) ? str_replace(' ', '_', get_post_meta($post->ID, '_edd_purchase_color', true)) : 'blue';
    }
    $purchase_form = '<form id="edd_purchase_' . $download_id . '" class="edd_download_purchase_form" method="POST">';
    if ($variable_pricing) {
        $prices = edd_get_variable_prices($download_id);
        $purchase_form .= '<div class="edd_price_options">';
        if ($prices) {
            foreach ($prices as $key => $price) {
                $checked = '';
                if ($key == 0) {
                    $checked = 'checked="checked"';
                }
                $purchase_form .= sprintf('<input type="radio" %1$s name="edd_options[price_id]" id="%2$s" class="%3$s" value="%4$s"/>&nbsp;', $checked, esc_attr('edd_price_option_' . $download_id . '_' . $key), esc_attr('edd_price_option_' . $download_id), esc_attr($key));
                $purchase_form .= sprintf('<label for="%1$s">%2$s</label><br/>', esc_attr('edd_price_option_' . $download_id . '_' . $key), esc_html($price['name'] . ' - ' . edd_currency_filter($price['amount'])));
            }
        }
        $purchase_form .= '</div><!--end .edd_price_options-->';
    }
    $purchase_form .= '<div class="edd_purchase_submit_wrapper">';
    $data_variable = $variable_pricing ? ' data-variable-price="yes"' : '';
    if (edd_item_in_cart($download_id)) {
        $button_display = 'style="display:none;"';
        $checkout_display = '';
    } else {
        $button_display = '';
        $checkout_display = 'style="display:none;"';
    }
    if ($style == 'button') {
        $purchase_button = sprintf('<span class="%1$s" %2$s>', esc_attr('edd_button edd_add_to_cart_wrap edd_' . $color), $button_display);
        $purchase_button .= '<span class="edd_button_outer">';
        $purchase_button .= '<span class="edd_button_inner">';
        $purchase_button .= sprintf('<input type="submit" class="%1$s" name="edd_purchase_download" value="%2$s" data-action="edd_add_to_cart" data-download-id="%3$s" %4$s/>', esc_attr('edd_button_text edd-submit edd-add-to-cart ' . $class), esc_attr($link_text), esc_attr($download_id), $data_variable);
        $purchase_button .= '</span>';
        $purchase_button .= '</span>';
        $purchase_button .= '</span>';
        $checkout_link = sprintf('<a href="%1$s" class="%2$s" %3$s>', esc_url($checkout_url), esc_attr('edd_go_to_checkout edd_button edd_' . $color), $checkout_display);
        $checkout_link .= '<span class="edd_button_outer"><span class="edd_button_inner">';
        $checkout_link .= '<span class="edd_button_text"><span>' . __('Checkout', 'edd') . '</span></span>';
        $checkout_link .= '</span></span>';
        $checkout_link .= '</a>';
        $purchase_form .= $purchase_button . $checkout_link;
    } else {
        $purchase_text = sprintf('<input type="submit" class="%1$s" name="edd_purchase_download" value="%2$s" data-action="edd_add_to_cart" data-download-id="%3$s" %4$s %5$s/>', esc_attr('edd_submit_plain edd-add-to-cart ' . $class), esc_attr($link_text), esc_attr($download_id), esc_attr($data_variable), esc_attr($button_display));
        $checkout_link = sprintf('<a href="%1$s" class="%2$s" %3$s>', esc_url($checkout_url), esc_attr('edd_go_to_checkout edd_button edd_' . $color), $checkout_display);
        $checkout_link .= __('Checkout', 'edd');
        $checkout_link .= '</a>';
        $purchase_form .= $purchase_text . $checkout_link;
    }
    if (edd_is_ajax_enabled()) {
        $purchase_form .= sprintf('<div class="edd-cart-ajax-alert"><img src="%1$s" class="edd-cart-ajax" style="display: none;"/>', esc_url(EDD_PLUGIN_URL . 'includes/images/loading.gif'));
        $purchase_form .= '&nbsp;<span style="display:none;" class="edd-cart-added-alert">' . __('added to your cart', 'edd') . '</span></div>';
    }
    $purchase_form .= '</div><!--end .edd_purchase_submit_wrapper-->';
    $purchase_form .= '<input type="hidden" name="download_id" value="' . esc_attr($download_id) . '">';
    $purchase_form .= '<input type="hidden" name="edd_action" value="add_to_cart">';
    $purchase_form .= '</form><!--end #edd_purchase_' . esc_html($download_id) . '-->';
    return apply_filters('edd_purchase_download_form', $purchase_form, $download_id, $link_text, $style, $color, $class);
}
Пример #15
0
/**
 * 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();
    if (get_bloginfo('version') < '3.4') {
        $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
        $theme = $theme_data['Name'] . ' ' . $theme_data['Version'];
    } else {
        $theme_data = wp_get_theme();
        $theme = $theme_data->Name . ' ' . $theme_data->Version;
    }
    // Try to identifty the hosting provider
    $host = false;
    if (defined('WPE_APIKEY')) {
        $host = 'WP Engine';
    } elseif (defined('PAGELYBIN')) {
        $host = 'Pagely';
    }
    ?>
	<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" dir="ltr">
			<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 ##

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

Multisite:                <?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";
    ?>
Permalink Structure:      <?php 
    echo get_option('permalink_structure') . "\n";
    ?>
Active Theme:             <?php 
    echo $theme . "\n";
    if ($host) {
        ?>
Host:                     <?php 
        echo $host . "\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 is:              <?php 
    echo !empty($edd_options['purchase_page']) ? "Valid\n" : "Invalid\n";
    ?>
Checkout Page:            <?php 
    echo !empty($edd_options['purchase_page']) ? get_permalink($edd_options['purchase_page']) . "\n" : "\n";
    ?>
Success Page:             <?php 
    echo !empty($edd_options['success_page']) ? get_permalink($edd_options['success_page']) . "\n" : "\n";
    ?>
Failure Page:             <?php 
    echo !empty($edd_options['failure_page']) ? get_permalink($edd_options['failure_page']) . "\n" : "\n";
    ?>
Downloads slug:           <?php 
    echo defined('EDD_SLUG') ? '/' . EDD_SLUG . "\n" : "/downloads\n";
    ?>

Taxes Enabled:            <?php 
    echo edd_use_taxes() ? "Yes\n" : "No\n";
    ?>
Taxes After Discounts:    <?php 
    echo edd_taxes_after_discounts() ? "Yes\n" : "No\n";
    ?>
Tax Rate:                 <?php 
    echo edd_get_tax_rate() * 100;
    ?>
%
Country / State Rates:    <?php 
    $rates = edd_get_tax_rates();
    if (!empty($rates)) {
        foreach ($rates as $rate) {
            echo 'Country: ' . $rate['country'] . ', State: ' . $rate['state'] . ', Rate: ' . $rate['rate'] . ' | ';
        }
    }
    ?>

Registered Post Stati:    <?php 
    echo implode(', ', get_post_stati()) . "\n\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";
    ?>

WordPress Memory Limit:   <?php 
    echo edd_let_to_num(WP_MEMORY_LIMIT) / 1024 . "MB";
    echo "\n";
    ?>
PHP Safe Mode:            <?php 
    echo ini_get('safe_mode') ? "Yes" : "No\n";
    ?>
PHP Memory Limit:         <?php 
    echo ini_get('memory_limit') . "\n";
    ?>
PHP Upload Max Size:      <?php 
    echo ini_get('upload_max_filesize') . "\n";
    ?>
PHP Post Max Size:        <?php 
    echo ini_get('post_max_size') . "\n";
    ?>
PHP Upload Max Filesize:  <?php 
    echo ini_get('upload_max_filesize') . "\n";
    ?>
PHP Time Limit:           <?php 
    echo ini_get('max_execution_time') . "\n";
    ?>
PHP Max Input Vars:       <?php 
    echo ini_get('max_input_vars') . "\n";
    ?>
PHP Arg Separator:        <?php 
    echo ini_get('arg_separator.output') . "\n";
    ?>
PHP Allow URL File Open:  <?php 
    echo ini_get('allow_url_fopen') ? "Yes" : "No\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";
    ?>

<?php 
    $request['cmd'] = '_notify-validate';
    $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'EDD/' . EDD_VERSION, 'body' => $request);
    $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
    if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
        $WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
    } else {
        $WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
    }
    ?>
WP Remote Post:           <?php 
    echo $WP_REMOTE_POST;
    ?>

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";
    ?>

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.' : 'Your server does not support fsockopen.';
    echo "\n";
    ?>
cURL:                     <?php 
    echo function_exists('curl_init') ? 'Your server supports cURL.' : 'Your server does not support cURL.';
    echo "\n";
    ?>
SOAP Client:              <?php 
    echo class_exists('SoapClient') ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.';
    echo "\n";
    ?>
SUHOSIN:                  <?php 
    echo extension_loaded('suhosin') ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.';
    echo "\n";
    ?>

TEMPLATES:

<?php 
    // Show templates that have been copied to the theme's edd_templates dir
    $dir = get_stylesheet_directory() . '/edd_templates/*';
    if (!empty($dir)) {
        foreach (glob($dir) as $file) {
            echo "Filename: " . basename($file) . "\n";
        }
    } else {
        echo 'No overrides found';
    }
    ?>

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'] . ': ' . $plugin['Version'] . "\n";
    }
    if (is_multisite()) {
        ?>

NETWORK ACTIVE PLUGINS:

<?php 
        $plugins = wp_get_active_network_plugins();
        $active_plugins = get_site_option('active_sitewide_plugins', array());
        foreach ($plugins as $plugin_path) {
            $plugin_base = plugin_basename($plugin_path);
            // If the plugin isn't active, don't show it.
            if (!array_key_exists($plugin_base, $active_plugins)) {
                continue;
            }
            $plugin = get_plugin_data($plugin_path);
            echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n";
        }
    }
    do_action('edd_system_info_after');
    ?>
### End System Info ###</textarea>
			<p class="submit">
				<input type="hidden" name="edd-action" value="download_sysinfo" />
				<?php 
    submit_button('Download System Info File', 'primary', 'edd-download-sysinfo', false);
    ?>
			</p>
		</form>
		</div>
	</div>
<?php 
}
    /**
     * Redeem Points Markup
     * 
     * Handles to show redeem points markup
     * 
     * @package Easy Digital Downloads - Points and Rewards
     * @since 1.0.0
     **/
    public function edd_points_redeem_point_markup()
    {
        global $current_user, $edd_options;
        if (!isset($_GET['payment-mode']) && count(edd_get_enabled_payment_gateways()) > 1 && !edd_is_ajax_enabled()) {
            return;
        }
        // Only show once a payment method has been selected if ajax is disabled
        //get points plural label
        $plurallabel = isset($edd_options['edd_points_label']['plural']) && !empty($edd_options['edd_points_label']['plural']) ? $edd_options['edd_points_label']['plural'] : 'Point';
        //get discount got by user via points
        $gotdiscount = EDD()->fees->get_fee('points_redeem');
        //get message from settings
        $redemptionmessage = $edd_options['edd_points_reedem_cart_messages'];
        //calculate discount towards points
        $available_discount = $this->model->edd_points_get_discount_for_redeeming_points();
        $button_color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : '';
        if (!empty($available_discount) && !empty($redemptionmessage) && empty($gotdiscount)) {
            //get discounte price from points
            $discountedpoints = $this->model->edd_points_calculate_points($available_discount);
            //get points label to show to user
            $points_label = $this->model->edd_points_get_points_label($discountedpoints);
            //display price to show to user
            $displaydiscprice = edd_currency_filter($available_discount);
            //show message on checkout page
            $points_replace = array("{points}", "{points_label}", "{points_value}");
            $replace_message = array($discountedpoints, $points_label, $displaydiscprice);
            $message = $this->model->edd_points_replace_array($points_replace, $replace_message, $redemptionmessage);
            ?>
 
			<fieldset class="edd-points-redeem-points-wrap">
				<form method="POST" action="" >
					<input type="submit" id="edd_points_apply_discount" name="edd_points_apply_discount" class="button edd-submit <?php 
            _e($button_color);
            ?>
 edd-points-apply-discount-button" value="<?php 
            _e('Apply Discount', 'eddpoints');
            ?>
" />
				</form>
				<div class="edd-points-redeem-message"><?php 
            echo $message;
            ?>
</div><!--.edd-points-checkout-message-->
			</fieldset><!--.edd-points-redeem-points-wrap-->
			<?php 
        }
        //end if cart total not empty
        //if points discount applied then show remove link
        if (!empty($gotdiscount)) {
            $removfeesurl = add_query_arg(array('edd_points_remove_discount' => 'remove'), edd_get_current_page_url());
            ?>
				<fieldset class="edd-points-checkout-message">
					<a href="<?php 
            echo $removfeesurl;
            ?>
" class="button edd-point-remove-discount-link edd-points-float-right"><?php 
            _e('Remove', 'eddpoints');
            ?>
</a>
					<div class="edd-points-remove-disocunt-message"><?php 
            printf(__('Remove %s Discount', 'eddpoints'), $plurallabel);
            ?>
</div><!--.edd-points-checkout-message-->
				</fieldset><!--.edd-points-redeem-points-wrap-->
			<?php 
        }
    }
/**
 * Get Checkout Form
 *
 * @access      private
 * @since       1.0 
 * @return      string
*/
function edd_checkout_form()
{
    global $edd_options, $user_ID, $post;
    if (is_singular()) {
        $page_URL = get_permalink($post->ID);
    } else {
        $page_URL = 'http';
        if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
            $pageURL .= "s";
        }
        $page_URL .= "://";
        if (isset($_SERVER["SERVER_PORT"]) && $_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
        } else {
            $page_URL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        }
    }
    if (is_user_logged_in()) {
        global $user_ID;
        $user_data = get_userdata($user_ID);
    }
    ob_start();
    ?>
		
		<?php 
    if (edd_get_cart_contents()) {
        ?>
				
			<?php 
        do_action('edd_before_checkout_cart');
        edd_checkout_cart();
        do_action('edd_after_checkout_cart');
        ?>
			
			<div id="edd_checkout_form_wrap" class="edd_clearfix">
			
				<?php 
        do_action('edd_checkout_form_top');
        $gateways = edd_get_enabled_payment_gateways();
        $show_gateways = false;
        if (count($gateways) > 1 && !isset($_GET['payment-mode'])) {
            $show_gateways = true;
            if (edd_get_cart_amount() <= 0) {
                $show_gateways = false;
            }
        }
        if ($show_gateways) {
            ?>
					<?php 
            do_action('edd_payment_mode_top');
            ?>
					<form id="edd_payment_mode" action="<?php 
            echo $page_URL;
            ?>
" method="GET">
						<fieldset id="edd_payment_mode_select">
							<?php 
            do_action('edd_payment_mode_before_gateways');
            ?>
							<p id="edd-payment-mode-wrap">
								<?php 
            echo '<select class="edd-select" name="payment-mode" id="edd-gateway">';
            foreach ($gateways as $gateway_id => $gateway) {
                echo '<option value="' . $gateway_id . '">' . $gateway['checkout_label'] . '</option>';
            }
            echo '</select>';
            echo '<label for="edd-gateway">' . __('Choose Your Payment Method', 'edd') . '</label>';
            ?>
							</p>
							<?php 
            do_action('edd_payment_mode_after_gateways');
            ?>
						</fieldset>
						<fieldset id="edd_payment_mode_submit">
							<p id="edd-next-submit-wrap">
								<?php 
            $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'gray';
            ?>
 
								<span class="edd_button edd_<?php 
            echo $color;
            ?>
">
									<span class="edd_button_outer">
										<span class="edd_button_inner">
											<input type="submit" id="edd_next_button" class="edd_button_text edd-submit" value="<?php 
            _e('Next', 'edd');
            ?>
"/>
										</span>
									</span>
								</span>
							</p>
						</fieldset>
					</form>
					<?php 
            do_action('edd_payment_mode_bottom');
            ?>
			
				<?php 
        } else {
            ?>
		
					<?php 
            if (count($gateways) >= 1 && !isset($_GET['payment-mode'])) {
                foreach ($gateways as $gateway_id => $gateway) {
                    $enabled_gateway = $gateway_id;
                    if (edd_get_cart_amount() <= 0) {
                        $enabled_gateway = 'manual';
                        // this allows a free download by filling in the info
                    }
                }
            } else {
                if (edd_get_cart_amount() <= 0) {
                    $enabled_gateway = 'manual';
                } else {
                    $enabled_gateway = 'none';
                }
            }
            $payment_mode = isset($_GET['payment-mode']) ? urldecode($_GET['payment-mode']) : $enabled_gateway;
            ?>
					
					<?php 
            do_action('edd_before_purchase_form');
            ?>
					<form id="edd_purchase_form" action="<?php 
            echo $page_URL;
            ?>
" method="POST">					
					
						<?php 
            do_action('edd_purchase_form_top');
            ?>
					
						<?php 
            if (isset($edd_options['logged_in_only']) && !isset($edd_options['show_register_form'])) {
                if (is_user_logged_in()) {
                    $can_checkout = true;
                } else {
                    $can_checkout = false;
                }
            } elseif (isset($edd_options['show_register_form']) && isset($edd_options['logged_in_only'])) {
                $can_checkout = true;
            } elseif (!isset($edd_options['logged_in_only'])) {
                $can_checkout = true;
            }
            $can_checkout = true;
            if ($can_checkout) {
                ?>
							
							<?php 
                if (isset($edd_options['show_register_form']) && !is_user_logged_in() && !isset($_GET['login'])) {
                    ?>
								<div id="edd_checkout_login_register"><?php 
                    echo edd_get_register_fields();
                    ?>
</div>
							<?php 
                } elseif (isset($edd_options['show_register_form']) && !is_user_logged_in() && isset($_GET['login'])) {
                    ?>
								<div id="edd_checkout_login_register"><?php 
                    echo edd_get_login_fields();
                    ?>
</div>
							<?php 
                }
                ?>

							<?php 
                if (!isset($_GET['login']) && is_user_logged_in() || !isset($edd_options['show_register_form'])) {
                    ?>
											
							<fieldset id="edd_checkout_user_info">
								<legend><?php 
                    _e('Personal Info', 'edd');
                    ?>
</legend>
								<?php 
                    do_action('edd_purchase_form_before_email');
                    ?>
								<p id="edd-email-wrap">
									<input class="edd-input required" type="email" name="edd_email" placeholder="<?php 
                    _e('Email address', 'edd');
                    ?>
" id="edd-email" value="<?php 
                    echo is_user_logged_in() ? $user_data->user_email : '';
                    ?>
"/>
									<label class="edd-label" for="edd-email"><?php 
                    _e('Email Address', 'edd');
                    ?>
</label>
								</p>
								<?php 
                    do_action('edd_purchase_form_after_email');
                    ?>
								<p id="edd-first-name-wrap">
									<input class="edd-input required" type="text" name="edd_first" placeholder="<?php 
                    _e('First Name', 'edd');
                    ?>
" id="edd-first" value="<?php 
                    echo is_user_logged_in() ? $user_data->first_name : '';
                    ?>
"/>
									<label class="edd-label" for="edd-first"><?php 
                    _e('First Name', 'edd');
                    ?>
</label>
								</p>
								<p id="edd-last-name-wrap">
									<input class="edd-input" type="text" name="edd_last" id="edd-last" placeholder="<?php 
                    _e('Last name', 'edd');
                    ?>
" value="<?php 
                    echo is_user_logged_in() ? $user_data->last_name : '';
                    ?>
"/>
									<label class="edd-label" for="edd-last"><?php 
                    _e('Last Name', 'edd');
                    ?>
</label>
								</p>	
								<?php 
                    do_action('edd_purchase_form_user_info');
                    ?>
							</fieldset>	
							
							<?php 
                    do_action('edd_purchase_form_after_user_info');
                    ?>

							<?php 
                }
                ?>
							
							<?php 
                if (edd_has_active_discounts()) {
                    // only show if we have at least one active discount
                    ?>
								<fieldset id="edd_discount_code">
									<p id="edd-discount-code-wrap">
										<input class="edd-input" type="text" id="edd-discount" name="edd-discount" placeholder="<?php 
                    _e('Enter discount', 'edd');
                    ?>
"/>
										<label class="edd-label" for="edd-discount">
											<?php 
                    _e('Discount', 'edd');
                    ?>
											<?php 
                    if (edd_is_ajax_enabled()) {
                        ?>
												- <a href="#" class="edd-apply-discount"><?php 
                        _e('Apply Discount', 'edd');
                        ?>
</a>
											<?php 
                    }
                    ?>
										</label>
									</p>
								</fieldset>	
							<?php 
                }
                ?>

							<?php 
                // load the credit card form and allow gateways to load their own if they wish
                if (has_action('edd_' . $payment_mode . '_cc_form')) {
                    do_action('edd_' . $payment_mode . '_cc_form');
                } else {
                    do_action('edd_cc_form');
                }
                ?>
			
							
							<?php 
                if (isset($edd_options['show_agree_to_terms'])) {
                    ?>
								<fieldset id="edd_terms_agreement">
									<p>
										<div id="edd_terms" style="display:none;">
											<?php 
                    do_action('edd_before_terms');
                    echo wpautop($edd_options['agree_text']);
                    do_action('edd_after_terms');
                    ?>
										</div>
										<div id="edd_show_terms">
											<a href="#" class="edd_terms_links"><?php 
                    _e('Show Terms', 'edd');
                    ?>
</a>
											<a href="#" class="edd_terms_links" style="display:none;"><?php 
                    _e('Hide Terms', 'edd');
                    ?>
</a>
										</div>
										<input name="edd_agree_to_terms" class="required" type="checkbox" id="edd_agree_to_terms" value="1"/>
										<label for="edd_agree_to_terms"><?php 
                    echo isset($edd_options['agree_label']) ? $edd_options['agree_label'] : __('Agree to Terms?', 'edd');
                    ?>
</label>
									</p>
								</fieldset>
							<?php 
                }
                ?>
	
							<fieldset id="edd_purchase_submit">
								<p>
									<?php 
                do_action('edd_purchase_form_before_submit');
                ?>
									<?php 
                if (is_user_logged_in()) {
                    ?>
									<input type="hidden" name="edd-user-id" value="<?php 
                    echo $user_data->ID;
                    ?>
"/>
									<?php 
                }
                ?>
									<input type="hidden" name="edd_action" value="purchase"/>
									<input type="hidden" name="edd-gateway" value="<?php 
                echo $payment_mode;
                ?>
" />
									<input type="hidden" name="edd-nonce" value="<?php 
                echo wp_create_nonce('edd-purchase-nonce');
                ?>
"/>
									<?php 
                $color = isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'gray';
                ?>
									<span class="edd_button edd_<?php 
                echo $color;
                ?>
">
										<span class="edd_button_outer">
											<span class="edd_button_inner">
												<?php 
                $complete_purchase = isset($edd_options['checkout_label']) && strlen(trim($edd_options['checkout_label'])) > 0 ? $edd_options['checkout_label'] : __('Purchase', 'edd');
                ?>
												<input type="submit" class="edd_button_text edd-submit" id="edd-purchase-button" name="edd-purchase" value="<?php 
                echo $complete_purchase;
                ?>
"/>
											</span>
										</span>
									</span>
									<?php 
                do_action('edd_purchase_form_after_submit');
                ?>
								</p>
								<?php 
                if (!edd_is_ajax_enabled()) {
                    ?>
									<p class="edd-cancel"><a href="javascript:history.go(-1)"><?php 
                    _e('Go back', 'edd');
                    ?>
</a></p>
								<?php 
                }
                ?>
				
							</fieldset>
						<?php 
            } else {
                ?>
							<p><?php 
                _e('You must be logged in to complete your purchase', 'edd');
                ?>
</p>
						<?php 
            }
            ?>
						<?php 
            do_action('edd_purchase_form_bottom');
            ?>
					</form>
					<?php 
            do_action('edd_after_purchase_form');
            ?>
			<?php 
        }
        ?>
		</div><!--end #edd_checkout_form_wrap-->
		<?php 
    } else {
        do_action('edd_empty_cart');
    }
    return ob_get_clean();
}