<div class="wrap">
	<h2><?php echo($GLOBALS['title']); ?></h2>

	<?php include(WP_PLUGIN_DIR . '/sj-object-cache/pages/header.php'); ?>

	<form method="post" action="<?php echo esc_attr(admin_url('admin-post.php')); ?>">
		<table class="widefat">
			<tbody>
				<tr>
					<th scope="row"><label for="sjfc_enabled"><?php _e('Enable WordPress Object Cache', 'sjobjectcache'); ?></label></th>
					<td><input type="checkbox" id="sjfc_enabled" name="options[enabled]" value="1"<?php checked(1, $params['enabled']); ?>/></td>
					<td>
						<strong><?php _e('Disabling WordPress Object Cache can make WordPress crawl!', 'sjobjectcache') ?></strong><br/>
						<?php _e("If you disable WordPress Object Cache, caching will be completely disabled, and WordPress will have to use the database every time it needs data. This is really slow.", 'sjobjectcache') ?>
						<?php _e("This can be useful only if you are a WordPress developer.", 'sjobjectcache'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="sjfc_persist"><?php _e('Save cached data across sessions', 'sjobjectcache'); ?></label></th>
					<td><input type="checkbox" id="sjfc_persist" name="options[persist]" value="1"<?php checked(1, $params['persist']); ?>/></td>
					<td>
						<?php _e("If this option is set, SJ Object Cache will maintain its cache between sessions to improve overall performance. Actually, this is what this plugin was made for and we strongly recommend that you do not turn this option off.", 'sjobjectcache'); ?><br/>
						<small><?php _e("<strong>Boring technical details:</strong> SJ Object Cache will save only those data that were not marked as 'non-persistent'.", 'sjobjectcache'); ?></small>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="sjfc_engine"><?php _e('Cache engine', 'sjobjectcache'); ?></label></th>
					<td>
						<select id="sjfc_path" name="options[engine]">
						<?php foreach ($params['modules'] as $key => $val) : ?>
							<option value="<?php echo esc_attr($key); ?>"<?php selected($params['engine'], $key); ?>><?php echo esc_attr($val[3]); ?></option>
						<?php endforeach; ?>
						</select>
					</td>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<th scope="row"><label for="sjfc_np"><?php _e('Non-persistent groups', 'sjobjectcache'); ?></label></th>
					<td><input type="text" id="sjfc_np" name="options[nonpersistent]" value="<?php echo esc_attr($params['nonpersistent']); ?>"/></td>
					<td>
						<?php _e("Comma separated list of the cache groups which should never be stored across sessions.", 'sjobjectcache'); ?>
					</td>
				</tr>
				<tr>
					<th scope="row"><label for="sjfc_ttl"><?php _e('Maximum TTL', 'sjobjectcache'); ?></label></th>
					<td><input type="text" id="sjfc_ttl" name="options[maxttl]" value="<?php echo esc_attr($params['maxttl']); ?>"/></td>
					<td>
						<?php _e("<code>0</code> is engine dependent and not recommended unless you have much memory allocated for the cache.", 'sjobjectcache'); ?>
					</td>
				</tr>
			</tbody>
		</table>

		<p class="submit">
			<?php wp_nonce_field('configure-objectcache'); ?>
			<input type="hidden" name="action" value="save_sjoc_generic_options"/>
			<input type="submit" name="submit" value="<?php esc_attr_e('Save Changes', 'sjobjectcache'); ?>" class="button button-primary"/>
		</p>
	</form>

	<form method="post" action="<?php echo esc_attr(admin_url('admin-post.php')); ?>">
		<p class="submit">
			<?php wp_nonce_field('purge-objectcache'); ?>
			<input type="hidden" name="action" value="purge_sjoc_cache"/>
			<input type="submit" name="purge" value="<?php esc_attr_e('Purge Cache', 'sjobjectcache'); ?>" class="button" onclick="return confirm('<?php _e("Are you sure?", 'sjobjectcache'); ?>')"/>
		</p>
	</form>
</div>
