Esempio n. 1
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $button_text = !$button_text ? '' : $button_text;
     $button_size = !$button_size || strtolower($button_size) == 'default' ? '' : $button_size;
     $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color;
     $button_icon = !$icon ? '' : "<i class='{$icon}'></i>";
     $tag = 'a';
     $href = '';
     $single_item = explode('__#__', $single_item);
     $single_item = $single_item[0];
     if (!empty($link_type)) {
         $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies();
         $post_types = IG_Pb_Helper_Type::get_post_types();
         // single post
         if (array_key_exists($link_type, $post_types)) {
             $permalink = home_url() . "/?p={$single_item}";
             $href = !$single_item ? ' href="#"' : " href='{$permalink}'";
         } else {
             if (array_key_exists($link_type, $taxonomies)) {
                 $permalink = get_term_link(intval($single_item), $link_type);
                 if (!is_wp_error($permalink)) {
                     $href = !$single_item ? ' href="#"' : " href='{$permalink}'";
                 }
             } else {
                 switch ($link_type) {
                     case 'no_link':
                         $tag = 'button';
                         break;
                     case 'url':
                         $href = !$button_type_url ? ' href="#"' : " href='{$button_type_url}'";
                         break;
                 }
             }
         }
     }
     $target = '';
     if ($open_in) {
         switch ($open_in) {
             case 'current_browser':
                 $target = '';
                 break;
             case 'new_browser':
                 $target = ' target="_blank"';
                 break;
             case 'lightbox':
                 $cls_button_fancy = 'ig-button-fancy';
                 $script = IG_Pb_Helper_Functions::fancybox(".{$cls_button_fancy}", array('type' => 'iframe', 'width' => '75%', 'height' => '75%'));
                 break;
         }
     }
     $button_type = $tag == 'button' ? " type='button'" : '';
     $cls_button_fancy = !isset($cls_button_fancy) ? '' : $cls_button_fancy;
     $script = !isset($script) ? '' : $script;
     $html_result = "<{$tag} class='btn {$button_size} {$button_color} {$cls_button_fancy}'{$href}{$target}{$button_type}>[icon]{$button_icon}[/icon][title]{$button_text}[/title]</{$tag}>";
     return $html_result . $script . '<!--seperate-->';
 }
