Ejemplo n.º 1
0
 function avia_header_setting($single_val = false)
 {
     global $avia_config;
     if (isset($avia_config['header_settings']) && $single_val && isset($avia_config['header_settings'][$single_val])) {
         return $avia_config['header_settings'][$single_val];
     }
     if (isset($avia_config['header_settings']) && !$single_val) {
         return $avia_config['header_settings'];
     }
     //return cached header setting if available
     $defaults = array('header_position' => 'header_top', 'header_layout' => 'logo_left menu_right', 'header_size' => 'slim', 'header_custom_size' => '', 'header_sticky' => 'header_sticky', 'header_shrinking' => 'header_shrinking', 'header_title_bar' => '', 'header_social' => '', 'header_unstick_top' => '', 'header_secondary_menu' => '', 'header_stretch' => '', 'header_custom_size' => '', 'header_phone_active' => '', 'header_replacement_logo' => '', 'header_replacement_menu' => '', 'header_mobile_behavior' => '', 'header_searchicon' => true, 'header_mobile_activation' => 'mobile_menu_phone', 'phone' => '', 'sidebarmenu_sticky' => 'conditional_sticky', 'layout_align_content' => 'content_align_center', 'sidebarmenu_widgets' => '', 'sidebarmenu_social' => 'disabled', 'header_menu_border' => '', 'header_style' => '', 'blog_global_style' => '');
     $settings = avia_get_option();
     //overwrite with custom fields if they are set
     $post_id = avia_get_the_id();
     if ($post_id && is_singular()) {
         $custom_fields = get_post_custom($post_id);
         foreach ($defaults as $key => $default) {
             if (!empty($custom_fields[$key]) && !empty($custom_fields[$key][0])) {
                 $settings[$key] = $custom_fields[$key][0];
             }
         }
         //check if header transparency is set to true
         $transparency = post_password_required() ? false : get_post_meta($post_id, 'header_transparency', true);
     }
     $header = shortcode_atts($defaults, $settings);
     $header['header_scroll_offset'] = avia_get_header_scroll_offset($header);
     //if sidebar main menu is active set the header accordingly and return the sidebar header
     if ($header['header_position'] != "header_top") {
         return avia_header_setting_sidebar($header, $single_val);
     }
     //------------------------------------------------------------------------------------------------------
     //------------------------------------------------------------------------------------------------------
     //if header main menu is above the logo set a var to indicate that and disable transparency and shrinking
     if (strpos($header['header_layout'], 'top_nav_header') !== false) {
         $header['header_menu_above'] = true;
         $header['header_shrinking'] = 'disabled';
         $transparency = false;
     }
     //set header transparency
     $header['header_transparency'] = "";
     if (!empty($transparency)) {
         $header['header_transparency'] = 'header_transparency';
     }
     if (!empty($transparency) && strpos($transparency, 'glass')) {
         $header['header_transparency'] .= ' header_glassy';
     }
     if (!empty($transparency) && strpos($transparency, 'hidden')) {
         $header['disabled'] = true;
     }
     if (!empty($transparency) && strpos($transparency, 'scrolldown')) {
         $header['header_transparency'] .= ' header_scrolldown';
         $header['header_sticky'] = 'header_sticky';
     }
     //deactivate title bar if header is transparent
     if (!empty($transparency)) {
         $header['header_title_bar'] = 'hidden_title_bar';
     }
     //sticky and shrinking are tied together
     if ($header['header_sticky'] == 'disabled') {
         $header['header_shrinking'] = 'disabled';
         $header['header_scroll_offset'] = 0;
     }
     //if the custom height is less than 70 shrinking doesnt really work
     if ($header['header_size'] == 'custom' && (int) $header['header_custom_size'] < 65) {
         $header['header_shrinking'] = 'disabled';
     }
     //create a header class so we can style properly
     $header_class_var = array('header_position', 'header_layout', 'header_size', 'header_sticky', 'header_shrinking', 'header_stretch', 'header_mobile_activation', 'header_transparency', 'header_searchicon', 'header_unstick_top', 'header_menu_border', 'header_style');
     $header['header_class'] = "";
     foreach ($header_class_var as $class_name) {
         if (!empty($header[$class_name])) {
             if ($header[$class_name] == "disabled") {
                 $header[$class_name] = $class_name . "_disabled";
             }
             $header['header_class'] .= " av_" . str_replace(' ', ' av_', $header[$class_name]);
         }
     }
     //set manual flag if we should display the top bar
     $header['header_topbar'] = false;
     if (strpos($header['header_social'], 'extra_header_active') !== false || strpos($header['header_secondary_menu'], 'extra_header_active') !== false || !empty($header['header_phone_active'])) {
         $header['header_topbar'] = 'header_topbar_active';
     }
     //set manual flag if the menu is at the bottom
     $header['bottom_menu'] = false;
     if (strpos($header['header_layout'], 'bottom_nav_header') !== false) {
         $header['bottom_menu'] = 'header_bottom_menu_active';
     } else {
         $header['header_class'] .= " av_bottom_nav_disabled ";
     }
     //header class that tells us to use the alternate logo
     if (!empty($header['header_replacement_logo'])) {
         $header['header_class'] .= " av_alternate_logo_active";
         if (is_numeric($header['header_replacement_logo'])) {
             $header['header_replacement_logo'] = wp_get_attachment_image_src($header['header_replacement_logo'], 'full');
             $header['header_replacement_logo'] = $header['header_replacement_logo'][0];
         }
     }
     //header class that tells us to use the alternate logo
     if (empty($header['header_menu_border'])) {
         $header['header_class'] .= " av_header_border_disabled";
     }
     $header = apply_filters('avf_header_setting_filter', $header);
     //make settings available globaly
     $avia_config['header_settings'] = $header;
     if (!empty($single_val) && isset($header[$single_val])) {
         return $header[$single_val];
     }
     return $header;
 }
