示例#1
0
 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('title' => '', 'type' => 'image', 'image' => '', 'link' => '', 'effect' => '', 'max_width' => 650, 'icon_type' => 'icon', 'iconbox_icon' => 'fa fa-adjust', 'iconbox_image' => '', 'color' => '', 'custom_color' => '', 'size' => 'md', 'align' => 'center', 'el_class' => '', 'css_animation' => '', 'animation_delay' => '', 'css' => ''), $atts);
     extract($atts);
     $output = $custom_css = '';
     $uniqid = uniqid();
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'lightbox-content', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => cruxstore_getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'align' => 'text-' . $align);
     $lightbox_icon = '';
     if ($icon_type == 'image') {
         $img_lightbox_id = preg_replace('/[^\\d]/', '', $iconbox_image);
         $img_lightbox = wp_get_attachment_image_src($img_lightbox_id, 'full');
         if (array($img_lightbox)) {
             $lightbox_icon = sprintf('<img src="%s" class="img-responsive" alt="" />', $img_lightbox['0']);
         }
     } else {
         $lightbox_class = array('vc_lightbox size-' . $size);
         if ($color != 'custom') {
             $lightbox_class[] = 'color-' . $color;
             $custom_color = cruxstore_color2Hex($color);
         }
         $lightbox_style = 'style="color: ' . $custom_color . '"';
         $lightbox_icon = sprintf('<span class="%s %s" %s></span>', $iconbox_icon, implode(' ', $lightbox_class), $lightbox_style);
     }
     $link_attr = array('href' => '', 'class' => 'lightbox-link lightbox-' . $type);
     if ($type == 'inline') {
         $link_attr['href'] = '#lightbox-content' . $uniqid;
         $output .= sprintf('<div id="%s" class="%s">%s</div>', 'lightbox-content' . $uniqid, 'mfp-hide lightbox-popup-block mfp-with-anim', $content);
     } elseif ($type == 'iframe') {
         $link_attr['href'] = $link;
     } else {
         $img_lightbox_id = preg_replace('/[^\\d]/', '', $image);
         $img_lightbox = wp_get_attachment_image_src($img_lightbox_id, 'full');
         if (array($img_lightbox)) {
             $link_attr['href'] = $img_lightbox['0'];
         } else {
             $link_attr['href'] = vc_asset_url('vc/no_image.png');
         }
     }
     $output .= sprintf('<a href="%s" class="%s" data-type="%s" data-effect="%s" data-width="%s">%s</a>', $link_attr['href'], $link_attr['class'], $type, $effect, $max_width, $lightbox_icon);
     if ($animation_delay) {
         $animation_delay = sprintf(' data-wow-delay="%sms"', $animation_delay);
     }
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div id="lightbox-' . $uniqid . '" class="' . esc_attr($elementClass) . '"' . $animation_delay . '>' . $output . $custom_css . '</div>';
 }
示例#2
0
 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('style' => 'check', 'background_style' => '', 'background_color' => 'grey', 'custom_background_color' => '', 'color' => 'black', 'custom_color' => '', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
     extract($atts);
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cruxstore-list ', $this->settings['base'], $atts), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'css_animation' => $this->getCSSAnimation($css_animation), 'extra' => $this->getExtraClass($el_class), 'style' => 'style-' . $style);
     $uniqid = 'fancy-list-' . uniqid();
     $custom_css = '';
     if ($color == 'custom') {
         $color = $custom_color;
     } else {
         $color = cruxstore_color2Hex($color);
     }
     $custom_css .= '#' . $uniqid . ' > ul > li:before{color: ' . $color . ';}';
     if (strlen($background_style) > 0) {
         if ($background_color == 'custom') {
             $background_color = $custom_background_color;
         } else {
             $background_color = cruxstore_color2Hex($background_color);
         }
         if (false !== strpos($background_style, 'outline')) {
             $background_style .= ' list-outline';
             // if we use outline style it is border in css
             $custom_css .= '#' . $uniqid . ' > ul > li:before{border-color:' . $background_color . ';}';
         } else {
             $background_style .= ' list-background';
             $custom_css .= '#' . $uniqid . ' > ul > li:before{background:' . $background_color . ';}';
         }
         $elementClass[] = 'bg-style-' . $background_style;
         $elementClass[] = 'bg-style';
     }
     if ($custom_css) {
         $custom_css = '<div class="cruxstore_custom_css" data-css="' . esc_attr($custom_css) . '"></div>';
     }
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div id="' . $uniqid . '" class="' . esc_attr($elementClass) . '">' . $content . $custom_css . '</div>';
 }
