$value ) {
$input[$id][$key] = false;
}
}
// Apply filters
if (isset($input[$id])) {
if (has_filter('nimbus_filter_' . $option['type'])) {
$clean[$id] = apply_filters('nimbus_filter_' . $option['type'], $input[$id], $option);
} else {
$clean[$id] = $input[$id];
}
}
}
$alert = __('Options saved.', 'nimbus');
add_settings_error('nimbus-options', 'save_options', $alert, 'updated fade');
return $clean;
}
}
/* * *************************************************************************************************** */
// Return default options
/* * *************************************************************************************************** */
function nimbus_return_defaults() {
global $NIMBUS_OPTIONS_ARR;
$defaults_return = array();
$options = $NIMBUS_OPTIONS_ARR;
foreach ((array) $options as $option) {
if (!isset($option['id'], $option['default'])) {
continue;
}
$defaults_return[$option['id']] = $option['default'];
}
return $defaults_return;
}
/* * *************************************************************************************************** */
// Helper to return options.
/* * *************************************************************************************************** */
if (!function_exists('nimbus_get_option')) {
function nimbus_get_option($option_data, $default_data = false) {
global $NIMBUS_OPTIONS_ARR;
$options = get_option(THEME_OPTIONS);
$default_options = $NIMBUS_OPTIONS_ARR;
if (isset($options[$option_data])) {
return $options[$option_data];
} else {
$default = $default_options[$option_data]['default'];
return $default;
}
}
}
/* * *************************************************************************************************** */
// WP_head options.
/* * *************************************************************************************************** */
add_action('wp_head', 'nimbus_options_to_head');
function nimbus_options_to_head() {
global $NIMBUS_FONT_FACES, $NIMBUS_OPTIONS_ARR, $post;
$get_fonts = $NIMBUS_FONT_FACES;
$options = $NIMBUS_OPTIONS_ARR;
foreach ($options as $option) {
if (($option['type'] == "typography") || ($option['type'] == "font") || ($option['type'] == "face")) {
$$option['id'] = nimbus_get_option($option['id']);
}
}
$font_list = array();
foreach ($options as $option) {
if (($option['type'] == "typography") || ($option['type'] == "font") || ($option['type'] == "face")) {
$nimbus_get_face = nimbus_get_option($option['id']);
array_push($font_list, $nimbus_get_face['face']);
}
}
$filtered_font_list = array_unique($font_list);
foreach ($filtered_font_list as $key => $font) {
if(isset($get_fonts[$font])){
echo $get_fonts[$font]['import'];
echo "\n";
}
}
?>