<h3>Compatibility Test</h3>

<div id="self_test_container">
    <h4>Server Modules &amp; Resources:</h4>
    
    <div class="monospace">
    	PHP Version: 
        <?php if (PHP_VERSION >= 5): ?>
        <span class="w3tc-test-ok"><?php echo PHP_VERSION; ?></span>
        <?php else: ?> 
        <span class="w3tc-test-warn"><?php echo PHP_VERSION; ?> (Minify disabled)</span>;
        <?php endif; ?>
        <br />
        
    	PHP Timezone: 
        <?php if (ini_get('date.timezone')): ?>
        <span class="w3tc-test-ok">OK</span>
        <?php else: ?> 
        <span class="w3tc-test-error">Not set</span>
        <?php endif; ?>
        <br />
    
    	Web Server: 
        <?php if (stristr($_SERVER['SERVER_SOFTWARE'], 'apache') !== false): ?>
        <span class="w3tc-test-ok">Apache</span>
        <?php elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false): ?> 
        <span class="w3tc-test-warn">Lite Speed</span>
        <?php elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false): ?> 
        <span class="w3tc-test-warn">nginx</span>
        <?php elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false): ?> 
        <span class="w3tc-test-warn">lighttpd</span>
        <?php elseif (stristr($_SERVER['SERVER_SOFTWARE'], 'iis') !== false): ?> 
        <span class="w3tc-test-warn">Microsoft IIS</span>
        <?php else: ?>
        <span class="w3tc-test-error">Not detected</span>
        <?php endif; ?>
        <br />

    	FTP functions:
    	<?php if (function_exists('ftp_connect')): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
    	(required for Self-hosted (FTP) CDN support)
        <br />
        
    	Multibyte String support:
    	<?php if (function_exists('mb_substr')): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
    	(required for Rackspace Cloud Files support)
        <br />
    
    	cURL extension:
    	<?php if (function_exists('curl_init')): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
    	(required for Amazon S3 support)
        <br />
    
    	zlib extension:
    	<?php if (function_exists('gzencode')): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
    	(required for compression support)
        <br />
    
    	Opcode cache:
    	<?php if (function_exists('apc_store')): ?>
    	<span class="w3tc-test-ok">APC</span>
    	<?php elseif (function_exists('eaccelerator_put')): ?>
    	<span class="w3tc-test-ok">eAccelerator</span>
    	<?php elseif (function_exists('xcache_set')): ?>
    	<span class="w3tc-test-ok">XCache</span>
    	<?php elseif (PHP_VERSION >= 6): ?>
    	<span class="w3tc-test-ok">PHP6</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <br />
    
    	Memcache extension:
    	<?php if (class_exists('Memcache')): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <br />

    	Mime type detection:
    	<?php if (function_exists('finfo_open')): ?>
    	<span class="w3tc-test-ok">Fileinfo</span>
    	<?php elseif (function_exists('mime_content_type')): ?>
    	<span class="w3tc-test-warn">Mimetype</span>
    	<?php else:  ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <br />
    
    	Hash function:
    	<?php if (function_exists('hash')): ?>
    	<span class="w3tc-test-ok">hash</span>
    	<?php elseif (function_exists('mhash')): ?>
    	<span class="w3tc-test-warn">mhash</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
    	(required for NetDNA purge support)
        <br />
    
    	Safe mode:
    	<?php if (w3_to_boolean(ini_get('safe_mode'))): ?>
    	<span class="w3tc-test-warn">On</span>
    	<?php else: ?>
    	<span class="w3tc-test-ok">Off</span>
    	<?php endif; ?>
        <br />
    
    	Open basedir:
    	<?php $open_basedir = ini_get('open_basedir'); if ($open_basedir): ?>
    	<span class="w3tc-test-warn">On: <?php echo htmlspecialchars($open_basedir); ?></span>
    	<?php else: ?>
    	<span class="w3tc-test-ok">Off</span>
    	<?php endif; ?>
        <br />
    
    	zlib output compression:
    	<?php if (w3_to_boolean(ini_get('zlib.output_compression'))): ?>
    	<span class="w3tc-test-error">On</span>
    	<?php else: ?>
    	<span class="w3tc-test-ok">Off</span>
    	<?php endif; ?>
        <br />
        
        <?php 
        if (function_exists('apache_get_modules')): 
            $apache_modules = apache_get_modules(); 
        else: 
            $apache_modules = false; 
        endif; 
        ?>
    	mod_mime:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_mime', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
        <br />
		          
    	mod_expires:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_expires', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
        <br />

    	mod_deflate / mod_gzip:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_deflate', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
        <br />
    
    	mod_headers:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_headers', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
        <br />
    
    	mod_env:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_env', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
        <br />
    
    	mod_setenvif:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_setenvif', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
        <br />
    
    	mod_rewrite:
    	<?php if ($apache_modules): ?>
    	<?php if (in_array('mod_rewrite', $apache_modules)): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not installed</span>
    	<?php endif; ?>
        <?php else: ?>
    	<span class="w3tc-test-warn">Not detected</span>
        <?php endif; ?>
	</div>
	    
    <h4>WordPress Resources</h4>
    
    <div class="monospace">
    	<?php echo w3_path(WP_CONTENT_DIR); ?>:
    	<?php if (w3_is_writable_dir(WP_CONTENT_DIR)): ?>
    	<span class="w3tc-test-ok">Write-able</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not write-able</span>
    	<?php endif; ?>
    	<br />
        
        <?php 
        $home_root = w3_get_home_root();
        $htaccess_home_path = $home_root . '/.htaccess';
    	
        if (file_exists($htaccess_home_path)): ?>
        	<?php echo htmlspecialchars($htaccess_home_path); ?>
        	<?php if (w3_is_writable($htaccess_home_path)): ?>
        	<span class="w3tc-test-ok">Write-able</span>
        	<?php else: ?>
        	<span class="w3tc-test-error">Not write-able</span>
        	<?php endif; ?>
        <?php else: ?>
        	<?php echo htmlspecialchars($home_root); ?>
        	<?php if (w3_is_writable_dir($home_root)): ?>
        	<span class="w3tc-test-ok">Write-able</span>
        	<?php else: ?>
        	<span class="w3tc-test-error">Not write-able</span>
        	<?php endif; ?>
        <?php endif; ?>
        <br />
        
    	<?php
    	$document_root = w3_get_document_root(); 
    	$htaccess_docroot_path = $document_root . '/.htaccess'; 
    	
    	if ($document_root != $home_root): if (file_exists($htaccess_docroot_path)): ?>
        	<?php echo htmlspecialchars($htaccess_docroot_path); ?>
        	<?php if (w3_is_writable($htaccess_docroot_path)): ?>
        	<span class="w3tc-test-ok">Write-able</span>
        	<?php else: ?>
        	<span class="w3tc-test-error">Not write-able</span>
        	<?php endif; ?>
        <?php else: ?>
        	<?php echo htmlspecialchars($document_root); ?>
        	<?php if (w3_is_writable_dir($document_root)): ?>
        	<span class="w3tc-test-ok">Write-able</span>
        	<?php else: ?>
        	<span class="w3tc-test-error">Not write-able</span>
        	<?php endif; ?>
        <?php endif; ?><br /><?php endif; ?>
        
    	Uploads directory:
    	<?php $uploads_dir = @wp_upload_dir(); if (!empty($uploads_dir['error'])): ?>
    	<span class="w3tc-test-error">Error: <?php echo htmlspecialchars($uploads_dir['error']); ?></span>
    	<?php elseif (!w3_is_writable_dir($uploads_dir['path'])): ?>
    	<span class="w3tc-test-error">Not write-able</span>
    	<?php else: ?>
    	<span class="w3tc-test-ok">Write-able</span>
    	<?php endif; ?>
    	<br />
    
    	WP_CACHE define:
    	<?php if (defined('WP_CACHE') && WP_CACHE): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-error">Not defined</span>
    	<?php endif; ?>
    	<br />
    
    	Fancy permalinks:
    	<?php if (get_option('permalink_structure')): ?>
    	<span class="w3tc-test-ok">OK</span>
    	<?php else: ?>
    	<span class="w3tc-test-warn">Disabled</span>
    	<?php endif; ?>
    	<br />
    
    	Network mode:
    	<?php if (w3_is_multisite()): ?>
    	<span class="w3tc-test-ok">On</span>
    	<?php else: ?>
    	<span class="w3tc-test-ok">Off</span>
    	<?php endif; ?>
    	<br />
        
        <?php if (w3_is_multisite()): ?>
        	VHOST mode:
        	<?php if (w3_is_vhost()): ?>
        	<span class="w3tc-test-ok">On</span>
        	<?php else: ?>
        	<span class="w3tc-test-ok">Off</span>
        	<?php endif; ?>
        <?php endif; ?>
	</div>
	    
    <fieldset>
    	<legend>Legend</legend>
    
    	<p>
    		<span class="w3tc-test-ok">Green</span> - Good<br />
    		<span class="w3tc-test-warn">Orange</span> - OK<br />
    		<span class="w3tc-test-error">Red</span> - Bad<br />
    	</p>
    </fieldset>
    
    <p>
    	<input class="button-primary" type="button" value="Close" />
    </p>
</div>
