| @@ -1,57 +1,57 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace FL\Assistant\Helpers; | |
| 4 | - | |
| 5 | -class AstraSettingsHelper { | |
| 6 | - | |
| 7 | - /** | |
| 8 | - * @return array | |
| 9 | - */ | |
| 10 | - public static function export() { | |
| 11 | - $settings = []; | |
| 12 | - | |
| 13 | - // Customizer settings | |
| 14 | - if ( class_exists( '\Astra_Theme_Options' ) ) { | |
| 15 | - $settings['customizer']['astra-settings'] = \Astra_Theme_Options::get_options(); | |
| 16 | - } | |
| 17 | - | |
| 18 | - // Global color palette | |
| 19 | - if ( function_exists( 'astra_get_palette_colors' ) ) { | |
| 20 | - $settings['customizer']['astra-color-palettes'] = astra_get_palette_colors(); | |
| 21 | - } | |
| 22 | - | |
| 23 | - // Typography presets | |
| 24 | - if ( function_exists( 'astra_get_typography_presets' ) ) { | |
| 25 | - $settings['customizer']['astra-typography-presets'] = astra_get_typography_presets(); | |
| 26 | - } | |
| 27 | - | |
| 28 | - // Astra addons | |
| 29 | - if ( class_exists( '\Astra_Ext_Extension' ) ) { | |
| 30 | - $settings['addons'] = \Astra_Ext_Extension::get_enabled_addons(); | |
| 31 | - } | |
| 32 | - | |
| 33 | - return $settings; | |
| 34 | - } | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * @param array $settings | |
| 38 | - * @return void | |
| 39 | - */ | |
| 40 | - public static function import( $settings ) { | |
| 41 | - | |
| 42 | - // Astra addons | |
| 43 | - if ( class_exists( '\Astra_Admin_Helper' ) && isset( $settings['addons'] ) ) { | |
| 44 | - \Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $settings['addons'] ); | |
| 45 | - } | |
| 46 | - | |
| 47 | - // Clear Astra's cache | |
| 48 | - delete_option( 'astra-settings' ); | |
| 49 | - | |
| 50 | - // Customizer settings | |
| 51 | - if ( ! empty( $settings['customizer'] ) ) { | |
| 52 | - foreach ( $settings['customizer'] as $option => $value ) { | |
| 53 | - update_option( $option, $value ); | |
| 54 | - } | |
| 55 | - } | |
| 56 | - } | |
| 57 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace FL\Assistant\Helpers; | |
| 4 | + | |
| 5 | +class AstraSettingsHelper { | |
| 6 | + | |
| 7 | + /** | |
| 8 | + * @return array | |
| 9 | + */ | |
| 10 | + public static function export() { | |
| 11 | + $settings = []; | |
| 12 | + | |
| 13 | + // Customizer settings | |
| 14 | + if ( class_exists( '\Astra_Theme_Options' ) ) { | |
| 15 | + $settings['customizer']['astra-settings'] = \Astra_Theme_Options::get_options(); | |
| 16 | + } | |
| 17 | + | |
| 18 | + // Global color palette | |
| 19 | + if ( function_exists( 'astra_get_palette_colors' ) ) { | |
| 20 | + $settings['customizer']['astra-color-palettes'] = astra_get_palette_colors(); | |
| 21 | + } | |
| 22 | + | |
| 23 | + // Typography presets | |
| 24 | + if ( function_exists( 'astra_get_typography_presets' ) ) { | |
| 25 | + $settings['customizer']['astra-typography-presets'] = astra_get_typography_presets(); | |
| 26 | + } | |
| 27 | + | |
| 28 | + // Astra addons | |
| 29 | + if ( class_exists( '\Astra_Ext_Extension' ) ) { | |
| 30 | + $settings['addons'] = \Astra_Ext_Extension::get_enabled_addons(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + return $settings; | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * @param array $settings | |
| 38 | + * @return void | |
| 39 | + */ | |
| 40 | + public static function import( $settings ) { | |
| 41 | + | |
| 42 | + // Astra addons | |
| 43 | + if ( class_exists( '\Astra_Admin_Helper' ) && isset( $settings['addons'] ) ) { | |
| 44 | + \Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $settings['addons'] ); | |
| 45 | + } | |
| 46 | + | |
| 47 | + // Clear Astra's cache | |
| 48 | + delete_option( 'astra-settings' ); | |
| 49 | + | |
| 50 | + // Customizer settings | |
| 51 | + if ( ! empty( $settings['customizer'] ) ) { | |
| 52 | + foreach ( $settings['customizer'] as $option => $value ) { | |
| 53 | + update_option( $option, $value ); | |
| 54 | + } | |
| 55 | + } | |
| 56 | + } | |
| 57 | +} | |