コード例 #1
0
ファイル: buttonbar.php プロジェクト: WaitButWhy/www
 /**
  * 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-->';
 }
コード例 #2
0
ファイル: content.php プロジェクト: WaitButWhy/www
 /**
  * Generate HTML structure content
  *
  * @global type $wpdb
  * @param type $configs
  * @param type $atts
  * @param type $content
  * @param type $post_contents: if true, it will return array of post objects. otherwise, it will return content, which is wrapped in li, ul
  * @return string
  */
 public function element_shortcode_($configs, $atts = null, $content = null, $contentclips = false)
 {
     global $wpdb;
     $html_element = $item_filter = '';
     $data = $arr_ids = $source = array();
     if ($atts == null) {
         $shortcode_params = shortcode_atts($configs, $atts);
     } else {
         $shortcode_params = $atts;
     }
     extract($shortcode_params);
     if (intval($cl_depth_level) == 0 or empty($ig_cl_source)) {
         return '';
     }
     $arr_post_types = array();
     foreach (IG_Pb_Helper_Type::get_post_types() as $slug => $name) {
         $arr_post_types[] = $slug;
     }
     $arr_taxonomies = array();
     foreach (IG_Pb_Helper_Type::get_term_taxonomies() as $slug => $name) {
         $arr_taxonomies[] = $slug;
     }
     // progress order by
     $orderby = $order = $offset = null;
     if (isset($ig_cl_orderby) and isset($ig_cl_order) and $ig_cl_orderby != 'no_order') {
         $orderby = $ig_cl_orderby;
         $order = $ig_cl_order == 'desc' ? 'desc' : 'asc';
     }
     $limit = isset($total_items) ? intval($total_items) : null;
     $items_per_page = isset($items_per_page) ? intval($items_per_page) : null;
     if (isset($items_per_page) && isset($limit) && $items_per_page < $limit) {
         $limit = $items_per_page;
         $offset = 0;
     }
     if (isset($contentclips_page)) {
         $offset = $items_per_page * ($contentclips_page - 1);
         $limit = intval($total_items) - $items_per_page * ($contentclips_page - 1);
         if ($limit > $items_per_page) {
             $limit = $items_per_page;
         }
     }
     $arr_has_parent = IG_Pb_Helper_Type::_get_exclude_taxonomies();
     $is_parent = in_array($ig_cl_source, $arr_has_parent);
     // source is not a parent item
     if (!$is_parent) {
         // source = single entries
         if (in_array($ig_cl_source, $arr_post_types)) {
             // with filter value
             if (!empty($item_filter)) {
                 IG_Pb_Helper_Type::post_by_termid($item_filter, $arr_ids, $source);
             }
             if (!empty($item_filter) && !count($arr_ids)) {
                 return null;
             }
             // query post entry
             $data = $this->querypost($ig_cl_source, $arr_ids, $limit, $offset, $orderby, $order);
             if (count($data)) {
                 $html_element = '<ul>';
                 foreach ($data as $i => $item) {
                     $html_element = self::output_post($item, $html_element);
                 }
                 $html_element .= '</ul>';
             }
         } elseif (in_array($ig_cl_source, $arr_taxonomies)) {
             // has filter items
             if ($item_filter) {
                 $arr_filters = explode(',', $item_filter);
                 // query post entry
                 $data = get_terms($ig_cl_source, array('hide_empty' => false, 'orderby' => 'name'));
                 if (count($data)) {
                     $html_element = '<ul>';
                     if ($item_filter == 'root') {
                         foreach ($data as $i => $item) {
                             $html_element = self::output_taxonomy($item, $ig_cl_source, $html_element);
                         }
                     } else {
                         foreach ($data as $i => $item) {
                             if (in_array($item->term_id, $arr_filters)) {
                                 $html_element = self::output_taxonomy($item, $ig_cl_source, $html_element);
                             }
                         }
                     }
                     $html_element .= '</ul>';
                 }
             } else {
                 $args = array('hide_empty' => false);
                 if ($orderby and $order) {
                     $args['orderby'] = $orderby;
                     $args['order'] = $order;
                 } else {
                     $args['orderby'] = 'name';
                 }
                 if (isset($limit)) {
                     $args['number'] = $limit;
                 }
                 $data = get_terms($ig_cl_source, $args);
                 if (count($data)) {
                     $html_element = '<ul>';
                     foreach ($data as $i => $item) {
                         $html_element = self::output_taxonomy($item, $ig_cl_source, $html_element);
                     }
                     $html_element .= '</ul>';
                 }
             }
         }
     } else {
         // source = single entries
         if (in_array($ig_cl_source, $arr_post_types)) {
             $data = $data_post = $this->querypost($ig_cl_source, $arr_ids, $limit, $offset, $orderby, $order);
             $level = $index = 0;
             if (count($data)) {
                 $html_element = '<ul>';
                 if ($limit) {
                     foreach ($data as $i => $item) {
                         $html_element = self::output_post($item, $html_element);
                     }
                 } else {
                     foreach ($data as $i => $item) {
                         if ($item->ID == $item_filter or $item_filter == 'root' and $item->post_parent == 0) {
                             unset($data[$i]);
                             if (!isset($data_content)) {
                                 $data_content = array();
                             }
                             $data_content[] = $item;
                             $html_element = self::output_post($item, $html_element, false);
                             $index = '';
                             self::_recur_tree($html_element, $data, $item->ID, $level, $cl_depth_level, '1', '', $index, '', $data_content);
                             $html_element .= '</li>';
                         }
                     }
                 }
                 $html_element .= '</ul>';
             }
         } else {
             if (in_array($ig_cl_source, $arr_taxonomies)) {
                 if ($limit) {
                     $args = array('hide_empty' => false);
                     if ($orderby and $order) {
                         $args['orderby'] = $orderby;
                         $args['order'] = $order;
                     } else {
                         $args['orderby'] = 'name';
                     }
                     $args['number'] = $limit;
                     $data = get_terms($ig_cl_source, $args);
                     $html_element = '<ul>';
                     foreach ($data as $i => $item) {
                         unset($data[$i]);
                         $html_element = self::output_taxonomy($item, $ig_cl_source, $html_element);
                     }
                     $html_element .= '</ul>';
                 } else {
                     $data = get_terms($ig_cl_source, array('hide_empty' => false, 'orderby' => 'name'));
                     $item_filter = isset($item_filter) ? $item_filter : 'root';
                     $level = 0;
                     $html_element = '<ul>';
                     foreach ($data as $i => $item) {
                         if ($item->term_id == $item_filter or $item_filter == 'root' and $item->parent == 0) {
                             unset($data[$i]);
                             $html_element = self::output_taxonomy($item, $ig_cl_source, $html_element, false);
                             self::_recur_tree($html_element, $data, $item->term_id, $level, $cl_depth_level, '-1', $ig_cl_source);
                             $html_element .= '</li>';
                         }
                     }
                     $html_element .= '</ul>';
                 }
             } else {
                 if ($ig_cl_source == 'nav_menu_item') {
                     if (isset($item_filter)) {
                         // process for menu case
                         $menu_start_from = isset($ig_cl_menu_start_from) ? $ig_cl_menu_start_from : '';
                         if ($menu_start_from != 'root') {
                             $menu_start_from = intval($menu_start_from);
                         } else {
                             $menu_start_from = '0';
                         }
                         $level = 0;
                         $data = wp_get_nav_menu_items($item_filter, array('update_post_term_cache' => false));
                         $html_element = '<ul>';
                         if ($data) {
                             foreach ($data as $i => $item) {
                                 unset($data[$i]);
                                 if ($menu_start_from == 0 and $item->menu_item_parent == $menu_start_from or $menu_start_from != 0 and $item->ID == $menu_start_from) {
                                     $html_element = self::output_post($item, $html_element, false, '', 'title');
                                     self::_recur_tree($html_element, $data, $item->ID, $level, $cl_depth_level, '0', '', $index, '');
                                     $html_element .= '</li>';
                                 }
                             }
                         }
                         $html_element .= '</ul>';
                     }
                 }
             }
         }
     }
     if ($contentclips) {
         return array('data' => isset($data_content) ? $data_content : $data, 'source' => $source);
     }
     return $html_element;
 }
コード例 #3
0
ファイル: image.php プロジェクト: WaitButWhy/www
 /**
  * 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);
 }
コード例 #4
0
ファイル: promobox.php プロジェクト: WaitButWhy/www
        /**
         * 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);
        }
コード例 #5
0
ファイル: banner.php プロジェクト: binq2/borealpaddle
 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);
 }
コード例 #6
0
ファイル: pricing.php プロジェクト: binq2/borealpaddle
 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);
 }