/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $random_id = uniqid(); $testimonials_id = "testimonials_{$random_id}"; $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000; $interval = @($automatic_cycling == 'yes') ? $interval_time : 'false'; $pause = @($pause_mouseover == 'yes') ? 'pause : "hover"' : ''; $script = ""; $testimonials_indicators = array(); $testimonials_indicators[] = '<ol class="testimonials-indicators">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = isset($initial_open) ? $initial_open > count($items) ? 1 : $initial_open : 1; foreach ($items as $idx => $item) { $active = $idx + 1 == $initial_open ? 'active' : ''; $item = str_replace('{active}', $active, $item); $item = @str_replace('{WIDTH}', 'width : ' . $dimension_width . $dimension_width_unit . ';', $item); $item = @str_replace('{HEIGHT}', 'height : ' . $dimension_height . 'px;', $item); $items[$idx] = $item; $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $testimonials_indicators[] = "<li data-target='#{$testimonials_id}'></li>"; } $testimonials_content = "" . implode('', $items) . ''; $html = "<div class=\"testimonials\"><div class=\"test-welcome\"><div class=\"cont\">" . $test_text . "</div></div>\n\t\t\t\t <div class=\"test-cont\">\n\t\t\t\t <ul data-slider=\"ios\" data-infinite=\"true\" data-drag=\"true\" data-autoplay=\"{$autoplay}\" data-info=\"false\" data-height=\"100\" id=\"{$testimonials_id}\" class=\"v-slider\">\n\t\t\t\t {$testimonials_content}\n\t\t\t\t </ul>\n\t\t\t\t </div>\n\t\t\t\t </div>"; return $this->element_wrapper($html . $script, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); $custom_style = IG_Pb_Utils_Placeholder::get_placeholder('custom_style'); return "{$heading}<!--heading-->{$icon}<!--icon--><div id='pane{index}' class='tab-pane {active} {fade_effect}' {$custom_style}>\n\t\t\t\t\t{$inner_content}\n\t\t\t\t</div><!--seperate-->"; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); $content_class = !empty($image_file) ? 'carousel-caption' : 'carousel-content'; $hidden = empty($heading) && empty($content) ? 'style="display:none"' : ''; $img = !empty($image_file) ? "<div class='carousel-image' style='{WIDTH}{HEIGHT}background-image: url( {$image_file} )'></div>" : ''; $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); return "\n\t\t\t\t<div class='item' data-item='ios'>\n\t\t\t\t\t\t{$inner_content}\n\t\t\t\t</div><!--seperate-->"; }
/** * define shortcode structure of element */ function element_shortcode($atts = null, $content = null) { extract(shortcode_atts(array('span' => 'span6', 'style' => ''), $atts)); $style = empty($style) ? '' : "style='{$style}'"; $span = intval(substr($span, 4)); $span_sm = intval($span * 3 / 2); $class = "col-md-{$span} col-sm-{$span_sm}"; return '<div class="' . $class . '" ' . $style . '>' . IG_Pb_Helper_Shortcode::remove_autop($content) . '</div>'; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); $content_class = !empty($image_file) ? 'carousel-caption' : 'carousel-content'; $hidden = empty($heading) && empty($content) ? 'style="display:none"' : ''; $img = !empty($image_file) ? "<div class='test-image'><img src='{$image_file}' alt='{$heading}' /></div>" : ''; $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); return "\n\t\t\t\t<li class='test-item'>\n\t\t\t\t\t\t{$img}<div class=\"t-cont\">{$inner_content}<div class=\"t-sign\">{$sign}</div></div>\n\t\t\t\t</li><!--seperate-->"; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); // tag1,tag2 => tag1 tag2 , to filter $tag = str_replace(' ', '_', $tag); $tag = str_replace(',', ' ', $tag); $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); IG_Pb_Helper_Functions::heading_icon($heading, $icon); return "\n\t\t\t<div class='panel panel-default' data-tag='{$tag}'>\n\t\t\t\t<div class='panel-heading'>\n\t\t\t\t\t<h4 class='panel-title'>\n\t\t\t\t\t\t<a data-toggle='collapse' data-parent='#accordion_{ID}' href='#collapse{index}'>\n\t\t\t\t\t\t<i class='{$icon}'></i>{$heading}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h4>\n\t\t\t\t</div>\n\t\t\t\t<div id='collapse{index}' class='panel-collapse collapse {show_hide}'>\n\t\t\t\t <div class='panel-body'>\n\t\t\t\t {$inner_content}\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t</div><!--seperate-->"; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); $rowstyle = !$rowstyle || strtolower($rowstyle) == 'default' ? '' : $rowstyle; if (in_array($tagname, array('tr_start', 'tr_end'))) { return "{$tagname}<!--seperate-->"; } $width = !empty($width_value) ? "width='{$width_value}{$width_type}'" : ''; $empty = empty($content) ? '<!--empty-->' : ''; return "<CELL_WRAPPER class='{$rowstyle}' rowspan='{$rowspan}' colspan='{$colspan}' {$width}>" . IG_Pb_Helper_Shortcode::remove_autop($content) . "</CELL_WRAPPER>{$empty}<!--seperate-->"; }
/** * 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); $initial_open = intval($arr_params['initial_open']); $multi_open = $arr_params['multi_open']; $filter = $arr_params['filter']; $random_id = IG_Pb_Utils_Common::random_string(); $script = ''; if ($multi_open == 'yes') { $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$( '#accordion_{$random_id} .panel-title a' ).click( function(e ){\n\t\t\t\t\t\tvar collapse_item = \$( '#accordion_{$random_id} '+this.hash )\n\t\t\t\t\t\tcollapse_item.collapse( 'toggle' )\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; } else { // some case the collapse doesn't work, need this code $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$( '#accordion_{$random_id} .panel-collapse' ).click( function(e ){\n\t\t\t\t\t\tvar collapse_item = \$( '#accordion_{$random_id} '+this.hash )\n\t\t\t\t\t\t\$( '#accordion_{$random_id} .panel-body' ).each(function(){\n\t\t\t\t\t\t\t\$( this ).addClass( 'panel-collapse' );\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcollapse_item.removeClass( 'panel-collapse' );\n\t\t\t\t\t\tcollapse_item.attr( 'style', '' );\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; } $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); // remove empty element $items = array_filter($items); // update id, class for each item $initial_open = $initial_open > count($items) ? 1 : $initial_open; foreach ($items as $idx => $item) { $open = $idx + 1 == $initial_open ? 'in' : ''; $item = str_replace('{index}', $random_id . $idx, $item); $item = str_replace('{show_hide}', $open, $item); $items[$idx] = $item; } $sub_shortcode = implode('', $items); $filter_html = ''; if ($filter == 'yes') { $sub_sc_data = IG_Pb_Helper_Shortcode::extract_sub_shortcode($content); $sub_sc_data = reset($sub_sc_data); // tags to filter item $tags = array('all'); foreach ($sub_sc_data as $shortcode) { $extract_params = shortcode_parse_atts($shortcode); $tags[] = $extract_params['tag']; } $tags = array_filter($tags); if (count($tags) > 1) { $tags = implode(',', $tags); $tags = explode(',', $tags); $tags = array_unique($tags); $filter_html = IG_Pb_Helper_Shortcode::render_parameter('filter_list', $tags, $random_id); // remove "All" tag array_shift($tags); $inner_tags = implode(',', $tags); $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\twindow.parent.jQuery.noConflict()( '#jsn_view_modal').contents().find( '#ig_share_data' ).text( '{$inner_tags}')\n\t\t\t\t\tvar parent_criteria = '#filter_{$random_id}'\n\t\t\t\t\tvar clientsClone = \$( '#accordion_{$random_id}' );\n\t\t\t\t\tvar tag_to_filter = 'div';\n\t\t\t\t\tvar class_to_filter = '.panel-default';\n\n\t\t\t\t\t\$( parent_criteria + ' a' ).click( function(e ) {\n\t\t\t\t\t\t// stop running filter\n\t\t\t\t\t\t\$( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\$( this ).stop( true )\n\t\t\t\t\t\t})\n\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\t//active clicked criteria\n\t\t\t\t\t\t\$( parent_criteria + ' li' ).removeClass( 'active' );\n\t\t\t\t\t\t\$( this ).parent().addClass( 'active' );\n\n\t\t\t\t\t\tvar filterData = \$( this ).attr( 'class' );\n\t\t\t\t\t\tvar filters;\n\t\t\t\t\t\tif( filterData == 'all' ){\n\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter + '[data-tag~='+ filterData +']' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclientsClone.find( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\$( this ).fadeOut()\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfilters.each(function(){\n\t\t\t\t\t\t\t\$( this ).fadeIn()\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; } } $html = '<div class="panel-group" id="accordion_{ID}">' . $sub_shortcode . '</div>'; $html = str_replace('{ID}', $random_id, $html); return $this->element_wrapper($filter_html . $html . $script, $arr_params); }
/** * 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); $initial_open = intval($arr_params['initial_open']); $tab_position = $arr_params['tab_position']; $random_id = IG_Pb_Utils_Common::random_string(); $tab_navigator = array(); $tab_navigator[] = '<ul class="nav nav-tabs">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = $initial_open > count($items) ? 1 : $initial_open; $fade_effect = ''; if ($arr_params['fade_effect'] == 'yes') { $fade_effect = 'fade in'; } foreach ($items as $idx => $item) { // Extract icon & heading $ex_heading = explode('<!--heading-->', $item); $ex_icon = explode('<!--icon-->', isset($ex_heading[1]) ? $ex_heading[1] : ''); $new_key = $random_id . $idx; $active = $idx + 1 == $initial_open ? 'active' : ''; $item = isset($ex_icon[1]) ? $ex_icon[1] : ''; $item = str_replace('{index}', $new_key, $item); $item = str_replace('{active}', $active, $item); $item = str_replace('{fade_effect}', $fade_effect, $item); $items[$idx] = $item; $icon = !empty($ex_icon[0]) ? "<i class='{$ex_icon[0]}'></i> " : ''; $heading = !empty($ex_heading[0]) ? $ex_heading[0] : __('Tab Item ') . ' ' . $idx; IG_Pb_Helper_Functions::heading_icon($heading, $icon); $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $tab_navigator[] = "<li {$active_li}><a href='#pane{$new_key}' data-toggle='tab'>{$icon}{$heading}</a></li>"; } $sub_shortcode = implode('', $items); $tab_content = "<div class='tab-content'>{$sub_shortcode}</div>"; // update min-height of each tab content in case tap position is left/right if (in_array($tab_position, array('left', 'right'))) { $min_height = 36 * count($items); $tab_content = IG_Pb_Utils_Placeholder::remove_placeholder($tab_content, 'custom_style', "style='min-height: {$min_height}px'"); } $tab_navigator[] = '</ul>'; $tab_positions = array('top' => '', 'left' => 'tabs-left', 'right' => 'tabs-right', 'bottom' => 'tabs-below'); $extra_class = $tab_positions[$tab_position]; if ($tab_position == 'bottom') { $tab_content .= implode('', $tab_navigator); } else { $tab_content = implode('', $tab_navigator) . $tab_content; } $html_element = "<div class='tabbable {$extra_class}' id='tab_{ID}'>{$tab_content}</div>"; $html_element = str_replace('{ID}', "{$random_id}", $html_element); return $this->element_wrapper($html_element, $arr_params); }
/** * 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 = ''; $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) . '"' : ''; if ($image_file) { $html_elemments .= "<div class='contact-img-wrapper {$image_container_style}'>"; $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 = ''; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); if ($items) { $buttons = "" . implode('', $items) . ''; $html_elemments .= "<div class='btns-wrapper'><div class='contact-btns'>" . $buttons . "</div><div class='vertical-helper'></div></div>"; } $html_elemments .= '</div>'; 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); }
/** * 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); $html_element = ''; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); // remove empty element $items = array_filter($items); $initial_open = !isset($initial_open) || $initial_open > count($items) ? 1 : $initial_open; foreach ($items as $idx => $item) { $open = $idx + 1 == $initial_open ? 'in' : ''; $items[$idx] = $item; } $sub_shortcode = implode('', $items); $sub_htmls = do_shortcode($sub_shortcode); if ($arr_params['buttonbar_show_title'] == 'no') { $pattern = '\\[(\\[?)(title)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace('/' . $pattern . '/s', '', $sub_htmls); } else { $sub_htmls = str_replace('[title]', '', $sub_htmls); $sub_htmls = str_replace('[/title]', '', $sub_htmls); } if ($arr_params['buttonbar_show_icon'] == 'no') { $pattern = '\\[(\\[?)(icon)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace('/' . $pattern . '/s', '', $sub_htmls); } else { $sub_htmls = str_replace('[icon]', '', $sub_htmls); $sub_htmls = str_replace('[/icon]', '', $sub_htmls); } if ($arr_params['buttonbar_group'] == 'no') { $html_element = $sub_htmls; } else { $html_element = "<div class='btn-group'>" . $sub_htmls . '</div>'; } $cls_alignment = ''; if (strtolower($arr_params['buttonbar_alignment']) != 'inherit') { if (strtolower($arr_params['buttonbar_alignment']) == 'left') { $cls_alignment = 'pull-left'; } if (strtolower($arr_params['buttonbar_alignment']) == 'right') { $cls_alignment = 'pull-right'; } if (strtolower($arr_params['buttonbar_alignment']) == 'center') { $cls_alignment = 'text-center'; } } $html_element = "<div class='btn-toolbar {$cls_alignment}'>{$html_element}</div>"; return $this->element_wrapper($html_element, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $random_id = IG_Pb_Utils_Common::random_string(); $carousel_id = "carousel_{$random_id}"; $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000; $interval = $automatic_cycling == 'yes' ? $interval_time : 'false'; $pause = $pause_mouseover == 'yes' ? 'pause : "hover"' : ''; $script = ""; /*$styles = array(); if ( ! empty( $dimension_width ) ) $styles[] = "width : {$dimension_width}{$dimension_width_unit};"; if ( ! empty( $dimension_height ) ) $styles[] = "height : {$dimension_height}px;"; if ( in_array( $align, array( 'left', 'right', 'inherit') ) ) { $styles[] = "float : $align;"; } else if ( $align == 'center' ) $styles[] = 'margin : 0 auto;'; $styles = trim( implode( ' ', $styles ) ); $styles = ! empty( $styles ) ? "style='$styles'" : ''; */ $carousel_indicators = array(); $carousel_indicators[] = '<ol class="carousel-indicators">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = isset($initial_open) ? $initial_open > count($items) ? 1 : $initial_open : 1; foreach ($items as $idx => $item) { $active = $idx + 1 == $initial_open ? 'active' : ''; $item = str_replace('{active}', $active, $item); $item = str_replace('{WIDTH}', 'width : ' . $dimension_width . $dimension_width_unit . ';', $item); $item = str_replace('{HEIGHT}', 'height : ' . $dimension_height . 'px;', $item); $items[$idx] = $item; $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $carousel_indicators[] = "<li data-target='#{$carousel_id}' data-slide-to='{$idx}' {$active_li}></li>"; } $carousel_content = "" . implode('', $items) . ''; $html = "<div class='content-carousel' {$styles} id='{$carousel_id}'> \n\t\t\t\t <div class=\"slider\" data-slider=\"ios\" data-autoplay=\"{$autoplay}\" data-mode=\"{$car_mode}\" " . ($dimension_width != "" ? "data-width=\"{$dimension_width}\"" : "") . " " . ($dimension_height != "" ? "data-height=\"{$dimension_height}\"" : "") . ">\n\t\t\t\t {$carousel_content}\n\t\t\t\t </div>\n\t\t\t\t </div>"; return $this->element_wrapper($html . $script, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); $content_class = !empty($image_file) ? 'carousel-caption' : 'carousel-content'; $img = !empty($image_file) ? "<img src='{$image_file}' style='{HEIGHT}'>" : ''; // remove image shortcode in content $content = IG_Pb_Helper_Shortcode::remove_ig_shortcodes($content, 'ig_image'); $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); IG_Pb_Helper_Functions::heading_icon($heading, $icon, true); if (empty($heading) && empty($inner_content)) { $html_content = ""; } else { $html_content = "<div class='{$content_class}'>"; $html_content .= !empty($heading) ? "<h4><i class='{$icon}'></i>{$heading}</h4>" : ''; $html_content .= !empty($inner_content) ? "<p>{$inner_content}</p>" : ''; $html_content .= "</div>"; } return "<div class='{active} item'>{$img}{$html_content}</div><!--seperate-->"; }
/** * 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); $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); // seperate by cell $items_html = explode('<!--seperate-->', $sub_shortcode); // remove empty element $items_html = array_filter($items_html); $row = 0; $not_empty = 0; $updated_html = array(); foreach ($items_html as $item) { $cell_html = ''; $cell_wrap = $row == 0 ? 'th' : 'td'; if (strpos($item, 'CELL_WRAPPER') === false) { $cell_html .= $item == 'tr_start' ? '<tr>' : '</tr>'; if (strip_tags($item) == 'tr_end') { $row++; } } else { if (strpos($item, '<!--empty-->') !== false) { $item = str_replace('<!--empty-->', '', $item); } else { $not_empty++; } $cell_html .= str_replace('CELL_WRAPPER', $cell_wrap, $item); } $updated_html[] = $cell_html; } $sub_shortcode = implode('', $updated_html); if ($not_empty == 0) { $sub_shortcode = ''; } $html_element = "<table class='table {$arr_params['tb_style']}'>" . $sub_shortcode . '</table>'; return $this->element_wrapper($html_element, $arr_params); }
/** * define shortcode structure of element */ function element_shortcode($atts = null, $content = null) { $extra_class = $style = $custom_script = ''; if (isset($atts) && is_array($atts)) { $arr_styles = array(); switch ($atts['width']) { case 'full': $extra_class = 'ig_fullwidth'; // some overwrite css to enable row full width $script = "\$('body').addClass('ig-full-width');"; $custom_script = IG_Pb_Helper_Functions::script_box($script); $arr_styles[] = '-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;width: 100%;padding-left: 1000px;padding-right: 1000px;margin:0 -1000px;'; break; case 'boxed': ///$arr_styles[] = "width: 100%;"; break; } $background = ''; switch ($atts['background']) { case 'none': if ($atts['width'] == 'full') { $background = 'background: none;'; } break; case 'solid': $solid_color = $atts['solid_color_value']; $background = "background-color: {$solid_color};"; break; case 'gradient': $background = $atts['gradient_color_css']; break; case 'pattern': $pattern_img = $atts['pattern']; $pattern_repeat = $atts['repeat']; $pattern_stretch = $atts['stretch']; $background = "background-image:url(\"{$pattern_img}\");"; switch ($pattern_repeat) { case 'full': $background_repeat = 'repeat'; break; case 'vertical': $background_repeat = 'repeat-y'; break; case 'horizontal': $background_repeat = 'repeat-x'; break; } $background .= "background-repeat:{$background_repeat};"; switch ($pattern_stretch) { case 'none': $background_size = ''; break; case 'full': $background_size = '100% 100%'; break; case 'cover': $background_size = 'cover'; break; case 'contain': $background_size = 'contain'; break; } $background .= !empty($background_size) ? "background-size:{$background_size};" : ''; break; case 'image': $image = $atts['image']; $image_position = $atts['position']; $background = "background-image:url(\"{$image}\");background-position:{$image_position};"; break; } $arr_styles[] = $background; if (isset($atts['paralax']) && $atts['paralax'] == 'yes') { $arr_styles[] = 'background-attachment:fixed;'; } if (isset($atts['border_width_value_']) && intval($atts['border_width_value_'])) { $border = array(); $border[] = $atts['border_width_value_'] . 'px'; $border[] = $atts['border_style']; $border[] = $atts['border_color']; $border = implode(' ', $border); $arr_styles[] = "border-top:{$border}; border-bottom:{$border};"; } $arr_styles[] = "padding-top:{$atts['div_padding_top']}px;"; $arr_styles[] = "padding-bottom:{$atts['div_padding_bottom']}px;"; if ($atts['width'] != 'full') { $arr_styles[] = "padding-left:{$atts['div_padding_left']}px;"; $arr_styles[] = "padding-right:{$atts['div_padding_right']}px;"; } $arr_styles = implode('', $arr_styles); $style = !empty($arr_styles) ? "style='{$arr_styles}'" : ''; } $extra_class .= !empty($atts['css_suffix']) ? ' ' . esc_attr($atts['css_suffix']) : ''; $extra_class = ltrim($extra_class, ' '); $extra_id = !empty($atts['id_wrapper']) ? ' ' . esc_attr($atts['id_wrapper']) : ''; $extra_id = !empty($extra_id) ? "id='" . ltrim($extra_id, ' ') . "'" : ''; return $custom_script . "<div class='jsn-bootstrap3'>" . "<div {$extra_id} class='row {$extra_class}' {$style}>" . IG_Pb_Helper_Shortcode::remove_autop($content) . '</div>' . '</div>'; }
/** * 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); $random_id = IG_Pb_Utils_Common::random_string(); $carousel_id = "carousel_{$random_id}"; $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000; $interval = $automatic_cycling == 'yes' ? $interval_time : 'false'; $pause = $pause_mouseover == 'yes' ? 'pause : "hover"' : ''; $script = "<script type='text/javascript'>(function (\$){ \$( document ).ready(function(){if( \$( '#{$carousel_id}' ).length ){ \$( '#{$carousel_id}' ).carousel( {interval: {$interval},{$pause}} );}});} )( jQuery )</script>"; $styles = array(); if (!empty($dimension_width)) { $styles[] = "width : {$dimension_width}{$dimension_width_unit};"; } if (!empty($dimension_height)) { $styles[] = "height : {$dimension_height}px;"; } if (in_array($align, array('left', 'right', 'inherit'))) { $styles[] = "float : {$align};"; } else { if ($align == 'center') { $styles[] = 'margin : 0 auto;'; } } $styles = trim(implode(' ', $styles)); $styles = !empty($styles) ? "style='{$styles}'" : ''; $carousel_indicators = array(); $carousel_indicators[] = '<ol class="carousel-indicators">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = isset($initial_open) ? $initial_open > count($items) ? 1 : $initial_open : 1; foreach ($items as $idx => $item) { $active = $idx + 1 == $initial_open ? 'active' : ''; $item = str_replace('{active}', $active, $item); $item = str_replace('{WIDTH}', !empty($dimension_width) ? 'width : ' . $dimension_width . $dimension_width_unit . ';' : '', $item); $item = str_replace('{HEIGHT}', !empty($dimension_height) ? 'height : ' . $dimension_height . 'px;' : '', $item); $items[$idx] = $item; $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $carousel_indicators[] = "<li data-target='#{$carousel_id}' data-slide-to='{$idx}' {$active_li}></li>"; } $carousel_content = "<div class='carousel-inner'>" . implode('', $items) . '</div>'; $carousel_indicators[] = '</ol>'; $carousel_indicators = implode('', $carousel_indicators); if ($show_indicator == 'no') { $carousel_indicators = ''; } $carousel_navigator = ''; if ($show_arrows == 'yes') { $carousel_navigator = "<a class='left carousel-control' href='#{$carousel_id}' data-slide='prev'><span class='icon-arrow-left'></span></a><a class='right carousel-control' href='#{$carousel_id}' data-slide='next'><span class='icon-arrow-right'></span></a>"; } $html = "<div class='carousel slide' {$styles} id='{$carousel_id}'>{$carousel_indicators} {$carousel_content} {$carousel_navigator}</div>"; return $this->element_wrapper($html . $script, $arr_params); }
/** * 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) { $script = ''; if (!empty($atts) and is_array($atts)) { if (!isset($atts['border_bottom_width_value_'])) { $atts['border_bottom_width_value_'] = ''; $atts['border_bottom_style'] = ''; $atts['border_bottom_color'] = ''; } if (!isset($atts['padding_bottom_value_'])) { $atts['padding_bottom_value_'] = ''; } if (!isset($attrs['font_size_value_'])) { $attrs['font_size_value_'] = ''; } } // Reload shortcode params: because we get Heading Text from "text" param IG_Pb_Helper_Shortcode::generate_shortcode_params($this->items, NULL, $atts); $arr_params = shortcode_atts($this->config['params'], $atts); $style = array(); $exclude_params = array('tag', 'text', 'preview'); $stylesheet = $font_style = ''; // Override custom style if (!empty($arr_params) and is_array($arr_params)) { if ($arr_params['font'] == 'inherit' || $arr_params['font'] == 'Inherit') { unset($arr_params['font']); unset($arr_params['font_face_type']); unset($arr_params['font_face_value']); unset($arr_params['font_size_value_']); unset($arr_params['font_style']); unset($arr_params['color']); } if (isset($arr_params['font']) && $arr_params['font'] == 'custom') { unset($arr_params['font']); if (isset($arr_params['font_style']) && strtolower($arr_params['font_style']) == 'bold') { $arr_params['font_weight'] = '700'; unset($arr_params['font_style']); } if (isset($arr_params['font_style']) && strtolower($arr_params['font_style']) == 'normal') { $arr_params['font_weight'] = 'normal'; unset($arr_params['font_style']); } } if (isset($arr_params['font_size_value_']) && $arr_params['font_size_value_'] == '') { unset($arr_params['font_size_value_']); } if ($arr_params['border_bottom_width_value_'] == '') { unset($arr_params['border_bottom_width_value_']); unset($arr_params['border_bottom_style']); unset($arr_params['border_bottom_color']); } if ($arr_params['padding_bottom_value_'] == '') { unset($arr_params['padding_bottom_value_']); } if ($arr_params['text_align'] == 'inherit' || $arr_params['text_align'] == 'Inherit') { unset($arr_params['text_align']); } } foreach ($arr_params as $key => $value) { if ($value != '') { if ($key == 'font_face_type') { if ($value == __('Standard fonts', IGPBL) || $value == 'standard fonts') { $font_style = 'font-family:' . $arr_params['font_face_value']; } elseif ($value == __('Google fonts', IGPBL) || $value == 'google fonts') { $script = IG_Pb_Helper_Functions::add_google_font_link_tag($arr_params['font_face_value']); $font_style = 'font-family:' . $arr_params['font_face_value']; } } elseif ($key != 'font_face_value') { $key = IG_Pb_Helper_Functions::remove_tag($key); if (!in_array($key, $exclude_params)) { switch ($key) { case 'border_bottom_width_value_': $style[$key] = 'border-bottom-width:' . $value . 'px'; break; case 'text_align': $style[$key] = 'text-align:' . $value; break; case 'font_size_value_': $style[$key] = 'font-size:' . $value . 'px'; break; case 'font_style': $style[$key] = 'font-style:' . $value; break; case 'border_bottom_style': $style[$key] = 'border-bottom-style:' . $value; break; case 'border_bottom_color': $style[$key] = 'border-bottom-color:' . $value; break; case 'padding_bottom_value_': $style[$key] = 'padding-bottom:' . $value . 'px'; break; case 'font_weight': $style[$key] = 'font-weight:' . $value; break; case 'color': $style[$key] = 'color:' . $value; break; } } } } } // Finalize style $style = implode(';', $style) . ';' . $font_style; if ($style == ';') { $style = ''; } // Finalize HTML code $true_element = "<{$arr_params['tag']} style='{$style}'>" . IG_Pb_Helper_Shortcode::remove_autop($content) . "</{$arr_params['tag']}>"; return $this->element_wrapper($script . $stylesheet . $true_element, $arr_params); }
/** * 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); $html_element = ''; if ($arr_params['progress_bar_stack_active'] == 'yes') { $content = str_replace('pbar_item_style="solid"', 'pbar_item_style="striped"', $content); } $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); // remove empty element $items = array_filter($items); $initial_open = !isset($initial_open) || $initial_open > count($items) ? 1 : $initial_open; foreach ($items as $idx => $item) { $open = $idx + 1 == $initial_open ? 'in' : ''; $items[$idx] = $item; } $sub_shortcode = implode('', $items); $sub_htmls = do_shortcode($sub_shortcode); if ($arr_params['progress_bar_show_icon'] == 'no') { $pattern = '\\[(\\[?)(icon)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); } else { $sub_htmls = str_replace('[icon]', '', $sub_htmls); $sub_htmls = str_replace('[/icon]', '', $sub_htmls); } if ($arr_params['progress_bar_show_title'] == 'no') { $pattern = '\\[(\\[?)(text)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); } else { $sub_htmls = str_replace('[text]', '', $sub_htmls); $sub_htmls = str_replace('[/text]', '', $sub_htmls); } if ($arr_params['progress_bar_show_percent'] == 'no') { $pattern = '\\[(\\[?)(percentage)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); } else { $sub_htmls = str_replace('[percentage]', '', $sub_htmls); $sub_htmls = str_replace('[/percentage]', '', $sub_htmls); } if ($arr_params['progress_bar_show_percent'] == 'no' and $arr_params['progress_bar_show_title'] == 'no' and $arr_params['progress_bar_show_icon'] == 'no') { $pattern = '\\[(\\[?)(sub_content)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); } $script = '<script type="text/javascript"> (function($) { $(document).ready(function() { $(".progress-bar" ).each(function () { bar_width = $(this).attr("aria-valuenow"); $(this).width(bar_width + "%"); }); }); })(jQuery); </script>'; if ($arr_params['progress_bar_style'] == 'stacked') { $sub_htmls = str_replace('{active}', '', $sub_htmls); $active = $arr_params['progress_bar_stack_active'] == 'yes' ? ' progress-striped active' : ''; $stacked = ' stacked'; $html_titles = ''; $pattern = '\\[(\\[?)(sub_content)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; preg_match_all("/{$pattern}/s", $sub_htmls, $matches); $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); foreach ($matches as $i => $items) { if (is_array($items)) { foreach ($items as $j => $item) { if ($item != '' and strpos($item, '[sub_content]') !== false) { $item = str_replace('[sub_content]', '', $item); $item = str_replace('[/sub_content]', '', $item); $html_titles .= $item; } } } } $html_element = $html_titles; $html_element .= "<div class='progress{$active}{$stacked}'>"; $html_element .= $sub_htmls; $html_element .= '</div>'; } else { $sub_htmls = str_replace('[sub_content]', '', $sub_htmls); $sub_htmls = str_replace('[/sub_content]', '', $sub_htmls); if ($arr_params['progress_bar_stack_active'] == 'yes') { $sub_htmls = str_replace('{active}', ' active', $sub_htmls); } else { $sub_htmls = str_replace('{active}', '', $sub_htmls); } $html_element = $sub_htmls; } return $this->element_wrapper($html_element . $script, $arr_params); }
/** * 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); $link = ''; $exclude_params = array('tag', 'text', 'preview'); $arr_styles = array(); if (strtolower($arr_params['font_face_type']) == 'google fonts' and $arr_params['font'] != 'inherit') { wp_enqueue_style('ig-google-fonts', "http://fonts.googleapis.com/css?family={$arr_params['font_face_value']}"); } if ($arr_params['font'] != 'inherit') { if ($arr_params['font_face_value']) { $arr_styles[] = 'font-family: ' . $arr_params['font_face_value']; } if ($arr_params['font_size_value']) { $arr_styles[] = 'font-size: ' . $arr_params['font_size_value'] . 'px'; } if ($arr_params['color']) { $arr_styles[] = 'color: ' . $arr_params['color']; } if ($arr_params['font_style'] == 'bold') { $arr_styles[] = 'font-weight: 700 !important'; } else { if ($arr_params['font_style'] == 'normal') { $arr_styles[] = 'font-weight: normal !important'; } else { $arr_styles[] = 'font-style: ' . $arr_params['font_style']; } } } $arr_icon_styles = array(); $arr_icon_class = array(); $arr_icon_class[] = ''; if ($arr_params['icon_position']) { $icon_position = strtolower($arr_params['icon_position']); $arr_icon_class[] = $icon_position != 'inherit' ? "ig-position-{$icon_position}" : ''; } if (strtolower($arr_params['icon_background_type']) != '') { $arr_icon_class[] = "ig-shape-{$arr_params['icon_background_type']}"; } if ($arr_params['icon_size_value']) { $arr_icon_class[] = "ig-icon-{$arr_params['icon_size_value']}"; } if ($arr_params['icon_background_color']) { $arr_icon_styles[] = 'background-color: ' . $arr_params['icon_background_color']; } if ($arr_params['icon_c_color']) { $arr_icon_styles[] = 'color: ' . $arr_params['icon_c_color']; } $html_elements = ''; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); // remove empty element $items = array_filter($items); $initial_open = !isset($initial_open) || $initial_open > count($items) ? 1 : $initial_open; foreach ($items as $idx => $item) { $open = $idx + 1 == $initial_open ? 'in' : ''; $items[$idx] = $item; } $sub_shortcode = implode('', $items); $sub_shortcode = implode('', $items); if (!empty($sub_shortcode)) { $parent_class = implode(' ', $arr_icon_class); $html_elements = "<ul class='ig-list-icons {$parent_class}'>"; $sub_htmls = do_shortcode($sub_shortcode); $sub_htmls = str_replace('ig-sub-icons', 'ig-icon-base', $sub_htmls); $sub_htmls = str_replace('ig-styles', implode(';', $arr_icon_styles), $sub_htmls); $sub_htmls = str_replace('ig-list-title', implode(';', $arr_styles), $sub_htmls); if ($arr_params['show_icon'] == 'no') { $pattern = '\\[(\\[?)(icon)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); } else { $sub_htmls = str_replace('[icon]', '', $sub_htmls); $sub_htmls = str_replace('[/icon]', '', $sub_htmls); } if ($arr_params['show_heading'] == 'no') { $pattern = '\\[(\\[?)(heading)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $sub_htmls = preg_replace("/{$pattern}/s", '', $sub_htmls); } else { $sub_htmls = str_replace('[heading]', '', $sub_htmls); $sub_htmls = str_replace('[/heading]', '', $sub_htmls); } $html_elements .= $sub_htmls; $html_elements .= '</ul>'; } return $this->element_wrapper($link . $html_elements, $arr_params); }