mirror of
https://github.com/10h30/woo-viet.git
synced 2026-07-11 18:56:13 +09:00
Add the new option "add_city" and better manage the options when upgrading
This commit is contained in:
+14
-2
@@ -7,7 +7,7 @@
|
||||
* Author URI: https://profiles.wordpress.org/htdat
|
||||
* Text Domain: woo-viet
|
||||
* Domain Path: /languages
|
||||
* Version: 1.2
|
||||
* Version: 1.2-dev
|
||||
* License: GPLv2+
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,10 @@ class WooViet {
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
),
|
||||
'add_city' =>
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
),
|
||||
'change_currency_symbol' =>
|
||||
array(
|
||||
'enabled' => 'yes',
|
||||
@@ -133,6 +137,12 @@ class WooViet {
|
||||
if ( 'yes' == $settings['add_province']['enabled'] ) {
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-provinces.php' );
|
||||
$this->Provinces = new WooViet_Provinces();
|
||||
|
||||
// Enable "Add cities for Vietnam" if the province option is selected.
|
||||
if ( 'yes' == $settings['add_city']['enabled'] ) {
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-cities.php' );
|
||||
new WooViet_Cities();
|
||||
}
|
||||
}
|
||||
|
||||
include( WOO_VIET_DIR . 'inc/class-wooviet-currency.php' );
|
||||
@@ -165,7 +175,9 @@ class WooViet {
|
||||
* @return array
|
||||
*/
|
||||
static function get_settings() {
|
||||
return get_option( 'woo-viet', self::$default_settings );
|
||||
$settings = get_option( 'woo-viet', self::$default_settings );
|
||||
$settings = wp_parse_args( $settings, self::$default_settings );
|
||||
return $settings;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user