Esempio n. 2
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array   $atts     Shortcode attributes.
  * @param   string  $content  Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $html_elemments = $script = '';
     $alt_text = $image_alt ? " alt='{$image_alt}'" : '';
     $image_styles = array();
     if ($image_margin_top) {
         $image_styles[] = "margin-top:{$image_margin_top}px";
     }
     if ($image_margin_bottom) {
         $image_styles[] = "margin-bottom:{$image_margin_bottom}px";
     }
     if ($image_margin_right) {
         $image_styles[] = "margin-right:{$image_margin_right}px";
     }
     if ($image_margin_left) {
         $image_styles[] = "margin-left:{$image_margin_left}px";
     }
     $styles = count($image_styles) ? ' style="' . implode(';', $image_styles) . '"' : '';
     $class_img = $image_container_style != 'no-styling' ? $image_container_style : '';
     $class_img = $image_effect == 'yes' ? $class_img . ' image-scroll-fade' : $class_img;
     $class_img = !empty($class_img) ? ' class="' . $class_img . '"' : '';
     if ($image_file) {
         $image_id = IG_Pb_Helper_Functions::get_image_id($image_file);
         $attachment = wp_prepare_attachment_for_js($image_id);
         $image_file = !empty($attachment['sizes'][$image_size]['url']) ? $attachment['sizes'][$image_size]['url'] : $image_file;
         $html_elemments .= "<img src='{$image_file}'{$alt_text}{$styles}{$class_img} />";
         $script = '';
         $target = '';
         if ($image_effect == 'yes' and !isset($_POST['action'])) {
             $data = getimagesize($image_file);
             $width = $data[0];
             $height = $data[1];
             $html_elemments = "<img src='" . IG_Pb_Helper_Functions::path('assets/3rd-party') . '/jquery-lazyload/grey.gif' . "' data-original='{$image_file}' width='{$width}' height='{$height}' {$alt_text}{$styles} {$class_img}/>";
         }
         if ($open_in) {
             switch ($open_in) {
                 case 'current_browser':
                     $target = '';
                     break;
                 case 'new_browser':
                     $target = ' target="_blank"';
                     break;
                 case 'lightbox':
                     $cls_button_fancy = 'ig-image-fancy';
                     break;
             }
         }
         $class = isset($cls_button_fancy) && !empty($cls_button_fancy) ? " class='{$cls_button_fancy}'" : '';
         // get Single Item and check type to get right link
         $single_item = explode('__#__', $single_item);
         $single_item = $single_item[0];
         $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies();
         $post_types = IG_Pb_Helper_Type::get_post_types();
         // single post
         if (array_key_exists($link_type, $post_types)) {
             $permalink = home_url() . "/?p={$single_item}";
             $html_elemments = "<a href='{$permalink}'{$target}{$class}>" . $html_elemments . '</a>';
         } else {
             if (array_key_exists($link_type, $taxonomies)) {
                 $permalink = get_term_link(intval($single_item), $link_type);
                 if (!is_wp_error($permalink)) {
                     $html_elemments = "<a href='{$permalink}'{$target}{$class}>" . $html_elemments . '</a>';
                 }
             } else {
                 switch ($link_type) {
                     case 'url':
                         $html_elemments = "<a href='{$image_type_url}'{$target}{$class}>" . $html_elemments . '</a>';
                         break;
                     case 'large_image':
                         $image_id = IG_Pb_Helper_Functions::get_image_id($image_file);
                         $attachment = wp_prepare_attachment_for_js($image_id);
                         $image_url = !empty($attachment['sizes'][$image_image_size]['url']) ? $attachment['sizes'][$image_image_size]['url'] : $image_file;
                         $html_elemments = "<a href='{$image_url}'{$target}{$class}>" . $html_elemments . '</a>';
                         break;
                 }
             }
         }
         if (strtolower($image_alignment) != 'inherit') {
             if (strtolower($image_alignment) == 'left') {
                 $cls_alignment = 'pull-left';
             }
             if (strtolower($image_alignment) == 'right') {
                 $cls_alignment = 'pull-right';
             }
             if (strtolower($image_alignment) == 'center') {
                 $cls_alignment = 'text-center';
             }
             $html_elemments = "<div class='{$cls_alignment}'>" . $html_elemments . '</div>';
         }
     }
     return $this->element_wrapper($html_elemments . $script, $arr_params);
 }
