/**
  * 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']));
         }
     }
 }
/**
 * Get taxation rate
 *
 * @since 1.3.3
 * @param bool $country
 * @param bool $state
 * @return mixed|void
 */
function edd_get_tax_rate($country = false, $state = false)
{
    $rate = (double) edd_get_option('tax_rate', 0);
    $user_address = edd_get_customer_address();
    if (empty($country)) {
        if (!empty($_POST['billing_country'])) {
            $country = $_POST['billing_country'];
        } elseif (is_user_logged_in() && !empty($user_address)) {
            $country = $user_address['country'];
        }
        $country = !empty($country) ? $country : edd_get_shop_country();
    }
    if (empty($state)) {
        if (!empty($_POST['state'])) {
            $state = $_POST['state'];
        } elseif (!empty($_POST['card_state'])) {
            $state = $_POST['card_state'];
        } elseif (is_user_logged_in() && !empty($user_address)) {
            $state = $user_address['state'];
        }
        $state = !empty($state) ? $state : edd_get_shop_state();
    }
    if (!empty($country)) {
        $tax_rates = edd_get_tax_rates();
        if (!empty($tax_rates)) {
            // Locate the tax rate for this country / state, if it exists
            foreach ($tax_rates as $key => $tax_rate) {
                if ($country != $tax_rate['country']) {
                    continue;
                }
                if (!empty($tax_rate['global'])) {
                    if (!empty($tax_rate['rate'])) {
                        $rate = number_format($tax_rate['rate'], 4);
                    }
                } else {
                    if (empty($tax_rate['state']) || strtolower($state) != strtolower($tax_rate['state'])) {
                        continue;
                    }
                    $state_rate = $tax_rate['rate'];
                    if (0 !== $state_rate || !empty($state_rate)) {
                        $rate = number_format($state_rate, 4);
                    }
                }
            }
        }
    }
    if ($rate > 1) {
        // Convert to a number we can use
        $rate = $rate / 100;
    }
    return apply_filters('edd_tax_rate', $rate, $country, $state);
}
/**
 * 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();
}
Example #4
0
/**
 * Get system info
 *
 * @since       2.0
 * @access      public
 * @global      object $wpdb Used to query the database using the WordPress Database API
 * @global      array $edd_options Array of all EDD options
 * @return      string $return A string containing the info to output
 */
