public function shortcode_icon($atts, $content = null) { extract(shortcode_atts(array('icon' => '', 'target_blank' => '1', 'link' => '#'), $atts)); static $social_icons = null; if (!$social_icons) { $social_icons = presscore_get_social_icons_data(); } if ('deviant' == $icon) { $icon = 'devian'; } elseif ('tumblr' == $icon) { $icon = 'tumbler'; } elseif ('500px' == $icon) { $icon = 'px-500'; } elseif (in_array($icon, array('youtube', 'YouTube'))) { $icon = 'you-tube'; } elseif (in_array($icon, array('tripedvisor', 'tripadvisor'))) { $icon = 'tripedvisor'; } $icon = in_array($icon, array_keys($social_icons)) ? $icon : ''; if (empty($icon)) { return ''; } $classes = array(); if (presscore_shortcode_animation_on(self::$atts['animation'])) { $classes[] = presscore_get_shortcode_animation_html_class(self::$atts['animation']); } $target_blank = apply_filters('dt_sanitize_flag', $target_blank) ? '_blank' : ''; $output = presscore_get_social_icon($icon, $link, $social_icons[$icon], $classes, $target_blank); return $output; }
public function render_logo($attributes = array()) { $post_id = get_the_ID(); if (!$post_id) { return ''; } $html = ''; $images = array('normal' => null, 'retina' => null); $image_classes = array(); $esc_title = esc_attr(get_the_title()); $thumb_id = 0; // get featured image if (has_post_thumbnail($post_id)) { $thumb_id = get_post_thumbnail_id($post_id); $images['normal'] = wp_get_attachment_image_src($thumb_id, 'full'); } // get retina image $retina_logo_id = get_post_meta($post_id, '_dt_logo_options_retina_logo', true); if ($retina_logo_id) { $images['retina'] = dt_get_uploaded_logo(array('', $retina_logo_id[0]), 'retina'); } // default image $default_img = null; foreach ($images as $image) { if ($image) { $default_img = $image; break; } } if (!$default_img) { return ''; } if (presscore_shortcode_animation_on($attributes['animation'])) { $image_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']); } // ninjaaaa! $image_classes = implode(' ', $image_classes); // final image if (presscore_is_srcset_based_retina()) { $image = presscore_get_image_with_srcset($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes)); } else { $image = dt_get_retina_sensible_image($images['normal'], $images['retina'], $default_img, 'alt="' . $esc_title . '"', esc_attr($image_classes)); } // if link not empty - wrap image with it $link = get_post_meta($post_id, '_dt_logo_options_link', true); if ($link) { $image_id = dt_is_hd_device() && isset($retina_logo_id[0]) ? $retina_logo_id[0] : $thumb_id; $esc_caption = ''; $attachment = dt_get_attachment($image_id); if ($attachment) { $esc_caption = esc_attr($attachment['description']); } $link = esc_attr($link); $image = '<a href="' . $link . '" target="_blank" title="' . $esc_caption . '" >' . $image . '</a>'; } // get it all togeather return $image; }
public function shortcode($atts, $content = null) { $default_atts = array('animation' => 'none'); extract(shortcode_atts($default_atts, $atts)); $classes = array(); if (presscore_shortcode_animation_on($animation)) { $classes[] = presscore_get_shortcode_animation_html_class($animation); } // ninjaaaa! $classes = implode(' ', $classes); $output = '<div class="' . esc_attr($classes) . '">' . presscore_remove_wpautop($content, true) . '</div>'; return $output; }
protected function get_container_html_class($custom_class = '') { $class = array(); if ($custom_class) { $class[] = $custom_class; } if ($this->atts['link']) { $class[] = 'shortcode-banner-link'; } if (presscore_shortcode_animation_on($this->atts['animation'])) { $class[] = presscore_get_shortcode_animation_html_class($this->atts['animation']); } return 'class="' . esc_attr(implode(' ', $class)) . '"'; }
public function shortcode($atts, $content = null) { $default_atts = array('type' => 'blockquote', 'layout' => 'left', 'font_size' => 'big', 'size' => '1', 'animation' => 'none', 'background' => 'plain'); extract(shortcode_atts($default_atts, $atts)); $font_size = sanitize_key($font_size); $type = sanitize_key($type); $layout = sanitize_key($layout); $size = sanitize_key($size); $background = sanitize_key($background); $classes = array(); $classes[] = presscore_get_font_size_class($font_size); if (presscore_shortcode_animation_on($animation)) { $classes[] = presscore_get_shortcode_animation_html_class($animation); } if ('blockquote' != $type) { $tag = 'q'; $autop = false; $classes[] = 'shortcode-pullquote'; $classes[] = 'wf-cell'; if ('right' == $layout) { $classes[] = 'align-right'; } else { $classes[] = 'align-left'; } switch ($size) { case '2': $classes[] = 'wf-1-2'; break; case '3': $classes[] = 'wf-1-3'; break; case '4': $classes[] = 'wf-1-4'; break; default: $classes[] = 'wf-1'; } } else { $tag = 'blockquote'; $autop = true; $classes[] = 'shortcode-blockquote'; if ('fancy' == $background) { $classes[] = 'block-style-widget'; } } $classes = implode(' ', $classes); $output = sprintf('<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr($classes), presscore_remove_wpautop($content, $autop)); return $output; }
protected function get_container_html_class($custom_class = '') { $class = array(); if ($custom_class) { $class[] = $custom_class; } switch ($this->atts['style']) { case '3': $class[] = 'br-standard'; case '2': $class[] = 'borderframe'; } switch ($this->atts['align']) { case 'left': $class[] = 'alignleft'; break; case 'right': $class[] = 'alignright'; break; case 'centre': case 'center': $class[] = 'alignnone'; break; } if (presscore_shortcode_animation_on($this->atts['animation'])) { $class[] = presscore_get_shortcode_animation_html_class($this->atts['animation']); } if ($this->content) { $class[] = 'caption-on'; } $image_src = $this->choose_src_responsively($this->atts['image'], $this->atts['hd_image']); $video_url = $this->atts['media']; $lightbox = $this->atts['lightbox']; if ($image_src && $video_url && !$lightbox || !$image_src && $video_url) { $class[] = 'shortcode-single-video'; } return 'class="' . esc_attr(implode(' ', $class)) . '"'; }
public function shortcode($atts, $content = null) { $default_atts = array('style' => '1', 'image' => '', 'image_alt' => '', 'hd_image' => '', 'media' => '', 'padding' => '0', 'align' => '', 'animation' => 'none', 'width' => ''); $attributes = shortcode_atts($default_atts, $atts); // $attributes['type'] = in_array( $attributes['type'], array('image', 'video') ) ? $attributes['type'] : $default_atts['type']; $attributes['style'] = sanitize_key($attributes['style']); $attributes['align'] = sanitize_key($attributes['align']); $attributes['padding'] = intval($attributes['padding']); $attributes['width'] = absint($attributes['width']); $attributes['image'] = esc_url($attributes['image']); $attributes['image_alt'] = esc_attr($attributes['image_alt']); $attributes['hd_image'] = esc_url($attributes['hd_image']); $attributes['media'] = esc_url($attributes['media']); // $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']); $container_classes = array('shortcode-single-image-wrap'); $media_classes = array('shortcode-single-image'); $container_style = array(); $media = ''; $content_block = ''; $content = strip_shortcodes($content); $attributes['type'] = 'video'; $attributes['lightbox'] = 1; switch ($attributes['style']) { case '3': $container_classes[] = 'br-standard'; case '2': $container_classes[] = 'borderframe'; $style = ' style="padding: ' . esc_attr($attributes['padding']) . 'px"'; break; default: $style = ''; } switch ($attributes['align']) { case 'left': $container_classes[] = 'alignleft'; break; case 'right': $container_classes[] = 'alignright'; break; case 'centre': case 'center': $container_classes[] = 'alignnone'; break; } if (presscore_shortcode_animation_on($attributes['animation'])) { $container_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']); } if ($content) { $container_classes[] = 'caption-on'; $content_block = '<div class="shortcode-single-caption">' . $content . '</div>'; } $default_image_src = $attributes['image'] ? $attributes['image'] : $attributes['hd_image']; if (dt_retina_on()) { $image_src = dt_is_hd_device() ? $attributes['hd_image'] : $attributes['image']; } else { $image_src = $attributes['image']; } if (empty($image_src)) { $image_src = $default_image_src; } $media = sprintf('<img src="%s" alt="%s" />', $image_src, $attributes['image_alt']); $media = sprintf('<div class="rollover-video">%s<a class="video-icon dt-single-mfp-popup dt-mfp-item mfp-iframe" href="%s" title="%s" data-dt-img-description="%s"></a></div>', $media, $attributes['media'], $attributes['image_alt'], esc_attr($content)); if ($media) { $media = sprintf('<div class="%s"%s><div class="fancy-media-wrap">%s</div></div>', esc_attr(implode(' ', $media_classes)), $style, $media); } if ($attributes['width']) { $container_style[] = 'width: ' . $attributes['width'] . 'px'; } $output = sprintf('<div class="%s"%s>%s</div>', esc_attr(implode(' ', $container_classes)), $container_style ? ' style="' . esc_attr(implode(';', $container_style)) . '"' : '', $media . $content_block); return $output; }
protected function get_container_html_class($custom_class = '') { $container_classes = array(); if ($custom_class) { $container_classes[] = $custom_class; } switch ($this->atts['style']) { case '1': $container_classes[] = 'box-style-table'; break; default: $container_classes[] = 'table'; } switch ($this->atts['background']) { case 'fancy': $container_classes[] = 'shortcode-action-bg'; $container_classes[] = 'block-style-widget'; break; case 'plain': $container_classes[] = 'shortcode-action-bg'; $container_classes[] = 'plain-bg'; break; } /** * @deprecated Only for backward compatibility */ if (in_array($this->atts['text_align'], array('center', 'centre'))) { $container_classes[] = 'text-centered'; } if (!$this->atts['line']) { $container_classes[] = 'no-line'; } if (presscore_shortcode_animation_on($this->atts['animation'])) { $container_classes[] = presscore_get_shortcode_animation_html_class($this->atts['animation']); } return 'class="' . esc_attr(implode(' ', $container_classes)) . '"'; }
public function shortcode($atts, $content = null) { $default_atts = array('type' => '', 'style' => '1', 'image' => '', 'image_alt' => '', 'image_id' => '', 'image_width' => '', 'image_height' => '', 'misc_link' => '', 'target' => 'blank', 'media' => '', 'background' => 'plain', 'lightbox' => '0', 'content_size' => 'big', 'text_align' => 'left', 'animation' => 'none'); $attributes = shortcode_atts($default_atts, $atts); $attributes['type'] = sanitize_key($attributes['type']); $attributes['target'] = sanitize_key($attributes['target']); $attributes['style'] = sanitize_key($attributes['style']); $attributes['background'] = sanitize_key($attributes['background']); $attributes['content_size'] = sanitize_key($attributes['content_size']); $attributes['text_align'] = sanitize_key($attributes['text_align']); $attributes['image_id'] = absint($attributes['image_id']); $attributes['image_alt'] = esc_attr($attributes['image_alt']); $attributes['image_width'] = absint($attributes['image_width']); $attributes['image_height'] = absint($attributes['image_height']); $attributes['misc_link'] = esc_url($attributes['misc_link']); $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']); $attributes['media'] = esc_url($attributes['media']); $container_classes = array('shortcode-teaser'); $content_classes = array('shortcode-teaser-content'); $media = ''; // container classes if ('1' == $attributes['style']) { $container_classes[] = 'img-full'; } switch ($attributes['background']) { case 'fancy': $container_classes[] = 'frame-fancy'; case 'plain': $container_classes[] = 'frame-on'; } if (in_array($attributes['text_align'], array('center', 'centre'))) { $container_classes[] = 'text-centered'; } // content classes switch ($attributes['content_size']) { case 'small': $content_classes[] = 'text-small'; break; case 'normal': $content_classes[] = 'text-normal'; break; case 'big': default: $content_classes[] = 'text-big'; } if (presscore_shortcode_animation_on($attributes['animation'])) { $container_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']); } if ('uploaded_image' == $attributes['type']) { $attributes['image'] = $attributes['image_id']; $attributes['media'] = ''; } else { if ('image' == $attributes['type']) { $attributes['media'] = ''; } else { if ('video' == $attributes['type']) { $attributes['image'] = ''; } } } // if media url is set - do some stuff if ($attributes['media']) { $container_classes[] = 'shortcode-single-video'; $media = sprintf('<div class="shortcode-teaser-img"><div class="shortcode-teaser-video">%s</div></div>', dt_get_embed($attributes['media'])); // if image is set } elseif ($attributes['image']) { if (is_numeric($attributes['image'])) { $image_id = absint($attributes['image']); $image_info = wp_get_attachment_image_src($image_id, 'full'); // get image src if (!$image_info) { $image_info = presscore_get_default_image(); } $image_src = $image_info[0]; // get image alt if (empty($attributes['image_alt'])) { $attributes['image_alt'] = esc_attr(get_post_meta($image_id, '_wp_attachment_image_alt', true)); } // get image dimensions $attributes['image_width'] = $image_info[1]; $attributes['image_height'] = $image_info[2]; } else { $image_src = esc_url($attributes['image']); } // format image dimesions $image_dimension_attrs = ''; if ($attributes['image_width'] > 0 && $attributes['image_height'] > 0) { $image_dimension_attrs .= ' width="' . $attributes['image_width'] . '"'; $image_dimension_attrs .= ' height="' . $attributes['image_height'] . '"'; } $media = sprintf('<img src="%s" alt="%s"%s />', $image_src, $attributes['image_alt'], $image_dimension_attrs); if ($attributes['lightbox']) { $media = sprintf('<a class="rollover rollover-zoom dt-single-mfp-popup dt-mfp-item mfp-image" href="%s" title="%s" data-dt-img-description="%s">%s</a>', $image_src, esc_attr($attributes['image_alt']), '', $media); } else { if ($attributes['misc_link']) { $media = sprintf('<a class="rollover" href="%s"%s>%s</a>', $attributes['misc_link'], 'blank' == $attributes['target'] ? ' target="_blank"' : '', $media); } } $media = sprintf('<div class="shortcode-teaser-img">%s</div>', $media); } $output = sprintf('<section class="%s">%s<div class="%s">%s</div></section>', esc_attr(implode(' ', $container_classes)), $media, esc_attr(implode(' ', $content_classes)), presscore_remove_wpautop($content, true)); return $output; }
} $img['thumbnail'] = str_replace('<img ', '<img data-vc-zoom="' . $large_img_src . '" ', $img['thumbnail']); break; } // backward compatibility if (vc_has_class('prettyphoto', $el_class)) { $el_class = vc_remove_class('prettyphoto', $el_class); } $html = 'vc_box_shadow_3d' === $style ? '<span class="vc_box_shadow_3d_wrap">' . $img['thumbnail'] . '</span>' : $img['thumbnail']; if ($link) { $a_attrs['href'] = $link; $a_attrs['target'] = $img_link_target; $html = '<a ' . vc_stringify_attributes($a_attrs) . '>' . $html . '</a>'; } $html = '<div class="vc_single_image-wrapper ' . $style . ' ' . $border_color . '">' . $html . '</div>'; $class_to_filter = 'wpb_single_image wpb_content_element vc_align_' . $alignment . ' ' . presscore_get_shortcode_animation_html_class($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); if (in_array($source, array('media_library', 'featured_image')) && 'yes' === $add_caption) { $post = get_post($img_id); $caption = $post->post_excerpt; } else { if ('external_link' === $source) { $add_caption = 'yes'; } } if ('yes' === $add_caption && '' !== $caption) { $html = ' <figure class="vc_figure"> ' . $html . ' <figcaption class="vc_figure-caption">' . esc_html($caption) . '</figcaption>
* @var string $color * @var string $css_animation * @var string $message_box_type * @var string $message_box_style * @var string $message_box_shape * @var string $message_box_color * @var string $icon_type */ $defaultFont = 'fontawesome'; $defaultIconClass = 'fa fa-info-circle'; //$this->convert.. $atts = $this->convertAttributesToMessageBox2($atts); $defaults = array('el_class' => '', 'message_box_style' => 'classic', 'style' => 'rounded', 'color' => '', 'message_box_color' => 'alert-info', 'css_animation' => '', 'icon_type' => $defaultFont, 'icon_fontawesome' => $defaultIconClass); $atts = vc_shortcode_attribute_parse($defaults, $atts); extract($atts); $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'vc_message_box', $this->settings['base'], $atts), 'style' => 'vc_message_box-' . $message_box_style, 'shape' => 'vc_message_box-' . $style, 'color' => strlen($color) > 0 && strpos('alert', $color) === false ? 'vc_color-' . $color : 'vc_color-' . $message_box_color, 'extra' => $this->getExtraClass($el_class), 'css_animation' => presscore_get_shortcode_animation_html_class($css_animation)); $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass)); // Pick up icons $iconClass = isset(${"icon_" . $icon_type}) ? ${"icon_" . $icon_type} : $defaultIconClass; switch ($color) { case 'info': $icon_type = 'fontawesome'; $iconClass = 'fa fa-info-circle'; break; case 'alert-info': $icon_type = 'pixelicons'; $iconClass = 'vc_pixel_icon vc_pixel_icon-info'; break; case 'success': $icon_type = 'fontawesome'; $iconClass = 'fa fa-check';
<?php if (!defined('ABSPATH')) { exit; // Exit if accessed directly } /** * Shortcode attributes * @var $atts * @var $el_class * @var $css_animation * @var $css * @var $content - shortcode content * Shortcode class * @var $this WPBakeryShortCode_VC_Column_text */ $el_class = $css = $css_animation = ''; $atts = vc_map_get_attributes($this->getShortcode(), $atts); extract($atts); $class_to_filter = 'wpb_text_column wpb_content_element ' . presscore_get_shortcode_animation_html_class($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) . '"> <div class="wpb_wrapper"> ' . wpb_js_remove_wpautop($content, true) . ' </div> </div> '; echo $output;
* @var string $style * @var string $color * @var string $size * @var string $open * @var string $css_animation * * @var array $atts */ extract(shortcode_atts(array('title' => __("Click to toggle", "js_composer"), 'el_class' => '', 'style' => 'default', 'color' => 'default', 'size' => '', 'open' => 'false', 'css_animation' => '', 'el_id' => ''), $atts)); // checking is color inverted $style = str_replace('_outline', '', $style, $inverted); /** * class wpb_toggle removed since 4.4 * @since 4.4 */ $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'vc_toggle', $this->settings['base'], $atts), 'style' => 'vc_toggle_' . $style, 'color' => $color ? 'vc_toggle_color_' . $color : '', 'inverted' => $inverted ? 'vc_toggle_color_inverted' : '', 'size' => $size ? 'vc_toggle_size_' . $size : '', 'open' => $open == 'true' ? 'vc_toggle_active' : '', 'extra' => $this->getExtraClass($el_class), 'css_animation' => presscore_get_shortcode_animation_html_class($css_animation)); $elementClass = trim(implode(' ', $elementClass)); ?> <div <?php echo isset($el_id) && !empty($el_id) ? "id='" . esc_attr($el_id) . "'" : ""; ?> class="<?php echo esc_attr($elementClass); ?> "> <div class="vc_toggle_title"><?php echo apply_filters('wpb_toggle_heading', '<h4>' . esc_html($title) . '</h4>', array('title' => $title, 'open' => $open)); ?> <i class="vc_toggle_icon"></i></div> <div
public function shortcode_benefit($atts, $content = null) { $attributes = shortcode_atts(array('image_link' => '', 'target_blank' => 'true', 'image' => '', 'hd_image' => '', 'header_size' => 'h4', 'title' => '', 'content_size' => 'normal'), $atts); $attributes['image_link'] = esc_url($attributes['image_link']); $attributes['image'] = esc_url($attributes['image']); $attributes['hd_image'] = esc_url($attributes['hd_image']); $attributes['header_size'] = in_array($attributes['header_size'], array('h2', 'h3', 'h4', 'h5', 'h6')) ? $attributes['header_size'] : 'h4'; $attributes['content_size'] = in_array($attributes['content_size'], array('normal', 'small', 'big')) ? $attributes['content_size'] : 'normal'; $attributes['title'] = wp_kses($attributes['title'], array()); $attributes['target_blank'] = apply_filters('dt_sanitize_flag', $attributes['target_blank']); $image = ''; $title = ''; $output = ''; $default_image = null; $images = array($attributes['image'], $attributes['hd_image']); // get default logo foreach ($images as $img) { if ($img) { $default_image = $img; break; } } if (!empty($default_image)) { if (dt_retina_on()) { $image = dt_is_hd_device() ? $images[1] : $images[0]; } else { $image = $images[0]; } if (empty($image)) { $image = $default_image; } // ssl support $image = dt_make_image_src_ssl_friendly($image); $image = sprintf('<img src="%s" alt="" />', $image); $image_classes = array('benefits-grid-ico'); if (presscore_shortcode_animation_on(self::$atts['animation'])) { $image_classes[] = presscore_get_shortcode_animation_html_class(self::$atts['animation']); } // ninjaaaa! $image_classes = esc_attr(implode(' ', $image_classes)); if ($attributes['image_link']) { $image = sprintf('<a href="%s" class="%s"%s>%s</a>', $attributes['image_link'], $image_classes, $attributes['target_blank'] ? ' target="_blank"' : '', $image); } else { $image = sprintf('<span class="%s">%s</span>', $image_classes, $image); } } if ($attributes['title']) { $title = sprintf('<%1$s>%2$s</%1$s>', $attributes['header_size'], $attributes['title']); } $style = '1'; $column = '4'; $dividers = ' class="borders"'; if (!empty(self::$atts)) { $style = self::$atts['style']; $column = self::$atts['columns']; $dividers = !self::$atts['dividers'] ? $dividers = '' : $dividers; } switch ($column) { case '1': $column_class = 'wf-1'; break; case '2': $column_class = 'wf-1-2'; break; case '3': $column_class = 'wf-1-3'; break; case '5': $column_class = 'wf-1-5'; break; default: $column_class = 'wf-1-4'; } switch ($style) { case '2': $output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s"><div class="wf-table"><div class="wf-td">%s</div><div class="wf-td">%s</div></div>%s</div></div></div>', $column_class, $dividers, $attributes['content_size'], $image, $title, do_shortcode(wpautop($content))); break; case '3': $output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s"><div class="wf-table"><div class="wf-td">%s</div><div class="wf-td benefits-inner">%s</div></div></div></div></div>', $column_class, $dividers, $attributes['content_size'], $image, $title . do_shortcode(wpautop($content))); break; default: $output = sprintf('<div class="wf-cell %s"><div%s><div class="text-%s">%s</div></div></div>', $column_class, $dividers, $attributes['content_size'], $image . $title . do_shortcode(wpautop($content))); } return $output; }
} else { if (!empty($img_link)) { $link_to = $img_link; if (!preg_match('/^(https?\\:\\/\\/|\\/\\/)/', $link_to)) { $link_to = 'http://' . $link_to; } $a_class = ' class="' . $rollover_class . $img_class . ' ' . $style . '"'; } } } //to disable relative links uncomment this.. if (!empty($a_class)) { $img_class = ''; } $img = wpb_getImageBySize(array('attach_id' => $img_id, 'thumb_size' => $img_size, 'class' => 'vc_single_image-img')); if ($img == NULL) { $img['thumbnail'] = '<img class="vc_img-placeholder ' . $img_class . '" src="' . vc_asset_url('vc/no_image.png') . '" />'; } //' <small>'.__('This is image placeholder, edit your page to replace it.', 'the7mk2').'</small>'; $img_output = $style == 'vc_box_shadow_3d' ? '<span class="vc_box_shadow_3d_wrap">' . $img['thumbnail'] . '</span>' : $img['thumbnail']; $image_string = !empty($link_to) ? '<div class="vc_single_image-wrapper ' . $style . ' ' . $border_color . '"><a' . $a_class . ' href="' . $link_to . '"' . ' target="' . $img_link_target . '"' . '>' . $img_output . '</a></div>' : '<div class="vc_single_image-wrapper ' . $style . ' ' . $border_color . '">' . $img_output . '</div>'; $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_single_image wpb_content_element' . $el_class . vc_shortcode_custom_css_class($css, ' '), $this->settings['base'], $atts); $css_class .= ' ' . presscore_get_shortcode_animation_html_class($css_animation); $css_class .= ' vc_align_' . $alignment; $output .= "\n\t" . '<div class="' . $css_class . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= "\n\t\t\t" . wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_singleimage_heading')); $output .= "\n\t\t\t" . $image_string; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment('.wpb_single_image'); echo $output;
public function render_benefit($attributes, $content = null) { $image = ''; if ($attributes['icon_code']) { $image = wp_kses($attributes['icon_code'], array('i' => array('class' => array()))); } else { $default_image = null; $images = array($attributes['image'], $attributes['hd_image']); // get default logo foreach ($images as $img) { if ($img) { $default_image = $img; break; } } if (!empty($default_image)) { if (dt_retina_on()) { $image = dt_is_hd_device() ? $images[1] : $images[0]; } else { $image = $images[0]; } if (empty($image)) { $image = $default_image; } // ssl support $image = dt_make_image_src_ssl_friendly($image); $image_size = ''; if (!empty($attributes['image_size'])) { $image_size = image_hwstring($attributes['image_size'][0], $attributes['image_size'][1]); } $image = sprintf('<img src="%s" %s alt="%s" />', $image, $image_size, esc_attr($attributes['image_alt'])); } } if ($image) { $image_classes = array('benefits-grid-ico'); if (presscore_shortcode_animation_on($attributes['animation'])) { $image_classes[] = presscore_get_shortcode_animation_html_class($attributes['animation']); } // ninjaaaa! $image_classes = esc_attr(implode(' ', $image_classes)); if ($attributes['image_link']) { $image = sprintf('<a href="%s" class="%s"%s>%s</a>', $attributes['image_link'], $image_classes, $attributes['target_blank'] ? ' target="_blank"' : '', $image); } else { $image = sprintf('<span class="%s">%s</span>', $image_classes, $image); } } $style = empty($attributes['style']) ? '1' : $attributes['style']; $title = ''; if ($attributes['title']) { if ($attributes['image_link']) { $title = sprintf('<%1$s class="benefit-title"><a href="%2$s"%3$s>%4$s</a></%1$s>', $attributes['header_size'], $attributes['image_link'], $attributes['target_blank'] ? ' target="_blank"' : '', $attributes['title']); } else { $title = sprintf('<%1$s>%2$s</%1$s>', $attributes['header_size'], $attributes['title']); } } $output = ''; switch ($style) { case '2': $output .= '<div class="wf-cell">' . '<div>' . '<div class="text-' . $attributes['content_size'] . '">' . '<div class="wf-table">' . '<div class="wf-td">' . $image . '</div>' . '<div class="wf-td">' . $title . '</div>' . '</div>' . $content . '</div>' . '</div>' . '</div>'; break; case '3': $output .= '<div class="wf-cell">' . '<div>' . '<div class="text-' . $attributes['content_size'] . '">' . '<div class="wf-table">' . '<div class="wf-td">' . $image . '</div>' . '<div class="wf-td benefits-inner">' . $title . $content . '</div>' . '</div>' . '</div>' . '</div>' . '</div>'; break; default: $output .= '<div class="wf-cell">' . '<div>' . '<div class="text-' . $attributes['content_size'] . '">' . '<div class="line-decoration">' . $image . $title . '</div>' . $content . '</div>' . '</div>' . '</div>'; } return $output; }
protected function get_button_class() { $classes = array(); switch ($this->atts['size']) { case 'small': $classes[] = 'dt-btn-s'; break; case 'medium': $classes[] = 'dt-btn-m'; break; case 'big': $classes[] = 'dt-btn-l'; break; } switch ($this->atts['style']) { case 'light': $classes[] = 'dt-btn'; $classes[] = 'btn-light'; break; case 'link': $classes[] = 'btn-link'; break; case 'default': $classes[] = 'dt-btn'; break; } if (presscore_shortcode_animation_on($this->atts['animation'])) { $classes[] = presscore_get_shortcode_animation_html_class($this->atts['animation']); $classes[] = 'animation-builder'; } if ($this->atts['icon'] && 'right' == $this->atts['icon_align']) { $classes[] = 'ico-right-side'; } if ($this->atts['el_class']) { $classes[] = $this->atts['el_class']; } return implode(' ', $classes); }
protected function get_html_class() { // static classes $classes = array('btn-shortcode'); // base classes table // contains array( 'attribute' => array( 'value' => 'class' ) ) $att_value_class_table = array('size' => array('small' => 'dt-btn-s', 'medium' => 'dt-btn-m', 'big' => 'dt-btn-l'), 'style' => array('light' => 'dt-btn btn-light', 'outline' => 'dt-btn outline-btn', 'outline_with_bg' => 'dt-btn outline-bg-btn', 'link' => 'btn-link', 'light_with_bg' => 'dt-btn light-bg-btn', 'default' => 'dt-btn'), 'text_color_style' => array('context' => 'title-btn-color', 'default' => 'default-btn-color', 'accent' => 'accent-btn-color', 'custom' => 'custom-btn-color'), 'text_hover_color_style' => array('context' => 'title-btn-hover-color', 'default' => 'default-btn-hover-color', 'accent' => 'accent-btn-hover-color', 'custom' => 'custom-btn-hover-color'), 'bg_color_style' => array('default' => 'default-btn-bg-color', 'accent' => 'accent-btn-bg-color'), 'bg_hover_color_style' => array('default' => 'default-btn-bg-hover-color', 'accent' => 'accent-btn-bg-hover-color')); foreach ($att_value_class_table as $att => $values) { // if att from table exists - get it's value $value = array_key_exists($att, $this->atts) ? $this->atts[$att] : false; // if att value mentioned in table - add class from table if ($value && array_key_exists($value, $values)) { $classes[] = $values[$value]; } } // animation if (presscore_shortcode_animation_on($this->atts['animation'])) { $classes[] = presscore_get_shortcode_animation_html_class($this->atts['animation']); $classes[] = 'animation-builder'; } // icon alignment if ($this->atts['icon'] && 'right' == $this->atts['icon_align']) { $classes[] = 'ico-right-side'; } // smooth scroll if ($this->atts['smooth_scroll']) { $classes[] = 'anchor-link'; } // custom class if ($this->atts['el_class']) { $classes[] = $this->atts['el_class']; } return presscore_esc_implode(' ', $classes); }