new structure based in Settings API

This commit is contained in:
Harald Milz 2019-03-27 21:29:59 +01:00
parent d19abb31c0
commit 153fb0981f

View file

@ -92,9 +92,9 @@ function gcal_import_activate()
*/ */
// Create some plugin options in wp_options if they don't exist already // Create some plugin options in wp_options if they don't exist already
add_option( '_gcal_geocoding', 'off', '', 'no' ); // off, official, inofficial, or OSM (experimental) // add_option( '_gcal_geocoding', 'off', '', 'no' ); // off, official, inofficial, or OSM (experimental)
add_option( '_gcal_apikey', '', '', 'no' ); // default empty // add_option( '_gcal_apikey', '', '', 'no' ); // default empty
add_option( '_gcal_interval', '5', '', 'no' ); // default 60 minutes // add_option( '_gcal_interval', '5', '', 'no' ); // default 60 minutes
// CREATE geocaching table if it does not exist already. // CREATE geocaching table if it does not exist already.
// the location field will be used only during development and debugging, and will be omitted in production. // the location field will be used only during development and debugging, and will be omitted in production.
@ -165,11 +165,12 @@ function gcal_import_uninstall()
$wpdb->query( "DROP TABLE IF EXISTS $table" ); $wpdb->query( "DROP TABLE IF EXISTS $table" );
} }
// and the options. // and the options.
$options = array( '_gcal_geocoding', '_gcal_apikey', '_gcal_interval' ); delete_option ( 'gcal_options' );
foreach ( $options AS $option ) { // $options = array( '_gcal_geocoding', '_gcal_apikey', '_gcal_interval' );
delete_option( $option ); // foreach ( $options AS $option ) {
} // delete_option( $option );
error_log ("gcal_import_uninstall finished"); // }
// error_log ("gcal_import_uninstall finished");
} }
register_uninstall_hook( __FILE__, 'gcal_import_uninstall' ); register_uninstall_hook( __FILE__, 'gcal_import_uninstall' );