function vtmin_validate_setup_input($input) { //did this come from on of the secondary buttons? $reset = !empty($input['options-reset']) ? true : false; $repair = !empty($input['rules-repair']) ? true : false; $nuke_rules = !empty($input['rules-nuke']) ? true : false; $nuke_cats = !empty($input['cats-nuke']) ? true : false; switch (true) { case $reset === true: //reset options $output = $this->vtmin_get_default_options(); //load up the defaults //as default options are set, no further action, just return return apply_filters('vtmin_validate_setup_input', $output, $input); break; case $repair === true: //repair rules $vtmin_nuke = new VTMIN_Rule_delete(); $vtmin_nuke->vtmin_repair_all_rules(); $output = get_option('vtmin_setup_options'); //fix 2-13-2013 - initialize output, otherwise all Options go away... break; case $nuke_rules === true: $vtmin_nuke = new VTMIN_Rule_delete(); $vtmin_nuke->vtmin_nuke_all_rules(); $output = get_option('vtmin_setup_options'); //fix 2-13-2013 - initialize output, otherwise all Options go away... break; case $nuke_cats === true: $vtmin_nuke = new VTMIN_Rule_delete(); $vtmin_nuke->vtmin_nuke_all_rule_cats(); $output = get_option('vtmin_setup_options'); //fix 2-13-2013 - initialize output, otherwise all Options go away... break; default: //standard update button hit... //$output = array(); $output = get_option('vtmin_setup_options'); //v1.06 foreach ($input as $key => $value) { if (isset($input[$key])) { $output[$key] = strip_tags(stripslashes($input[$key])); } // end if } // end foreach break; } /* alternative to add_settings_error $message = __('<strong>Please Download and/or Activate ' .$free_plugin_name.' (the Free version). </strong><br>It must be installed and active, before the Pro version can be activated. The Free version can be downloaded from ' . $free_plugin_download , 'vtminpro'); $admin_notices = '<div id="message" class="error fade" style="background-color: #FFEBE8 !important;"><p>' . $message . ' </p></div>'; add_action( 'admin_notices', create_function( '', "echo '$admin_notices';" ) ); */ //NO Object-based code on the apply_filters statement needed or wanted!!!!!!!!!!!!! return apply_filters('vtmin_validate_setup_input', $output, $input); }
function vtmin_uninstall_hook() { if (!defined('WP_UNINSTALL_PLUGIN')) { return; //exit (); } delete_option('vtmin_setup_options'); $vtmin_nuke = new VTMIN_Rule_delete(); $vtmin_nuke->vtmin_nuke_all_rules(); $vtmin_nuke->vtmin_nuke_all_rule_cats(); }