Esempio n. 3
0
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $html_elemments = $script = '';
     $alt_text = $image_alt ? " alt='{$image_alt}'" : 'alt=""';
     $image_styles = array();
     if ($image_margin_top) {
         $image_styles[] = "margin-top:{$image_margin_top}px";
     }
     if ($image_margin_bottom) {
         $image_styles[] = "margin-bottom:{$image_margin_bottom}px";
     }
     if ($image_margin_right) {
         $image_styles[] = "margin-right:{$image_margin_right}px";
     }
     if ($image_margin_left) {
         $image_styles[] = "margin-left:{$image_margin_left}px";
     }
     $styles = count($image_styles) ? ' style="' . implode(';', $image_styles) . '"' : '';
     $class_img = $image_container_style != 'no-styling' ? $image_container_style : '';
     $class_img = $image_effect == 'yes' ? $class_img . ' image-scroll-fade' : $class_img;
     $class_img = !empty($class_img) ? ' class="' . $class_img . '"' : '';
     if ($image_type == 'banner') {
         $img_banner = ' data-image-type="banner" data-image-text="' . $banner_text . '" ';
     }
     if ($image_file) {
         $image_id = IG_Pb_Helper_Functions::get_image_id($image_file);
         $attachment = wp_prepare_attachment_for_js($image_id);
         $image_file = !empty($attachment['sizes'][$image_size]['url']) ? $attachment['sizes'][$image_size]['url'] : $image_file;
         if ($image_type != 'banner_wel') {
             $html_elemments .= "<img src='{$image_file}'{$alt_text}{$styles}{$class_img}{$img_banner} />";
         } else {
             $html_elemments .= "<div class=\"wel-banner\"><img src='{$image_file}'{$alt_text}{$styles}{$class_img} />\n                    <div class=\"wel-b-overlay\">{$welcome_text}</div>\n                   </div>";
         }
         $script = '';
         $target = '';
         if ($open_in) {
             switch ($open_in) {
                 case 'current_browser':
                     $target = '';
                     break;
                 case 'new_browser':
                     $target = ' target="_blank"';
                     break;
                 case 'lightbox':
                     $cls_button_fancy = ' pt-image-fancy';
                     $img_gal = ' rel="prettyPhoto" ';
                     break;
             }
         }
         $class = !empty($cls_button_fancy) ? "class='{$cls_button_fancy}'" : '';
         $img_gal = !empty($img_gal) ? $img_gal : '';
         // get Single Item and check type to get right link
         @($single_item = explode('__#__', $single_item));
         $single_item = $single_item[0];
         $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies();
         $post_types = IG_Pb_Helper_Type::get_post_types();
         // single post
         if (array_key_exists($link_type, $post_types)) {
             $permalink = home_url() . "/?p={$single_item}";
             $html_elemments = "<a href='{$permalink}'{$target}{$class}{$img_gal}>" . $html_elemments . '</a>';
         } else {
             if (array_key_exists($link_type, $taxonomies)) {
                 $permalink = get_term_link(intval($single_item), $link_type);
                 if (!is_wp_error($permalink)) {
                     $html_elemments = "<a href='{$permalink}'{$target}{$class}{$img_gal}>" . $html_elemments . '</a>';
                 }
             } else {
                 switch ($link_type) {
                     case 'url':
                         $html_elemments = "<a href='{$image_type_url}'{$target}{$class}{$img_gal}>" . $html_elemments . '</a>';
                         break;
                     case 'large_image':
                         $image_id = IG_Pb_Helper_Functions::get_image_id($image_file);
                         $attachment = wp_prepare_attachment_for_js($image_id);
                         $image_url = !empty($attachment['sizes'][$image_image_size]['url']) ? $attachment['sizes'][$image_image_size]['url'] : $image_file;
                         $html_elemments = "<a href='{$image_url}'{$target}{$class}{$img_gal}>" . $html_elemments . '</a>';
                         break;
                 }
             }
         }
         if (strtolower($image_alignment) != 'inherit') {
             if (strtolower($image_alignment) == 'left') {
                 $cls_alignment = 'pull-left';
             }
             if (strtolower($image_alignment) == 'right') {
                 $cls_alignment = 'pull-right';
             }
             if (strtolower($image_alignment) == 'center') {
                 $cls_alignment = 'text-center';
             }
             $html_elemments = "<div class='{$cls_alignment}'>" . $html_elemments . '</div>';
         }
     }
     return $this->element_wrapper($html_elemments . $script, $arr_params);
 }