function edd_tools_sysinfo_get()
{
    global $wpdb, $edd_options;
    if (!class_exists('Browser')) {
        require_once EDD_PLUGIN_DIR . 'includes/libraries/browser.php';
    }
    $browser = new Browser();
    // Get theme info
    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 identify the hosting provider
    $host = edd_get_host();
    $return = '### Begin System Info ###' . "\n\n";
    // Start with the basics...
    $return .= '-- Site Info' . "\n\n";
    $return .= 'Site URL:                 ' . site_url() . "\n";
    $return .= 'Home URL:                 ' . home_url() . "\n";
    $return .= 'Multisite:                ' . (is_multisite() ? 'Yes' : 'No') . "\n";
    $return = apply_filters('edd_sysinfo_after_site_info', $return);
    // Can we determine the site's host?
    if ($host) {
        $return .= "\n" . '-- Hosting Provider' . "\n\n";
        $return .= 'Host:                     ' . $host . "\n";
        $return = apply_filters('edd_sysinfo_after_host_info', $return);
    }
    // The local users' browser information, handled by the Browser class
    $return .= "\n" . '-- User Browser' . "\n\n";
    $return .= $browser;
    $return = apply_filters('edd_sysinfo_after_user_browser', $return);
    // WordPress configuration
    $return .= "\n" . '-- WordPress Configuration' . "\n\n";
    $return .= 'Version:                  ' . get_bloginfo('version') . "\n";
    $return .= 'Language:                 ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
    $return .= 'Permalink Structure:      ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n";
    $return .= 'Active Theme:             ' . $theme . "\n";
    $return .= 'Show On Front:            ' . get_option('show_on_front') . "\n";
    // Only show page specs if frontpage is set to 'page'
    if (get_option('show_on_front') == 'page') {
        $front_page_id = get_option('page_on_front');
        $blog_page_id = get_option('page_for_posts');
        $return .= 'Page On Front:            ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n";
        $return .= 'Page For Posts:           ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n";
    }
    // Make sure wp_remote_post() is working
    $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';
    } else {
        $WP_REMOTE_POST = 'wp_remote_post() does not work';
    }
    $return .= 'Remote Post:              ' . $WP_REMOTE_POST . "\n";
    $return .= 'Table Prefix:             ' . 'Length: ' . strlen($wpdb->prefix) . '   Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n";
    $return .= 'WP_DEBUG:                 ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
    $return .= 'Memory Limit:             ' . WP_MEMORY_LIMIT . "\n";
    $return .= 'Registered Post Stati:    ' . implode(', ', get_post_stati()) . "\n";
    $return = apply_filters('edd_sysinfo_after_wordpress_config', $return);
    // EDD configuration
    $return .= "\n" . '-- EDD Configuration' . "\n\n";
    $return .= 'Version:                  ' . EDD_VERSION . "\n";
    $return .= 'Upgraded From:            ' . get_option('edd_version_upgraded_from', 'None') . "\n";
    $return .= 'Test Mode:                ' . (edd_is_test_mode() ? "Enabled\n" : "Disabled\n");
    $return .= 'Ajax:                     ' . (!edd_is_ajax_disabled() ? "Enabled\n" : "Disabled\n");
    $return .= 'Guest Checkout:           ' . (edd_no_guest_checkout() ? "Disabled\n" : "Enabled\n");
    $return .= 'Symlinks:                 ' . (apply_filters('edd_symlink_file_downloads', isset($edd_options['symlink_file_downloads'])) && function_exists('symlink') ? "Enabled\n" : "Disabled\n");
    $return .= 'Download Method:          ' . ucfirst(edd_get_file_download_method()) . "\n";
    $return .= 'Currency Code:            ' . edd_get_currency() . "\n";
    $return .= 'Currency Position:        ' . edd_get_option('currency_position', 'before') . "\n";
    $return .= 'Decimal Separator:        ' . edd_get_option('decimal_separator', '.') . "\n";
    $return .= 'Thousands Separator:      ' . edd_get_option('thousands_separator', ',') . "\n";
    $return = apply_filters('edd_sysinfo_after_edd_config', $return);
    // EDD pages
    $return .= "\n" . '-- EDD Page Configuration' . "\n\n";
    $return .= 'Checkout:                 ' . (!empty($edd_options['purchase_page']) ? "Valid\n" : "Invalid\n");
    $return .= 'Checkout Page:            ' . (!empty($edd_options['purchase_page']) ? get_permalink($edd_options['purchase_page']) . "\n" : "Unset\n");
    $return .= 'Success Page:             ' . (!empty($edd_options['success_page']) ? get_permalink($edd_options['success_page']) . "\n" : "Unset\n");
    $return .= 'Failure Page:             ' . (!empty($edd_options['failure_page']) ? get_permalink($edd_options['failure_page']) . "\n" : "Unset\n");
    $return .= 'Downloads Slug:           ' . (defined('EDD_SLUG') ? '/' . EDD_SLUG . "\n" : "/downloads\n");
    $return = apply_filters('edd_sysinfo_after_edd_pages', $return);
    // EDD gateways
    $return .= "\n" . '-- EDD Gateway Configuration' . "\n\n";
    $active_gateways = edd_get_enabled_payment_gateways();
    if ($active_gateways) {
        $default_gateway_is_active = edd_is_gateway_active(edd_get_default_gateway());
        if ($default_gateway_is_active) {
            $default_gateway = edd_get_default_gateway();
            $default_gateway = $active_gateways[$default_gateway]['admin_label'];
        } else {
            $default_gateway = 'Test Payment';
        }
        $gateways = array();
        foreach ($active_gateways as $gateway) {
            $gateways[] = $gateway['admin_label'];
        }
        $return .= 'Enabled Gateways:         ' . implode(', ', $gateways) . "\n";
        $return .= 'Default Gateway:          ' . $default_gateway . "\n";
    } else {
        $return .= 'Enabled Gateways:         None' . "\n";
    }
    $return = apply_filters('edd_sysinfo_after_edd_gateways', $return);
    // EDD Taxes
    $return .= "\n" . '-- EDD Tax Configuration' . "\n\n";
    $return .= 'Taxes:                    ' . (edd_use_taxes() ? "Enabled\n" : "Disabled\n");
    $return .= 'Tax Rate:                 ' . edd_get_tax_rate() * 100 . "\n";
    $return .= 'Display On Checkout:      ' . (!empty($edd_options['checkout_include_tax']) ? "Displayed\n" : "Not Displayed\n");
    $return .= 'Prices Include Tax:       ' . (edd_prices_include_tax() ? "Yes\n" : "No\n");
    $rates = edd_get_tax_rates();
    if (!empty($rates)) {
        $return .= 'Country / State Rates:    ' . "\n";
        foreach ($rates as $rate) {
            $return .= '                          Country: ' . $rate['country'] . ', State: ' . $rate['state'] . ', Rate: ' . $rate['rate'] . "\n";
        }
    }
    $return = apply_filters('edd_sysinfo_after_edd_taxes', $return);
    // EDD Templates
    $dir = get_stylesheet_directory() . '/edd_templates/*';
    if (is_dir($dir) && count(glob("{$dir}/*")) !== 0) {
        $return .= "\n" . '-- EDD Template Overrides' . "\n\n";
        foreach (glob($dir) as $file) {
            $return .= 'Filename:                 ' . basename($file) . "\n";
        }
        $return = apply_filters('edd_sysinfo_after_edd_templates', $return);
    }
    // WordPress active plugins
    $return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
    $plugins = get_plugins();
    $active_plugins = get_option('active_plugins', array());
    foreach ($plugins as $plugin_path => $plugin) {
        if (!in_array($plugin_path, $active_plugins)) {
            continue;
        }
        $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
    }
    $return = apply_filters('edd_sysinfo_after_wordpress_plugins', $return);
    // WordPress inactive plugins
    $return .= "\n" . '-- WordPress Inactive Plugins' . "\n\n";
    foreach ($plugins as $plugin_path => $plugin) {
        if (in_array($plugin_path, $active_plugins)) {
            continue;
        }
        $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
    }
    $return = apply_filters('edd_sysinfo_after_wordpress_plugins_inactive', $return);
    if (is_multisite()) {
        // WordPress Multisite active plugins
        $return .= "\n" . '-- Network Active Plugins' . "\n\n";
        $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 (!array_key_exists($plugin_base, $active_plugins)) {
                continue;
            }
            $plugin = get_plugin_data($plugin_path);
            $return .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
        }
        $return = apply_filters('edd_sysinfo_after_wordpress_ms_plugins', $return);
    }
    // Server configuration (really just versioning)
    $return .= "\n" . '-- Webserver Configuration' . "\n\n";
    $return .= 'PHP Version:              ' . PHP_VERSION . "\n";
    $return .= 'MySQL Version:            ' . $wpdb->db_version() . "\n";
    $return .= 'Webserver Info:           ' . $_SERVER['SERVER_SOFTWARE'] . "\n";
    $return = apply_filters('edd_sysinfo_after_webserver_config', $return);
    // PHP configs... now we're getting to the important stuff
    $return .= "\n" . '-- PHP Configuration' . "\n\n";
    $return .= 'Safe Mode:                ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n");
    $return .= 'Memory Limit:             ' . ini_get('memory_limit') . "\n";
    $return .= 'Upload Max Size:          ' . ini_get('upload_max_filesize') . "\n";
    $return .= 'Post Max Size:            ' . ini_get('post_max_size') . "\n";
    $return .= 'Upload Max Filesize:      ' . ini_get('upload_max_filesize') . "\n";
    $return .= 'Time Limit:               ' . ini_get('max_execution_time') . "\n";
    $return .= 'Max Input Vars:           ' . ini_get('max_input_vars') . "\n";
    $return .= 'Display Errors:           ' . (ini_get('display_errors') ? 'On (' . ini_get('display_errors') . ')' : 'N/A') . "\n";
    $return = apply_filters('edd_sysinfo_after_php_config', $return);
    // PHP extensions and such
    $return .= "\n" . '-- PHP Extensions' . "\n\n";
    $return .= 'cURL:                     ' . (function_exists('curl_init') ? 'Supported' : 'Not Supported') . "\n";
    $return .= 'fsockopen:                ' . (function_exists('fsockopen') ? 'Supported' : 'Not Supported') . "\n";
    $return .= 'SOAP Client:              ' . (class_exists('SoapClient') ? 'Installed' : 'Not Installed') . "\n";
    $return .= 'Suhosin:                  ' . (extension_loaded('suhosin') ? 'Installed' : 'Not Installed') . "\n";
    $return = apply_filters('edd_sysinfo_after_php_ext', $return);
    // Session stuff
    $return .= "\n" . '-- Session Configuration' . "\n\n";
    $return .= 'EDD Use Sessions:         ' . (defined('EDD_USE_PHP_SESSIONS') && EDD_USE_PHP_SESSIONS ? 'Enforced' : (EDD()->session->use_php_sessions() ? 'Enabled' : 'Disabled')) . "\n";
    $return .= 'Session:                  ' . (isset($_SESSION) ? 'Enabled' : 'Disabled') . "\n";
    // The rest of this is only relevant is session is enabled
    if (isset($_SESSION)) {
        $return .= 'Session Name:             ' . esc_html(ini_get('session.name')) . "\n";
        $return .= 'Cookie Path:              ' . esc_html(ini_get('session.cookie_path')) . "\n";
        $return .= 'Save Path:                ' . esc_html(ini_get('session.save_path')) . "\n";
        $return .= 'Use Cookies:              ' . (ini_get('session.use_cookies') ? 'On' : 'Off') . "\n";
        $return .= 'Use Only Cookies:         ' . (ini_get('session.use_only_cookies') ? 'On' : 'Off') . "\n";
    }
    $return = apply_filters('edd_sysinfo_after_session_config', $return);
    $return .= "\n" . '### End System Info ###';
    return $return;
}
 /**
  * Get the tax rates in correct format
  */
 private function get_tax_rates()
 {
     $edd_tax_rates = edd_get_tax_rates();
     $tax_rates = array();
     if (count($edd_tax_rates) > 0) {
         foreach ($edd_tax_rates as $tax_rate) {
             $tax_rates[$tax_rate['country']] = $tax_rate['rate'];
         }
     }
     return $tax_rates;
 }
Example #6
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 
}