示例#3
0
 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('title' => esc_html__('Title', 'js_composer'), 'word' => 'false', 'line_color' => '#333333', 'border_width' => '1', 'line_width' => '', 'line_style' => '', 'size' => 'md', 'color' => 'grey', 'custom_color' => '', 'icon' => '', 'image' => '', 'spacer_position' => 'middle', 'spacer' => '', 'align' => 'center', 'font_size' => '', 'line_height' => '', 'letter_spacing' => '', 'font_container' => '', 'use_theme_fonts' => 'yes', 'google_fonts' => '', 'font_option' => '', 'css_animation' => '', 'animation_delay' => '', 'el_class' => '', 'css' => ''), $atts);
     // This is needed to extract $font_container_data and $google_fonts_data
     extract($this->getAttributes($atts));
     unset($font_container_data['values']['text_align']);
     $atts = vc_map_get_attributes($this->getShortcode(), $atts);
     extract($atts);
     extract($this->getStyles($el_class, $css, $google_fonts_data, $font_container_data, $atts));
     $settings = get_option('wpb_js_google_fonts_subsets');
     if (is_array($settings) && !empty($settings)) {
         $subsets = '&subset=' . implode(',', $settings);
     } else {
         $subsets = '';
     }
     if (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);
     }
     if (!empty($styles)) {
         $styles = array();
     }
     $font_option = explode(',', $font_option);
     if (in_array('uppercase', $font_option)) {
         $styles[] = 'text-transform: uppercase;';
     }
     if (in_array('underline', $font_option)) {
         $styles[] = 'text-decoration: underline;';
     }
     if (in_array('italic', $font_option)) {
         $styles[] = 'font-style: italic;';
     }
     if ($letter_spacing) {
         $styles[] = 'letter-spacing: ' . $letter_spacing . 'px';
     }
     if (count($styles)) {
         $style = 'style="' . esc_attr(implode(';', $styles)) . '"';
     } else {
         $style = '';
     }
     $output = '';
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cruxstore-heading ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => cruxstore_getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'align' => 'text-' . $align);
     $custom_css = '';
     $rand = 'cruxstore_heading_' . rand();
     if ($font_size) {
         $custom_css .= cruxstore_responsive_render('#' . $rand . ' .cruxstore-heading-title', 'font-size', $font_size);
     }
     if ($line_height) {
         $custom_css .= cruxstore_responsive_render('#' . $rand . ' .cruxstore-heading-title', 'line-height', $line_height);
     }
     if ($word == 'true') {
         $title_arr = preg_split("/\\s+/", $title);
         $title_arr[0] = "<span>" . $title_arr[0] . "</span>";
         $title = join(" ", $title_arr);
     }
     $title = sprintf('<%1$s class="cruxstore-heading-title" %2$s>%3$s</%1$s>', $font_container_data['values']['tag'], $style, $title);
     $content = sprintf('<div class="cruxstore-heading-content">%s</div>', $content);
     $divider = '';
     if ($spacer) {
         $elementClass['spacer'] = 'cruxstore-heading-' . $spacer_position;
         $divider_content = '';
         $divider_class = array('cruxstore-heading-spacer', 'cruxstore-heading-' . $spacer);
         $styles_divider = array();
         if (!$line_style) {
             $line_style = 'solid';
         }
         if (!$border_width) {
             $border_width = 1;
         }
         if ($spacer == 'line') {
             $styles_divider[] = 'border-color: ' . $line_color;
             $styles_divider[] = 'border-top-width: ' . intval($border_width) . 'px';
             $styles_divider[] = 'border-top-style: ' . $line_style;
             if ($line_width) {
                 $styles_diver[] = 'width: ' . intval($line_width) . 'px';
             }
         } elseif ($spacer == 'icon') {
             if ($icon) {
                 $icon_style = '';
                 $icon_class = array('iconbox-ct', 'size-' . $size);
                 if ($color != '' && $color != 'custom') {
                     $icon_class[] = 'color-' . $color;
                     $custom_color = cruxstore_color2Hex($color);
                 }
                 if ($custom_color) {
                     $icon_style .= 'color: ' . $custom_color . ';';
                 }
                 if ($icon_style) {
                     $icon_style = sprintf('style="%s"', $icon_style);
                 }
                 $divider_content = sprintf('<span class="%s %s" %s></span>', $icon, implode(' ', $icon_class), $icon_style);
             }
         } elseif ($spacer == 'image') {
             $img_id = preg_replace('/[^\\d]/', '', $image);
             $img_url = wp_get_attachment_image_src($img_id, 'full');
             if (array($img_url)) {
                 $icon = sprintf('<img src="%s" class="img-responsive" alt="" />', $img_url['0']);
             }
             $divider_content = sprintf('<span class="%s">%s</span>', 'icon-image', $icon);
         }
         $styles_divider = 'style="' . esc_attr(implode(';', $styles_divider)) . '"';
         $divider = '<div class="' . implode(' ', $divider_class) . '" ' . $styles_divider . '>' . $divider_content . '</div>';
     }
     if ($custom_css) {
         $custom_css = '<div class="cruxstore_custom_css" data-css="' . esc_attr($custom_css) . '"></div>';
     }
     if ($spacer_position == 'bottom') {
         $output .= $title . $content . $divider;
     } elseif ($spacer_position == 'top') {
         $output .= $divider . $title . $content;
     } else {
         $output .= $title . $divider . $content;
     }
     $output .= $custom_css;
     if ($animation_delay) {
         $animation_delay = sprintf(' data-wow-delay="%sms"', $animation_delay);
     }
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div id="' . $rand . '"  class="' . esc_attr($elementClass) . '"' . $animation_delay . '>' . $output . '</div>';
 }
