<?php
$popup = array();
$popup = get_option('woo2app_popup');
if(!is_array($popup)){
	$popup = array();
	$popup['enable'] = false ;
	$popup['html'] = '' ;
	update_option('woo2app_popup' , $popup);
}
if (isset($_POST['woo2app-admin']) && wp_verify_nonce($_POST['woo2app-admin'], 'woo2app-admin') && isset($_POST['submit_popup'])) {
	$popup = array();
	$popup['enable'] = (isset($_POST['enable']) && $_POST['enable'] == 'on' ) ? true : false;
	$popup['html'] = $_POST['html'] ;
	update_option('woo2app_popup' , $popup);
}
?>
<h2>
	<?php _e('PopUp', 'woo2app'); ?>
</h2>
<form method="post">
	<?php wp_nonce_field('woo2app-admin', 'woo2app-admin'); ?>
    <table class="form-table ">
        <tbody>
        <tr valign="top" class="" >
            <th scope="row" class="titledesc">
                <label> <?php _e('Enable', 'woo2app'); ?></label>
            </th>
            <td class="forminp">
                <input type="checkbox" name="enable" <?= checked( $popup['enable']  );?> />
            </td>
        </tr>
        <tr valign="top" class="" >
            <th scope="row" class="titledesc">
                <label>  <?php _e('Content', 'woo2app'); ?> </label>
            </th>
            <td class="forminp">
				<?php
				wp_editor( stripcslashes($popup['html']),'html');
				?>
            </td>
        </tr>
        </tbody>
    </table>
    <input name="submit_popup" class="button button-primary" value="<?php _e('Save Change', 'woo2app'); ?>" type="submit">
</form>