/**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('alt' => '', 'image' => '', 'link' => '', 'linktarget' => '_self'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     $image_id = T4PCore_Plugin::get_attachment_id_from_url($image);
     if (!$alt && empty($alt) && $image_id) {
         self::$child_args['alt'] = $alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
     }
     if ($image_id) {
         self::$child_args['title_attr'] = get_post_field('post_excerpt', $image_id);
     }
     $output = sprintf('<img src="%s" alt="%s" />', $image, $alt);
     if ($link || self::$parent_args['lightbox'] == 'yes') {
         $output = sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('image-carousel-shortcode-slide-link'), $output);
     }
     $html = sprintf('<li><div %s>%s</div></li>', T4PCore_Plugin::attributes('image'), $output);
     return $html;
 }
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('avatar' => 'none', 'company' => '', 'image' => '', 'link' => '', 'name' => '', 'target' => '_self', 'gender' => ''), $args);
     extract($defaults);
     self::$child_args = $defaults;
     // check for deprecated
     if ($gender) {
         self::$child_args['avatar'] = $gender;
     }
     $inner_content = $thumbnail = $pic = '';
     if ($name) {
         if (self::$child_args['avatar'] == 'image' && $image) {
             $image_id = T4PCore_Plugin::get_attachment_id_from_url($image);
             self::$child_args['alt'] = '';
             if ($image_id) {
                 self::$child_args['alt'] = get_post_field('post_excerpt', $image_id);
             }
             $pic = sprintf('<img %s />', T4PCore_Plugin::attributes('testimonials-shortcode-image'));
         }
         if (self::$child_args['avatar'] == 'image' && !self::$child_args['image']) {
             self::$child_args['avatar'] = 'none';
         }
         if (self::$child_args['avatar'] != 'none') {
             $thumbnail = sprintf('<span %s>%s</span>', T4PCore_Plugin::attributes('testimonials-shortcode-thumbnail'), $pic);
         }
         $inner_content .= sprintf('<div %s>%s<span %s><strong>%s</strong>', T4PCore_Plugin::attributes('author'), $thumbnail, T4PCore_Plugin::attributes('company-name'), $name);
         if ($company) {
             if (!empty($link) && $link) {
                 $inner_content .= sprintf(', <a href="%s" target="%s">%s</a>', $link, $target, sprintf('<span>%s</span>', $company));
             } else {
                 $inner_content .= sprintf(', <span>%s</span>', $company);
             }
         }
         $inner_content .= '</span></div>';
     }
     $html = sprintf('<div %s><blockquote %s><q>%s</q></blockquote>%s</div>', T4PCore_Plugin::attributes('testimonials-shortcode-review'), T4PCore_Plugin::attributes('testimonials-shortcode-quote'), do_shortcode($content), $inner_content);
     return $html;
 }
Beispiel #3
0
 /**
  * Render the child shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render_child($args, $content = '')
 {
     $defaults = shortcode_atts(array('lightbox' => 'no', 'link' => NULL, 'linktarget' => '_self', 'type' => 'image'), $args);
     extract($defaults);
     self::$child_args = $defaults;
     self::$child_args['alt'] = '';
     self::$child_args['title'] = '';
     self::$child_args['src'] = $src = str_replace('&#215;', 'x', $content);
     if ($lightbox == 'yes' && $type == 'image') {
         if (!empty($link) && $link) {
             $image_id = T4PCore_Plugin::get_attachment_id_from_url($link);
         } else {
             $image_id = T4PCore_Plugin::get_attachment_id_from_url($src);
         }
         if ($image_id) {
             self::$child_args['alt'] = get_post_meta($image_id, '_wp_attachment_image_alt', true);
             self::$child_args['title'] = get_post_field("post_excerpt", $image_id);
         }
     }
     if (isset($link) && empty($link) && !$link && $type == 'image') {
         self::$child_args['link'] = $link = $src;
     }
     $html = sprintf('<li %s>', T4PCore_Plugin::attributes('slider-shortcode-slide-li'));
     if (!empty($link) && $link) {
         $html .= sprintf('<a %s>', T4PCore_Plugin::attributes('slider-shortcode-slide-link'));
     }
     if (!empty($type) && $type == 'video') {
         $html .= sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('full-video'), do_shortcode($content));
     } else {
         $html .= sprintf('<img %s />', T4PCore_Plugin::attributes('slider-shortcode-slide-img'));
     }
     if (!empty($link) && $link) {
         $html .= '</a>';
     }
     $html .= '</li>';
     return $html;
 }
 /**
  * Render the shortcode
  * @param  array $args     Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string          HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     global $evl_options;
     $defaults = T4PCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'align' => '', 'bordercolor' => '', 'bordersize' => $smof_data['imageframe_border_size'] . $evl_options['evl_shortcode_image_frame_border_size'], 'lightbox' => 'no', 'style' => '', 'style_type' => 'none', 'stylecolor' => '', 'animation_type' => '', 'animation_direction' => 'left', 'animation_speed' => ''), $args);
     extract($defaults);
     if (!$style) {
         $defaults['style'] = $style_type;
     }
     self::$args = $defaults;
     if (!$bordercolor) {
         $bordercolor = $smof_data['imgframe_border_color'] . $evl_options['evl_shortcode_image_frame_border_color'];
     }
     if (!$stylecolor) {
         $stylecolor = $smof_data['imgframe_style_color'] . $evl_options['evl_shortcode_image_frame_style_color'];
     }
     $rgb = T4PCore_Plugin::hex2rgb($stylecolor);
     $styles = '';
     if ($bordersize != '0') {
         $styles .= ".imageframe-{$this->imageframe_counter} img{border:{$bordersize} solid {$bordercolor};}";
     }
     if ($style == 'glow') {
         $styles .= ".imageframe-{$this->imageframe_counter}.imageframe-glow img{\r\n\t\t\t\t-moz-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\r\n\t\t\t\t-webkit-box-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\r\n\t\t\t\tbox-shadow: 0 0 3px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\r\n\t\t\t}";
     }
     if ($style == 'dropshadow') {
         $styles .= ".imageframe-{$this->imageframe_counter}.imageframe-dropshadow img{\r\n\t\t\t\t-moz-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\r\n\t\t\t\t-webkit-box-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\r\n\t\t\t\tbox-shadow: 2px 3px 7px rgba({$rgb[0]},{$rgb[1]},{$rgb[2]},.3);\r\n\t\t\t}";
     }
     $styles = sprintf('<style type="text/css">%s</style>', $styles);
     $html = sprintf('%s<span %s>', $styles, T4PCore_Plugin::attributes('imageframe-shortcode'));
     preg_match('/(class=["\'](.*?)["\'])/', $content, $classes);
     $class_style = '';
     if ($style == 'circle') {
         $class_style = ' img-circle';
     }
     if ($classes) {
         $content = str_replace($classes[0], sprintf('class="img-responsive %s%s"', $classes[2], $class_style), $content);
     } else {
         $content = str_replace('/>', sprintf('class="img-responsive%s" />', $class_style), $content);
     }
     $alt_tag = '';
     if (isset($image_id) && $image_id) {
         $alt_tag = sprintf('alt="%s"', get_post_meta($image_id, '_wp_attachment_image_alt', true));
     }
     if (strpos($content, 'alt=""') !== false && $alt_tag) {
         $content = str_replace('alt=""', $alt_tag, $content);
     } elseif (strpos($content, 'alt') === false && $alt_tag) {
         $content = str_replace('/> ', $alt_tag . ' />', $content);
     }
     $output = do_shortcode($content);
     if ($lightbox == 'yes') {
         preg_match('/(src=["\'](.*?)["\'])/', $content, $src);
         self::$args['link'] = $src[2];
         $image_id = T4PCore_Plugin::get_attachment_id_from_url(self::$args['link']);
         self::$args['title_attr'] = '';
         if ($image_id) {
             self::$args['title_attr'] = get_post_field('post_excerpt', $image_id);
         }
         $output = sprintf('<a %s>%s</a>', T4PCore_Plugin::attributes('imageframe-shortcode-link'), do_shortcode($content));
     }
     $html .= $output . '</span>';
     if ($align == 'center') {
         $html = sprintf('<div %s>%s</div>', T4PCore_Plugin::attributes('imageframe-align-center'), $html);
     }
     $this->imageframe_counter++;
     return $html;
 }