function enlightenment_merge_theme_options($input) { global $enlightenment_theme_options_input; $enlightenment_theme_options_input = $input; $options = get_option('enlightenment_theme_options', enlightenment_default_theme_options()); return array_merge($options, $input); }
function enlightenment_theme_option($option, $default_value = null) { global $enlightenment_theme_options, $enlightenment_default_theme_options; if (!isset($enlightenment_theme_options)) { $enlightenment_theme_options = get_option('enlightenment_theme_options', enlightenment_default_theme_options()); } if (isset($enlightenment_theme_options[$option])) { $return = $enlightenment_theme_options[$option]; } else { if (!isset($enlightenment_default_theme_options)) { $enlightenment_default_theme_options = enlightenment_default_theme_options(); } if (isset($enlightenment_default_theme_options[$option])) { $return = $enlightenment_default_theme_options[$option]; } else { $return = $default_value; } } return apply_filters('enlightenment_theme_option-' . $option, $return); }
function enlightenment_enqueue_theme_options_font($option) { $default_options = enlightenment_default_theme_options(); if (enlightenment_theme_option($option . '_font_family') != $default_options[$option . '_font_family'] && array_key_exists(enlightenment_theme_option($option . '_font_family'), enlightenment_web_fonts())) { enlightenment_enqueue_font(enlightenment_theme_option($option . '_font_family'), array(enlightenment_theme_option($option . '_font_style'))); } }
function enlightenment_print_background_color_option($selector, $option, $echo = true) { $defaults = enlightenment_default_theme_options(); $output = ''; if (enlightenment_theme_option($option) != $defaults[$option]) { $output = "{$selector} {\n"; $output .= sprintf("\tbackground-color: %s;\n", enlightenment_theme_option($option)); $output .= "}\n"; } $output = apply_filters('enlightenment_print_color_option', $output); if (!$echo) { return $output; } echo $output; }
function enlightenment_print_background_color_option($selector, $option, $echo = true) { $default_options = enlightenment_default_theme_options(); if (!isset($default_options[$option])) { $default_options[$option] = false; } $defaults = apply_filters('enlightenment_print_background_color_option_settings_defaults', $default_options[$option], $selector, $option); $color = apply_filters('enlightenment_print_background_color_option_settings', enlightenment_theme_option($option), $selector, $option); $output = ''; if ($color != $defaults) { $output = "{$selector} {\n"; if (is_array($color)) { if (isset($color['transparent']) && $color['transparent']) { $output .= "\tbackground-color: transparent;\n"; } else { if (strlen($color['hex']) === 4) { list($r, $g, $b) = sscanf($color['hex'], "#%1x%1x%1x"); $r .= $r; $g .= $g; $b .= $b; } else { list($r, $g, $b) = sscanf($color['hex'], "#%2x%2x%2x"); } if (isset($color['alpha'])) { $a = absint($color['alpha']) / 100; } else { $a = 1; } $output .= "\tbackground-color: rgba({$r}, {$g}, {$b}, {$a});\n"; } } else { $output .= sprintf("\tbackground-color: %s;\n", esc_attr($color)); } $output .= "}\n"; } $output = apply_filters('enlightenment_print_color_option', $output); if (!$echo) { return $output; } echo $output; }
function enlightenment_unlimited_sidebars_print_background_color_option_settings_defaults($color, $selector, $option) { $default_options = enlightenment_default_theme_options(); $default_sidebars = isset($default_options['sidebars']) ? $default_options['sidebars'] : array(); if (array_key_exists($option, $default_sidebars)) { $color = $default_sidebars[$option]['widgets_background_color']; } else { $defaults = enlightenment_registered_sidebars_default_atts(); $color = $defaults['widgets_background_color']; } return $color; }