/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode($atts = null, $content = null) { extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts)); $inner_content = JSNPagebuilderHelpersShortcode::removeAutop($content); $inner_content = JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($inner_content); return "\n\t\t\t<div id='pane_{index}' class='tab-pane {active} {fade_effect}' STYLE>\n\t\t\t\t{$inner_content}\n\t\t\t</div><!--seperate-->"; }
/** * Generate html for PageBuilder layout. * * @return string */ public function html() { $helper = new JSNPagebuilderHelpersBuilder(); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/elements-lang.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/handle.js'); JSNHtmlAsset::addScript(JSNPB_ADMIN_URL . '/assets/js/shortcodesetting/settings-handler.js'); // Genrate pagebuilder element template. $helper->generateElementColumnTemplate(); $helper->generateElementRowTemplate(); $source_content = ''; $data = array(); $source_content = $_POST['form_data']; // Remove all p tags which auto added by the editor $source_content = JSNPagebuilderHelpersShortcode::removeAutop($source_content); $source_content = html_entity_decode($source_content, ENT_COMPAT, 'UTF-8'); $html[] = '<link rel="stylesheet" href="' . JSNPB_ADMIN_URL . '/assets/css/jsn-element-font.css' . '" type="text/css" />'; $html[] = '<link rel="stylesheet" href="' . JSNPB_ADMIN_URL . '/assets/css/pb-layout-font.css' . '" type="text/css" />'; $html[] = '<div id="form-container" class="jsn-layout jsn-section-content">'; if ($source_content) { //$shortcodeTags = $helper->getShortcodeTags(); $html[] = $helper->generateShortCode($source_content); } else { $html[] = $helper->getRowStructure(); } $html[] = '<a href="javascript:void(0);" id="jsn-add-container" class="jsn-add-more jsn-add-more-row"><i class="icon-plus"></i> Add Row </a>'; /** * Show thumbnail for default layouts */ $html[] = '<div class="row-fluid pb-layout-thumbs">'; $layouts = JSNPBShortcodeRow::$layouts; foreach ($layouts as $columns) { $columns_name = implode('x', $columns); $icon_class = implode('-', $columns); $data_columns = implode(',', $columns); $icon_class = 'pb-layout-' . $icon_class; $icon = '<i class="' . $icon_class . '"></i>'; $html[] = '<div class="thumb-wrapper" data-columns="' . $data_columns . '" title="' . $columns_name . '">' . $icon . '</div>'; } $html[] = '</div>'; $html[] = JSNHtmlGenerate::footer(array(), false); $html[] = '</div>'; $html[] = $helper->getAddShortcodesPopup(); if (defined("JSN_PAGEBUILDER_EDITION")) { if (strtolower(JSN_PAGEBUILDER_EDITION) == "free") { if (file_exists(JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/articles.php')) { include_once JPATH_ROOT . '/administrator/components/com_pagebuilder/helpers/articles.php'; $pbTotal = JSNPagebuilderHelpersArticles::getCountArticleUsedPageBuilderFromPlugin(); if ($pbTotal >= 5 && !JFactory::getApplication()->input->getInt('article_id') && JFactory::getApplication()->input->getInt('is_com_modules') != 1) { $html = array(); $html[] = '<div class="jsn-bootstrap3"><div class="pb-element-container"><p class="jsn-bglabel">You have reached 5 pages limit of using JSN PageBuilder.</p><p style="font-size: 20px;text-align: center;color: #d3d3d3;">Please to upgrade <a target=\'_blank\' href=\'' . JSN_PAGEBUILDER_INFO_LINK . '\'>Pro version</a> or remove your old pages that used JSN PageBuilder.</p><div style="text-align: center"><a href="index.php?option=com_pagebuilder&view=upgrade" target="_blank" class="btn-primary btn-large btn"> Upgrade </a></div></div></div>'; } } } } print_r(implode("\n", $html)); exit; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts)); // tag1,tag2 => tag1 tag2 , to filter $tag = str_replace(" ", "_", $tag); $tag = str_replace(",", " ", $tag); $content = JSNPagebuilderHelpersShortcode::removeAutop($content); 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 " . JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($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 * * @return string */ public function element_shortcode($atts = null, $content = null) { JSNPagebuilderHelpersFunctions::loadFancyboxJS(); $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/buttonbar/assets/js/buttonbar.js', 'text/javascript'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/buttonbar/assets/css/buttonbar.css', 'text/css'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); $html_element = ''; $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $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_htmls = implode('', $items); 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' style='float: none;'>" . $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 style="clear: both"></div>'; $html_element = "<div class='btn-toolbar {$cls_alignment}'>{$html_element}</div>"; $html_element .= '<div style="clear: both"></div>'; return $this->element_wrapper($html_element, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode($atts = null, $content = null) { extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts)); $content = JSNPagebuilderHelpersShortcode::removeAutop($content); $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}>" . JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($content) . "</CELL_WRAPPER>{$empty}<!--seperate-->"; }
/** * DEFINE shortcode content * * @param array $atts * @param string $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); // 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>'; $html_element .= '<div class="clear:both"></div>'; return $this->element_wrapper($html_element, $arr_params); }
/** * define shortcode structure of element * * @return string */ function element_shortcode($atts = null, $content = null) { $extra_class = $style = $common_style = $data_attr = ''; $extra_id = !empty($atts['id_wrapper']) ? $atts['id_wrapper'] : JSNPagebuilderHelpersShortcode::generateRandomString(); if (isset($atts) && is_array($atts)) { $arr_styles = array(); // if(isset($atts['width'])){ // if($atts['width'] == 'full'){ // $extra_class = 'pb_fullwidht'; // $script = "$(body).addClass('pb_fullwidht');"; // $custom_script = JSNPagebuilderHelpersShortcode::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;'; // } // } $background = ""; switch ($atts['background']) { case 'solid': $solid_color = $atts['solid_color_value']; $background = "background-color: {$solid_color};"; break; case 'gradient': if (!isset($atts['gradient_color_css'])) { $background = "background:linear-gradient(center top , #ffffff 0%, #000000 100%);background:-moz-linear-gradient(center top , #ffffff 0%, #000000 100%); background: -webkit-linear-gradient(#FFFFFF, #000000);background:-o-linear-gradient(center top , #ffffff 0%, #000000 100%);background:-ms-linear-gradient(center top , #ffffff 0%, #000000 100%);"; } else { $background = $atts['gradient_color_css']; } break; case 'pattern': $pattern_img = isset($atts['pattern']) ? $atts['pattern'] : ''; $pattern_repeat = isset($atts['repeat']) ? $atts['repeat'] : ''; $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; default: $background_repeat = "repeat"; } $background .= "background-repeat:{$background_repeat};"; break; case 'image': if (isset($atts['image'])) { $image = $atts['image']; } $image_position = $atts['position']; $pattern_stretch = isset($atts['stretch']) ? $atts['stretch'] : ''; $background = "background-image:url('{$image}');background-position:{$image_position};"; 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 'video': $url = $atts['video_url']; // Youtube video if (preg_match('/youtube\\.com/', $url)) { $extra_class .= 'pb_video_bg'; parse_str($url, $youtube_url); $data_attr = sprintf("data-property=\"{videoURL:'http://youtu.be/%s', containment:'%s', autoplay:%s, mute:true, startAt:0, opacity:1, showControls:false}\"", reset($youtube_url), "#{$extra_id}", $atts['autoplay']); $script = "\r\n (function(\$){\r\n \$(document).ready(function(){\r\n \$('.pb_video_bg').mb_YTPlayer();\r\n \$('.pb_video_bg').click(function(){ \$(this).playYTP()})\r\n })\r\n })(jQuery)\r\n "; JFactory::getDocument()->addScriptDeclaration($script, 'text/javascript'); self::enqueue_player_scripts(); } break; } $arr_styles[] = $background; if (isset($atts['paralax']) && $atts['paralax'] == 'yes') { $arr_styles[] = "background-attachment:fixed;"; } if (isset($atts['parallax_scroll']) && $atts['parallax_scroll'] == 'yes') { $extra_class .= 'parallax'; $document = JFactory::getDocument(); $document->addScript(JUri::root(true) . '/administrator/components/com_pagebuilder/helpers/shortcode/row/assets/js/parallax.js', 'text/javascript'); } 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;"; $arr_styles[] = "padding-left:{$atts['div_padding_left']}px;"; $arr_styles[] = "padding-right:{$atts['div_padding_right']}px;"; if (@$atts['width_value']) { $arr_styles[] = "width:" . $atts['width_value'] . $atts['width_unit'] . '; margin:0 auto'; } $arr_styles = implode("", $arr_styles); $style = !empty($arr_styles) ? "style=\"{$arr_styles}\"" : ""; } $column_html = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, true, 'frontend'); $extra_class .= !empty($atts['css_suffix']) ? ' ' . htmlspecialchars($atts['css_suffix']) : ''; $extra_class = ltrim($extra_class, ' '); return $common_style . "<div class='jsn-bootstrap3'><div id='{$extra_id}' class='{$extra_class} row' {$style} {$data_attr}>" . $column_html . "</div></div>"; }
/** * DEFINE shortcode content * * @param array|null $atts * @param array|null $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $this->load_assets_frontend(); } $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $initial_open = intval($initial_open); $tab_position = $tab_position; $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); $tab_navigator = array(); $tab_navigator[] = '<ul class="nav nav-tabs">'; // extract icons of tab items $sub_sc_data = JSNPagebuilderHelpersShortcode::extractSubShortcode($content); $sub_sc_data = $sub_sc_data[$this->config['has_subshortcode']]; $items_data = array('icons' => array(), 'heading' => array()); foreach ($sub_sc_data as $idx => $shortcode) { $extract_params = JSNPagebuilderHelpersShortcode::shortcodeParseAtts($shortcode); $items_data['icons'][] = !empty($extract_params['icon']) ? "<i class='{$extract_params['icon']}'></i> " : ''; $items_data['heading'][] = isset($extract_params['heading']) ? $extract_params['heading'] : ''; } $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = $initial_open > count($items) ? 1 : $initial_open; if ($fade_effect == 'yes') { $fade_effect = 'fade in'; } else { $fade_effect = ''; } foreach ($items as $idx => $item) { $active = $idx + 1 == $initial_open ? 'active' : ''; $item = str_replace('{index}', $random_id . '_' . $idx, $item); $item = str_replace('{active}', $active, $item); $item = str_replace('{fade_effect}', $fade_effect, $item); $items[$idx] = $item; $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $href = "#pane_" . $random_id . '_' . $idx; $tab_navigator[] = "<li {$active_li}><a href='{$href}' data-toggle='tab'>{$items_data['icons'][$idx]}{$items_data['heading'][$idx]}</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 = str_replace('STYLE', "style='min-height: {$min_height}px'", $tab_content); } $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); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $this->load_assets_frontend(); } $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); $testimonial_id = "testimonial_{$random_id}"; $styles = "style='width:100%'"; $image_container_style = $author_image_style != 'no-styling' ? "{$author_image_style}" : ''; $content_elements = array_filter(explode('__#__', $content_elements)); $testimonial_indicators = array(); $testimonial_indicators[] = '<ol class="carousel-indicators">'; $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $testimonial_content = array(); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $count_items = count($items); foreach ($items as $idx => $item) { $pathRoot = JURI::root(); $item = unserialize($item); $url_pattern = '/^(http|https)/'; $image_file = @$item['image_file']; preg_match($url_pattern, $image_file, $m); if (count($m)) { $pathRoot = ''; } if ($idx % $items_per_slide == 0) { $active = $idx == 0 ? 'active' : ''; $testimonial_content[] = "<div class='item row {$active}'>"; $active_li = $idx == 0 ? "class='active'" : ''; $testimonial_indicators[] = "<li {$active_li}></li>"; } $divide = $count_items > $items_per_slide ? $items_per_slide : $count_items; $colmd = 'col-md-' . 12 / $divide; $colsm = 'col-sm-' . 12 / $divide; $item_html = "<div class='pb-testimonial-item {$colmd} {$colsm}'>"; $testimonial_info = array(); if (in_array('content', $content_elements)) { $item_content = JSNPagebuilderHelpersShortcode::removeAutop($item['testimonial_content']); $item_content = JSNPagebuilderHelpersShortcode::pbTrimContent($item_content, $content_count, $content_type); $testimonial_info['content'] = "<div class='pb-testimonial-box top'><div class='arrow'></div><div class='pb-testimonial-content'><p>" . $item_content . '</p></div></div>'; } $img = !empty($item['image_file']) ? "<div class='pb-testimonial-avatar'><img class='{$image_container_style}' src='{$pathRoot}{$item['image_file']}' /></div>" : ''; $testimonial_info['image'] = in_array('image', $content_elements) ? $img : ''; // Process company field if (isset($item['company']) && $item['company'] != '') { $company_link = "<a href='{$item['web_url']}' target='_blank'>{$item['company']}</a>"; } else { $company_link = "<a href='{$item['web_url']}' target='_blank'>{$item['web_url']}</a>"; } if (!isset($item['web_url']) || empty($item['web_url'])) { $company_link = $item['company']; } // Process testimonial metadata $arr_style = array(); if (isset($item['name_height'])) { $arr_style[] = 'font-size: ' . $item['name_height'] . 'px'; } if (isset($item['name_color'])) { $arr_style[] = 'color: ' . $item['name_color']; } $style = $arr_style ? "style='" . implode(';', $arr_style) . "'" : ''; $name = in_array('name', $content_elements) ? "<strong {$style} class='pb-testimonial-name'>" . @$item['name'] . "</strong>" : ''; $job_title = in_array('job_title', $content_elements) ? "<span class='pb-testimonial-jobtitle'>" . @$item['job_title'] . "</span>" : ''; $country = in_array('country', $content_elements) ? "<span class='pb-testimonial-country'>" . @$item['country'] . "</span>" : ''; if ($company_link) { $company = in_array('company', $content_elements) ? "<span class='pb-testimonial-company'>{$company_link}</span>" : ''; } $html_metadata = ''; if ($name != '' || $job_title != '' || $country != '' || $company != '') { $html_metadata .= '<div class="pb-testimonial-meta">'; $html_metadata .= $name . $job_title . $country . $company; $html_metadata .= '</div>'; } foreach ($content_elements as $element) { $item_html .= isset($testimonial_info[$element]) ? $testimonial_info[$element] : ''; } $item_html .= $html_metadata; $item_html .= '</div>'; $testimonial_content[] = $item_html; if (($idx + 1) % $items_per_slide == 0 || $idx + 1 == count($items)) { $testimonial_content[] = '</div>'; } } $testimonial_content = "<div class='carousel-inner'>" . implode('', $testimonial_content) . '</div>'; $testimonial_indicators[] = "</ol>"; $testimonial_indicators = implode('', $testimonial_indicators); $slider_time = $slider_time . '000'; if ($auto_play == 'yes') { $script = "<script type='text/javascript'>\n\t\t\t\t\t\t(function(\$){\n\t\t\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\t\t\tif(\$('#{$testimonial_id}').length){\n\t\t\t\t\t\t\t\t\t\$('#{$testimonial_id}').carousel({\n\t\t\t\t\t\t\t\t interval: " . (int) $slider_time . "\n\t\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t\t\t\$('#{$testimonial_id} .carousel-indicators li').each(function(i){\n\t\t\t\t\t\t\t\t\t\t\$(this).on('click', function(){\n\t\t\t\t\t\t\t\t\t\t\t\$('#{$testimonial_id}').carousel(i);\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})(jQuery)\n\t\t\t\t</script>"; } else { $script = "<script type='text/javascript'>\n\t\t\t\t\t\t(function(\$){\n\t\t\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\t\t\tif(\$('#{$testimonial_id}').length){\n\t\t\t\t\t\t\t\t\t\$('#{$testimonial_id}').carousel({\n\t\t\t\t\t\t\t\t interval: false\n\t\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t\t\t\$('#{$testimonial_id} .carousel-indicators li').each(function(i){\n\t\t\t\t\t\t\t\t\t\t\$(this).on('click', function(){\n\t\t\t\t\t\t\t\t\t\t\t\$('#{$testimonial_id}').carousel(i);\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})(jQuery)\n\t\t\t\t</script>"; } $slider_elements = explode('__#__', $slider_elements); if ($count_items <= (int) $items_per_slide || !in_array('indicator', $slider_elements)) { $testimonial_indicators = ''; } $testimonial_navigator = $count_items > $items_per_slide && in_array('arrows', $slider_elements) ? "<a class='carousel-control left icon-arrow-left pb-arrow-left'></a><a class='carousel-control right icon-arrow-right pb-arrow-right'></a>" : ''; $html = "<div class='carousel slide pb-testimonial' {$styles} id='{$testimonial_id}'> {$testimonial_content} {$testimonial_indicators} {$testimonial_navigator}</div>"; return $this->element_wrapper($script . $html, $arr_params); }
/** * define shortcode structure of element * * @return string */ function element_shortcode($atts = null, $content = null) { extract(JSNPagebuilderHelpersShortcode::shortcodeAtts(array('span' => 'span6', 'style' => ''), $atts)); $style = empty($style) ? '' : "style='{$style}'"; $span = intval(substr($span, 4)); $class = "col-md-{$span} col-sm-{$span} col-xs-12"; $column_html = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, true, 'frontend'); return '<div class="' . $class . '" ' . $style . '>' . $column_html . '</div>'; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addStyleSheet(JSNPB_ELEMENT_URL . "/list/assets/css/list.css", 'text/css'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($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') { $document->addStyleSheet("http://fonts.googleapis.com/css?family={$arr_params['font_face_value']}", 'text/css'); } 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' ? "pb-position-{$icon_position}" : ''; } if (strtolower($arr_params['icon_background_type']) != '') { $arr_icon_class[] = "pb-shape-{$arr_params['icon_background_type']}"; } if ($arr_params['icon_size_value']) { $arr_icon_class[] = "pb-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 = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $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; } if (!empty($sub_shortcode)) { $parent_class = implode(' ', $arr_icon_class); $html_elements = "<ul class='pb-list-icons {$parent_class}'>"; $sub_htmls = $sub_shortcode; $sub_htmls = str_replace('pb-sub-icons', 'pb-icon-base', $sub_htmls); $sub_htmls = str_replace('pb-styles', implode(';', $arr_icon_styles), $sub_htmls); $sub_htmls = str_replace('pb-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>'; $html_elements .= '<div style="clear: both"></div>'; } return $this->element_wrapper($link . $html_elements, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/carousel/assets/css/carousel.css', 'text/css'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/carousel/assets/css/carousel-responsive.css', 'text/css'); $document->addScriptDeclaration("if (typeof jQuery != 'undefined' && typeof MooTools != 'undefined' ) {\n\t\t\t\t\t\t\t\t\t\t Element.implement({\n\t\t\t\t\t\t\t\t\t\t slide: function(how, mode){\n\t\t\t\t\t\t\t\t\t\t return this;\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t });\n\n\t\t\t\t\t\t\t\t\t\t}", 'text/javascript'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); $carousel_id = "carousel_{$random_id}"; // Set fixed stylesheet $document->addStyleDeclaration("#{$carousel_id} .item{\n\t\t\twidth: 100% !important;\n\t\t\tmargin: 0;\n\t\t}", 'text/css'); $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000; $interval = $automatic_cycling == 'yes' ? $interval_time : 'false'; $pause = $pause_mouseover == 'yes' ? 'pause : "hover"' : 'pause : "false"'; $script = "<script type='text/javascript'>\n\t\t\t(function (\$){ \n\t\t\t\t\$( document ).ready(function(){\n\t\t\t\t\tif( \$( '#{$carousel_id}' ).length ){ \n\t\t\t\t\t\t\$( '#{$carousel_id}' ).carousel( {interval: {$interval},{$pause}} );\n\t\t\t\t\t\t\n\t\t\t\t\t\t\$( '#{$carousel_id} .carousel-indicators li' ).each(function (i) {\n\t\t\t\t\t\t\t\$(this).on('click', function () {\n\t\t\t\t\t\t\t\t\$('#{$carousel_id}').carousel(i);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} )( JoomlaShine.jQuery );\n\t\t</script>"; $styles = array(); if (!empty($dimension_width)) { $styles[] = "width : {$dimension_width}{$dimension_width_unit};"; } if (!isset($atts['dimension_height'])) { $styles[] = "min-height : 0px;"; } else { if (!empty($dimension_height)) { $styles[] = "min-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 = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $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}' {$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><div style=\"clear: both\"></div>"; return $this->element_wrapper($html . $script, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/socialicon/assets/js/socialicon.js', 'text/javascript'); $document->addStyleSheet(JSNPB_ADMIN_URL . '/assets/3rd-party/font-awesome/css/font-awesome.css', 'text/css'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/socialicon/assets/css/socialicon.css', 'text/css'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $style = ''; if ($icon_bg_color == 'custom') { $style .= 'background:' . $custom_bg_color . ';'; } if ($shape == 'square') { if (!empty($rounded_corner)) { $style .= 'border-radius:' . $rounded_corner . 'px;'; } } elseif ($shape == 'circle') { $style .= 'border-radius:50px;'; } $html_elements = ''; $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); if (!empty($sub_shortcode)) { $html_elements = "<ul class='pb-social-icons {$shape} {$icon_bg_color}'>"; $sub_htmls = $sub_shortcode; $sub_htmls = str_replace('{icon_size}', $icon_size, $sub_htmls); $sub_htmls = str_replace('STYLE', "style='{$style}'", $sub_htmls); $html_elements .= $sub_htmls; $html_elements .= '</ul>'; $html_elements .= '<div style="clear: both"></div>'; } return $this->element_wrapper($html_elements, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { 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 JSNPagebuilderHelpersShortcode::generateShortcodeParams($this->items, NULL, $atts); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($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 == JText::_('JSN_PAGEBUILDER_DEFAULT_ELEMENT_FONT_STANDARD') || $value == 'standard fonts') { $font_style = 'font-family:' . $arr_params['font_face_value']; } else { if ($value == JText::_('JSN_PAGEBUILDER_DEFAULT_ELEMENT_FONT_GOOGLE') || $value == 'google fonts') { $document = JFactory::getDocument(); $document->addStyleSheet("http://fonts.googleapis.com/css?family={$arr_params['font_face_value']}", 'text/css'); $font_style = 'font-family:' . $arr_params['font_face_value']; } } } else { if ($key != 'font_face_value') { $key = JSNPagebuilderHelpersShortcode::removeTag($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; } } } } } } $style = implode(';', $style); $style .= ';' . $font_style; $style = $style == ';' ? '' : $style; $true_element = "<{$arr_params['tag']} style='{$style}'>" . JSNPagebuilderHelpersShortcode::removeAutop($content) . "</{$arr_params['tag']}>"; $true_element .= ''; return $this->element_wrapper($true_element, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $this->load_assets_frontend(); } $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $style = ''; if ($icon_bg_color == 'custom') { $style .= 'background:' . $custom_bg_color . ';'; } if ($shape == 'square') { if (!empty($rounded_corner)) { $style .= 'border-radius:' . $rounded_corner . 'px;'; } } elseif ($shape == 'circle') { $style .= 'border-radius:50px;'; } $html_elements = ''; $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); if (!empty($sub_shortcode)) { $html_elements = "<ul class='pb-social-icons {$shape} {$icon_bg_color}'>"; $sub_htmls = $sub_shortcode; $sub_htmls = str_replace('{icon_size}', $icon_size, $sub_htmls); $sub_htmls = str_replace('STYLE', "style='{$style}'", $sub_htmls); $html_elements .= $sub_htmls; $html_elements .= '</ul>'; $html_elements .= '<div style="clear: both"></div>'; } return $this->element_wrapper($html_elements, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/accordion/assets/css/accordion.css', 'text/css'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); $initial_open = intval($arr_params['initial_open']); $multi_open = $arr_params['multi_open']; $filter = $arr_params['filter']; $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); $script = ""; $scriptFilter = ""; if ($multi_open == "yes") { $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t\t{\n\t\t\t\t\t\t\$( '#accordion_{$random_id} .panel-title a' ).click( function(e ){\n\t\t\t\t\t\t\tvar collapse_item = \$( '#accordion_{$random_id} '+this.hash )\n\t\t\t\t\t\t\tcollapse_item.collapse( 'toggle' )\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} )( JoomlaShine.jQuery );</script>"; } else { // some case the collapse doesn't work, need this code $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t\t{\n\t\t\t\t\t\t\$( '#accordion_{$random_id} .panel-collapse' ).click( function(e ){\n\t\t\t\t\t\t\tvar collapse_item = \$( '#accordion_{$random_id} '+this.hash )\n\t\t\t\t\t\t\t\$( '#accordion_{$random_id} .panel-body' ).each(function(){\n\t\t\t\t\t\t\t\t\$( this ).addClass( 'panel-collapse' );\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcollapse_item.removeClass( 'panel-collapse' );\n\t\t\t\t\t\t\tcollapse_item.attr( 'style', '' );\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} )( JoomlaShine.jQuery );</script>"; } $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $items = explode("<!--seperate-->", $sub_shortcode); // remove empty element $items = array_filter($items); $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 = JSNPagebuilderHelpersShortcode::extractSubShortcode($content); $sub_sc_data = $sub_sc_data[$this->config['has_subshortcode']]; $tags = array(); $tags[] = 'all'; foreach ($sub_sc_data as $shortcode) { $extract_params = JSNPagebuilderHelpersShortcode::shortcodeParseAtts($shortcode); $tags[] = isset($extract_params["tag"]) ? $extract_params["tag"] : ''; } $tags = array_filter($tags); if (count($tags) > 1) { $tags = implode(",", $tags); $tags = explode(",", $tags); $tags = array_unique($tags); $filter_html = "<ul id='filter_{$random_id}' class='nav nav-pills elementFilter' style='margin-bottom:2px;'>"; foreach ($tags as $idx => $value) { $active = $idx == 0 ? "active" : ""; $filter_html .= "<li class='{$active}'><a href='#' class='" . str_replace(" ", "_", $value) . "'>" . ucfirst($value) . "</a></li>"; } $filter_html .= "</ul>"; // remove "All" tag array_shift($tags); $inner_tags = implode(',', $tags); $scriptFilter .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.parent.jQuery.noConflict()( '#jsn_view_modal').contents().find( 'data-tag' ).text( '{$inner_tags}')\n\t\t\t\t\t\tvar parent_criteria = '#filter_{$random_id}'\n\t\t\t\t\t\tvar clientsClone = \$( '#accordion_{$random_id}' );\n\t\t\t\t\t\tvar tag_to_filter = 'div';\n\t\t\t\t\t\tvar class_to_filter = '.panel-default';\n\t\n\t\t\t\t\t\t\$( parent_criteria + ' a' ).click( function(e ) {\n\t\t\t\t\t\t\t// stop running filter\n\t\t\t\t\t\t\t\$( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\t\$( this ).stop( true )\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\te.preventDefault();\n\t\n\t\t\t\t\t\t\t//active clicked criteria\n\t\t\t\t\t\t\t\$( parent_criteria + ' li' ).removeClass( 'active' );\n\t\t\t\t\t\t\t\$( this ).parent().addClass( 'active' );\n\t\n\t\t\t\t\t\t\tvar filterData = \$( this ).attr( 'class' );\n\t\t\t\t\t\t\tvar filters;\n\t\t\t\t\t\t\tif( filterData == 'all' ){\n\t\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter + '[data-tag~='+ filterData +']' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclientsClone.find( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\t\$( this ).fadeOut();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tfilters.each(function(){\n\t\t\t\t\t\t\t\t\$( this ).fadeIn();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} )( jQuery )</script>"; } } $html = '<div class="panel-group" id="accordion_{ID}">' . $sub_shortcode . '</div>'; $html = str_replace("{ID}", "{$random_id}", $html); $html .= $script . $scriptFilter; return $this->element_wrapper($filter_html . $html, $arr_params); }
/** * DEFINE shortcode content * * @param array $attributes * @param mixed $content * * @return string */ function element_shortcode($attributes = null, $content = null) { $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/market/assets/js/3rd-party/slick/slick.min.js', 'text/javascript'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/market/assets/js/3rd-party/slick/slick.css', 'text/css'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/market/assets/css/market.css', 'text/css'); $arrParams = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $attributes); $htmlElement = ''; $itemShortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $itemsData = explode('<!--separate-->', $itemShortcode); // remove empty element $itemsData = array_filter($itemsData); $dataMarket = array(); // decode foreach ($itemsData as $_key => $_value) { $dataMarket[] = json_decode($_value, true); } $randomMarketId = "market-" . JSNPagebuilderHelpersShortcode::generateRandomString(); $marketLayoutClass = $attributes['market_layout'] == self::PB_MARKET_CAROUSEL_LAYOUT ? 'pb-market-carousel' : 'pb-market-table'; $htmlElement .= "<div id='{$randomMarketId}' class='pb-market-wrapper {$marketLayoutClass}'><div class='pb-market-header'><div class='pb-market-title'>{$attributes['market_title']}</div>"; if (count($dataMarket) <= 0) { } else { if ($attributes['market_show_time_update'] == 'yes') { $timeStamp = new DateTime($dataMarket[0]['time_stamp']); $timeStamp->setTimezone(new DateTimeZone('UTC')); $htmlElement .= "<div class='pb-market-update-time'>{$timeStamp->format('D, M d, Y, g:iA e')}</div>"; } $headerList = explode("__#__", $attributes['market_show_data']); foreach ($headerList as $_key => $_value) { if ($_value == null || $_value == " ") { unset($headerList[$_key]); } } $marketDataType = JSNPbMarketHelper::getMarketDataType(); if ($attributes['market_layout'] == self::PB_MARKET_CAROUSEL_LAYOUT) { if ($attributes['market_show_carousel_control'] == JSNPagebuilderHelpersType::PB_HELPER_ANSWER_YES) { $htmlElement .= "<div class='pb-market-carousel-control'>"; if ($attributes['market_slide_dimension'] == JSNPbMarketHelper::PB_MARKET_SLIDE_DIMENSION_HORIZONTAL) { $htmlElement .= "<div class='button pb-market-carousel-up'><i class='fa fa-chevron-up'></i></div>"; $htmlElement .= "<div class='button pb-market-carousel-down'><i class='fa fa-chevron-down'></i></div>"; } else { $htmlElement .= "<div class='button pb-market-carousel-back'><i class='fa fa-chevron-left'></i></div>"; $htmlElement .= "<div class='button pb-market-carousel-next'><i class='fa fa-chevron-right'></i></div>"; } $htmlElement .= "</div>"; } // End of header $htmlElement .= "</div>"; $htmlElement .= "<div class='pb-market-content pb-market-layout-{$attributes['market_slide_dimension']}'>"; // Show carousel layout foreach ($dataMarket as $_key => $_item) { if (strpos($_item['data'][JSNPbMarketHelper::PB_MARKET_DATA_TYPE_CHANGE], "+") !== false) { $htmlElement .= "<div class='pb-market-carousel-item change-up'>"; } else { $htmlElement .= "<div class='pb-market-carousel-item change-down'>"; } $style = ""; if ($attributes['market_slide_dimension'] == JSNPbMarketHelper::PB_MARKET_SLIDE_DIMENSION_HORIZONTAL) { $style .= "style='width: " . 100 / count($headerList) . "%'"; } if ($_item['data'][JSNPbMarketHelper::PB_MARKET_DATA_TYPE_CHANGE] == null) { $index = 0; foreach ($headerList as $_value) { if ($_value == JSNPbMarketHelper::PB_MARKET_DATA_TYPE_NAME || $_value == JSNPbMarketHelper::PB_MARKET_DATA_TYPE_SYMBOL) { $htmlElement .= "<div {$style} class='market-" . strtolower(str_replace("% ", "percent-", $marketDataType[$_value])) . "'>{$_item['data'][$_value]}</div>"; $index++; } } if (count($headerList) - $index > 0) { if (isset($_item['error'])) { $htmlElement .= "<div class='error'>" . $_item['error'] . "</div>"; } else { $htmlElement .= "<div class='error'>" . JText::_('JSN_PAGEBUILDER_MARKET_ERROR_SYMBOL') . "</div>"; } } } else { foreach ($headerList as $_value) { if (isset($_item['data'][$_value])) { $htmlElement .= "<div {$style} class='market-" . strtolower(str_replace("% ", "percent-", $marketDataType[$_value])) . "'>{$_item['data'][$_value]}</div>"; } } } $htmlElement .= "</div>"; } } else { // End of header $htmlElement .= "</div>"; $htmlElement .= "<div class='pb-market-content'>"; // Show table layout $htmlElement .= "<table class='table'>"; $htmlElement .= "<thead><tr>"; foreach ($headerList as $_key => $_value) { if (isset($marketDataType[$_value]) && $_value != JSNPbMarketHelper::PB_MARKET_DATA_TYPE_CHART) { $htmlElement .= "<th class='market-" . strtolower(str_replace("% ", "percent-", $marketDataType[$_value])) . "'>{$marketDataType[$_value]}</th>"; } } $htmlElement .= "</tr></thead>"; $htmlElement .= "<tbody>"; foreach ($dataMarket as $_key => $_item) { if ($_item['data'][JSNPbMarketHelper::PB_MARKET_DATA_TYPE_CHANGE] == null) { $htmlElement .= "<tr class='error'>"; $index = 0; foreach ($headerList as $_value) { if ($_value == JSNPbMarketHelper::PB_MARKET_DATA_TYPE_NAME || $_value == JSNPbMarketHelper::PB_MARKET_DATA_TYPE_SYMBOL) { $htmlElement .= "<td class='market-" . strtolower(str_replace("% ", "percent-", $marketDataType[$_value])) . "'>{$_item['data'][$_value]}</td>"; $index++; } } if (count($headerList) - $index > 0) { $htmlElement .= "<td colspan='" . (count($headerList) - 1) . "'>" . JText::_('JSN_PAGEBUILDER_MARKET_ERROR_SYMBOL') . "</td>"; } } else { if (strpos($_item['data'][JSNPbMarketHelper::PB_MARKET_DATA_TYPE_CHANGE], "+") !== false) { $htmlElement .= "<tr class='change-up'>"; } else { $htmlElement .= "<tr class='change-down'>"; } foreach ($headerList as $_value) { if (isset($_item['data'][$_value])) { $htmlElement .= "<td class='market-" . strtolower(str_replace("% ", "percent-", $marketDataType[$_value])) . "'>{$_item['data'][$_value]}</td>"; } } } $htmlElement .= "</tr>"; } $htmlElement .= "</tbody>"; $htmlElement .= "</table>"; } } $htmlElement .= "</div></div>"; if ($attributes['market_layout'] == self::PB_MARKET_CAROUSEL_LAYOUT) { $scriptCarousel = "<script type='text/javascript'>(function (\$) {\n\t\t\t\t\t\$(document).ready(function ()\n\t\t\t\t\t{\n \$('#{$randomMarketId} .pb-market-content').slick({\n infinite: true"; if ($attributes['market_slide_dimension'] == JSNPbMarketHelper::PB_MARKET_SLIDE_DIMENSION_HORIZONTAL) { $scriptCarousel .= ", vertical: true, slidesToShow: " . (int) $attributes['market_number_to_show']; } else { $scriptCarousel .= ", variableWidth: true"; } if ($attributes['market_auto_play_carousel'] == JSNPagebuilderHelpersType::PB_HELPER_ANSWER_YES) { $scriptCarousel .= ", autoplay: true"; if (is_numeric($attributes['market_auto_play_speed']) && (int) $attributes['market_auto_play_speed'] > 0) { $scriptCarousel .= ", autoplaySpeed: {$attributes['market_auto_play_speed']}000"; } else { $scriptCarousel .= ", autoplaySpeed: 3000"; } } if ($attributes['market_show_carousel_control'] == JSNPagebuilderHelpersType::PB_HELPER_ANSWER_YES) { if ($attributes['market_slide_dimension'] == JSNPbMarketHelper::PB_MARKET_SLIDE_DIMENSION_HORIZONTAL) { $scriptCarousel .= ", prevArrow: \$('#{$randomMarketId}').find('.pb-market-carousel-up'), nextArrow: \$('#{$randomMarketId}').find('.pb-market-carousel-down')"; } else { $scriptCarousel .= ", prevArrow: \$('#{$randomMarketId}').find('.pb-market-carousel-back'), nextArrow: \$('#{$randomMarketId}').find('.pb-market-carousel-next')"; } } else { $scriptCarousel .= ", arrows: false"; } $scriptCarousel .= ", swipe: false\n });\n\t\t\t\t\t});\n\t\t\t\t})(JoomlaShine.jQuery);</script>"; $htmlElement .= $scriptCarousel; } return $this->element_wrapper($htmlElement, $arrParams); }
/** * define shortcode structure of element * * @return string */ function element_shortcode($atts = null, $content = null) { $extra_class = $style = $common_style = $data_attr = ''; $extra_id = !empty($atts['id_wrapper']) ? $atts['id_wrapper'] : JSNPagebuilderHelpersShortcode::generateRandomString(); if (isset($atts) && is_array($atts)) { $arr_styles = array(); // if(isset($atts['width'])){ // if($atts['width'] == 'full'){ // $extra_class = 'pb_fullwidht'; // $script = "$(body).addClass('pb_fullwidht');"; // $custom_script = JSNPagebuilderHelpersShortcode::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;'; // } // } $background = ""; switch ($atts['background']) { case 'solid': $solid_color = $atts['solid_color_value']; $background = "background-color: {$solid_color};"; break; case 'gradient': if (!isset($atts['gradient_color_css'])) { $background = "background:linear-gradient(center top , #ffffff 0%, #000000 100%);background:-moz-linear-gradient(center top , #ffffff 0%, #000000 100%); background: -webkit-linear-gradient(#FFFFFF, #000000);background:-o-linear-gradient(center top , #ffffff 0%, #000000 100%);background:-ms-linear-gradient(center top , #ffffff 0%, #000000 100%);"; } else { $background = $atts['gradient_color_css']; } break; case 'pattern': $pattern_img = isset($atts['pattern']) ? $atts['pattern'] : ''; $pattern_repeat = isset($atts['repeat']) ? $atts['repeat'] : ''; $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; default: $background_repeat = "repeat"; } $background .= "background-repeat:{$background_repeat};"; break; case 'image': if (isset($atts['image'])) { $image = $atts['image']; } $image_position = $atts['position']; $pattern_stretch = isset($atts['stretch']) ? $atts['stretch'] : ''; $url_pattern = '/^(http|https)/'; preg_match($url_pattern, $image, $_f); if (!count($_f)) { $image = JUri::root() . $image; } $background = "background-image:url('{$image}');background-position:{$image_position};"; 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 'video': $url = $atts['video_url']; // Youtube video $pattern = '#^(?:https?://)?'; # Optional URL scheme. Either http or https. $pattern .= '(?:www\\.)?'; # Optional www subdomain. $pattern .= '(?:'; # Group host alternatives: $pattern .= 'youtu\\.be/'; # Either youtu.be, $pattern .= '|youtube\\.com'; # or youtube.com $pattern .= '(?:'; # Group path alternatives: $pattern .= '/embed/'; # Either /embed/, $pattern .= '|/v/'; # or /v/, $pattern .= '|/watch\\?v='; # or /watch?v=, $pattern .= '|/watch\\?.+&v='; # or /watch?other_param&v= $pattern .= ')'; # End path alternatives. $pattern .= ')'; # End host alternatives. $pattern .= '([\\w-]{11})'; # 11 characters (Length of Youtube video ids). $pattern .= '(?:.+)?$#x'; # Optional other ending URL parameters. if (preg_match($pattern, $url, $matches)) { $extra_class .= 'pb_video_bg'; $youtube_url = end($matches); $data_attr = sprintf("data-property=\"{videoURL:'http://youtu.be/%s', containment:'%s', autoplay:%s, mute:true, startAt:0, opacity:1, showControls:false}\"", $youtube_url, "#{$extra_id}", $atts['autoplay']); $script = "\n\t (function(\$){\n\t \$(document).ready(function(){\n\t \$('.pb_video_bg').mb_YTPlayer();\n\t \$('.pb_video_bg').click(function(){ \$(this).playYTP()})\n\t })\n\t })(jQuery);\n\t "; JFactory::getDocument()->addScriptDeclaration($script, 'text/javascript'); self::enqueue_player_scripts(); } else { JSNPagebuilderHelpersFunctions::print_asset_tag(JUri::root(true) . '/administrator/components/com_pagebuilder/helpers/shortcode/row/assets/css/row.css', 'css'); $autoplay = $atts['autoplay'] == 1 ? 'autoplay="true"' : ''; $script = "\n\t\t\t\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\t\tvar bgwidth = \$('#{$extra_id}').width();\n\t\t\t\t\t\t\tvar bgheight = \$('#{$extra_id}').height();\n\t\t\t\t\t\t\tconsole.log(bgwidth)\n\t\t\t\t\t\t\t\$('#{$extra_id}').css({'position':'relative','z-index':'1','overflow':'hidden'})\n\t\t\t\t\t\t\t\$('video').attr({'width':bgheight, 'height': bgheight});\n\t\t\t\t\t\t\t\$('object').attr({'width':bgheight, 'height': bgheight});\n\t\t\t\t\t\t\t\t\$('video').mediaelementplayer({\n\t\t\t\t\t\t\t\t'loop':true,\n\t\t\t\t\t\t\t\t'clickToPlayPause': false,\n\t\t\t\t\t\t\t\t'controls': false,\n\t\t\t\t\t\t\t\tsuccess: function(player, dom, mediaelement){\n\t\t\t\t\t\t\t\t\tmediaelement.container[0].style.position = 'absolute';\n\t\t\t\t\t\t\t\t\tmediaelement.container[0].style.zIndex = '1';\n\t\t\t\t\t\t\t\t\t\$('.mejs-controls').css('display', 'none');\n\t\t\t\t\t\t\t\t\tplayer.play();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tvar source = \$('<object type=\"application/x-shockwave-flash\" width=\"'+bgwidth+'\" height=\"'+bgheight+'\" data=\"" . JSNPB_PLG_SYSTEM_ASSETS_URL . "/3rd-party/mediaelement/flashmediaelement.swf\">'+\n\t\t\t\t\t\t\t\t\t\t\t\t'<param name=\"movie\" value=\"" . JSNPB_PLG_SYSTEM_ASSETS_URL . "/3rd-party/mediaelement/flashmediaelement.swf\" />'+\n \t\t\t\t\t'<param name=\"flashVars\" value=\"controls=false&file=" . $url . "\" />'+\n \t\t\t\t\t'</object>'+\n '<img src=\"" . JSNPB_PLG_SYSTEM_ASSETS_URL . "/3rd-party/mediaelement/bigplay.png\" width=\"'+bgwidth+'\" height=\"'+bgheight+'\" title=\"No video playback capabilities\" />');\n\t\t\t\t\t var video = \$('<video controls=\"controls\" width=\"'+bgwidth+'\" height=\"\" {$autoplay} loop=\"true\" style=\"position: absolute; left: 0px; top: -20px; overflow: hidden; opacity: 1; transition-property: opacity; transition-duration: 2000ms; z-index: -1; min-width: 101%; min-height: 100%;\" ><source src=\"" . $url . "\" /></video>').append(source);\n\n\t\t\t\t\t \$('#{$extra_id}').append(video);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t"; JFactory::getDocument()->addScriptDeclaration($script, 'text/javascript'); $document = JFactory::getDocument(); $document->addStyleSheet(JSNPB_PLG_SYSTEM_ASSETS_URL . '3rd-party/mediaelement/mediaelementplayer.min.css', 'text/css'); $document->addScript(JSNPB_PLG_SYSTEM_ASSETS_URL . '3rd-party/mediaelement/mediaelement-and-player.min.js', 'text/javascript'); } break; } $arr_styles[] = $background; if (isset($atts['paralax']) && $atts['paralax'] == 'yes') { $arr_styles[] = "background-attachment:fixed;"; } if (isset($atts['parallax_scroll']) && $atts['parallax_scroll'] == 'yes') { $extra_class .= 'parallax'; $document = JFactory::getDocument(); $document->addScript(JUri::root(true) . '/administrator/components/com_pagebuilder/helpers/shortcode/row/assets/js/parallax.js', 'text/javascript'); } 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;"; $arr_styles[] = "padding-left:{$atts['div_padding_left']}px;"; $arr_styles[] = "padding-right:{$atts['div_padding_right']}px;"; if (@$atts['width_value']) { $arr_styles[] = "width:" . $atts['width_value'] . $atts['width_unit'] . '; margin:0 auto'; } $arr_styles = implode("", $arr_styles); $style = !empty($arr_styles) ? "style=\"{$arr_styles}\"" : ""; } $column_html = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, true, 'frontend'); $extra_class .= !empty($atts['css_suffix']) ? ' ' . htmlspecialchars($atts['css_suffix']) : ''; $extra_class = ltrim($extra_class, ' '); return $common_style . "<div class='jsn-bootstrap3'><div id='{$extra_id}' class='{$extra_class} row' {$style} {$data_attr}>" . $column_html . "</div></div>"; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $pathRoot = JURI::root(); extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts)); $content_class = !empty($image_file) ? 'carousel-caption' : 'carousel-content'; $pathRoot = JURI::root(); $url_pattern = '/^(http|https)/'; preg_match($url_pattern, $image_file, $m); if (count($m)) { $pathRoot = ''; } $hidden = empty($heading) && empty($content) ? 'style="display:none"' : ''; $img = !empty($image_file) ? "<img src='{$pathRoot}{$image_file}'>" : ''; $icon = !empty($icon) ? "<i class='{$icon}'></i>" : ''; $inner_content = JSNPagebuilderHelpersShortcode::removeAutop($content); $inner_content = JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($inner_content); if (empty($heading) && empty($inner_content)) { $html_content = ""; } else { $html_content = "<div class='{$content_class}' {$hidden}>"; $html_content .= "<h4>{$icon}{$heading}</h4>"; $html_content .= "<p>{$inner_content}</p></div>"; } return "<div class='{active} item'>{$img}{$html_content}</div><!--seperate-->"; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/progressbar/assets/css/progressbar.css', 'text/css'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($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 = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $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_htmls = implode('', $items); 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); } 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 = ' pb_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>'; $html_element .= "<div style='clear: both'></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, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $html_element = $container_class = $str_scripts = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $arrDefaultOptions = array('streetViewControl', 'zoomControl', 'panControl', 'mapTypeControl', 'scaleControl', 'overviewControl'); if ($gmap_elements) { $arr_elements = array_filter(explode('__#__', $gmap_elements)); foreach ($arrDefaultOptions as $i => $item) { if (in_array($item, $arr_elements)) { $str_scripts .= $item . ':true, '; } else { $str_scripts .= $item . ':false, '; } } } $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); $player_elements = ''; if ($gmap_alignment == 'right') { $player_elements .= '$("#pb-gmap-' . $random_id . '").css({"float" : "right"});'; } elseif ($gmap_alignment == 'center') { $player_elements .= '$("#pb-gmap-' . $random_id . '").css({"margin" : "0 auto", "display" : "block"});'; } elseif ($gmap_alignment == 'left') { $player_elements .= '$("#pb-gmap-' . $random_id . '").css({"float" : "left"});'; } $html_element .= '<script type="text/javascript">(function ($) { $( document ).ready( function () { ' . $player_elements . ' var map_' . $random_id . ' = ""; var marker_locations_' . $random_id . ' = []; var jsnpbPathRoot = "' . JURI::root() . '" function get_latlong(obj) { var myLatlng = new google.maps.LatLng( obj.gmi_lat, obj.gmi_long); return myLatlng; } function get_infobox(obj) { var infowindow = ""; var contentString = "<div class=\\"pb-gmi-info\\" style=\\"width:250px\\" >"; contentString += "<div class=\\"pb-gmi-thumb\\">"; if ( obj.gmi_image != "" && obj.gmi_image != "http://" ) { if ((/\\.(gif|jpg|jpeg|tiff|png)$/i).test(obj.gmi_image) && !/\\b(http|https)/.test(obj.gmi_image)) { contentString += "<img src=\\"" + jsnpbPathRoot + obj.gmi_image + "\\" />"; } else { contentString += "<img src=\\"" + obj.gmi_image + "\\" />"; } } contentString += "</div>"; contentString += "<span class=\\"pb-gmi-title\\"><b>" + obj.gmi_title + "</b></span>"; if ( obj.gmi_desc_content ) contentString += "<p>" + obj.gmi_desc_content + "</p>"; if ( obj.gmi_url != "" && obj.gmi_url != "http://" ) contentString += "<a href=\\"" + obj.gmi_url + "\\" target=\\"_blank\\">more...></a>"; contentString += "</div>"; infowindow = new google.maps.InfoWindow({ content: contentString }); infowindow.setOptions({maxWidth:300}); return infowindow; } function markerAtPoint(latlng) { for (var i = 0; i < marker_locations_' . $random_id . '.length; ++i) { if (marker_locations_' . $random_id . '[i].equals(latlng)) return true; } return false; } function initialize_' . $random_id . '() { var gmap_zoom = parseInt("' . $gmap_zoom . '"); var gmap_lat = ""; var gmap_long = ""; var gmap_type = google.maps.MapTypeId.' . $gmap_type . '; var directionsService_' . $random_id . ' = new google.maps.DirectionsService(); var has_direction = false; var mapOptions_' . $random_id . ' = { zoom: gmap_zoom, center: new google.maps.LatLng(0,0), mapTypeId: gmap_type, ' . $str_scripts . ' }; map_' . $random_id . ' = new google.maps.Map(document.getElementById(\'pb-gmap-' . $random_id . '\'), mapOptions_' . $random_id . '); var rendererOptions_' . $random_id . ' = { map: map_' . $random_id . ', suppressMarkers: true } var directionsDisplay_' . $random_id . ' = new google.maps.DirectionsRenderer(rendererOptions_' . $random_id . '); directionsDisplay_' . $random_id . '.setMap(map_' . $random_id . '); // Check has directions $( "#pb-gmap-wrapper-' . $random_id . ' .pb-gmi-lat-long" ).each(function (index) { var obj = JSON.parse($(this).val()); if ( obj.gmi_lat != "" && obj.gmi_long != "" && obj.gmi_destination != "" ) { has_direction = true; } }); // Add markers if ( has_direction == false ) { $( "#pb-gmap-wrapper-' . $random_id . ' .pb-gmi-lat-long" ).each(function (index) { var obj = JSON.parse($(this).val()); if ( obj.gmi_lat != "" && obj.gmi_long != "" ) { var myLatlng = get_latlong(obj); var infowindow = get_infobox(obj); if ( map_' . $random_id . ' ) { var marker = new google.maps.Marker({ position: myLatlng, map: map_' . $random_id . ', title: obj.gmi_title }); marker_locations_' . $random_id . '.push(myLatlng); map_' . $random_id . '.setCenter(marker.getPosition()); google.maps.event.addListener(marker, \'click\', function() { infowindow.open(map_' . $random_id . ',marker); }); } } }); } else { $( "#pb-gmap-wrapper-' . $random_id . ' .pb-gmi-lat-long" ).each(function (i) { var obj = JSON.parse($(this).val()); $( "#pb-gmap-wrapper-' . $random_id . ' .pb-gmi-lat-long" ).each(function (j) { var sub_obj = JSON.parse($(this).val()); if ( sub_obj.gmi_title == obj.gmi_destination && sub_obj.gmi_lat != "" && sub_obj.gmi_long != "" ) { var start = get_latlong(obj); var end = get_latlong(sub_obj); var infowindow = get_infobox(obj); if ( map_' . $random_id . ' ) { var marker = new google.maps.Marker({ position: start, map: map_' . $random_id . ', title: obj.gmi_title }); marker_locations_' . $random_id . '.push(start); google.maps.event.addListener(marker, \'click\', function() { infowindow.open(map_' . $random_id . ',marker); }); } var sub_infowindow = get_infobox(sub_obj); if ( map_' . $random_id . ' ) { var sub_marker = new google.maps.Marker({ position: end, map: map_' . $random_id . ', title: sub_obj.gmi_title }); marker_locations_' . $random_id . '.push(end); google.maps.event.addListener(sub_marker, \'click\', function() { sub_infowindow.open(map_' . $random_id . ',sub_marker); }); } var request = { origin:start, destination:end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService_' . $random_id . '.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay_' . $random_id . '.setDirections(response); } }); } if ( markerAtPoint(new google.maps.LatLng( obj.gmi_lat, obj.gmi_long) ) == false ) { var myLatlng = get_latlong(obj); var infowindow = get_infobox(obj); if ( map_' . $random_id . ' ) { var marker = new google.maps.Marker({ position: myLatlng, map: map_' . $random_id . ', title: obj.gmi_title }); marker_locations_' . $random_id . '.push(myLatlng); map_' . $random_id . '.setCenter(marker.getPosition()); google.maps.event.addListener(marker, \'click\', function() { infowindow.open(map_' . $random_id . ',marker); }); } } }); }); } } google.maps.event.addDomListener(window, \'load\', initialize_' . $random_id . '); }); })(jQuery)</script>'; $class = 'pb-googlemap'; if ($gmap_container_style == 'img-thumbnail') { $class .= ' img-thumbnail'; } if ($gmap_margin_top) { $gmap_styles[] = "margin-top:{$gmap_margin_top}px !important"; } if ($gmap_margin_bottom) { $gmap_styles[] = "margin-bottom:{$gmap_margin_bottom}px !important"; } if ($gmap_margin_right) { $gmap_styles[] = "margin-right:{$gmap_margin_right}px !important"; } if ($gmap_margin_left) { $gmap_styles[] = "margin-left:{$gmap_margin_left}px !important"; } if ($gmap_dimension_height) { $gmap_styles[] = "height:{$gmap_dimension_height}px !important"; } if ($gmap_dimension_width) { $gmap_styles[] = "width:{$gmap_dimension_width}{$gmap_dimension_width_unit} !important"; } $styles = count($gmap_styles) ? ' style="' . implode(';', $gmap_styles) . '"' : ''; $html_element .= '<div id="pb-gmap-wrapper-' . $random_id . '">'; $html_element .= '<div id="pb-gmap-' . $random_id . '" ' . $styles . ' class="' . $class . '"></div>'; $sub_shortcode = empty($content) ? JSNPagebuilderHelpersShortcode::removeAutop($content) : JSNPagebuilderHelpersBuilder::generateShortCode($content, false, 'frontend', true); $items = explode('<!--seperate-->', $sub_shortcode); $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; } if (!empty($sub_shortcode)) { $sub_html = $sub_shortcode; $html_element .= $sub_html; $html_element .= '</div>'; } $document = JFactory::getDocument(); $document->addScript('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/googlemap/assets/css/googlemap.css', 'text/css'); return $this->element_wrapper($html_element, $arr_params); }