function wpo_PluginOptionsSetDefaults() { $deprecated = null; $autoload = 'no'; if (get_option(OPTION_NAME_SCHEDULE) !== false) { // The option already exists, so we just update it. } else { // The option hasn't been added yet. We'll add it with $autoload set to 'no'. add_option(OPTION_NAME_SCHEDULE, 'false', $deprecated, $autoload); add_option(OPTION_NAME_LAST_OPT, 'Never', $deprecated, $autoload); add_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly', $deprecated, $autoload); // deactivate cron wpo_cron_deactivate(); } if (get_option(OPTION_NAME_RETENTION_ENABLED) !== false) { // } else { add_option(OPTION_NAME_RETENTION_ENABLED, 'false', $deprecated, $autoload); add_option(OPTION_NAME_RETENTION_PERIOD, '2', $deprecated, $autoload); } if (get_option(OPTION_NAME_ENABLE_ADMIN_MENU) !== false) { // } else { add_option(OPTION_NAME_ENABLE_ADMIN_MENU, 'false', $deprecated, $autoload); } // --------- if (get_option(OPTION_NAME_ENABLE_EMAIL) !== false) { // } else { add_option(OPTION_NAME_ENABLE_EMAIL, 'true', $deprecated, $autoload); } // --------- if (get_option(OPTION_NAME_ENABLE_EMAIL_ADDRESS) !== '') { // } else { add_option(OPTION_NAME_ENABLE_EMAIL_ADDRESS, get_bloginfo('admin_email'), $deprecated, $autoload); } if (get_option(OPTION_NAME_TOTAL_CLEANED) !== false) { // } else { add_option(OPTION_NAME_TOTAL_CLEANED, '0', $deprecated, $autoload); } if (get_option('wp-optimize-auto') !== false) { // The option already exists, so we just update it. } else { // 'revisions', 'drafts', 'spams', 'unapproved', 'transient', 'postmeta', 'tags' $new_options = array('revisions' => 'true', 'drafts' => 'true', 'spams' => 'true', 'unapproved' => 'false', 'transient' => 'false', 'postmeta' => 'false', 'tags' => 'false', 'optimize' => 'true'); update_option('wp-optimize-auto', $new_options); } // settings for main screen if (get_option('wp-optimize-settings') !== false) { // The option already exists, so we just update it. } else { // 'revisions', 'drafts', 'spams', 'unapproved', 'transient', 'postmeta', 'tags' $new_options_main = array('user-revisions' => 'true', 'user-drafts' => 'true', 'user-spams' => 'true', 'user-unapproved' => 'true', 'user-transient' => 'false', 'user-optimize' => 'true'); update_option('wp-optimize-settings', $new_options_main); } }
add_filter('cron_schedules', 'wpo_cron_update_sched'); } */ if (isset($_POST["schedule_type"])) { $schedule_type = $_POST['schedule_type']; update_option(OPTION_NAME_SCHEDULE_TYPE, $schedule_type); } else { update_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly'); } wpo_cron_activate(); add_action('wpo_cron_event2', 'wpo_cron_action'); wpo_debugLog('We are at setting page form submission and reached wpo_cron_activate()'); } else { update_option(OPTION_NAME_SCHEDULE, 'false'); update_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly'); wpo_cron_deactivate(); } if (isset($_POST["enable-retention"])) { $retention_period = $_POST['retention-period']; update_option(OPTION_NAME_RETENTION_ENABLED, 'true'); update_option(OPTION_NAME_RETENTION_PERIOD, $retention_period); } else { update_option(OPTION_NAME_RETENTION_ENABLED, 'false'); } if (isset($_POST["enable-admin-bar"])) { update_option(OPTION_NAME_ENABLE_ADMIN_MENU, 'true'); } else { update_option(OPTION_NAME_ENABLE_ADMIN_MENU, 'false'); } if (isset($_POST['wp-optimize-settings'])) { $new_options = $_POST['wp-optimize-auto'];
function wpo_admin_actions_remove() { wpo_cron_deactivate(); wpo_removeOptions(); }