Example #1
0
 function shoestrap_get_rgba($hex = '#fff', $opacity = 100, $echo = false)
 {
     // Make sure that opacity is properly formatted :
     // Set the opacity to 100 if a larger value has been entered by mistake.
     // If a negative value is used, then set to 0.
     // If an opacity value is entered in a decimal form (for example 0.25), then multiply by 100.
     if ($opacity >= 100) {
         $opacity = 100;
     } elseif ($opacity < 0) {
         $opacity = 0;
     } elseif ($opacity < 1 && $opacity != 0) {
         $opacity = $opacity * 100;
     } else {
         $opacity = $opacity;
     }
     // Divide the opacity by 100 to end-up with a CSS value for the opacity
     $opacity = $opacity / 100;
     $color = 'rgba(' . shoestrap_get_rgb($hex, true) . ', ' . $opacity . ')';
     // Echo or Return the value
     if ($echo == true) {
         echo $color;
     } else {
         return $color;
     }
 }
 function shoestrap_footer_css()
 {
     $bg = shoestrap_getVariable('footer_background');
     $cl = shoestrap_getVariable('footer_color');
     $cl_brand = shoestrap_getVariable('color_brand_primary');
     $opacity = 1;
     // AC override due to feature removal
     $rgb = shoestrap_get_rgb($bg, true);
     $border = shoestrap_getVariable('footer_border');
     $top_margin = shoestrap_getVariable('footer_top_margin');
     $style = 'footer.content-info {';
     $style .= $opacity != 1 && $opacity != "" ? 'background: rgba(' . $rgb . ',' . $opacity . ');' : 'background:' . $bg . ';';
     $style .= !empty($border) && $border['border-top'] > 0 && !empty($border['border-color']) ? 'border-top:' . $border['border-top'] . ' ' . $border['border-style'] . ' ' . $border['border-color'] . ';' : '';
     $style .= !empty($top_margin) ? 'margin-top:' . $top_margin . 'px;' : '';
     $style .= '}';
     $style .= '#copyright-bar { line-height: 22px; }';
     $style .= '#footer_social_bar { line-height: 30px; font-size: 20px; text-align: center; }';
     //  $style .= '#footer_social_bar a { margin-left: 9px; padding: 3px; color:' . $cl . '; }';
     wp_add_inline_style('shoestrap_css', $style);
 }
 function shoestrap_navbar_css()
 {
     $navbar_bg_opacity = shoestrap_getVariable('navbar_bg_opacity');
     $style = "";
     $opacity = $navbar_bg_opacity == '' ? '0' : intval($navbar_bg_opacity) / 100;
     if ($opacity != 1 && $opacity != '') {
         $bg = ac_prepare_bg_colour_for_less(shoestrap_getVariable('navbar_bg'));
         $rgb = shoestrap_get_rgb($bg, true);
         $opacityie = str_replace('0.', '', $opacity);
         $style .= '.navbar, .navbar-default {';
         if ($opacity != 1 && $opacity != '') {
             $style .= 'background: transparent; background: rgba(' . $rgb . ', ' . $opacity . '); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#' . $opacityie . $bg . ',endColorstr=#' . $opacityie . $bg . '); ;';
         } else {
             $style .= 'background: #' . $bg . ';';
         }
         $style .= '}';
     }
     if (shoestrap_getVariable('navbar_margin') != 1) {
         $style .= '.navbar-static-top { margin-top:' . shoestrap_getVariable('navbar_margin') . 'px !important; margin-bottom:' . shoestrap_getVariable('navbar_margin') . 'px !important; }';
     }
     wp_add_inline_style('shoestrap_css', $style);
 }
 function shoestrap_header_css()
 {
     $bg = shoestrap_getVariable('header_bg');
     $cl = shoestrap_getVariable('header_color');
     $header_margin_top = shoestrap_getVariable('header_margin_top');
     $header_margin_bottom = shoestrap_getVariable('header_margin_bottom');
     $opacity = intval(shoestrap_getVariable('header_bg_opacity')) / 100;
     $rgb = shoestrap_get_rgb($bg, true);
     if (shoestrap_getVariable('header_toggle') == 1) {
         $style = '.header-wrapper{ color: ' . $cl . ';';
         $style .= $opacity != 1 && $opacity != '' ? 'background: rgb(' . $rgb . '); background: rgba(' . $rgb . ', ' . $opacity . ');' : ($style .= 'background: ' . $bg . ';');
         $style .= 'margin-top:' . $header_margin_top . 'px; margin-bottom:' . $header_margin_bottom . 'px; }';
         wp_add_inline_style('shoestrap_css', $style);
     }
 }