Esempio n. 4
0
        /**
         * Generate HTML code from shortcode content.
         *
         * @param   array   $atts     Shortcode attributes.
         * @param   string  $content  Current content.
         *
         * @return  string
         */
        public function element_shortcode_full($atts = null, $content = null)
        {
            $html_element = '';
            $arr_params = shortcode_atts($this->config['params'], $atts);
            extract($arr_params);
            $styles = array();
            if ($pb_bg_color) {
                $styles[] = 'background-color:' . $pb_bg_color;
            }
            if (intval($pb_border_top) > 0) {
                $styles[] = 'border-top-width:' . (int) $pb_border_top . 'px';
                $styles[] = 'border-top-style: solid';
            }
            if (intval($pb_border_left) > 0) {
                $styles[] = 'border-left-width:' . (int) $pb_border_left . 'px';
                $styles[] = 'border-left-style: solid';
            }
            if (intval($pb_border_bottom) > 0) {
                $styles[] = 'border-bottom-width:' . (int) $pb_border_bottom . 'px';
                $styles[] = 'border-bottom-style: solid';
            }
            if (intval($pb_border_right) > 0) {
                $styles[] = 'border-right-width:' . (int) $pb_border_right . 'px';
                $styles[] = 'border-right-style: solid';
            }
            if ($pb_border_color) {
                $styles[] = 'border-color:' . $pb_border_color;
            }
            $elements = explode('__#__', $elements);
            $class = '';
            if ($pb_show_drop == 'yes') {
                $class .= 'promo-box-shadow';
            }
            $single_item = explode('__#__', $single_item);
            $single_item = $single_item[0];
            $script = $cls_button_fancy = $target = $button = '';
            if (in_array('button', $elements)) {
                $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies();
                $post_types = IG_Pb_Helper_Type::get_post_types();
                // single post
                if (array_key_exists($link_type, $post_types)) {
                    $permalink = home_url() . "/?p={$single_item}";
                    $button_href = "href='{$permalink}'";
                } else {
                    if (array_key_exists($link_type, $taxonomies)) {
                        $permalink = get_term_link(intval($single_item), $link_type);
                        if (!is_wp_error($permalink)) {
                            $button_href = "href='{$permalink}'";
                        }
                    } else {
                        switch ($link_type) {
                            case 'no_link':
                                $button_href = '';
                                break;
                            case 'url':
                                $button_href = "href='{$pb_button_url}'";
                                break;
                        }
                    }
                }
                if ($pb_button_open_in and $link_type != 'no_link') {
                    switch ($pb_button_open_in) {
                        case 'current_browser':
                            $target = '';
                            break;
                        case 'new_browser':
                            $target = ' target="_blank"';
                            break;
                        case 'lightbox':
                            $cls_button_fancy = 'ig-pb-button-fancy';
                            break;
                    }
                }
                $pb_button_size = isset($pb_button_size) && $pb_button_size != 'default' ? $pb_button_size : '';
                $pb_button_color = isset($pb_button_color) && $pb_button_color != 'default' ? $pb_button_color : '';
                $button = "<a class='pull-right btn {$pb_button_size} {$pb_button_color} {$cls_button_fancy}' {$target} {$button_href}>{$pb_button_title}</a>";
                if (isset($cls_button_fancy) && !empty($cls_button_fancy)) {
                    $button .= '
<script type="text/javascript">
	(function($) {
		$(document).ready(function() {
			$(".' . $cls_button_fancy . '" ).fancybox({type:"iframe",autoScale:"false",transitionIn:"elastic",transitionOut:"elastic",width:"75%",height:"75%"});
		});
	})(jQuery);
</script>';
                }
            }
            $styles = implode(';', $styles);
            $styles = $styles ? "style='{$styles}'" : '';
            $html_element .= "<div class='ig-promobox'>";
            $html_element .= "<section class='{$class}' {$styles}>";
            $html_element .= $button;
            if (in_array('title', $elements)) {
                $style_title = array();
                if ($title_font == 'custom') {
                    if ($title_font_face_type == 'google fonts') {
                        $script .= IG_Pb_Helper_Functions::add_google_font_link_tag($title_font_face_value);
                        $style_title[] = 'font-family:' . $title_font_face_value;
                    } elseif ($title_font_face_value) {
                        $style_title[] = 'font-family:' . $title_font_face_value;
                    }
                    if (intval($title_font_size) > 0) {
                        $style_title[] = 'font-size:' . intval($title_font_size) . 'px';
                    }
                    switch ($title_font_style) {
                        case 'bold':
                            $style_title[] = 'font-weight:700';
                            break;
                        case 'italic':
                            $style_title[] = 'font-style:italic';
                            break;
                        case 'normal':
                            $style_title[] = 'font-weight:normal';
                            break;
                    }
                    if (strpos($title_font_color, '#') !== false) {
                        $style_title[] = 'color:' . $title_font_color;
                    }
                }
                if ($title_padding_bottom) {
                    $style_title[] = 'padding-bottom:' . $title_padding_bottom . 'px';
                }
                if ($title_margin_bottom) {
                    $style_title[] = 'margin-bottom:' . $title_margin_bottom . 'px';
                }
                if (count($style_title)) {
                    $style_title = 'style="' . implode(';', $style_title) . '"';
                } else {
                    $style_title = '';
                }
                $html_element .= "<h2 {$style_title}>{$pb_title}</h2>";
            }
            $content = !$content ? '' : $content;
            if (in_array('content', $elements)) {
                $html_element .= "<p>{$content}</p>";
            }
            $html_element .= '</section>';
            $html_element .= '</div>';
            return $this->element_wrapper($html_element . $script, $arr_params);
        }
