| 1 |
<?php |
| 2 |
namespace StoreEngine\Admin; |
| 3 |
|
| 4 |
use StoreEngine\Admin\Settings\Base; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
class Settings { |
| 11 |
|
| 12 |
public static function init() { |
| 13 |
$self = new self(); |
| 14 |
$self->save_settings(); |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Load settings. |
| 19 |
* Load store settings in global variable as `$storeengine_settings` and `$storeengine_addons`. |
| 20 |
* use `Helper::get_settings()` to retrieve setting by settings name. |
| 21 |
* |
| 22 |
* @see \StoreEngine\Utils\Helper::get_settings() |
| 23 |
* |
| 24 |
* @since 1.6.4 |
| 25 |
* |
| 26 |
* @return void |
| 27 |
*/ |
| 28 |
public static function load_settings() { |
| 29 |
$GLOBALS['storeengine_settings'] = apply_filters( 'storeengine_settings', json_decode( get_option( STOREENGINE_SETTINGS_NAME, '{}' ) ) ); |
| 30 |
$GLOBALS['storeengine_addons'] = json_decode( get_option( STOREENGINE_ADDONS_SETTINGS_NAME, '{}' ) ); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Save base settings. |
| 35 |
* |
| 36 |
* @return void |
| 37 |
*/ |
| 38 |
public static function save_settings() { |
| 39 |
Base::save_settings(); |
| 40 |
self::load_settings(); |
| 41 |
} |
| 42 |
} |
| 43 |
|