/** * Imports the color scheme * Reads the color settings from colors.php and updates theme to database */ function swift_import_color_scheme() { if (isset($_POST['scheme'])) { $dir = get_template_directory() . '/colors/' . $_POST['scheme']; if (is_dir($dir)) { include $dir . '/colors.php'; global $swift_design_options, $swift_colors; foreach ($swift_colors as $key => $value) { $swift_design_options[$key] = $value; } $temp_options = get_option('SwiftOptions'); $temp_options['design_options'] = $swift_design_options; update_option('SwiftOptions', $temp_options); if (swift_write_file(TRUE)) { return; } } } }
/** * * Things to do when the theme is first installed */ function swift_on_activation() { if (is_admin() && isset($_GET['activated'])) { require_once get_template_directory() . '/lib/load-core.php'; swift_functions(); if (!get_option('SwiftOptions')) { global $swift_options_init; foreach ($swift_options_init as $option) { // Use in array and include custom_slider if (isset($option['datatype']) && $option['datatype'] != 'none') { $sanitized_options[$option['id']] = $option['default']; } } //update_option('swift_options',$sanitized_options); $temp['site_options'] = $sanitized_options; global $swift_design_options_init; foreach ($swift_design_options_init as $option) { if (isset($option['datatype']) && $option['datatype'] == 'font') { global $swift_font_defaults; $sanitized_options[$option['id'] . '_enable'] = $swift_font_defaults[$option['id'] . '_enable']; $sanitized_options[$option['id'] . '_family'] = $swift_font_defaults[$option['id'] . '_family']; $sanitized_options[$option['id'] . '_size'] = $swift_font_defaults[$option['id'] . '_size']; $sanitized_options[$option['id'] . '_size_unit'] = $swift_font_defaults[$option['id'] . '_size_unit']; $sanitized_options[$option['id'] . '_lh'] = $swift_font_defaults[$option['id'] . '_lh']; $sanitized_options[$option['id'] . '_lh_unit'] = $swift_font_defaults[$option['id'] . '_lh_unit']; $sanitized_options[$option['id'] . '_weight'] = $swift_font_defaults[$option['id'] . '_weight']; $sanitized_options[$option['id'] . '_transform'] = $swift_font_defaults[$option['id'] . '_transform']; $sanitized_options[$option['id'] . '_style'] = $swift_font_defaults[$option['id'] . '_style']; } elseif (isset($option['datatype']) && $option['datatype'] != 'none' && isset($option['default'])) { $sanitized_options[$option['id']] = $option['default']; } } $temp['design_options'] = $sanitized_options; update_option('SwiftOptions', $temp); } swift_write_file(true); //header('Location: ' . admin_url() . 'admin.php?page=swift-help'); } }