function esu_deactivate() { delete_transient('esu_update_message'); if (get_option('easy_sign_up_delete_settings') != true) { return; } // don't delete // remove the plugin's default options from the database $defaults = esu_options_array(); //was EsuAdmin::esu_options_array(); foreach ($defaults as $default_array) { extract($default_array); delete_option($id); } // end first loop delete_option('esu_simple_data'); }
function esu_options_pg_html() { $e_options = esu_options_array(); // save plugin's options if (isset($_REQUEST['action']) && 'easy_sign_up_saved' == $_REQUEST['action']) { foreach ($e_options as $value) { $temp_val = isset($_REQUEST[$value['id']]) ? $_REQUEST[$value['id']] : ''; update_option($value['id'], $temp_val); } foreach ($e_options as $value) { if (isset($_REQUEST[$value['id']])) { switch ($value['type']) { case 'text': $text_update_value = sanitize_text_field($_REQUEST[$value['id']]); update_option($value['id'], $text_update_value); break; case 'hidden': $hidden_update_value = sanitize_text_field($_REQUEST[$value['id']]); update_option($value['id'], $hidden_update_value); break; case 'wp_editor': update_option($value['id'], $_REQUEST[$value['id']]); break; case 'textarea': $textarea_update_value = sanitize_text_field($_REQUEST[$value['id']]); update_option($value['id'], $textarea_update_value); break; default: update_option($value['id'], $_REQUEST[$value['id']]); break; } } else { delete_option($value['id']); } } } ?> <div class="wrap"> <h2><?php echo ESU_NAME; _e(" Options", 'easy-sign-up'); ?> </h2> <?php $this->esu_plug(); ?> <form method="post" action=""> <table class="form-table" id="easy_sign_up_form_table"> <?php foreach ($e_options as $value) { switch ($value['type']) { case 'hidden': ?> <input name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="<?php echo $value['type']; ?> " value="<?php if (get_option($value['id']) != "") { echo get_option($value['id']); } else { echo $value['std']; } ?> "> <?php break; case 'text': ?> <tr valign="top"> <th scope="row"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></th> <td> <input name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " class="<?php $class = isset($value['class']) ? $value['class'] : 'regular-text'; echo $class; ?> " type="<?php echo $value['type']; ?> " value="<?php if (get_option($value['id']) != "") { echo stripslashes(htmlentities(get_option($value['id']))); } else { echo $value['std']; } ?> " > <?php echo $value['desc']; ?> </td> </tr> <?php break; case 'wp_editor': ?> <tr valign="top"> <th scope="row"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></th> <td> <?php $esu_wysiwyg_options = array('media_buttons' => 0, 'teeny' => 1); $esu_wysiwyg_options = apply_filters('esu_wysiwyg_options_filter', $esu_wysiwyg_options); $esu_wysiwyg_options['textarea_name'] = $value['id']; $esu_wysiwyg_contents = get_option($value['id']) != "" ? stripslashes(get_option($value['id'])) : $value['std']; wp_editor($esu_wysiwyg_contents, $value['id'], $esu_wysiwyg_options); ?> <br> <?php echo $value['desc']; ?> </td> </tr> <?php break; case 'textarea': if (isset($_REQUEST['options'])) { $ta_options = $value['options']; } ?> <tr valign="top"> <th scope="row"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></th> <td> <textarea name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " class="widefat" cols="<?php echo $value['cols']; ?> " rows="<?php echo $value['rows']; ?> "><?php if (get_option($value['id']) != "") { echo stripslashes(get_option($value['id'])); } else { echo $value['std']; } ?> </textarea> <br> <?php echo $value['desc']; ?> </td> </tr> <?php break; case 'checkbox': if (isset($_REQUEST['options'])) { $ta_options = $value['options']; } ?> <tr valign="top"> <th scope="row"><label for="<?php echo $value['id']; ?> "><?php echo $value['name']; ?> </label></th> <td> <?php if (get_option($value['id']) == true) { $ischecked = 'checked="checked"'; } else { $ischecked = ''; } ?> <input name="<?php echo $value['id']; ?> " id="<?php echo $value['id']; ?> " type="checkbox" value="true" <?php echo $ischecked; ?> > <?php echo $value['desc']; ?> </td> </tr> <?php break; case 'nothing': $ta_options = $value['options']; ?> </table> <?php echo $value['desc']; ?> <table class="form-table"> <?php break; default: break; } } ?> <tr valign="top"> <th scope="row"> </th> <td> <p class="submit"> <input type="hidden" name="action" value="easy_sign_up_saved" > <input class="button-primary" name="save" type="submit" value="<?php _e('Save Your Changes', 'easy-sign-up'); ?> " > </p> </td> </tr> </table> </form> <!-- END WRAP --> <?php }