" class="button-primary" style="float:right;margin-top:10px" /> <input type="hidden" name="action" value="yiw-import-configuration" /> <input type="hidden" name="yiw-callback-save" value="yiw_panel_configuration_save" /> <small><?php _e('Put here the string for import all theme options and configure the theme in one step.', 'yiw'); ?> </small><div class="clearfix"></div> </div> </form> <div class="rm_option rm_input rm_textarea"> <?php $code = base64_encode(serialize(yiw_theme_options_from_db())); ?> <label for="import-theme-options"><?php _e('Export Theme Options', 'yiw'); ?> </label> <textarea name="import-theme-options" cols="" rows="" class="listdata form-input-tip"><?php echo $code; ?> </textarea> <small><?php _e('This is your theme options in one code string, that you can put in the "Import" textarea and restore the entire panel configuration.', 'yiw'); ?> </small><div class="clearfix"></div>
function yiw_panel_configuration_save() { if (isset($_REQUEST['action'])) { $tab = yiw_get_current_tab(); switch ($_REQUEST['action']) { case 'yiw-save-configuration': $configs = get_option('yiw_configs'); $actual_config = array(); if ($configs != false) { $configs = maybe_unserialize($configs); } else { $configs = array(); } $config_name = esc_attr($_REQUEST['new_configuration']); $config_slug = yiw_check_if_exists(sanitize_title($config_name), $configs, 'key'); $actual_config[$config_slug] = array('name' => $config_name, 'values' => yiw_theme_options_from_db()); // echo $config_slug; // yiw_debug( $configs ); die; update_option('yiw_configs', array_merge($configs, $actual_config)); $url = admin_url('themes.php') . "?page={$_GET['page']}&tab={$tab}&message=saved"; yiw_end_process($url, false); break; case 'yiw-apply-configuration': $configs = get_option('yiw_configs'); if (!$configs) { break; } $config_to_apply = esc_attr($_REQUEST['name_configuration']); yiw_update_theme_options($configs[$config_to_apply]['values']); $url = admin_url('themes.php') . "?page={$_GET['page']}&tab={$tab}&message=saved"; yiw_end_process($url, false); break; case 'yiw-delete-config': $configs = get_option('yiw_configs'); if ($configs != false) { $configs = maybe_unserialize($configs); } else { $configs = array(); } $to_delete = esc_attr($_REQUEST['id']); if (isset($configs[$to_delete])) { unset($configs[$to_delete]); } update_option('yiw_configs', $configs); $url = admin_url('themes.php') . "?page={$_GET['page']}&tab={$tab}&message=delete"; yiw_end_process($url, false); break; case 'yiw-import-configuration': if (!isset($_REQUEST['import-theme-options'])) { break; } $options = unserialize(base64_decode($_REQUEST['import-theme-options'])); yiw_update_theme_options($options); $url = admin_url('themes.php') . "?page={$_GET['page']}&tab={$tab}&message=delete"; yiw_end_process($url, false); break; } } }