/** * Group items * * @param type $element * * @return string */ static function render($element) { $_element = $element; $label_item = isset($element['label_item']) ? $element['label_item'] : ''; $sub_items = $_element['sub_items']; $overwrite_shortcode_data = isset($element['overwrite_shortcode_data']) ? $element['overwrite_shortcode_data'] : true; $sub_item_type = $element['sub_item_type']; $items_html = array(); $shortcode_name = str_replace('IG_', '', $element['shortcode']); // get id of parameter to extract $extract_title = isset($element['extract_title']) ? $element['extract_title'] : ''; $extra_params = array('drag_handle' => false); if ($sub_items) { foreach ($sub_items as $idx => $item) { $el = new $sub_item_type(); $el->init_element(); // check if $item['std'] is empty or not $shortcode_data = ''; if (!$label_item) { $content = __($shortcode_name, IGPBL) . ' ' . __('Item', IGPBL) . ' ' . ($idx + 1); } else { $content = $label_item . ($idx + 1); } if (isset($_element['no_title'])) { $content = $_element['no_title']; } if (!empty($item['std'])) { // keep shortcode data as it is $shortcode_data = $item['std']; // reassign params for shortcode base on std string $extract_params = IG_Pb_Helper_Shortcode::extract_params($item['std']); $params = IG_Pb_Helper_Shortcode::generate_shortcode_params($el->items, NULL, $extract_params, TRUE, FALSE, $content); $el->shortcode_data(); $params['extract_title'] = empty($params['extract_title']) ? __('(Untitled)', IGPBL) : $params['extract_title']; $content = $params['extract_title']; if ($overwrite_shortcode_data) { $shortcode_data = $el->config['shortcode_structure']; } } $element_type = (array) $el->element_in_pgbldr($content, $shortcode_data, '', '', true, $extra_params); foreach ($element_type as $element_structure) { $items_html[$shortcode_data] = $element_structure; } } } $style = isset($_element['style']) ? 'style="' . $_element['style'] . '"' : ''; // Wrap item html to table $html = ''; foreach ($items_html as $shortcode_data => $item_html) { if (!empty($extract_title)) { $attrs = shortcode_parse_atts($shortcode_data); $title = isset($attrs[$extract_title]) ? $attrs[$extract_title] : ''; $html .= sprintf('<tr><td><b>%s</b></td><td>%s</td></tr>', $title, $item_html); } } $html = sprintf('<table class="%s" %s>%s</table>', 'table table-bordered', $style, balanceTags($html)); $element_name = isset($_element['name']) ? $_element['name'] : __(ucwords(!$label_item ? $shortcode_name : $label_item), IGPBL) . ' ' . __('Items', IGPBL); $html_element = "<div id='{$_element['id']}' class='form-group control-group clearfix'><label class='col-xs-3 control-label'>{$element_name}</label>\n\t\t\t\t<div class='item-container submodal_frame_2 controls col-xs-9 group-table {$_element['class']}'>\n <div class='item-container-content jsn-items-list'>\n {$html}\n </div>\n </div>\n </div>"; return $html_element; }
/** * 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); }
/** * List of other option types ( checkbox, select... ) * @param type $element * @return type */ static function render($element) { $element = parent::get_extra_info($element); $label = parent::get_label($element); $options_type = isset($element['options_type']) ? $element['options_type'] : ''; $ul_wrap = isset($element['ul_wrap']) ? $element['ul_wrap'] : true; $output = ''; $element_clone = $element; $element_clone['wrapper_item_start'] = "<li class='jsn-item jsn-iconbar-trigger'>"; $element_clone['wrapper_item_end'] = '</li>'; $element_clone['blank_output'] = '1'; $element['class'] = str_replace('form-control', '', $element['class']); $element_clone['class'] = (isset($element['class']) ? $element['class'] : '') . ' ' . $options_type; // re-arrange $element['options'] array by the order of value in $element['std'] $element_clone['std'] = str_replace(',', '__#__', $element_clone['std']); if (!isset($element_clone['no_order'])) { $std_val = explode('__#__', $element_clone['std']); $std = array(); foreach ($std_val as $value) { if (trim($value) != '' && isset($element_clone['options'][$value])) { $std[$value] = $element_clone['options'][$value]; } } // other option value which is not defined in std foreach ($element_clone['options'] as $key => $value) { if (!in_array($key, $std_val)) { $std[$key] = $value; } } $element_clone['options'] = $std; } $output = IG_Pb_Helper_Shortcode::render_parameter($options_type, $element_clone); $output = $ul_wrap ? "<ul class='jsn-items-list ui-sortable'>{$output}</ul>" : $output; return parent::final_element($element, $output, $label); }
/** * 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']); $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); }
/** * Group items * * @param type $element * * @return string */ static function render($element) { $_element = $element; $label_item = isset($element['label_item']) ? $element['label_item'] : ''; $add_item = isset($element['add_item_text']) ? $element['add_item_text'] : __('Add Item', IGPBL); $sub_items = $_element['sub_items']; $overwrite_shortcode_data = isset($element['overwrite_shortcode_data']) ? $element['overwrite_shortcode_data'] : true; $sub_item_type = $element['sub_item_type']; $items_html = array(); $shortcode_name = str_replace('IG_', '', $element['shortcode']); if ($sub_items) { foreach ($sub_items as $idx => $item) { $element = new $sub_item_type(); $element->init_element(); // check if $item['std'] is empty or not $shortcode_data = ''; if (!$label_item) { $content = __($shortcode_name, IGPBL) . ' ' . __('Item', IGPBL) . ' ' . ($idx + 1); } else { $content = $label_item . ($idx + 1); } if (isset($_element['no_title'])) { $content = $_element['no_title']; } if (!empty($item['std'])) { // keep shortcode data as it is $shortcode_data = $item['std']; // reassign params for shortcode base on std string $extract_params = IG_Pb_Helper_Shortcode::extract_params($item['std']); $params = IG_Pb_Helper_Shortcode::generate_shortcode_params($element->items, NULL, $extract_params, TRUE, FALSE, $content); $element->shortcode_data(); $params['extract_title'] = empty($params['extract_title']) ? __('(Untitled)', IGPBL) : $params['extract_title']; $content = $params['extract_title']; if ($overwrite_shortcode_data) { $shortcode_data = $element->config['shortcode_structure']; } } $element_type = (array) $element->element_in_pgbldr($content, $shortcode_data, '', $idx + 1); foreach ($element_type as $element_structure) { $items_html[] = $element_structure; } } } $style = isset($_element['style']) ? 'style="' . $_element['style'] . '"' : ''; $items_html = implode('', $items_html); $element_name = isset($_element['name']) ? $_element['name'] : __(ucwords(!$label_item ? $shortcode_name : $label_item), IGPBL) . ' ' . __('Items', IGPBL); $html_element = "<div id='{$_element['id']}' class='form-group control-group clearfix'><label class='col-xs-3 control-label'>{$element_name}</label>\n\t\t\t\t<div class='item-container has_submodal controls col-xs-9'>\n\t\t\t\t\t<ul {$style} class='ui-sortable jsn-items-list item-container-content jsn-rounded-medium' id='group_elements'>\n\t\t\t\t\t\t{$items_html}\n\t\t\t\t\t</ul>\n\t\t\t\t\t<a href='javascript:void(0);' class='jsn-add-more ig-more-element' item_common_title='" . __($shortcode_name, IGPBL) . ' ' . __('Item', IGPBL) . "' data-shortcode-item='" . strtolower($sub_item_type) . "'><i class='icon-plus'></i>" . __($add_item, IGPBL) . '</a> </div></div>'; return $html_element; }
/** * 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); }
/** * Dimension type, which defines Width, Height of element * @param type $element * @param type $input_params * @return type */ static function render($element, $input_params) { $element = parent::get_extra_info($element); $label = parent::get_label($element); $element['dimension_elements'] = isset($element['dimension_elements']) ? explode(',', str_replace(' ', '', $element['dimension_elements'])) : array('w', 'h'); $_no_prefix_id = str_replace('param-', '', $element['id']); $output = ''; if (in_array('w', $element['dimension_elements'])) { $_idx_width = $_no_prefix_id . '_width'; $_idx_width_unit = $_no_prefix_id . '_width_unit'; $element['width_std'] = isset($element[$_idx_width]) ? $element[$_idx_width]['std'] : ''; $element['width_std'] = isset($input_params[$_idx_width]) ? $input_params[$_idx_width] : $element['width_std']; // Width and Width unit $_width = array('id' => $element['id'] . '_width', 'type' => 'text_append', 'input_type' => 'number', 'class' => 'jsn-input-number input-mini input-sm', 'parent_class' => 'input-group-inline', 'std' => $element['width_std'], 'append_before' => 'W', 'validate' => 'number', 'bound' => '0'); if (isset($element[$_idx_width_unit])) { $element['width_unit_std'] = isset($element[$_idx_width_unit]) ? $element[$_idx_width_unit]['std'] : ''; $element['width_unit_std'] = isset($input_params[$_idx_width_unit]) ? $input_params[$_idx_width_unit] : $element['width_unit_std']; $_w_unit = array('id' => $element['id'] . '_width_unit', 'type' => 'select', 'class' => 'input-mini input-sm', 'bound' => '0'); $_w_unit = array_merge($_w_unit, $element[$_idx_width_unit]); $_w_unit['std'] = $element['width_unit_std']; $_append = ''; } else { $_width = array_merge($_width, array('append' => 'px')); } $output .= IG_Pb_Helper_Shortcode::render_parameter('text_append', $_width); $output .= isset($element[$_idx_width_unit]) ? IG_Pb_Helper_Shortcode::render_parameter('select', $_w_unit) : ''; } // Height and Height Unit if (in_array('h', $element['dimension_elements'])) { $_idx_height = $_no_prefix_id . '_height'; $_idx_height_unit = $_no_prefix_id . '_height_unit'; $element['height_std'] = isset($element[$_idx_height]) ? $element[$_idx_height]['std'] : ''; $element['height_std'] = isset($input_params[$_idx_height]) ? $input_params[$_idx_height] : $element['height_std']; $_append = 'px'; $_height = array('id' => $element['id'] . '_height', 'input_type' => 'number', 'class' => 'jsn-input-number input-mini input-sm', 'parent_class' => 'input-group-inline', 'std' => $element['height_std'], 'append_before' => 'H', 'validate' => 'number', 'bound' => '0'); if (isset($element[$_idx_height_unit])) { $element['height_unit_std'] = isset($element[$_idx_width_unit]) ? $element[$_idx_width_unit]['std'] : ''; $element['height_unit_std'] = isset($input_params[$_idx_width_unit]) ? $input_params[$_idx_width_unit] : $element['width_unit_std']; $_h_unit = array('id' => $element['id'] . '_height_unit', 'type' => 'select', 'class' => 'input-mini input-sm', 'bound' => '0'); $_h_unit = array_merge($_h_unit, $element[$_idx_height_unit]); $_h_unit['std'] = $element['height_unit_std']; $_append = ''; } else { $_height = array_merge($_height, array('append' => 'px')); } $output .= IG_Pb_Helper_Shortcode::render_parameter('text_append', $_height); $output .= isset($element[$_idx_height_unit]) ? IG_Pb_Helper_Shortcode::render_parameter('select', $_h_unit) : ''; } return parent::final_element($element, $output, $label); }
/** * 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); }
/** * Option to Define top/right/bottom/left margin for element * @param type $element * @param type $input_params * @return type */ static function render($element, $input_params) { $element = parent::get_extra_info($element); $label = parent::get_label($element); $_no_prefix_id = str_replace('param-', '', $element['id']); // Set default margin element // t: top // r: right // b: bottom // l: left $element['margin_elements'] = isset($element['margin_elements']) ? explode(',', str_replace(' ', '', $element['margin_elements'])) : array('t', 'r', 'b', 'l'); $output = ''; $_br = false; if (in_array('t', $element['margin_elements'])) { $_idx_top = $_no_prefix_id . '_top'; $_br = true; $element['top_std'] = isset($element[$_idx_top]) ? $element[$_idx_top]['std'] : ''; $element['top_std'] = isset($input_params[$_idx_top]) ? $input_params[$_idx_top] : $element['top_std']; $_top = array('id' => $element['id'] . '_top', 'type' => 'text_append', 'input_type' => 'number', 'class' => 'jsn-input-number input-mini', 'parent_class' => 'input-group-inline', 'std' => $element['top_std'], 'append_before' => '<i class="icon-arrow-up"></i>', 'append' => 'px', 'validate' => 'number', 'bound' => '0'); $output .= IG_Pb_Helper_Shortcode::render_parameter('text_append', $_top); } if (in_array('r', $element['margin_elements'])) { $_idx_right = $_no_prefix_id . '_right'; $_br = true; $element['right_std'] = isset($element[$_idx_right]) ? $element[$_idx_right]['std'] : ''; $element['right_std'] = isset($input_params[$_idx_right]) ? $input_params[$_idx_right] : $element['right_std']; $_right = array('id' => $element['id'] . '_right', 'input_type' => 'number', 'class' => 'jsn-input-number input-mini', 'parent_class' => 'input-group-inline', 'std' => $element['right_std'], 'append_before' => '<i class="icon-arrow-right"></i>', 'append' => 'px', 'validate' => 'number', 'bound' => '0'); $output .= IG_Pb_Helper_Shortcode::render_parameter('text_append', $_right); } $output .= $_br ? '<div class="clearbreak"></div>' : ''; if (in_array('b', $element['margin_elements'])) { $_idx_bottom = $_no_prefix_id . '_bottom'; $element['bottom_std'] = isset($element[$_idx_bottom]) ? $element[$_idx_bottom]['std'] : ''; $element['bottom_std'] = isset($input_params[$_idx_bottom]) ? $input_params[$_idx_bottom] : $element['bottom_std']; $_bottom = array('id' => $element['id'] . '_bottom', 'input_type' => 'number', 'class' => 'jsn-input-number input-mini', 'parent_class' => 'input-group-inline', 'std' => $element['bottom_std'], 'append_before' => '<i class="icon-arrow-down"></i>', 'append' => 'px', 'validate' => 'number', 'bound' => '0'); $output .= IG_Pb_Helper_Shortcode::render_parameter('text_append', $_bottom); } if (in_array('l', $element['margin_elements'])) { $_idx_left = $_no_prefix_id . '_left'; $element['left_std'] = isset($element[$_idx_left]) ? $element[$_idx_left]['std'] : ''; $element['left_std'] = isset($input_params[$_idx_left]) ? $input_params[$_idx_left] : $element['left_std']; $_left = array('id' => $element['id'] . '_left', 'input_type' => 'number', 'class' => 'jsn-input-number input-mini', 'parent_class' => 'input-group-inline', 'std' => $element['left_std'], 'append_before' => '<i class="icon-arrow-left"></i>', 'append' => 'px', 'validate' => 'number', 'bound' => '0'); $output .= IG_Pb_Helper_Shortcode::render_parameter('text_append', $_left); } return parent::final_element($element, $output, $label); }
/** * List of "items_list" * @param type $element * @return type */ static function render($element) { $element = parent::get_extra_info($element); $label = parent::get_label($element); $output = ''; $items = isset($element['items']) ? $element['items'] : ''; if (is_array($items)) { foreach ($items as $element_) { $element_func = $element_['type']; $element_['wrap'] = '0'; $element_['wrap_class'] = ''; $element_['std'] = $element['std']; $element_['id'] = $element['id']; $output .= IG_Pb_Helper_Shortcode::render_parameter($element_func, $element_); } } return parent::final_element($element, $output, $label); }
/** * 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-->"; }
/** * get params & structure of shortcode * OVERWRIGE parent function */ public function shortcode_data() { $params = IG_Pb_Helper_Shortcode::generate_shortcode_params($this->items); $this->config['params'] = array_merge(array('div_margin_top' => '', 'div_margin_bottom' => '', 'disabled_el' => 'no', 'css_suffix' => ''), $params); // get content of sub-shortcode $sub_items_content = array(); $sub_items = isset($this->config['params']['sub_items_content']) ? $this->config['params']['sub_items_content'] : array(); foreach ($sub_items as $sub_item_type => &$sub_shortcodes) { foreach ($sub_shortcodes as $sub_shortcode) { $sub_sc = new $sub_item_type(); $sub_sc->init_element(); // empty std if (empty($sub_shortcode['std'])) { // only empty 'std' if (count($sub_shortcode) == 1) { // get default shortcode structure of sub-shortcode $sub_sc->config['params'] = IG_Pb_Helper_Shortcode::generate_shortcode_params($sub_sc->items, null, null, false, true); // re-generate shortcode structure $sub_shortcode['std'] = IG_Pb_Helper_Shortcode::generate_shortcode_structure($sub_sc->config['shortcode'], $sub_sc->config['params']); } else { // MODIFY $instance->items IG_Pb_Helper_Shortcode::generate_shortcode_params($sub_sc->items, NULL, $sub_shortcode, TRUE); // re-generate shortcode structure $sub_sc->shortcode_data(); // get updated std of sub-shortcode $sub_shortcode['std'] = $sub_sc->config['shortcode_structure']; } } else { // if std of sub-shortcode is predefined ( such as GoogleMap ) $params = stripslashes($sub_shortcode['std']); $extract_params = IG_Pb_Helper_Shortcode::extract_params(urldecode($params)); // MODIFY $instance->items IG_Pb_Helper_Shortcode::generate_shortcode_params($sub_sc->items, NULL, $extract_params, TRUE); // re-generate shortcode structure $sub_sc->shortcode_data(); } $sub_items_content[] = $sub_shortcode['std']; } } $sub_items_content = implode('', $sub_items_content); // END get content of sub-shortcode $this->config['shortcode_structure'] = IG_Pb_Helper_Shortcode::generate_shortcode_structure($this->config['shortcode'], $this->config['params'], $sub_items_content); }
/** * 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); }
/** * 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); }
/** * Radio * @param type $element * @return string */ static function render($element) { $element['class'] = isset($element['class']) ? $element['class'] : 'radio-inline'; $element['input_type'] = 'radio'; return IG_Pb_Helper_Shortcode::render_parameter('checkbox', $element); }
$exp = preg_quote($widget->get_field_id('____')); $exp = str_replace('____', '(.*? )', $exp); $form = preg_replace('/' . $exp . '/', '$1', $form); // tab and content generate $tabs = array(); foreach (array('content', 'styling') as $i => $tab) { $active = $i++ == 0 ? 'active' : ''; $data_['href'] = "#{$tab}"; $data_['data-toggle'] = 'tab'; $content_ = ucfirst($tab); $tabs[] = "<li class='{$active}'>" . IG_Pb_Objects_Modal::tab_settings('a', $data_, $content_) . '</li>'; } // content $contents = array(); $contents[] = "<div class='tab-pane active' id='content'><form id='ig-widget-form'>{$form}</form></div>"; $contents[] = "<div class='tab-pane' id='styling'>" . IG_Pb_Helper_Shortcode::render_parameter('preview') . '</div>'; $output = IG_Pb_Objects_Modal::setting_tab_html($shortcode, $tabs, $contents, array(), '', array()); echo balanceTags($output); } } ?> <div id="modalAction" class="ig-pb-setting-tab"></div> </div> <textarea class="hidden" id="shortcode_content"><?php echo esc_attr($params); ?> </textarea> <textarea class="hidden" id="ig_share_data"></textarea> <textarea class="hidden" id="ig_merge_data"></textarea> <textarea class="hidden" id="ig_extract_data"></textarea> <input type="hidden" id="ig_previewing" value="0" />
/** * Get params & structure of shortcode */ public function shortcode_data() { $params = IG_Pb_Helper_Shortcode::generate_shortcode_params($this->items, null, null, false, true); // add Margin parameter for Not child shortcode if (strpos($this->config['shortcode'], '_item') === false) { $this->config['params'] = array_merge(array('div_margin_top' => '10', 'div_margin_bottom' => '10', 'disabled_el' => 'no', 'css_suffix' => '', 'id_wrapper' => ''), $params); } else { $this->config['params'] = $params; } $this->config['shortcode_structure'] = IG_Pb_Helper_Shortcode::generate_shortcode_structure($this->config['shortcode'], $this->config['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); $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); 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); }
/** * get HTML of Modal Settings Box of Shortcode * * @param array $options * * @return string */ static function get_shortcode_modal_settings($settings, $shortcode = '', $input_params = null, $raw_shortcode = null) { $i = 0; $tabs = $contents = $actions = $general_actions = array(); foreach ((array) $settings as $tab => $options) { $options = self::ignore_settings($options); if ($tab == 'action') { foreach ($options as $option) { $actions[] = IG_Pb_Helper_Shortcode::render_parameter($option['type'], $option); } } else { if ($tab == 'generalaction') { foreach ($options as $option) { $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : ''; $general_actions[] = IG_Pb_Helper_Shortcode::render_parameter($option['type'], $option); } } else { $active = $i++ == 0 ? 'active' : ''; if (strtolower($tab) != 'notab') { $data_ = isset($settings[$tab]['settings']) ? $settings[$tab]['settings'] : array(); $data_['href'] = "#{$tab}"; $data_['data-toggle'] = 'tab'; $content_ = ucfirst($tab); $tabs[] = "<li class='{$active}'>" . self::tab_settings('a', $data_, $content_) . '</li>'; } $has_margin = 0; $param_html = array(); foreach ($options as $idx => $option) { // check if this element has Margin param (1) if (isset($option['name']) && $option['name'] == __('Margin', IGPBL) && $option['id'] != 'div_margin') { $has_margin = 1; } // if (1), don't use the 'auto extended margin ( top, bottom ) option' if ($has_margin && isset($option['id']) && $option['id'] == 'div_margin') { continue; } $type = $option['type']; $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : "{$idx}"; if (!is_array($type)) { $param_html[$option['id']] = IG_Pb_Helper_Shortcode::render_parameter($type, $option, $input_params); } else { $output_inner = ''; foreach ($type as $sub_options) { $sub_options['id'] = isset($sub_options['id']) ? 'param-' . $sub_options['id'] : ''; /* for sub option, auto assign bound = 0 {not wrapped by <div class='controls'></div> } */ $sub_options['bound'] = '0'; /* for sub option, auto assign 'input-small' class */ $sub_options['class'] = isset($sub_options['class']) ? $sub_options['class'] : ''; $type = $sub_options['type']; $output_inner .= IG_Pb_Helper_Shortcode::render_parameter($type, $sub_options); } $option = IG_Pb_Helper_Html::get_extra_info($option); $label = IG_Pb_Helper_Html::get_label($option); $param_html[$option['id']] = IG_Pb_Helper_Html::final_element($option, $output_inner, $label); } } if (!empty($param_html['param-copy_style_from'])) { array_pop($param_html); // move "auto extended margin ( top, bottom ) option" to top of output $style_copy = array_shift($param_html); // Shift Preview frame from the array $preview = array_shift($param_html); if (!empty($param_html['param-div_margin'])) { $margin = $param_html['param-div_margin']; $param_html = array_merge(array($preview, $style_copy, $margin), $param_html); } else { $param_html = array_merge(array($preview, $style_copy), $param_html); } } $param_html = implode('', $param_html); $content_tab = "<div class='tab-pane {$active} ig-pb-setting-tab' id='{$tab}'>{$param_html}</div>"; $contents[] = $content_tab; } } } // Auto-append `Shortcode Content` tab if ($shortcode != 'ig_row') { self::shortcode_content_tab($tabs, $contents, $raw_shortcode); } return self::setting_tab_html($shortcode, $tabs, $contents, $general_actions, $settings, $actions); }
/** * 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); }
/** * Get post excerpt (can't use WP excerpt function, because post content contains IGPB shortcodes) * * @param type $post_content * * @return type */ static function post_excerpt($post_content) { $excerpt = IG_Pb_Helper_Shortcode::remove_ig_shortcodes($post_content); return strip_tags($excerpt); }