/**
 * Adds scripts to the footer. Filters `wp_footer`.
 */
function hiilite_addfooter()
{
    $hiilite_settings = hiilite_read_options();
    $hiilite_other = stripslashes($hiilite_settings['hiilite_other']);
    if ('' != $hiilite_other) {
        echo $hiilite_other;
    }
}
/**
 * Add to Footer options.
 */
function hiilite_options()
{
    global $wpdb;
    $poststable = $wpdb->posts;
    $hiilite_settings = hiilite_read_options();
    if (isset($_POST['hiilite_save']) && check_admin_referer('hiilite-admin-options')) {
        $hiilite_settings['enable_plugin'] = isset($_POST['enable_plugin']) ? true : false;
        $hiilite_settings['disable_notice'] = isset($_POST['disable_notice']) ? true : false;
        $hiilite_settings['hiilite_other'] = $_POST['hiilite_other'];
        update_option('hiilite_settings', $hiilite_settings);
        $str = '<div id="message" class="updated fade"><p>' . __('Options saved successfully.', 'hiilite-admin') . '</p></div>';
        echo $str;
    }
    if (isset($_POST['hiilite_default']) && check_admin_referer('hiilite-admin-options')) {
        delete_option('hiilite_settings');
        $hiilite_settings = hiilite_default_options();
        update_option('hiilite_settings', $hiilite_settings);
        $str = '<div id="message" class="updated fade"><p>' . __('Options set to Default.', 'hiilite-admin') . '</p></div>';
        echo $str;
    }
    ?>

<div class="wrap">
	<h2><?php 
    _e("Hiilite Admin", 'hiilite-admin');
    ?>
</h2>
	<div id="poststuff">
	<div id="post-body" class="metabox-holder columns-2">
	<div id="post-body-content">
	  <form method="post" id="hiilite_options" name="hiilite_options" onsubmit="return checkForm()">
	    <div id="genopdiv" class="postbox"><div class="handlediv" title="<?php 
    _e('Click to toggle', 'hiilite-admin');
    ?>
"><br /></div>
	      <h3 class='hndle'><span><?php 
    _e('General options', 'hiilite-admin');
    ?>
</span></h3>
	      <div class="inside">
			<table class="form-table">
				<tr><th scope="row" style="background:#<?php 
    if ($hiilite_settings['enable_plugin']) {
        echo 'cfc';
    } else {
        echo 'fcc';
    }
    ?>
"><label for="enable_plugin">&nbsp;<?php 
    _e('Enable Footer Code:', 'hiilite-admin');
    ?>
</label></th>
					<td style="background:#<?php 
    if ($hiilite_settings['enable_plugin']) {
        echo 'cfc';
    } else {
        echo 'fcc';
    }
    ?>
"><input type="checkbox" name="enable_plugin" id="enable_plugin" <?php 
    if ($hiilite_settings['enable_plugin']) {
        echo 'checked="checked"';
    }
    ?>
 /></td>
				</tr>
				
				<tr><th scope="row" colspan="2"><?php 
    _e('HTML (no PHP) to add to <code>wp_footer</code>:', 'hiilite-admin');
    ?>
</th>
				</tr>
				<tr><td scope="row" colspan="2"><textarea name="hiilite_other" id="hiilite_other" rows="15" cols="80"><?php 
    echo stripslashes($hiilite_settings['hiilite_other']);
    ?>
</textarea></td>
				</tr>
			</table>
	      </div>
	    </div>
		<p>
		  <input type="submit" name="hiilite_save" id="hiilite_save" value="<?php 
    _e('Save Options', 'hiilite-admin');
    ?>
" class="button button-primary" />
		  <input type="submit" name="hiilite_default" id="hiilite_default" value="<?php 
    _e('Default Options', 'hiilite-admin');
    ?>
" class="button button-secondary" onclick="if ( ! confirm( '<?php 
    _e("Do you want to set options to Default?", 'hiilite-admin');
    ?>
' ) ) return false;" />
		</p>
		<?php 
    wp_nonce_field('hiilite-admin-options');
    ?>
	  </form>

	</div><!-- /post-body-content -->
	<div id="postbox-container-1" class="postbox-container">
	  <div id="side-sortables" class="meta-box-sortables ui-sortable">
		  <?php 
    hiilite_admin_side();
    ?>
	  </div><!-- /side-sortables -->
	</div><!-- /postbox-container-1 -->
	</div><!-- /post-body -->
	<br class="clear" />
	</div><!-- /poststuff -->
</div><!-- /wrap -->

<?php 
}