/** * Save customize Settings * @return none */ function st_customize_save($obj) { $st_default_lang_code = get_bloginfo('language'); // DO NOT REMOVE if (st_is_wpml()) { $langs = array(); $langs = icl_get_languages('skip_missing=0'); // sync preview for all langs foreach ($langs as $l) { $st_options = __st_preview_options(get_option(ST_SETTINGS_OPTION . '_' . $l['language_code'], array()), $_POST['customized']); update_option(ST_SETTINGS_OPTION . '_' . $l['language_code'], $st_options); } $st_options = __st_preview_options(get_option(ST_SETTINGS_OPTION, array()), $_POST['customized']); update_option(ST_SETTINGS_OPTION, $st_options); } else { // default settings $st_options = __st_preview_options(get_option(ST_SETTINGS_OPTION, array()), $_POST['customized']); update_option(ST_SETTINGS_OPTION, $st_options); } }
/** * load options * @return array(); */ function __st_get_options() { // $st_default_lang_code = get_bloginfo('language'); // DO NOT REMOVE if (st_is_wpml()) { $st_same_settings = get_option('st_same_lang_settings', 'y'); // reload options for current language if ($st_same_settings == 'y') { $st_options = get_option(ST_SETTINGS_OPTION, array()); } else { $st_options = get_option(ST_SETTINGS_OPTION . '_' . ICL_LANGUAGE_CODE, array()); if (empty($st_options)) { $st_options = get_option(ST_SETTINGS_OPTION, array()); // default value } } } else { $st_options = get_option(ST_SETTINGS_OPTION, array()); } // if is priview and user can edit theme options if (isset($_POST['wp_customize']) && $_POST['wp_customize'] == 'on' && current_user_can('edit_theme_options')) { $st_options = __st_preview_options($st_options, $_POST['customized']); } return $st_options; }