\n");
$add_css = aweaver_getopt("inject_{$name}_bgcolor_css"); // if the div has a border, it will show, so add message
if (stripos( $add_css, 'border') !== false)
echo __('This empty injection area with a border is displayed only in the Customizer preview.', 'absolute-weaver');
echo("\t
\n");
}
}
//--
// >>>>> aweaver_area_class <<<<<
function aweaver_area_class( $area, $p_default = 'pad', $sides = '', $margin = '') {
$class = '';
$cols = aweaver_getopt_default( $area . '_cols_int', 1);
if ( $cols > 1 ) {
$l_smart = ' widget-smart-rm';
$m_smart = ' m-widget-smart-rm';
if ( aweaver_getopt( $area . '_no_widget_margins' ) ) {
$l_smart = '';
$m_smart = '';
}
$l_class = 'widget-cols-' . $cols;;
$m_class = ' m-widget-cols-2';
if ( aweaver_getopt('_' . $area . '_lw_cols_list') != '') {
$l_class = '';
$l_smart = '';
}
if ( aweaver_getopt('_' . $area . '_mw_cols_list') != '') {
$m_class = '';
$m_smart = '';
}
$class = $l_class . $l_smart . $m_class . $m_smart;
}
// top/bottom margin
// border
if ( aweaver_getopt( $area . '_border'))
$class .= ' border';
// shadow
$val = aweaver_getopt( $area . '_shadow' );
if ( $val && $val != '-0' )
$class .= ' shadow' . $val;
// rounded
$val = aweaver_getopt( $area . '_rounded' );
if ( $val && $val != 'none' )
$class .= ' rounded' . $val;
// font-size
$val = aweaver_getopt( $area . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= ' ' . $val;
}
// font-family
$val = aweaver_getopt( $area . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= aweaver_get_bold_italic($area,'bold');
$class .= aweaver_get_bold_italic($area,'italic');
// hide
$val = aweaver_getopt( $area . '_hide' );
if ( $val && $val != 'hide-none' ) {
$class .= ' ' . $val;
}
// align
$align = aweaver_getopt_default( $area . '_align', 'float-left' );
if ( $align != 'float-left' ) {
if ( $align == 'center' ) $align = 'align-center';
$class .= ' ' . $align;
}
// eq height
if ( aweaver_getopt( $area . '_eq_widgets') ) {
$class .= ' widget-eq';
}
// extend bg
if ( aweaver_getopt( $area . '_extend_width') ) {
$class .= ' wvrx-fullwidth';
}
// expand area
if ( aweaver_getopt_expand( 'expand_' . $area ) ) {
$class .= ' wvrx-expand-full';
} else if ( ($area == 'header' || $area == 'footer' ) && aweaver_is_checked_page_opt("_pp_{$area}_full") ) { // look for per page settings for header and footer
$class .= ' wvrx-expand-full';
}
// add classes
$val = aweaver_getopt( $area . '_add_class' );
if ( $val ) {
$val = trim( $val );
str_replace( '.', '', $val ); // no .'s allowed, so kill them hoping it will fix user errors
str_replace(',', ' ', $val ); // and allow , separators instead of blanks
$class .= ' ' . trim($val);
}
// add classes
$val = aweaver_get_per_page_value( "_pp_{$area}_add_class" );
if ( $val ) {
$val = trim( $val );
str_replace( '.', '', $val ); // no .'s allowed, so kill them hoping it will fix user errors
str_replace(',', ' ', $val ); // and allow , separators instead of blanks
$class .= ' ' . trim($val);
}
return trim($class);
}
//--
// >>>>> aweaver_get_bold_italic <<<<<
function aweaver_get_bold_italic($area, $which) {
if ( $which == 'bold') {
$val = aweaver_getopt("{$area}_normal"); // if have a normal, there won't be a 'bold'
if ( $val ) {
return " font-weight-normal";
}
$val = aweaver_getopt("{$area}_bold");
if ($val == 'on')
return " font-bold";
else
return '';
}
$val = aweaver_getopt("{$area}_italic");
if ($val == 'on')
return " font-italic";
return '';
}
// >>>>> aweaver_area_div <<<<<
function aweaver_area_div( $who , $x_class = '' ) {
$c_class = $who . ' ' . aweaver_area_class( $who, 'not-pad', '', '' );
if ( $x_class )
$c_class .= ' ' . $x_class;
echo "\n" . '
';
echo "\n";
}
//--
// >>>>> aweaver_container_div <<<<<
function aweaver_container_div( $who ) {
$full = ''; // handle parallax options
if ( $who == 'page') {
$fi_loc = aweaver_get_per_page_value( '_pp_fi_location');
if ( !$fi_loc )
$fi_loc = aweaver_getopt( 'page_fi_location');
if ( strpos($fi_loc, 'parallax') !== false ) // parallax
$full = 'wvrx-parallax ';
if ( strpos($fi_loc, '-full') !== false ) // full parallax
$full .= 'wvrx-fullwidth ';
} else if ($who == 'single') {
$fi_loc = aweaver_get_per_post_value( '_pp_post_fi_location');
if ( !$fi_loc )
$fi_loc = aweaver_getopt( 'post_fi_location');
if ( strpos($fi_loc, 'parallax-full') !== false ) // full parallax
$full = 'wvrx-parallax wvrx-fullwidth ';
else if ( strpos($fi_loc, 'parallax') !== false ) // full parallax
$full = 'wvrx-parallax ';
} else if ( $who == 'page-builder' ) { // make the area full width, no padding/margins
$full = 'wvrx-expand-full container-expand ';
}
$class = 'class="container container-' . $who . " relative {$full}"
. aweaver_area_class('container', 'not-pad', '', '' ) . '"';
echo "\n" . '
' . "\n";
}
//--
// >>>>> aweaver_content_class <<<<<
function aweaver_content_class( $sb_layout, $who, $echo = true ) {
$c_class = aweaver_area_class( 'content', 'pad', '-rbl', '' );
$smart = '';
if ( aweaver_getopt('content_smartmargin')) {
$smart = '-m';
}
$class = 'content ';
switch ( $sb_layout ) {
case 'right':
case 'right-top':
$l_content = 'l-content-rsb' . $smart;
$class .= $l_content . ' m-full s-full ' . $c_class;
break;
case 'left':
case 'left-top':
$l_content = 'l-content-lsb' . $smart;
$class .= $l_content . ' m-full s-full sb-float-right ' . $c_class;
break;
case 'split':
$l_content = 'l-content-ssb' . $smart;
$class .= $l_content . ' m-full s-full ' . $c_class;
break;
case 'split-top':
$l_content = 'l-content-ssbs' . $smart;
$class .= $l_content . ' m-full s-full ' . $c_class;
break;
case 'one-column':
$l_content = 'l-content' . $smart;
$class .= $l_content . ' ' . $c_class;
break;
}
$class = ' class="' . trim($class) . '"';
if ( $echo )
echo $class;
return $class;
}
//--
// >>>>> aweaver_menu_class <<<<<
function aweaver_menu_class( $who, $no_hide = false ) {
// for the main menu bar - submenus must be done via CSS...
$class = '';
// font-size
$val = aweaver_getopt( $who . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= $val;
}
// font-family
$val = aweaver_getopt( $who . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= aweaver_get_bold_italic($who,'bold');
$class .= aweaver_get_bold_italic($who,'italic');
// border
if ( aweaver_getopt( $who . '_border'))
$class .= ' border';
// shadow
$val = aweaver_getopt( $who . '_shadow' );
if ( $val && $val != '-0' )
$class .= ' shadow' . $val;
// rounded
$val = aweaver_getopt( $who . '_rounded' );
if ( $val && $val != 'none' )
$class .= ' rounded' . $val;
if ( aweaver_getopt( $who . '_extend_width') ) {
$class .= ' wvrx-fullwidth';
}
// hide - subject to override by [show_if]
$val = aweaver_getopt( $who . '_hide' );
if ( $val && $val != 'hide-none' && !$no_hide) {
$class .= ' ' . $val;
}
// expand
// fullwidth
$wide = aweaver_getopt($who . '_align'); // added V 4.0
if (strpos($wide,'alignwide') !== false)
$class .= ' alignwide';
else if (strpos($wide,'alignfull') !== false)
$class .= ' alignfull';
if (aweaver_getopt_expand('expand_' . $who))
$class .= ' wvrx-expand-full';
// add classes - !important - do these LAST so will override other classes
$val = aweaver_getopt( $who . '_add_class' );
if ( $val ) {
$val = trim( $val );
str_replace( '.', '', $val ); // no .'s allowed, so kill them hoping it will fix user errors
str_replace(',', ' ', $val ); // and allow , separators instead of blanks
$class .= ' ' . trim($val);
}
return trim($class);
}
//--
// >>>>> aweaver_page_lead <<<<<
function aweaver_page_lead( $who , $archive = false ) {
// common lead in for all pages with infobar and top widget area
$GLOBALS['aweaver_page_who'] = $who;
$GLOBALS['aweaver_page_is_archive'] = $archive;
get_header( $who );
if ($who == 'woocommerce') {
$body_classes = get_body_class();
if ( in_array('single-product', $body_classes) ) { // Single product page - treat as page
$sb_layout = aweaver_sb_layout( $who );
} else { // Archive like page
$sb_layout = aweaver_sb_layout_archive( $who );
}
} elseif ( $archive )
$sb_layout = aweaver_sb_layout_archive( $who );
else
$sb_layout = aweaver_sb_layout( $who );
aweaver_container_div( $who ); // #container
if ( $who != 'page-builder')
get_template_part('templates/infobar');
aweaver_sidebar_before( $sb_layout, $who ); // sidebars if top-stacking
do_action('aweaver_per_page');
echo '
\n";
return $sb_layout;
}
//--
// >>>>> aweaver_page_tail <<<<<
function aweaver_page_tail( $who, $sb_layout ) {
echo "\n
\n"; // do not clear:both!
aweaver_sidebar_after( $sb_layout, $who ); // sidebars after content
echo "\n
\n";
aweaver_get_footer( $who );
}
//--
// >>>>> aweaver_title_class <<<<<
function aweaver_title_class( $who, $class_only = false, $front = '' ) {
$class = $front;
// font-size
$val = aweaver_getopt( $who . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= ' ' . $val . '-title';
}
// font-family
$val = aweaver_getopt( $who . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= aweaver_get_bold_italic($who,'bold');
$class .= aweaver_get_bold_italic($who,'italic');
if ( $class ) {
return $class_only ? trim($class) : ' class="' . trim($class) . '"';
}
else
return '';
}
//--
// >>>>> aweaver_text_class <<<<<
function aweaver_text_class( $who, $class_only = true ) {
// 'title' option used for plain text
$class = '';
// font-size
$val = aweaver_getopt( $who . '_font_size' );
if ( $val && $val != 'default' ) {
$class .= $val;
}
// font-family
$val = aweaver_getopt( $who . '_font_family' );
if ( $val && $val != 'default' ) {
$class .= ' font-' . $val;
}
$class .= aweaver_get_bold_italic($who,'bold');
$class .= aweaver_get_bold_italic($who,'italic');
if ( $class ) {
return $class_only ? ' ' . trim($class) : ' class="' . trim($class) . '"';
}
else
return '';
}
//--
// ================================= sidebars ======================================
// >>>>> aweaver_sb_layout <<<<<
function aweaver_sb_layout( $who, $is_index = false ) {
// get sb layout for page-like content: 'layout_default', 'layout_page', 'layout_blog', 'layout_single'
//
// possible values: 'right', 'right-top', 'left', 'left-top', 'split', 'split-top', 'one-column'
$per_page = $is_index ? '' : aweaver_get_per_page_value('_pp_page_layout');
if ( $who == '404' ) $who = 'search'; // sigh - they are the same layout
if ( $who == 'page-builder' ) {
$who = 'page'; // page builder same as page
if ( $per_page == '' || $per_page == 'default' )
$per_page = 'one-column'; // default to one-column for page-builder
}
$layout = ( $per_page ) ? $per_page : aweaver_getopt_default( 'layout_' . $who , 'default');
// aweaver_debug_comment("aweaver_sb_layout - who: {$who} layout: {$layout} per_page: {$per_page}");
if ( $who == 'woocommerce') {
$layout = aweaver_getopt( 'layout_page' , 'default');
}
if ( $layout == 'default' ) {
$layout = aweaver_getopt( 'layout_default', 'right' );
}
return apply_filters('aweaver_sb_layout', $layout, $who);
}
//--
// >>>>> aweaver_sb_layout_archive <<<<<
function aweaver_sb_layout_archive( $who ) {
// get sb layout for archive-like content: 'layout_default_archive', 'layout_archive', 'layout_category', 'layout_tag'
// 'layout_author', 'layout_search', 'layout_image'
// same possible values
if ( $who == '404' ) $who = 'search'; // they are the same layout
$layout = aweaver_getopt_default( 'layout_' . $who , 'default');
if ( $layout == 'default' ) {
if ($who == 'blog') {
$layout = aweaver_getopt( 'layout_default' );
if ( !$layout )
$layout = 'right'; // fallback
} else {
$layout = aweaver_getopt( 'layout_default_archive' );
if ( !$layout )
$layout = 'one-column'; // fallback
}
}
return apply_filters('aweaver_sb_layout_archive', $layout, $who);
}
//---
// >>>>> aweaver_sidebar_before <<<<<
function aweaver_sidebar_before( $sb_layout, $who ) {
switch ( $sb_layout ) {
case 'right-top': // for "top" sidebars, emit the upper sidebar before the content
case 'split-top':
case 'left-top':
get_sidebar( $sb_layout );
break;
default:
break;
}
}
//--
// >>>>> aweaver_sidebar_after <<<<<
function aweaver_sidebar_after( $sb_layout, $who ) {
switch ( $sb_layout ) {
case 'right': // for non-top sidebars, both upper and lower get emitted here together
case 'left':
case 'split':
get_sidebar( $sb_layout );
break;
case 'right-top': // for "top" sidebars, only the lower one gets emitted here
get_sidebar( 'bottom');
break;
case 'split-top':
get_sidebar( 'split-bottom');
break;
case 'left-top':
get_sidebar( 'left-bottom');
break;
default: // 'one-column'
break;
}
}
//--
if ( ! function_exists( 'aweaver_sb_precontent' ) ) {
function aweaver_sb_precontent( $who ) {
$class = 'l-widget-area-top m-widget-area-top s-widget-area-top ' . aweaver_area_class( 'top', 'pad' );
aweaver_put_widgetarea('sitewide-top-widget-area', $class, 'top'); // sitewide top
switch ($who) {
case 'blog':
case 'pwp':
case 'single':
aweaver_put_widgetarea('blog-top-widget-area', $class, 'top');
break;
case 'page':
case 'page-builder':
aweaver_put_widgetarea('page-top-widget-area', $class, 'top');
break;
case 'archive':
case 'author':
case 'category':
case 'search':
case 'tag':
aweaver_put_widgetarea('postpages-widget-area', $class, 'top');
break;
case '404':
case 'attachment':
case 'image':
default:
break;
}
}
}
//--
// >>>>> aweaver_sb_postcontent <<<<<
function aweaver_sb_postcontent($who, $hide_sitewide = false) {
aweaver_clear_both('sb-postcontent-' . $who);
$class = 'l-widget-area-bottom m-widget-area-bottom s-widget-area-bottom ' . aweaver_area_class( 'bottom', 'pad' );
switch ($who) {
case 'blog':
case 'pwp':
case 'single':
aweaver_put_widgetarea('blog-bottom-widget-area', $class, 'bottom');
break;
case 'page':
case 'page-builder':
aweaver_put_widgetarea('page-bottom-widget-area', $class, 'bottom');
break;
case 'archive':
case 'author':
case 'category':
case 'tag':
case 'search':
break;
case 'attachment':
case 'image':
case '404':
default:
break;
}
if ( !$hide_sitewide )
aweaver_put_widgetarea('sitewide-bottom-widget-area', $class, 'bottom'); // sitewide bottom
aweaver_clear_both('sitewide-bottom-widget-area');
}
//--
// >>>>> aweaver_put_widgetarea <<<<<
function aweaver_put_widgetarea($area_name, $class = '', $area_class_name = '') {
$area = $area_name;
if ( isset( $GLOBALS['aweaver_page_is_archive'] ) && !$GLOBALS['aweaver_page_is_archive'] && aweaver_is_checked_page_opt('_pp_' . $area_name) ) {
return;
} // hide area option checked
unset( $GLOBALS['wvr_widget_number']); // clear for each widget
$GLOBALS['wvr_widget_number'] = false;
if ( $area_class_name )
$class .= ' widget-area-' . $area_class_name;
$class = ' ' . $class;
if (is_active_sidebar($area)) { /* add top and bottom widget areas */
ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */
$success = dynamic_sidebar($area);
$content = ob_get_clean();
if ($success && $content) {
?>
>
'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' // these to simplify [extra_widget_area]
);
$opt_name = 'widget'; // default styling option name: widget-xxx
$search_sb_id = $sb_id;
if ( aweaver_t_get('use_widget_area') ) // map from replacement area or [extra_widget_area]
$search_sb_id = aweaver_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 = aweaver_getopt( $opt_name . '_cols_int');
if ( !$cols || $cols < 1 )
$cols = 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 = aweaver_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 = aweaver_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 = aweaver_title_class( 'widget_title', true);
if ( $title_class )
$params[0]['before_title'] = str_replace( '">', ' ' . trim($title_class) . '">', $params[0]['before_title'] );
return $params;
}
//--
// >>>>> aweaver_no_sidebars <<<<<
function aweaver_no_sidebars( $class ) {
?>
>>>> aweaver_has_widgetarea <<<<<
function aweaver_has_widgetarea( $area_name ) {
// see if a widget area is available to show...
$area = apply_filters('aweaver_replace_widget_area', $area_name);
if ( isset( $GLOBALS['aweaver_page_is_archive'] ) && !$GLOBALS['aweaver_page_is_archive'] && aweaver_is_checked_page_opt('_pp_' . $area_name) ) {
return false; // hide area option checked
}
if ( is_active_sidebar($area) ) {
return true;
}
return false;
}
//--
?>