コード例 #1
0
 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;
 }
コード例 #2
0
ファイル: list-vc.php プロジェクト: noman90rauf/wp-content
 public function shortcode_item($atts, $content = null)
 {
     extract(shortcode_atts(array('image' => ''), $atts));
     $image = esc_url($image);
     if (isset(self::$atts['style']) && '3' == self::$atts['style']) {
         $content = '<div>' . $content . '</div>';
         if ($image) {
             $content = sprintf('<div><img src="%s" class="list-img" alt="" /></div>%s', $image, $content);
         }
         $content = '<div class="wf-table">' . $content . '</div>';
     }
     $output = sprintf('<li>%s</li>', presscore_remove_wpautop($content, true));
     return $output;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 public function shortcode($atts, $content = null)
 {
     $this->sanitize_attributes($atts);
     $button = $this->strip_first_button_shortcode($content);
     $output = '';
     $output .= '<section ' . $this->get_container_html_class('shortcode-action-box') . '>';
     $output .= '<div ' . $this->get_content_html_class('shortcode-action-container') . '>';
     /**
      * @see sanitize-functions.php
      */
     $output .= presscore_remove_wpautop($content, true);
     $output .= '</div>';
     $output .= $button;
     $output .= '</section>';
     return $output;
 }
コード例 #5
0
ファイル: banner.php プロジェクト: noman90rauf/wp-content
 public function shortcode($atts, $content = null)
 {
     $this->sanitize_attributes($atts);
     $output = '';
     $output .= '<div ' . $this->get_container_html_class('shortcode-banner') . ' ' . $this->get_container_inline_style() . $this->get_link() . '>';
     $output .= '<div class="shortcode-banner-bg wf-table" ' . $this->get_bg_inline_style() . '>';
     $output .= '<div ' . $this->get_inner_html_class('shortcode-banner-inside wf-table') . ' ' . $this->get_inner_inline_style() . '>';
     $output .= '<div>';
     /**
      * @see sanitize-functions.php
      */
     $output .= presscore_remove_wpautop($content, true);
     $output .= '</div>';
     $output .= '</div>';
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }
コード例 #6
0
 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;
 }