color_prefix = $style->scheme_to_prefix($this->option_default_filter('bluesquirrel_color_scheme')); } //Main function public function option_default_filter($option_name) { $value = get_option( $option_name , false ); $src = wp_parse_args( ($value === false) ? array() : array($option_name => $value,), $this->themeslug_get_option_defaults() ); //var_dump(get_theme_mods()); $validation = $this->options_validations(); $valide = $validation[$option_name]; $result = (in_array($option_name, array("bluesquirrel_theme_own_slider", "bluesquirrel_social"))) ? $this->$valide($src[$option_name]) : $valide($src[$option_name]); return $result; } //Prepage default values public function themeslug_get_option_defaults() { $helper = new \bluesquirrel\Helper(); $defaults = array( 'bluesquirrel_theme_list_image' => get_template_directory_uri().'/'.$this->color_prefix.'images/punkt_addit.png', 'bluesquirrel_theme_hang_image' => get_template_directory_uri().'/'.$this->color_prefix.'images/hang.png', 'bluesquirrel_theme_slider_button' => get_template_directory_uri().'/'.$this->color_prefix.'images/slider_button.png', 'bluesquirrel_theme_slider_button_active' => get_template_directory_uri().'/'.$this->color_prefix.'images/slider_button_active.png', 'bluesquirrel_theme_own_slider' => $helper->default_slider_settings(), 'bluesquirrel_number_first_menu' => 2, 'bluesquirrel_number_second_menu' => 15, 'bluesquirrel_first_menu_section_width' => 150, 'bluesquirrel_second_menu_section_width' => 120, 'bluesquirrel_logo' => get_template_directory_uri().'/'.$this->color_prefix.'images/logo.png', 'bluesquirrel_logo_use' => "0", 'bluesquirrel_hide_sidebar' => "0", 'bluesquirrel_insert_top' => "0", 'bluesquirrel_body_classes' => "", 'bluesquirrel_bs_is_excerpt' => "1", 'bluesquirrel_favicon' => get_template_directory_uri().'/'.$this->color_prefix.'images/favicon.ico', 'bluesquirrel_theme_slider_page' => '0:', 'bluesquirrel_is_attachment_directly_link' => "0", 'bluesquirrel_attachments_show' => "0", 'bluesquirrel_single_page_use' => "0", 'bluesquirrel_hide_comments' => "0", 'bluesquirrel_color_scheme' => "0", 'bluesquirrel_social' => array(), 'bluesquirrel_feature_image_show' => "0", 'bluesquirrel_active_slider' => "demo", 'bluesquirrel_lower_resolution_start_width' => "620" ); return apply_filters( 'themeslug_option_defaults', $defaults ); } //Slider validations public function slider_validation(&$slider) { if (!empty($slider)) { foreach ($slider as &$slide) { if (is_array($slide))$this->slider_validation($slide); else { $esc_slide = wp_kses_post($slide); if ($slide != $esc_slide)$slide = $esc_slide; } } } return $slider; } //Default Filter public function default_filter($val) { return esc_html($val); } //Functions for validation options public function options_validations() { $sanitize = array( 'bluesquirrel_theme_list_image' => 'esc_url', 'bluesquirrel_theme_hang_image' => 'esc_url', 'bluesquirrel_theme_slider_button' => 'esc_url', 'bluesquirrel_theme_slider_button_active' => 'esc_url', 'bluesquirrel_theme_own_slider' => 'slider_validation', 'bluesquirrel_number_first_menu' => 'intval', 'bluesquirrel_number_second_menu' => 'intval', 'bluesquirrel_first_menu_section_width' => 'intval', 'bluesquirrel_second_menu_section_width' => 'intval', 'bluesquirrel_logo' => 'esc_url', 'bluesquirrel_logo_use' => "esc_html", 'bluesquirrel_hide_sidebar' => "esc_html", 'bluesquirrel_insert_top' => "esc_html", 'bluesquirrel_body_classes' => "esc_attr", 'bluesquirrel_bs_is_excerpt' => "esc_html", 'bluesquirrel_favicon' => 'esc_url', 'bluesquirrel_theme_slider_page' => 'esc_html', 'bluesquirrel_is_attachment_directly_link' => 'esc_html', 'bluesquirrel_attachments_show' => "esc_html", 'bluesquirrel_single_page_use' => "esc_html", 'bluesquirrel_hide_comments' => "esc_html", 'bluesquirrel_color_scheme' => "esc_html", 'bluesquirrel_social' => 'slider_validation', 'bluesquirrel_feature_image_show' => "esc_html", 'bluesquirrel_active_slider' => "esc_html", 'bluesquirrel_lower_resolution_start_width' => "esc_attr" ); return $sanitize; } //Sane Default for mods public function option_default_mods() { $mods = get_theme_mods(); $src = wp_parse_args( $mods, $this->themeslug_get_mods_defaults() ); return $src; } //Mods default array public function mods_defs() { return array("0" => array( 'title_color' => '#ffffff', 'description_color' => '#cccccc', 'background_color' => '#e5fdfb', 'footer_background_color' => '#a3c2c2', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#e5fdfb', 'links_color' => '#036a73', 'hover_links_color' => '#012e32', 'visited_links_color' => '#04a0ae' ), //Dark Blue "1" => array( 'title_color' => '#ffffff', 'description_color' => '#cccccc', 'background_color' => '#316588', 'footer_background_color' => '#476b6b', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#316588', 'links_color' => '#036a73', 'hover_links_color' => '#012e32', 'visited_links_color' => '#04a0ae' ), //Pink "2" => array( 'title_color' => '#ffffff', 'description_color' => '#cccccc', 'background_color' => '#ffccf2', 'footer_background_color' => '#cc6699', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#ffccf2', 'links_color' => '#60203f', 'hover_links_color' => '#993364', 'visited_links_color' => '#391326' ), //Red "3" => array( 'title_color' => '#ffffff', 'description_color' => '#ffcccc', 'background_color' => '#ffcccc', 'footer_background_color' => '#ce6477', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#ffcccc', 'links_color' => '#ff0000', 'hover_links_color' => '#800000', 'visited_links_color' => '#cc0000' ), //Yellow "4" => array( 'title_color' => '#ffffff', 'description_color' => '#000', 'background_color' => '#fefbe4', 'footer_background_color' => '#c1bda4', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#fefbe4', 'links_color' => '#757202', 'hover_links_color' => '#333200', 'visited_links_color' => '#979202' ), //Green "5" => array( 'title_color' => '#ffffff', 'description_color' => '#000', 'background_color' => '#d7fbd0', 'footer_background_color' => '#66cc66', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#d7fbd0', 'links_color' => '#374f30', 'hover_links_color' => '#7ea871', 'visited_links_color' => '#162013' ), //Grey - Blue "6" => array( 'title_color' => '#ffffff', 'description_color' => '#000', 'background_color' => '#e5fdfb', 'footer_background_color' => '#a3c2c2', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#e5fdfb', 'links_color' => '#036a73', 'hover_links_color' => '#012e32', 'visited_links_color' => '#048995' ), //Yellow - Red "7" => array( 'title_color' => '#ffffff', 'description_color' => '#000', 'background_color' => '#fefbe4', 'footer_background_color' => '#c1bda4', 'background_repeat' => 'repeat', 'background_position_x' => 'left', 'background_image' => '', 'header_image' => '', 'background_attachment' => 'scroll', 'main_background_color' => '#fefbe4', 'links_color' => '#757202', 'hover_links_color' => '#333200', 'visited_links_color' => '#979202' ) ); } //Mods defaults values public function themeslug_get_mods_defaults() { $helper = new \bluesquirrel\Helper(); $defaults = $this->mods_defs(); //Blue return apply_filters( 'themeslug_mods_defaults', $defaults[$this->option_default_filter('bluesquirrel_color_scheme')] ); } //Mods defaults values for customizer public function get_mods_defaults() { $helper = new \bluesquirrel\Helper(); $defaults = $this->mods_defs(); return $defaults[$this->option_default_filter('bluesquirrel_color_scheme')]; } } ?>