Return to plugins page"); } } public static function deactivate() { // Needs to be a better system in place to handle this // Delete the 'blogs' rewrite rules, so a rebuild happens on next page load delete_option( 'rewrite_rules' ); delete_option(af_namespace() . '_rewrite_rules'); } public static function uninstall() { Options::remove(); delete_option(af_namespace() . '_ver'); if (get_option(af_namespace() . '_rewrite_rules')) { // Needs to be a better system in place to handle this // Delete the 'blogs' rewrite rules, so a rebuild happens on next page load delete_option( 'rewrite_rules' ); delete_option(af_namespace() . '_rewrite_rules'); } } public static function upgrade() { $db_version = get_option(af_namespace() . '_ver', ''); if (strcmp($db_version, af_version()) == 0) { return; } //else if (strcmp($dbversion, 'm.n.a') > 0) {... $options = Options::defaults(); $current_options = get_option(af_namespace() . '_options'); if (!is_array($current_options)) $current_options = array ( ); foreach ($options->names() as $key) { if (array_key_exists($key, $current_options)) { $options->$key = $current_options[$key]; } } $options->update(); update_option(af_namespace() . '_ver', af_version()); // updates are not common, assume the rewrite rules need to be flushed // mark for flush rewrite rules on next load by deleting option delete_option(af_namespace() . '_rewrite_rules'); } public static function update_rewrite_rules() { if (!get_option(af_namespace() . '_rewrite_rules')) { flush_rewrite_rules(); add_option(af_namespace() . '_rewrite_rules', 'current'); } } }