/** * Output header inline css. * * @since 3.0.0 */ function presscore_header_inline_style() { $config = presscore_config(); if (in_array($config->get('header_title'), array('fancy', 'slideshow')) && 'transparent' === $config->get('header_background') && (presscore_mixed_header_with_top_line() || !presscore_header_layout_is_side())) { $transparent_bg_color = dt_stylesheet_color_hex2rgba($config->get('header.transparent.background.color'), $config->get('header.transparent.background.opacity')); echo ' style="background-color: ' . esc_attr($transparent_bg_color) . ';"'; } }
} switch ($color_mode) { case 'title_like': $color = 'dt-title'; break; case 'content_like': $color = 'dt-content'; break; case 'accent': $color = 'dt-accent'; break; case 'custom': default: $colors_arr = array("wpb_button", "btn-primary", "btn-info", "btn-success", "btn-warning", "btn-danger", "btn-inverse"); if (!in_array($color, $colors_arr)) { $color = false !== strpos($color, 'rgba') ? $color : dt_stylesheet_color_hex2rgba($color, 100); } if (!$color) { $color = 'wpb_button'; } break; } $el_class = $this->getExtraClass($el_class) . $appearance_class; $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'vc_pie_chart wpb_content_element' . $el_class, $this->settings['base'], $atts); $output = "\n\t" . '<div class= "' . $css_class . '" data-pie-value="' . $value . '" data-pie-label-value="' . $label_value . '" data-pie-units="' . $units . '" data-pie-color="' . htmlspecialchars($color) . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= "\n\t\t\t" . '<div class="vc_pie_wrapper">'; $output .= "\n\t\t\t" . '<span class="vc_pie_chart_back"></span>'; $output .= "\n\t\t\t" . '<span class="vc_pie_chart_value"></span>'; $output .= "\n\t\t\t" . '<canvas width="101" height="101"></canvas>'; $output .= "\n\t\t\t" . '</div>';
/** * Returns array( 'rgba', 'ie_color' ). * * @param string $color. * @param string $ie_color. * @param int $opacity. * * @return array. */ function dt_stylesheet_make_ie_compat_rgba($color, $ie_color, $opacity) { $return = array('rgba' => dt_stylesheet_color_hex2rgba($color, $opacity), 'ie_color' => $ie_color); if ($opacity == 100) { $return['ie_color'] = $color; } return $return; }
public function shortcode($atts, $content = null) { $default_atts = array('bg_image' => '', 'bg_color' => '', 'bg_opacity' => '100', 'text_color' => '', 'text_size' => 'normal', 'border_width' => '1', 'outer_padding' => '10', 'inner_padding' => '10', 'min_height' => '150', 'link' => '', 'target_blank' => '1', 'animation' => 'none'); $attributes = shortcode_atts($default_atts, $atts); $attributes['animation'] = in_array($attributes['animation'], array('none', 'scale', 'fade', 'left', 'right', 'bottom', 'top')) ? $attributes['animation'] : $default_atts['animation']; $attributes['bg_image'] = esc_url($attributes['bg_image']); $attributes['bg_color'] = apply_filters('of_sanitize_color', $attributes['bg_color']); $attributes['bg_opacity'] = absint($attributes['bg_opacity']); $attributes['bg_opacity'] = $attributes['bg_opacity'] > 100 ? 100 : $attributes['bg_opacity']; $attributes['text_size'] = in_array($attributes['text_size'], array('normal', 'small', 'big')) ? $attributes['text_size'] : $default_atts['text_size']; $attributes['text_color'] = apply_filters('of_sanitize_color', $attributes['text_color']); $attributes['border_width'] = absint($attributes['border_width']); $attributes['outer_padding'] = absint($attributes['outer_padding']); $attributes['inner_padding'] = absint($attributes['inner_padding']); $attributes['min_height'] = absint($attributes['min_height']); $attributes['link'] = esc_url($attributes['link']); $attributes['target_blank'] = apply_filters('dt_sanitize_flag', $attributes['target_blank']); $banner_inner_height = $attributes['min_height'] - $attributes['inner_padding']; $banner_style = array(); $banner_bg_style = array(); $banner_inner_style = array(); $banner_classes = array('shortcode-banner'); $banner_more_inner_style = ''; if ($attributes['bg_color']) { $banner_inner_style[] = 'background-color: ' . dt_stylesheet_color_hex2rgb($attributes['bg_color']); $banner_inner_style[] = 'background-color: ' . dt_stylesheet_color_hex2rgba($attributes['bg_color'], $attributes['bg_opacity']); } $banner_inner_style[] = sprintf('border: solid %spx transparent', $attributes['inner_padding']); $banner_inner_style[] = sprintf('outline: solid %spx', $attributes['border_width']); if ($attributes['text_color']) { $banner_inner_style[] = 'color: ' . $attributes['text_color']; $banner_inner_style[] = 'outline-color: ' . $attributes['text_color']; } $banner_inner_style[] = 'height: ' . $banner_inner_height . 'px'; $banner_bg_style[] = 'padding: ' . ($attributes['outer_padding'] > $attributes['border_width'] ? $attributes['outer_padding'] : $attributes['border_width']) . 'px'; $banner_bg_style[] = 'min-height: ' . $attributes['min_height'] . 'px'; $banner_style[] = 'min-height: ' . $attributes['min_height'] . 'px'; if ($attributes['bg_image']) { $banner_style[] = sprintf('background-image: url(%s)', $attributes['bg_image']); } $text_size_class = ''; if ('small' == $attributes['text_size']) { $text_size_class = ' text-small'; } elseif ('big' == $attributes['text_size']) { $text_size_class = ' text-big'; } $link = ''; if ($attributes['link']) { if ($attributes['target_blank']) { $link = sprintf(' onclick="window.open(\'%s\');"', $attributes['link']); } else { $link = sprintf(' onclick="window.location.href=\'%s\';"', $attributes['link']); } } if ($link) { $banner_classes[] = 'shortcode-banner-link'; } if ('none' != $attributes['animation']) { switch ($attributes['animation']) { case 'scale': $banner_classes[] = 'scale-up'; break; case 'fade': $banner_classes[] = 'fade-in'; break; case 'left': $banner_classes[] = 'right-to-left'; break; case 'right': $banner_classes[] = 'left-to-right'; break; case 'bottom': $banner_classes[] = 'top-to-bottom'; break; case 'top': $banner_classes[] = 'bottom-to-top'; break; } $banner_classes[] = 'animate-element'; } $output = sprintf('<div class="%s" %s><div class="shortcode-banner-bg wf-table" %s><div class="shortcode-banner-inside wf-table%s" %s><div %s>%s</div></div></div></div>', esc_attr(implode(' ', $banner_classes)), 'style="' . esc_attr(implode(';', $banner_style)) . '"' . $link, 'style="' . esc_attr(implode(';', $banner_bg_style)) . '"', $text_size_class, 'style="' . esc_attr(implode(';', $banner_inner_style)) . '"', $banner_more_inner_style, do_shortcode($content)); return $output; }
<?php $title = $el_class = $value = $label_value = $units = ''; extract(shortcode_atts(array('appearance' => 'default', 'title' => '', 'el_class' => '', 'value' => '50', 'units' => '', 'color' => 'turquoise', 'label_value' => ''), $atts)); wp_enqueue_script('vc_dt_pie'); $appearance_class = ''; if ('counter' == $appearance) { $appearance_class = ' transparent-pie'; } $colors_arr = array("wpb_button", "btn-primary", "btn-info", "btn-success", "btn-warning", "btn-danger", "btn-inverse"); if (!in_array($color, $colors_arr)) { $color = dt_stylesheet_color_hex2rgba($color, 100); if (!$color) { $color = 'wpb_button'; } } $el_class = $this->getExtraClass($el_class); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'vc_pie_chart wpb_content_element' . $appearance_class . $el_class, $this->settings['base']); $output = "\n\t" . '<div class= "' . $css_class . '" data-pie-value="' . $value . '" data-pie-label-value="' . $label_value . '" data-pie-units="' . $units . '" data-pie-color="' . htmlspecialchars($color) . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= "\n\t\t\t" . '<div class="vc_pie_wrapper">'; $output .= "\n\t\t\t" . '<span class="vc_pie_chart_back"></span>'; $output .= "\n\t\t\t" . '<span class="vc_pie_chart_value"></span>'; $output .= "\n\t\t\t" . '<canvas width="101" height="101"></canvas>'; $output .= "\n\t\t\t" . '</div>'; if ($title != '') { $output .= '<h4 class="wpb_heading wpb_pie_chart_heading">' . $title . '</h4>'; } //wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_pie_chart_heading')); $output .= "\n\t\t" . '</div>' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div>' . $this->endBlockComment('.wpb_pie_chart') . "\n";
function presscore_header_table_style() { $config = Presscore_Config::get_instance(); $style = array(); if ('transparent' == $config->get('header_background') && 'content_width_line' == $config->get('header.transparent.background.style')) { $style[] = 'border-bottom-color: ' . dt_stylesheet_color_hex2rgba($config->get('header.transparent.background.color'), $config->get('header.transparent.background.opacity')); } echo $style ? ' style="' . esc_attr(implode('; ', $style)) . '"' : ''; }