Ejemplo n.º 2
0
            break;
        case '.socket_color':
            $output .= "\n\n\t\t\thtml, #scroll-top-link{ background-color: {$bg}; }\n\t\t\t#scroll-top-link{ color: {$color}; border:1px solid {$border}; }\n\t\t\t\n\t\t\t.html_stretched #wrap_all{\n\t\t\tbackground-color:{$bg};\n\t\t\t}\n\t\t\t";
            break;
    }
    //unset all vars with the help of variable vars :)
    foreach ($colors as $key => $val) {
        unset(${$key});
    }
}
//filter to plug in, in case a plugin/extension/config file wants to make use of it
$output = apply_filters('avia_dynamic_css_output', $output, $color_set);
######################################################################
# DYNAMIC ICONFONT CHARACTERS
######################################################################
//forum topic icons
$output .= "\n.bbp-topics .bbp-body .bbp-topic-title:before{ " . av_icon_css_string('one_voice') . " }\n.bbp-topics .bbp-body .topic-voices-multi .bbp-topic-title:before { " . av_icon_css_string('multi_voice') . " }\n.bbp-topics .bbp-body .super-sticky .bbp-topic-title:before { " . av_icon_css_string('supersticky') . " }\n.bbp-topics .bbp-body .sticky .bbp-topic-title:before { " . av_icon_css_string('sticky') . " }\n.bbp-topics .bbp-body .status-closed .bbp-topic-title:before { " . av_icon_css_string('closed') . " }\n.bbp-topics .bbp-body .super-sticky.status-closed .bbp-topic-title:before{ " . av_icon_css_string('supersticky_closed') . " }\n.bbp-topics .bbp-body .sticky.status-closed .bbp-topic-title:before{ " . av_icon_css_string('sticky_closed') . " }\n";
//layerslider nav icons
$output .= "\n#top .avia-layerslider .ls-nav-prev:before{  " . av_icon_css_string('prev_big') . " }\n#top .avia-layerslider .ls-nav-next:before{  " . av_icon_css_string('next_big') . " }\n#top .avia-layerslider .ls-nav-start:before, #top .avia_playpause_icon.av-play:before{ " . av_icon_css_string('play') . " }\n#top .avia-layerslider .ls-nav-stop:before, #top .avia_playpause_icon.av-pause:before{ " . av_icon_css_string('pause') . " }\n";
//image hover overlay icons
$output .= "\n.image-overlay .image-overlay-inside:before{ " . av_icon_css_string('ov_image') . " }\n.image-overlay.overlay-type-extern .image-overlay-inside:before{ " . av_icon_css_string('ov_external') . " }\n.image-overlay.overlay-type-video .image-overlay-inside:before{ " . av_icon_css_string('ov_video') . " }\n";
//lightbox next/prev icons
$output .= "\ndiv.avia-popup button.mfp-arrow:before\t\t{ " . av_icon_css_string('next_big') . " }\ndiv.avia-popup button.mfp-arrow-left:before { " . av_icon_css_string('prev_big') . "}\n";
######################################################################
# OUTPUT THE DYNAMIC CSS RULES
######################################################################
//compress output
$output = preg_replace('/\\r|\\n|\\t/', '', $output);
//todo: if the style are generated for the wordpress header call the generating script, otherwise create a simple css file and link to that file
$avia_config['style'] = array(array('key' => 'direct_input', 'value' => $output), array('key' => 'direct_input', 'value' => ".html_header_transparency #top .avia-builder-el-0 .container, .html_header_transparency #top .avia-builder-el-0 .slideshow_inner_caption{padding-top:" . avia_get_header_scroll_offset() . "px;}"), array('elements' => 'h1, h2, h3, h4, h5, h6, #top .title_container .main-title, tr.pricing-row td, #top .portfolio-title, .callout .content-area, .avia-big-box .avia-innerbox, .av-special-font, .av-current-sort-title', 'key' => 'google_webfont', 'value' => avia_get_option('google_webfont')), array('elements' => 'body', 'key' => 'google_webfont', 'value' => avia_get_option('default_font')), array('key' => 'direct_input', 'value' => avia_get_option('quick_css')));
do_action('ava_generate_styles', $options, $color_set, $styles);