// needs a clear if not an img
            }
        }
        echo "\t\t</div><!-- #header-image -->\n";
    }
    // ! $really_hide
}
/* end hide-header-image */
if (weaverx_getopt('title_over_image')) {
    echo '</div><!--/#title-over-image -->' . "\n";
}
weaverx_header_widget_area('after_header');
// show header widget area if set to this position
/* ======== EXTRA HTML ======== */
$extra = weaverx_getopt('header_html_text');
$hide = weaverx_getopt_default('header_html_hide', 'hide-none');
if ($extra == '' && is_customize_preview()) {
    echo '<div id="header-html" style="display:inline;"></div>';
    // need the area there for customizer live preview
} else {
    if ($extra != '' && $hide != 'hide') {
        $c_class = weaverx_area_class('header_html', 'not-pad', '-none', 'margin-none');
        ?>
		<div id="header-html" class="<?php 
        echo $c_class;
        ?>
">
			<?php 
        echo do_shortcode($extra);
        ?>
		</div> <!-- #header-html -->
function weaverx_mainopts_general()
{
    $font_size = weaverx_getopt_default('site_fontsize_int', 16);
    $opts = array(array('type' => 'submit'), array('name' => __('Wrapping Areas', 'weaver-xtreme'), 'id' => '-admin-generic', 'type' => 'header', 'info' => __('Settings for wrapping areas', 'weaver-xtreme'), 'help' => 'help.html#GenApp'), array('name' => __('GLOBAL SETTINGS', 'weaver-xtreme'), 'type' => 'note', 'info' => __('These settings control site outer background and the standard link colors.', 'weaver-xtreme')), array('name' => __('Outside BG', 'weaver-xtreme'), 'id' => 'body_bgcolor', 'type' => 'ctext', 'info' => __('Background color that wraps entire page. (&lt;body&gt;) Using <em>Appearance->Background</em> will override this value, or allow a background image instead.', 'weaver-xtreme')), array('name' => __('Fade Outside BG', 'weaver-xtreme'), 'id' => 'fadebody_bg', 'type' => 'checkbox', 'info' => __('Will fade the Outside BG color, darker at top to lighter at bottom.', 'weaver-xtreme')), array('name' => __('Full Browser Height', 'weaver-xtreme'), 'id' => 'full_browser_height', 'type' => 'checkbox', 'info' => __('For short pages, add extra padding to bottom of content to force full browser height.', 'weaver-xtreme')), array('name' => __('Standard Links', 'weaver-xtreme'), 'id' => 'link', 'type' => 'link', 'info' => __('Global default for link colors (not including menus and titles). Set Bold, Italic, and Underline by setting those options for specific areas rather than globally to have more control.', 'weaver-xtreme')), array('name' => __('Current Base Font Size:', 'weaver-xtreme'), 'type' => 'note', 'info' => '<span style="font-size:' . $font_size . 'px;">' . $font_size . __('px.', 'weaver-xtreme') . '</span> ' . __('Change on Custom Tab', 'weaver-xtreme')), array('type' => 'submit'), array('name' => __('Wrapper Area', 'weaver-xtreme'), 'id' => 'wrapper', 'type' => 'widget_area_submit', 'info' => __('Wrapper wraps entire site (CSS id: #wrapper). Colors and font settings will be the default values for all other areas.', 'weaver-xtreme')), array('name' => __('Container Area', 'weaver-xtreme'), 'id' => 'container', 'type' => 'widget_area_submit', 'info' => __('Container (#container div) wraps content and sidebars.', 'weaver-xtreme')));
    ?>

   <div class="options-intro"><?php 
    _e('<strong>Wrapping Areas:</strong>
The options on this tab affect the overall site appearance.
The main <strong>Wrapper Area</strong> wraps the entire site, and is used to specify default text and background colors, site width, font families, and more.
With <em>Weaver Xtreme Plus</em>, you can also specify background images for various areas of your site.', 'weaver-xtreme');
    ?>
<div class="options-intro-menu"> <a href="#wrapping-areas"><?php 
    _e('Wrapping Areas', 'weaver-xtreme');
    ?>
</a> |
<a href="#wrapper-area"><?php 
    _e('Wrapper Area', 'weaver-xtreme');
    ?>
</a> |
<a href="#container-area"><?php 
    _e('Container Area', 'weaver-xtreme');
    ?>
</a> |
<a href="#background-images"><?php 
    _e('Background Image (X-Plus)', 'weaver-xtreme');
    ?>
</a>
</div>
</div>
<?php 
    weaverx_form_show_options($opts);
    do_action('weaverxplus_admin', 'general_appearance');
}
function weaverx_mce_css($default_style)
{
    /* replace the default editor-style.css with custom CSS generated on the fly by the php version */
    if (weaverx_getopt('_hide_editor_style')) {
        return $default_style;
    }
    $mce_css_file = trailingslashit(get_template_directory()) . 'editor-style-css.php';
    $mce_css_dir = trailingslashit(get_template_directory_uri()) . 'editor-style-css.php';
    if (!@file_exists($mce_css_file)) {
        // see if it is there
        return $default_style;
    }
    /* do we need to do anything about rtl? */
    /* if we have a custom style file, return that instead of the default */
    // Build the overrides
    $put = '?mce=1';
    // cheap way to start with ?
    if ($twidth = weaverx_getopt_default('theme_width_int', 940)) {
        /*  figure out a good width - we will please most of the users, most of the time
        		We're going to assume that mostly people will use the default layout -
        		we can't actually tell if the editor will be for a page or a post at this point.
        		And let's just assume the default sidebar widths.
        	*/
        $sb_layout = weaverx_getopt_default('layout_default', 'right');
        switch ($sb_layout) {
            case 'left':
            case 'left-top':
                $sb_width = weaverx_getopt_default('left_sb_width_int', 25);
                break;
            case 'split':
            case 'split-top':
                $sb_width = weaverx_getopt_default('left_split_sb_width_int', 25) + weaverx_getopt_default('right_split_sb_width_int', 25);
                break;
            case 'one-column':
                $sb_width = 0;
                break;
            default:
                // right
                $sb_width = weaverx_getopt_default('right_sb_width_int', 25);
                break;
        }
        $content_w = $twidth - $twidth * (double) ($sb_width / 95.0);
        // .95 by trial and error
        //  calculate theme width based on default layout and width of sidebars.
        $put .= '&twidth=' . urlencode($content_w);
    }
    //if (($val = weaverx_getopt('site_fontsize_int')))	// base font size
    //	$put .= '&fontsize=' . urlencode($val);
    if (($base_font_px = weaverx_getopt('site_fontsize_int')) == '') {
        $base_font_px = 16;
    }
    $base_font_px = (double) $base_font_px;
    $font_size = 'default';
    if (!is_page() && ($area_font = weaverx_getopt_default('post_font_size', 'default')) != 'default') {
        $font_size = $area_font;
    } else {
        if (($area_font = weaverx_getopt_default('content_font_size', 'default')) != 'default') {
            $font_size = $area_font;
        } else {
            if (($area_font = weaverx_getopt_default('container_font_size', 'default')) != 'default') {
                $font_size = $area_font;
            } else {
                if (($area_font = weaverx_getopt_default('wrapper_font_size', 'default')) != 'default') {
                    $font_size = $area_font;
                }
            }
        }
    }
    switch ($font_size) {
        // find conversion factor
        case 'xxs-font-size':
            $h_fontmult = 0.625;
            break;
        case 'xs-font-size':
            $h_fontmult = 0.75;
            break;
        case 's-font-size':
            $h_fontmult = 0.875;
            break;
        case 'l-font-size':
            $h_fontmult = 1.125;
            break;
        case 'xl-font-size':
            $h_fontmult = 1.25;
            break;
        case 'xxl-font-size':
            $h_fontmult = 1.5;
            break;
        default:
            $h_fontmult = 1;
            break;
    }
    $em_font_size = $base_font_px / 16.0 * $h_fontmult;
    $put .= '&fontsize=' . $em_font_size;
    $val = weaverx_getopt_default('content_font_family', 'default');
    if ($val == 'default') {
        $val = weaverx_getopt_default('container_font_family', 'default');
    }
    if ($val == 'default') {
        $val = weaverx_getopt('wrapper_font_family');
    }
    if ($val != 'default') {
        // found a font {
        // these are not translatable - the values are used to define the actual font definition
        $fonts = array('sans-serif' => 'Arial,sans-serif', 'arialBlack' => '"Arial Black",sans-serif', 'arialNarrow' => '"Arial Narrow",sans-serif', 'lucidaSans' => '"Lucida Sans",sans-serif', 'trebuchetMS' => '"Trebuchet MS", "Lucida Grande",sans-serif', 'verdana' => 'Verdana, Geneva,sans-serif', 'alegreya-sans' => "'Alegreya Sans', sans-serif", 'roboto' => "'Roboto', sans-serif", 'roboto-condensed' => "'Roboto Condensed', sans-serif", 'source-sans-pro' => "'Source Sans Pro', sans-serif", 'serif' => 'TimesNewRoman, "Times New Roman",serif', 'cambria' => 'Cambria,serif', 'garamond' => 'Garamond,serif', 'georgia' => 'Georgia,serif', 'lucidaBright' => '"Lucida Bright",serif', 'palatino' => '"Palatino Linotype",Palatino,serif', 'alegreya' => "'Alegreya', serif", 'roboto-slab' => "'Roboto Slab', serif", 'source-serif-pro' => "'Source Serif Pro', serif", 'monospace' => '"Courier New",Courier,monospace', 'consolas' => 'Consolas,monospace', 'inconsolata' => "'Inconsolata', monospace", 'roboto-mono' => "'Roboto Mono', sans-serif", 'papyrus' => 'Papyrus,cursive,serif', 'comicSans' => '"Comic Sans MS",cursive,serif', 'handlee' => "'Handlee', cursive", 'open-sans' => "'Open Sans', sans-serif", 'open-sans-condensed' => "'Open Sans Condensed', sans-serif", 'droid-sans' => "'Droid Sans', sans-serif", 'droid-serif' => "'Droid Serif', serif", 'exo-2' => "'Exo 2', sans-serif", 'lato' => "'Lato', sans-serif", 'lora' => "'Lora', serif", 'arvo' => "'Arvo', serif", 'archivo-black' => "'Archivo Black', sans-serif", 'vollkorn' => "'Vollkorn', serif", 'ultra' => "'Ultra', serif", 'arimo' => "'Arimo', serif", 'tinos' => "'Tinos', serif");
        if (isset($fonts[$val])) {
            $font = $fonts[$val];
        } else {
            $font = "Arial,'Helvetica Neue',Helvetica,sans-serif";
            // fallback
            // scan Google Fonts
            $gfonts = weaverx_getopt_array('fonts_added');
            if (!empty($gfonts)) {
                foreach ($gfonts as $gfont) {
                    $slug = sanitize_title($gfont['name']);
                    if ($slug == $val) {
                        $font = str_replace('font-family:', '', $gfont['family']);
                        //'Papyrus';
                        break;
                    }
                }
            }
        }
        $put .= '&fontfamily=' . urlencode($font);
    }
    /* need to handle bg color of content area - need to do the cascade yourself */
    if (($val = weaverx_getopt('editor_bgcolor')) && strcasecmp($val, 'transparent') != 0) {
        /* alt bg color */
        $put .= '&bg=' . urlencode($val);
    } else {
        if (($val = weaverx_getopt('content_bgcolor')) && strcasecmp($val, 'transparent') != 0) {
            /* #content */
            $put .= '&bg=' . urlencode($val);
        } else {
            if (($val = weaverx_getopt('container_bgcolor')) && strcasecmp($val, 'transparent') != 0) {
                /* #container */
                $put .= '&bg=' . urlencode($val);
            } else {
                if (($val = weaverx_getopt('wrapper_bgcolor')) && strcasecmp($val, 'transparent') != 0) {
                    /* #wrapper */
                    $put .= '&bg=' . urlencode($val);
                } else {
                    if (($name = weaverx_getopt('themename')) && strcasecmp($name, 'Transparent Dark') === 0) {
                        $put .= '&bg=' . urlencode('#222');
                    } else {
                        if (($name = weaverx_getopt('themename')) && strcasecmp($name, 'Transparent Light') === 0) {
                            $put .= '&bg=' . urlencode('#ccc');
                        }
                    }
                }
            }
        }
    }
    if ($val = weaverx_getopt('content_color')) {
        // text color
        $put .= '&textcolor=' . urlencode($val);
    } elseif ($val = weaverx_getopt('container_color')) {
        // text color
        $put .= '&textcolor=' . urlencode($val);
    } elseif ($val = weaverx_getopt('wrapper_color')) {
        // text color
        $put .= '&textcolor=' . urlencode($val);
    }
    if ($val = weaverx_getopt('input_bgcolor')) {
        // input area
        $put .= '&inbg=' . urlencode($val);
    }
    if ($val = weaverx_getopt('input_color')) {
        $put .= '&incolor=' . urlencode($val);
    }
    if ($val = weaverx_getopt('contentlink_color')) {
        // link
        $put .= '&a=' . urlencode($val);
    }
    if ($val = weaverx_getopt('contentlink_hover_color')) {
        $put .= '&ahover=' . urlencode($val);
    }
    if ($val = weaverx_getopt('weaverx_tables')) {
        // table type
        $put .= '&table=' . urlencode($val);
    }
    if ($val = weaverx_getopt('contentlist_bullet')) {
        // list bullet
        $put .= '&list=' . urlencode($val);
    }
    // images
    if ($val = weaverx_getopt('caption_color')) {
        // image caption, border color, width
        $put .= '&imgcapt=' . urlencode($val);
    }
    if ($val = weaverx_getopt('media_lib_border_color')) {
        $put .= '&imgbcolor=' . urlencode($val);
    }
    if ($val = weaverx_getopt('media_lib_border_int')) {
        $put .= '&imgbwide=' . urlencode($val);
    }
    return $default_style . ',' . $mce_css_dir . $put;
}
function weaverx_form_radio($value)
{
    ?>

	<tr>
	<th scope="row" align="right"><?php 
    weaverx_echo_name($value);
    ?>
:&nbsp;</th>
	<td colspan="2">

	<?php 
    $cur_val = weaverx_getopt_default($value['id'], 'black');
    foreach ($value['value'] as $option) {
        $desc = $option['val'];
        if ($desc == 'none') {
            $desc = "None";
        } else {
            $icon = weaverx_relative_url('assets/css/icons/search-' . $desc . '.png');
            $desc = '<img style="background-color:#ccc;height:24px; width:24px;" src="' . $icon . '" />';
        }
        ?>
		<input type="radio" name="<?php 
        weaverx_sapi_main_name($value['id']);
        ?>
" value="<?php 
        echo $option['val'];
        ?>
"
		<?php 
        checked($cur_val, $option['val']);
        ?>
 > <?php 
        echo $desc;
        ?>
&nbsp;
	<?php 
    }
    ?>
	<?php 
    echo '<br /><small style="margin-left:5%;">' . $value['info'] . '</small>';
    ?>
	</td>
	</tr>
<?php 
}
/**
 * Adds the classes to the widget in the front-end
 */
function weaverx_add_widget_classes($params)
{
    global $wp_registered_widgets;
    $arr_registered_widgets = wp_get_sidebars_widgets();
    // Get an array of ALL registered widgets
    $sb_id = $params[0]['id'];
    // Get the id for the current sidebar we're processing
    $widget_id = $params[0]['widget_id'];
    // add first, last, even, and odd, and widget classes
    $area_map = array('primary-widget-area' => 'primary', 'secondary-widget-area' => 'secondary', 'footer-widget-area' => 'footer', 'sitewide-top-widget-area' => 'top', 'page-top-widget-area' => 'top', 'postpages-widget-area' => 'top', 'blog-top-widget-area' => 'top', 'sitewide-bottom-widget-area' => 'bottom', 'page-bottom-widget-area' => 'bottom', 'blog-bottom-widget-area' => 'bottom', 'header-widget-area' => 'header_sb', 'footer-widget-area' => 'footer_sb', 'primary' => 'primary', 'secondary' => 'secondary', 'widget' => 'widget', 'header' => 'header_sb', 'footer' => 'footer_sb', 'top' => 'top', 'bottom' => 'bottom');
    $opt_name = 'widget';
    // default styling option name: widget-xxx
    $search_sb_id = $sb_id;
    if (weaverx_t_get('use_widget_area')) {
        // map from replacement area or [extra_widget_area]
        $search_sb_id = weaverx_t_get('use_widget_area');
    }
    foreach ($area_map as $area => $opt) {
        // need to find name to use for option values
        if ($search_sb_id == $area) {
            $opt_name = $opt;
            break;
        }
    }
    $cols = weaverx_getopt_default($opt_name . '_cols_int', 1);
    if ($cols > 8) {
        $cols = 8;
    }
    // sanity check
    $show_number = true;
    $show_evenodd = true;
    if (!isset($arr_registered_widgets[$sb_id]) || !is_array($arr_registered_widgets[$sb_id])) {
        return $params;
    }
    if (empty($GLOBALS['wvr_widget_number']) || !isset($GLOBALS['wvr_widget_number']) || !$GLOBALS['wvr_widget_number']) {
        // global to keep track of which widget this is
        $GLOBALS['wvr_widget_number'] = array();
    }
    if (isset($GLOBALS['wvr_widget_number'][$sb_id])) {
        // initialize or bump widget number
        $GLOBALS['wvr_widget_number'][$sb_id]++;
    } else {
        $GLOBALS['wvr_widget_number'][$sb_id] = 1;
    }
    $is_sidebar = in_array($sb_id, array('primary-widget-area', 'secondary-widget-area'));
    // this is a vertical widget
    $no_smart = weaverx_getopt($opt_name . '_no_widget_margins');
    $is_vert = $cols == 1;
    $per_row_tail = $is_vert || $no_smart ? ' ' : '-m ';
    $class = '';
    $sides = $is_sidebar ? '-b' : '-rb';
    $cur_widget = $GLOBALS['wvr_widget_number'][$sb_id];
    $widget_count = count($arr_registered_widgets[$sb_id]);
    $first = $cur_widget == 1;
    $last = $cur_widget == $widget_count;
    $def_bottom = 'margin-bottom';
    if ($opt_name == 'header_sb') {
        $def_bottom = 'no-margin-vertical ';
    }
    $area_class = weaverx_area_class('widget', 'not-pad', $sides, $def_bottom) . ' ';
    if ($area_class) {
        $class .= $area_class;
    }
    if (!$is_vert) {
        $class .= 'per-row-' . $cols . $per_row_tail;
        $end_of_row = $cur_widget % $cols == 0;
        if ($widget_count > 1 && !$end_of_row && !$no_smart) {
            $class .= 'smart-rm ';
        }
        if ($end_of_row) {
            $class .= 'end-of-row ';
        }
        if ($cur_widget % $cols == 1) {
            $class .= 'begin-of-row ';
        }
    }
    $class .= 'widget-' . $GLOBALS['wvr_widget_number'][$sb_id] . ' ';
    if ($is_vert) {
        $widget_first = 'widget-first widget-first-vert ';
        $widget_last = 'widget-last widget-last-vert ';
    } else {
        $widget_first = 'widget-first ';
        $widget_last = 'widget-last ';
    }
    if ($first) {
        $class .= $widget_first;
    }
    if ($last) {
        $class .= $widget_last;
    }
    if ($show_evenodd) {
        $widget_even = 'widget-even ';
        $widget_odd = 'widget-odd ';
        $class .= $cur_widget % 2 ? $widget_odd : $widget_even;
    }
    // need no-margin-bottom if $cols > 1
    $params[0]['before_widget'] = str_replace('">', ' ' . trim($class) . '">', $params[0]['before_widget']);
    $title_class = weaverx_title_class('widget_title', true);
    if ($title_class) {
        $params[0]['before_title'] = str_replace('">', ' ' . trim($title_class) . '">', $params[0]['before_title']);
    }
    return $params;
}
    function weaverx_fi($who, $where)
    {
        // Emit Featured Image depending on settings and who and where called from
        $hide = weaverx_getopt($who . '_fi_hide');
        if ($hide == 'hide' || weaverx_t_get('hide_featured_image') || !has_post_thumbnail()) {
            // hide all or no FI
            return false;
        }
        $show = '';
        if ($where != 'title_featured' && (weaverx_get_per_page_value('_pp_wvrx_pwp_type') == 'title' || weaverx_get_per_page_value('_pp_wvrx_pwp_type') == 'title_featured' || weaverx_t_get('show') == 'title' || weaverx_t_get('show') == 'title_featured')) {
            return false;
        } else {
            if ($where == 'title_featured') {
                $show = $where;
            }
        }
        if (!$show) {
            if ($who == 'page') {
                // || $who == 'post_full')
                $show = weaverx_get_per_page_value('_pp_fi_location');
            } else {
                if ($GLOBALS['weaverx_page_who'] == 'single') {
                    $show = weaverx_get_per_post_value('_pp_fi_location');
                }
            }
        }
        if (!$show) {
            $show = weaverx_getopt($who . '_fi_location');
        } else {
            if ($show == 'hide') {
                return false;
            }
        }
        $show_post = $who == 'post' && $show == $where;
        $align = $where == 'title_featured' ? 'fi-alignleft' : weaverx_getopt_default($who . '_fi_align', 'fi-alignleft');
        $before = '';
        if ($where == 'post-before') {
            $align .= '-pb';
            // need to be able to fixup alignment for small devices
            $before = '<div class="clear-post-before" style="clear:both;"></div>';
        }
        $fi_class = 'featured-image fi-' . $who . '-' . $where . ' ' . $hide . ' ' . $align;
        // construct fi class
        $attr = array('class' => $fi_class);
        // add width if defined
        $w = weaverx_getopt($who . '_fi_width');
        if ($w) {
            $attr['style'] = 'width:' . $w . '%';
        }
        if ($show == $where || $show_post) {
            if ($show == 'header-image') {
                // special case : header replacement area
                if (weaverx_getopt('link_site_image')) {
                    ?>
<a href="<?php 
                    echo esc_url(home_url('/'));
                    ?>
" title="<?php 
                    echo esc_attr(get_bloginfo('name', 'display'));
                    ?>
" rel="home">
			<?php 
                    the_post_thumbnail('full', $attr);
                    echo "</a>\n";
                } else {
                    the_post_thumbnail('full', $attr);
                }
                return true;
            }
            $size = weaverx_getopt_default($who . '_fi_size', 'thumbnail');
            // weaverx_debug_comment('FI who:' . $who . ' FI size:' . $size);
            if (get_post_thumbnail_id()) {
                if (($href = weaverx_get_per_post_value('_pp_fi_link')) == '') {
                    // per page link override?
                    if ($who == 'post_excerpt') {
                        $href = esc_url(get_permalink());
                    } else {
                        $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                        // (url, width, height)
                        $href = esc_url($image[0]);
                    }
                }
                echo "\n{$before}<a class=\"wvrx-fi-link\" href=\"{$href}\">";
                the_post_thumbnail($size, $attr);
                echo "</a>\n";
                return true;
            }
        }
    }
</footer><!-- #colophon -->
<?php 
    weaverx_clear_both('colophon');
}
// end if !hide_footer
do_action('weaverxplus_action', 'footer');
weaverx_inject_area('fixedbottom');
echo "</div><!-- /#wrapper --><div class='clear-wrapper-end' style='clear:both;'></div>\n";
weaverx_inject_area('postfooter');
// and this is the end options insertion
do_action('weaverxplus_action', 'postfooter');
echo "\n<a href=\"#page-top\" id=\"page-bottom\">&uarr;</a>\n";
if (!($content_h_ff = weaverx_getopt('content_h_font_family'))) {
    $content_h_ff = '0';
}
$font_size = weaverx_getopt_default('content_h_font_size', 'default');
switch ($font_size) {
    case 'xxs-font-size':
        $h_fontmult = 0.625;
        break;
    case 'xs-font-size':
        $h_fontmult = 0.75;
        break;
    case 's-font-size':
        $h_fontmult = 0.875;
        break;
    case 'l-font-size':
        $h_fontmult = 1.125;
        break;
    case 'xl-font-size':
        $h_fontmult = 1.25;
 function weaverx_generate_wphead()
 {
     /* this guy does ALL the work for generating theme look - it writes out the over-rides to the standard style.css */
     global $weaverx_main_options, $weaverx_cur_page_ID;
     global $post;
     $weaverx_cur_page_ID = 0;
     // need this for 404 page when this is not valid
     if (is_object($post)) {
         $weaverx_cur_page_ID = get_the_ID();
     }
     // we're on a page now, so set the post id for the rest of the session
     printf("\n<!-- This site is using %s %s (%s) subtheme: %s -->\n", WEAVERX_THEMENAME, WEAVERX_VERSION, weaverx_getopt('style_version'), weaverx_getopt('themename'));
     do_action('weaverxplus_show_version');
     if (weaverx_use_inline_css(weaverx_get_css_filename())) {
         // generate inline CSS
         echo '<style type="text/css">' . "\n";
         if (isset($_REQUEST['wp_customize'])) {
             // don't use cached CSS from customizer
             $css = '';
         } else {
             $css = weaverx_getopt_default('wvrx_css_saved', '');
         }
         if ($css == '' || $css[0] != '/') {
             // there isn't an entry in the DB, so do it on the fly
             require_once get_template_directory() . '/includes/generatecss.php';
             // include only now at runtime.
             $output = weaverx_f_open('php://output', 'w+');
             weaverx_output_style($output);
         } else {
             weaverx_echo_css($css);
         }
         echo "\n</style> <!-- end of main options style section -->\n";
     } else {
         // include generated file
         $vers = weaverx_getopt('style_version');
         if (!$vers) {
             $vers = '1';
         } else {
             $vers = sprintf("%d", $vers);
         }
         wp_enqueue_style('weaverxp-style-sheet', weaverx_get_css_url(), array('weaver-root-style-sheet'), $vers);
         wp_enqueue_style('weaverxp-style-sheet');
     }
     /* now head options */
     weaverx_echo_css(weaverx_getopt('_althead_opts'));
     weaverx_echo_css(weaverx_getopt('head_opts'));
     /* let the user have the last word! */
     $per_page_code = weaverx_get_per_page_value('page-head-code');
     if (!empty($per_page_code)) {
         weaverx_echo_css($per_page_code);
     }
     if (weaverx_is_checked_page_opt('_pp_hide_site_title')) {
         /* best to just do this inline */
         echo '<style type="text/css">#site-title,#site-tagline{display:none;}#nav-header-mini{margin-top:32px!important;}</style>' . "\n";
     }
     if ($ppsb = weaverx_get_per_page_value('_pp_sidebar_width') > 0) {
         require_once get_template_directory() . '/includes/generatecss.php';
         // include only now at runtime.
         $ppsb = weaverx_get_per_page_value('_pp_sidebar_width');
         echo "<style type=\"text/css\"> /* Per Page Sidebar Width */\n";
         weaverx_sidebar_style('echo', $ppsb);
         echo "</style>\n";
     }
     echo "\n<!-- End of Weaver Xtreme options -->\n";
 }
function wvrx_ts_sc_header_image($args = '')
{
    extract(shortcode_atts(array('style' => '', 'h' => '', 'w' => ''), $args));
    $hdr = get_header_image();
    if (!$hdr) {
        return '';
    }
    $hdr = str_replace(array('http://', 'https://'), '//', $hdr);
    $width = weaverx_getopt_default('theme_width_int', 1100);
    $custom_header_sizes = apply_filters('weaverx_custom_header_sizes', "(max-width: {$width}px) 100vw, 1920px");
    $width = $w ? $w : get_custom_header()->width;
    $height = $h ? $h : get_custom_header()->height;
    $st = $style ? ' style="' . $style . '"' : '';
    $srcset = esc_attr(wp_get_attachment_image_srcset(get_custom_header()->attachment_id));
    $sizes = esc_attr($custom_header_sizes);
    if (stripos($hdr, '.gif') !== false) {
        $hdrimg = '<img src="' . $hdr . '" width="' . $width . '" height="' . $height . '"' . $st . ' alt="' . esc_attr(get_bloginfo('name', 'display')) . '" />';
    } else {
        $hdrimg = '<img src="' . $hdr . '" srcset="' . $srcset . '" sizes="' . $sizes . '" width="' . $width . '" height="' . $height . '"' . $st . ' alt="' . esc_attr(get_bloginfo('name', 'display')) . '" />';
    }
    return $hdrimg;
}
function weaverx_header_widget_area($where_now)
{
    // header.php support
    // 'top' => 'Top of Header'
    // 'after_header' => 'After Header Image'
    // 'after_html' => 'After HTML Block'
    // 'after_menu' => 'After Main Menu'
    $sb_position = weaverx_getopt_default('header_sb_position', 'top');
    if ($sb_position == $where_now && weaverx_has_widgetarea('header-widget-area')) {
        $p_class = weaverx_area_class('header_sb', 'notpad', '-none', 'margin-none');
        //weaverx_clear_both('header_sb');
        weaverx_put_widgetarea('header-widget-area', $p_class, 'header');
        if (weaverx_getopt('header_sb_align') == 'float-right') {
            weaverx_clear_both('header-widget-area');
        }
    }
}
function weaverx_sidebar_style($sout, $override = 0)
{
    // allow per page sidebar width overrides
    $smart = weaverx_getopt_default('smart_margin_int', 1);
    if ($smart > 25) {
        $smart = 1;
    }
    // some sanity check
    if (!$override) {
        $l_sb_w = weaverx_getopt_default('left_sb_width_int', '25');
        $r_sb_w = weaverx_getopt_default('right_sb_width_int', '25');
        $ls_sb_w = weaverx_getopt_default('left_split_sb_width_int', '25');
        $rs_sb_w = weaverx_getopt_default('right_split_sb_width_int', '25');
    } else {
        $l_sb_w = $override;
        // using per page override - forces symmetrical split, but that's better than nothing
        $r_sb_w = $override;
        $ls_sb_w = $override;
        $rs_sb_w = $override;
    }
    // emit code for .is-desktop to resize widget areas (need .is-desktop to make IE8 work on free or in-line CSS)
    if ($r_sb_w != 25 || $smart != 1) {
        // changed right sidebar width (or smart width)
        $cw = 100 - $r_sb_w;
        $cw_m = $cw - $smart;
        $r_sb_m = $r_sb_w - $smart;
        weaverx_f_write($sout, sprintf(".is-desktop .l-content-rsb{width:%.5f%%;}.is-desktop .l-content-rsb-m{width:%.5f%%;margin-right:%.5f%%;}\n.is-desktop .l-sb-right{width:%.5f%%;}.is-desktop .l-sb-right-lm{width:%.5f%%;margin-left:%.5f%%;}.is-desktop .l-sb-right-rm {width:%.5f%%;margin-right:%.5f%%;}\n", $cw, $cw_m, $smart, $r_sb_w, $r_sb_m, $smart, $r_sb_m, $smart));
    }
    if ($l_sb_w != 25 || $smart != 1) {
        // changed left sidebar width
        $cw = 100 - $l_sb_w;
        $cw_m = $cw - $smart;
        $l_sb_m = $l_sb_w - $smart;
        weaverx_f_write($sout, sprintf(".is-desktop .l-content-lsb{width:%.5f%%;}.is-desktop .l-content-lsb-m{width:%.5f%%;margin-left:%.5f%%;}\n.is-desktop .l-sb-left{width:%.5f%%;}.is-desktop .l-sb-left-lm{width:%.5f%%;margin-left:%.5f%%;}.is-desktop .l-sb-left-rm {width:%.5f%%;margin-right:%.5f%%;}\n", $cw, $cw_m, $smart, $l_sb_w, $l_sb_m, $smart, $l_sb_m, $smart));
    }
    if ($ls_sb_w != 25 || $rs_sb_w != 25 || $smart != 1) {
        // changed a split width
        $cw = 100 - $ls_sb_w - $rs_sb_w;
        $lsb_margin = $cw + $rs_sb_w;
        $cw_l_m = $ls_sb_w + $smart;
        $cw_m = $cw - $smart - $smart;
        $l_m = $ls_sb_w - $smart;
        $r_m = $rs_sb_w - $smart;
        weaverx_f_write($sout, sprintf(".is-desktop .l-sb-right-split{width:%.5f%%}\n", $rs_sb_w) . sprintf(".is-desktop .l-sb-right-split-lm{width:%.5f%%;margin-left:%.5f%%;}\n", $rs_sb_w - $smart, $smart) . sprintf(".is-desktop .l-content-ssb{width:%.5f%%;margin-left:%.5f%%;}\n", $cw, $ls_sb_w) . sprintf(".is-desktop .l-content-ssb-m{width:%.5f%%;margin-left:%.5f%%;margin-right:%.5f%%;}\n", $cw - $smart - $smart, $ls_sb_w + $smart, $smart) . sprintf(".is-desktop .l-content-ssbs{width:%.5f%%;}\n", $cw) . sprintf(".is-desktop .l-content-ssbs-m{width:%.5f%%;margin-left:%.5f%%;margin-right:%.5f%%;}\n", $cw - $smart - $smart, $smart, $smart) . sprintf(".is-desktop .l-sb-left-split{margin-left:-%.5f%%;width:%.5f%%}\n", 100 - $rs_sb_w, $ls_sb_w) . sprintf(".is-desktop .l-sb-left-split-top{width:%.5f%%}\n", $ls_sb_w) . sprintf(".is-desktop .l-sb-left-split-rm{margin-left:-%.5f%%;width:%.5f%%}\n", 100 - $rs_sb_w, $ls_sb_w - $smart) . sprintf(".is-desktop .l-sb-left-split-top-rm {margin-right:%.5f%%;width:%.5f%%;}\n", $smart, $ls_sb_w - $smart));
    }
    if (!$override) {
        $sb_horizontal_areas = array('top' => '.widget-area-top', 'bottom' => '.widget-area-bottom', 'container' => '#container', 'footer' => '#colophon', 'footer_html' => '#footer-html', 'footer_sb' => '#footer-widget-area', 'alt:footer_sb' => '.widget-area-footer', 'header' => '#header', 'header_html' => '#header-html', 'header_sb' => '#header-widget-area', 'alt:header_sb' => '.widget-area-header', 'infobar' => '#infobar');
        foreach ($sb_horizontal_areas as $id => $tag) {
            // horizontal area widths
            $id = str_replace('alt:', '', $id);
            $w = weaverx_getopt($id . '_width_int');
            if ($w) {
                $ltag = str_replace('.', '.l-', $tag);
                weaverx_f_write($sout, "{$ltag}{width:{$w}%;}.is-phone {$ltag}{width:98%}\n");
            }
        }
    }
}
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which runs
  * before the init hook. The init hook is too late for some features, such as indicating
  * support post thumbnails.
  *
  * To override weaverx_setup() in a child theme, add your own weaverx_setup to your child theme's
  * functions.php file.
  *
  * @uses load_theme_textdomain() For translation/localization support.
  * @uses add_editor_style() To style the visual editor.
  * @uses add_theme_support() To add support for post thumbnails, automatic feed links, and Post Formats.
  * @uses register_nav_menus() To add support for navigation menus.
  * @uses register_default_headers() To register the default custom header images provided with the theme.
  * @uses set_post_thumbnail_size() To set a custom post thumbnail size
  * @uses add_theme_support( 'custom-header', $weaverx_header ) for WP 3.4+ custom header
  *
  *
  */
 function weaverx_setup()
 {
     $GLOBALS['wvrx_timer'] = microtime(true);
     // don't have options loaded, so just always get the current time.
     // Set the content width based on the theme's design and stylesheet.
     if (!isset($content_width)) {
         $content_width = 705;
     }
     // 940 * .75 - default for content with a sidebar
     /* Make Weaver Xtreme available for translation.
      *
      * We will first allow the possibility that the user has a private translation in
      * wp-content/languages/ (to avoid the update overwrite problem), then load the theme's files.
      */
     load_theme_textdomain('weaver-xtreme', get_template_directory() . '/languages');
     // now theme's translations as fallback
     // This theme styles the visual editor with editor-style.css to match the theme style.
     add_editor_style();
     //add_editor_style( str_replace( ',', '%2C', 'https://fonts.googleapis.com/css?family=Alegreya+Sans:400,700,400italic,700italic|Alegreya:400,700,700italic,400italic|Roboto:400,400italic,700,700italic|Roboto+Condensed:400,700|Roboto+Slab:400,700|Source+Sans+Pro:400,400italic,700,700italic|Source+Serif+Pro:400,700|Handlee|Inconsolata&subset=latin-ext,latin,cyrillic,greek' ) );
     add_editor_style(str_replace(',', '%2C', "https://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic|Open+Sans+Condensed:300,700|Alegreya:400,400italic,700,700italic|Alegreya+Sans:400,400italic,700,700italic|Droid+Sans:400,700|Droid+Serif:400,400italic,700,700italic|Exo+2:400,700|Lato:400,400italic,700,700italic|Lora:400,400italic,700,700italic|Arvo:400,700,400italic,700italic|Roboto:400,400italic,700,700italic|Roboto+Condensed:400,700|Roboto+Slab:400,700|Archivo+Black|Source+Sans+Pro:400,400italic,700,700italic|Source+Serif+Pro:400,700|Vollkorn:400,400italic,700,700italic|Arimo:400,700|Tinos:400,400italic,700,700italic|Roboto+Mono:400,700|Inconsolata|Handlee|Ultra&subset=latin,latin-ext"));
     // Add default posts and comments RSS feed links to <head>.
     add_theme_support('automatic-feed-links');
     // html5 for search
     add_theme_support('html5', array('search-form'));
     // Weaver Xtreme supports two main nav menus
     register_nav_menus(array('primary' => __('Primary Navigation: if specified, used instead of Default menu', 'weaver-xtreme'), 'secondary' => __('Secondary Navigation: if specified, adds 2nd menu bar', 'weaver-xtreme'), 'header-mini' => __('Header Mini Menu: if specified, adds horizontal mini-menu to header', 'weaver-xtreme')));
     // Add support for a variety of post formats
     add_theme_support('post-formats', array('aside', 'audio', 'gallery', 'image', 'link', 'quote', 'status', 'video'));
     // This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images
     add_theme_support('post-thumbnails');
     add_theme_support('title-tag');
     // now, need Weaver Xtreme settings available for everything else
     weaverx_init_opts('functions');
     $width = weaverx_getopt_default('theme_width_int');
     if (!$width) {
         $width = 940;
     }
     $height = weaverx_getopt('header_image_height_int');
     if (!$height) {
         $height = 188;
     }
     // now that everything is responsive, we can just set this to an arbitrary height.
     global $weaverx_header;
     $weaverx_header = array('default-image' => '%s/assets/images/headers/maroon-bells.jpg', 'random-default' => true, 'width' => $width, 'height' => $height, 'flex-height' => true, 'flex-width' => true, 'default-text-color' => '', 'header-text' => false, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => 'weaverx_admin_header_style', 'admin-preview-callback' => '');
     global $content_width;
     $content_width = $width;
     // let the WP $content_width be the same as theme width, and let our responsive CSS make it work.
     if (function_exists('get_custom_header')) {
         add_theme_support('custom-header', $weaverx_header);
         add_theme_support('custom-background');
     }
     // We'll be using post thumbnails for custom header images on posts and pages.
     // We want them to be the size of the header image that we just defined
     // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
     // CHANGE NOTE: This call was removed from Weaver Xtreme 1.1. The semantics of WP have changed
     // since this was first added and was causing the unnecessary auto-generation of a pretty large
     // file for each and every image added to the media library.
     // set_post_thumbnail_size( $weaverx_header['width'], $weaverx_header['height'], true );
     // ... and thus ends the changeable header business.
     weaverx_register_header_images();
 }