示例#4
0
 protected function content($atts, $content = null)
 {
     $atts = shortcode_atts(array('hover_div' => '', 'link' => '', 'type' => 'icon', 'image' => '', 'svg' => '', 'icon' => 'fa fa-adjust', 'size' => 'md', 'color' => '', 'custom_color' => '', 'color_hover' => '', 'custom_color_hover' => '', 'background_style' => 'default', 'background_color' => 'grey', 'custom_background_color' => '', 'background_color_hover' => '', 'custom_background_color_hover' => '', 'align' => 'center', 'el_class' => '', 'css_animation' => '', 'animation_delay' => '', 'css' => ''), $atts);
     extract($atts);
     $custom_css = $output = $icon_style = '';
     $uniqid = 'icon-box-' . uniqid();
     if (!$hover_div) {
         $hover_div = '#' . $uniqid . ' .iconbox-ct:hover';
     }
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'iconbox', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => cruxstore_getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '), 'align' => 'text-' . $align);
     $icon_class = array();
     if ($type == 'image') {
         $img_id = preg_replace('/[^\\d]/', '', $image);
         $img_url = wp_get_attachment_image_src($img_id, 'full');
         if (array($img_url)) {
             $icon = sprintf('<img src="%s" class="img-responsive" alt="" />', $img_url['0']);
         }
         $output = sprintf('<span class="%s %s" %s>%s</span>', 'icon-image', implode(' ', $icon_class), $icon_style, $icon);
     } else {
         if ($type == 'svg' && !$svg || $type == 'icon' && !$icon) {
             return;
         }
         $icon_class = array('iconbox-ct', 'size-' . $size, 'style-' . $background_style);
         if ($background_style != '' && $background_style != 'default') {
             $icon_class[] = 'style-special';
         }
         if ($background_color != '' && $background_color != 'custom') {
             $icon_class[] = 'background-' . $background_color;
             $custom_background_color = cruxstore_color2Hex($background_color);
         }
         if ($custom_background_color && $background_style != 'default') {
             if (strpos($background_style, 'outline') !== false) {
                 $icon_style .= 'border-color: ' . $custom_background_color . ';';
             } else {
                 $icon_style .= 'background: ' . $custom_background_color . ';';
             }
         }
         if ($background_color_hover != '') {
             $custom_background_color_hover = cruxstore_color2Hex($background_color_hover);
         }
         if ($custom_background_color_hover && $background_style != 'default') {
             if (strpos($background_style, 'outline') !== false) {
                 $custom_css .= $hover_div . ' {border-color:' . $custom_background_color_hover . '!important;}';
             } else {
                 $custom_css .= $hover_div . ' {background:' . $custom_background_color_hover . '!important;}';
             }
         }
         if ($color != '' && $color != 'custom') {
             $icon_class[] = 'color-' . $color;
             $custom_color = cruxstore_color2Hex($color);
         }
         if ($custom_color) {
             $icon_style .= 'color: ' . $custom_color . ';';
             if ($type == 'svg') {
                 $custom_css .= '#' . $uniqid . ' path{fill:' . $custom_color . '!important;}';
             }
         }
         if ($color_hover != '') {
             $custom_color_hover = cruxstore_color2Hex($color_hover);
         }
         if ($custom_color_hover) {
             if ($type == 'svg') {
                 $custom_css .= $hover_div . ' path{fill:' . $custom_color_hover . '!important;}';
             } else {
                 $custom_css .= $hover_div . ' {color:' . $custom_color_hover . '!important;}';
             }
         }
         if ($icon_style) {
             $icon_style = sprintf('style="%s"', $icon_style);
         }
         if ($type == 'svg') {
             $svg = '<span class="svg-content">' . rawurldecode(base64_decode(strip_tags($svg))) . '</span>';
             $icon = 'icon-svg';
         } else {
             $svg = '';
         }
         $output = sprintf('<span class="%s %s" %s>%s</span>', $icon, implode(' ', $icon_class), $icon_style, $svg);
     }
     $url = vc_build_link($link);
     $rel = '';
     if (!empty($url['rel'])) {
         $rel = ' rel="' . esc_attr($url['rel']) . '"';
     }
     if (strlen($link) > 0 && strlen($url['url']) > 0) {
         $output = '<a class="iconbox-link" href="' . esc_attr($url['url']) . '" ' . $rel . ' title="' . esc_attr($url['title']) . '" target="' . (strlen($url['target']) > 0 ? esc_attr($url['target']) : '_self') . '">' . $output . '</a>';
     }
     if ($custom_css) {
         $custom_css = '<div class="cruxstore_custom_css" data-css="' . esc_attr($custom_css) . '"></div>';
     }
     if ($animation_delay) {
         $animation_delay = sprintf(' data-wow-delay="%sms"', $animation_delay);
     }
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     return '<div id="' . $uniqid . '" class="' . esc_attr($elementClass) . '"' . $animation_delay . '>' . $output . $custom_css . '</div>';
 }