Example #1
0
<?php

if (!defined('ABSPATH')) {
    die('-1');
}
/** @var $this WPBakeryShortCode_VC_Icon */
$icon = $color = $size = $align = $el_class = $custom_color = $link = $background_style = $background_color = $type = $icon_fontawesome = $icon_openiconic = $icon_typicons = $icon_entypoicons = $icon_linecons = $custom_background_color = '';
/** @var array $atts - shortcode attributes */
$atts = vc_map_get_attributes($this->getShortcode(), $atts);
extract($atts);
$link = vc_gitem_create_link($atts, 'vc_icon_element-link');
$class_to_filter = $this->getCSSAnimation($css_animation);
$class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts);
// Enqueue needed icon font.
vc_icon_element_fonts_enqueue($type);
$has_style = false;
if (strlen($background_style) > 0) {
    $has_style = true;
    if (false !== strpos($background_style, 'outline')) {
        $background_style .= ' vc_icon_element-outline';
        // if we use outline style it is border in css
    } else {
        $background_style .= ' vc_icon_element-background';
    }
}
$style = '';
if ('custom' === $background_color) {
    if (false !== strpos($background_style, 'outline')) {
        $style = 'border-color:' . $custom_background_color;
    } else {
<?php

/**
 * Shortcode attributes
 * @var $atts
 * Shortcode class
 * @var $this WPBakeryShortCode_VC_Gitem_Post_Data
 */
$output = $text = $google_fonts = $font_container = $el_class = $css = $google_fonts_data = $font_container_data = $link_html = '';
extract($this->getAttributes($atts));
extract($this->getStyles($el_class, $css, $google_fonts_data, $font_container_data, $atts));
$data_source = $this->getDataSource($atts);
if (isset($atts['link']) && '' !== $atts['link'] && 'none' !== $atts['link']) {
    $link_html = vc_gitem_create_link($atts);
}
$use_custom_fonts = isset($atts['use_custom_fonts']) && 'yes' === $atts['use_custom_fonts'];
$settings = get_option('wpb_js_google_fonts_subsets');
$subsets = '';
if (is_array($settings) && !empty($settings)) {
    $subsets = '&subset=' . implode(',', $settings);
}
$content = '{{ post_data:' . esc_attr($data_source) . ' }}';
if (!empty($link_html)) {
    $content = '<' . $link_html . '>' . $content . '</a>';
}
$css_class .= ' vc_gitem-post-data';
if ($data_source) {
    $css_class .= ' vc_gitem-post-data-source-' . $data_source;
}
if ($use_custom_fonts && !empty($google_fonts_data) && isset($google_fonts_data['values']['font_family'])) {
    wp_enqueue_style('vc_google_fonts_' . vc_build_safe_css_class($google_fonts_data['values']['font_family']), '//fonts.googleapis.com/css?family=' . $google_fonts_data['values']['font_family'] . $subsets);
<?php

/**
 * @var $this WPBakeryShortCode_VC_Custom_heading
 */
$output = $text = $google_fonts = $font_container = $el_class = $css = $google_fonts_data = $font_container_data = '';
extract($this->getAttributes($atts));
$link = vc_gitem_create_link($atts);
extract($this->getStyles($el_class, $css, $google_fonts_data, $font_container_data, $atts));
$settings = get_option('wpb_js_google_fonts_subsets');
$subsets = '';
if (is_array($settings) && !empty($settings)) {
    $subsets = '&subset=' . implode(',', $settings);
}
if (!empty($link)) {
    $text = '<' . $link . '>' . $text . '</a>';
}
if (!empty($google_fonts_data) && isset($google_fonts_data['values']['font_family'])) {
    wp_enqueue_style('vc_google_fonts_' . vc_build_safe_css_class($google_fonts_data['values']['font_family']), '//fonts.googleapis.com/css?family=' . $google_fonts_data['values']['font_family'] . $subsets);
}
$output .= '<div class="' . esc_attr($css_class) . '" >';
$style = '';
if (!empty($styles)) {
    $style = 'style="' . esc_attr(implode(';', $styles)) . '"';
}
$output .= '<' . $font_container_data['values']['tag'] . ' ' . $style . ' >';
$output .= $text;
$output .= '</' . $font_container_data['values']['tag'] . '>';
$output .= '</div>';
echo $output;
switch ($source) {
    case 'media_library':
        $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'vc_single_image-img'));
        break;
    case 'external_link':
        $dimensions = vcExtractDimensions($img_size);
        $hwstring = $dimensions ? image_hwstring($dimensions[0], $dimensions[1]) : '';
        $custom_src = $custom_src ? esc_attr($custom_src) : $default_src;
        $img = array('thumbnail' => '<img class="vc_single_image-img" ' . $hwstring . ' src="' . $custom_src . '" />');
        break;
    default:
        $img = false;
}
if (!$img) {
    $img['thumbnail'] = '<img class="vc_single_image-img" src="' . $default_src . '" />';
}
$wrapperClass = 'vc_single_image-wrapper ' . $style . ' ' . $border_color;
$link = vc_gitem_create_link($atts, $wrapperClass);
$image_string = !empty($link) ? '<' . $link . '>' . $img['thumbnail'] . '</a>' : '<div class="' . $wrapperClass . '"> ' . $img['thumbnail'] . ' </div>';
$class_to_filter = 'wpb_single_image wpb_content_element vc_align_' . $alignment . ' ' . $this->getCSSAnimation($css_animation);
$class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class);
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts);
$output = '
	<div class="' . esc_attr($css_class) . '">
		' . wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_singleimage_heading')) . '
		<figure class="wpb_wrapper vc_figure">
			' . $image_string . '
		</figure>
	</div>
';
echo $output;