Esempio n. 5
0
 public function element_shortcode_full($atts = null, $content = null)
 {
     $html_element = '';
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $styles = array();
     if ($pb_bg_color) {
         $styles[] = 'background-color:' . $pb_bg_color;
     }
     if (intval($pb_border_top) > 0) {
         $styles[] = 'border-top-width:' . (int) $pb_border_top . 'px';
         $styles[] = 'border-top-style: solid';
     }
     if (intval($pb_border_left) > 0) {
         $styles[] = 'border-left-width:' . (int) $pb_border_left . 'px';
         $styles[] = 'border-left-style: solid';
     }
     if (intval($pb_border_bottom) > 0) {
         $styles[] = 'border-bottom-width:' . (int) $pb_border_bottom . 'px';
         $styles[] = 'border-bottom-style: solid';
     }
     if (intval($pb_border_right) > 0) {
         $styles[] = 'border-right-width:' . (int) $pb_border_right . 'px';
         $styles[] = 'border-right-style: solid';
     }
     if ($pb_border_color) {
         $styles[] = 'border-color:' . $pb_border_color;
     }
     $elements = explode('__#__', $elements);
     $class = '';
     if ($pb_show_drop == 'yes') {
         $class .= 'promo-box-shadow';
     }
     $single_item = explode('__#__', $single_item);
     $single_item = $single_item[0];
     $script = $cls_button_fancy = $target = $button = '';
     if (in_array('button', $elements)) {
         $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies();
         $post_types = IG_Pb_Helper_Type::get_post_types();
         // single post
         if (array_key_exists($link_type, $post_types)) {
             $permalink = home_url() . "/?p={$single_item}";
             $button_href = "href='{$permalink}'";
         } else {
             if (array_key_exists($link_type, $taxonomies)) {
                 $permalink = get_term_link(intval($single_item), $link_type);
                 if (!is_wp_error($permalink)) {
                     $button_href = "href='{$permalink}'";
                 }
             } else {
                 switch ($link_type) {
                     case 'no_link':
                         $button_href = '';
                         break;
                     case 'url':
                         $button_href = "href='{$pb_button_url}'";
                         break;
                 }
             }
         }
         if ($pb_button_open_in and $link_type != 'no_link') {
             switch ($pb_button_open_in) {
                 case 'current_browser':
                     $target = '';
                     break;
                 case 'new_browser':
                     $target = ' target="_blank"';
                     break;
                 case 'lightbox':
                     $cls_button_fancy = ' pt-pb-button-fancy';
                     break;
             }
         }
         $pb_button_size = isset($pb_button_size) && $pb_button_size != 'default' ? $pb_button_size : '';
         $pb_button_color = isset($pb_button_color) && $pb_button_color != 'default' ? $pb_button_color : '';
     }
     $styles = implode(';', $styles);
     //$styles = ( $styles ) ? "style='{$styles}'" : '';
     $html_element .= "<div class='pricing block {$box_type}'>";
     $html_element .= $button;
     if (in_array('title', $elements)) {
         $html_element .= "<h5 class='title'>{$pb_title}</h5>";
     }
     $html_element .= "<span class=\"price-box\"><span class=\"price\"><span class=\"currency\">{$pb_currency}</span>\t{$pb_price}</span><span class=\"rp\">{$pb_info}</span></span>";
     $content = !$content ? '' : $content;
     if (in_array('content', $elements)) {
         $html_element .= "<div class=\"features\">{$content}</div>";
     }
     $html_element .= "<a {$target} href=\"{$button_href}\" class=\"button\">{$pb_button_title}</a>";
     $html_element .= '</div>';
     return $this->element_wrapper($html_element . $script, $arr_params);
 }