/** * Method to generate HTML content for shortcode * in pagebuilder layout * * @return string */ public function generateHolder() { // Using $_POST instead JRequest::getVar() because getVar() can't get tinyMCE content has img tag $params = $_POST['params']; $params = urldecode($params); $shortcode = JRequest::getVar('shortcode'); $element_title = JRequest::getVar('el_title'); $class = JSNPagebuilderHelpersShortcode::getShortcodeClass($shortcode); $instance = null; global $JSNPbElements; $elements = $JSNPbElements->getElements(); $instance = isset($elements[strtolower($class)]) ? $elements[strtolower($class)] : null; if (!is_object($instance)) { $instance = new $class(); } // Process icon prepend title if (isset($instance->items)) { $items = array_shift($instance->items); foreach ($items as $i => $item) { if (isset($item['role']) && isset($item['role_type']) && ($item['role'] == 'title_prepend' && $item['role_type'] == 'icon')) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeParseAtts($params); $element = JSNPagebuilderHelpersShortcode::shortcodeAtts($instance->config['params'], $arr_params); if (isset($element['icon'])) { $element_title = '<i class="' . $element['icon'] . '"></i>' . $element_title; } } } } $content = $instance->element_in_pgbldr('', $params, $element_title); echo $content; exit; }
/** * 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-->"; }
/** * 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) { extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts)); $pbar_percentage = floatval($pbar_percentage); $pbar_color = strtolower($pbar_color) == 'default' || empty($pbar_color) ? $pbar_color = '' : ' ' . $pbar_color; $pbar_percentage_width = !$pbar_percentage ? '' : ' style="width: ' . $pbar_percentage . '%"'; $pbar_value = !$pbar_percentage ? '' : ' aria-valuenow="' . $pbar_percentage . '"'; $pbar_item_style = !$pbar_item_style || strtolower($pbar_item_style) == 'solid' ? '' : $pbar_item_style; if ($pbar_item_style == 'striped') { $pbar_item_style = ' progress-striped'; } $icon = !$icon ? '' : "<i class='{$icon}'></i>"; $html_content = "[icon]{$icon}[/icon][text]{$pbar_text}[/text]"; // Add title progressbar $html_content = "<div class='progress-info'[width]><span class='progress-title'>{$html_content}</span>[percentage]<span class='progress-percentage'>{$pbar_percentage}%</span>[/percentage]</div>"; if ($pbar_group == 'stacked') { $html_sub_elm = '[sub_content]' . $html_content . '[/sub_content]'; $html_sub_elm .= "<div class='progress-bar{$pbar_color}{$pbar_item_style}'{$pbar_percentage_width}></div>"; } else { $html_sub_elm = '[sub_content]' . $html_content . '[/sub_content]'; $html_sub_elm .= "<div class='progress{$pbar_item_style}{active}'>"; $html_sub_elm .= "<div class='progress-bar {$pbar_color}' role='progressbar'{$pbar_value}aria-valuemin='0' aria-valuemax='100'{$pbar_percentage_width}></div>"; $html_sub_elm .= '</div>'; } return $html_sub_elm . '<!--seperate-->'; }
/** * DEFINE setting options of shortcode * * @return type */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . "/plugins/system/jsnframework/assets/3rd-party/jquery-tipsy/tipsy.css", 'text/css'); $document->addScript(JURI::root(true) . "/plugins/system/jsnframework/assets/3rd-party/jquery-tipsy/jquery.tipsy.js", 'text/javascript'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $random_id = JSNPagebuilderHelpersShortcode::generateRandomString(); $tooltip_id = "tooltip_{$random_id}"; $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color; $position = strtolower($position); $delay_show = !empty($show) ? $show : 500; $delay_hide = !empty($hide) ? $hide : 100; $direction = array('top' => 's', 'bottom' => 'n', 'left' => 'e', 'right' => 'w'); $content = str_replace(array("\n", "\r"), '', $content); $script = "( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$('#{$tooltip_id}').click(function(e){\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t});\n\t\t\t\t\t\$('#{$tooltip_id}').tipsy({\n\t\t\t\t\t\tfallback: '{$content}',\n\t\t\t\t\t\thtml: true,\n\t\t\t\t\t\tlive: true,\n\t\t\t\t\t\tdelayIn: {$delay_show},\n\t\t\t\t\t\tdelayOut: {$delay_hide},\n\t\t\t\t\t\tgravity: '{$direction[$position]}'\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( JoomlaShine.jQuery );"; if ($tooltips_button == 'no') { $html = "<a id='{$tooltip_id}' class='pb-label-des-tipsy' original-title='' href='#'>{$text}</a>"; } else { $html = "<a id='{$tooltip_id}' class='pb-label-des-tipsy btn {$button_color}' original-title='' href='#'>{$text}</a>"; } $document->addScriptDeclaration($script, 'text/javascript'); //$html = $html; //if ( is_admin() ) { // $custom_style = "style='margin-top: 50px;'"; // $html_element = "<center $custom_style>$html</center>"; //} else // $html_element = $html; return $this->element_wrapper($html, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $html_element = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $qrcode_sizes = $qrcode_sizes ? (int) $qrcode_sizes : 0; $cls_alignment = ''; if (strtolower($arr_params['qr_alignment']) != 'inherit') { if (strtolower($arr_params['qr_alignment']) == 'left') { $cls_alignment = "class='pull-left'"; } if (strtolower($arr_params['qr_alignment']) == 'right') { $cls_alignment = "class='pull-right'"; } if (strtolower($arr_params['qr_alignment']) == 'center') { $cls_alignment = "class='text-center'"; } } $class_img = $qr_container_style != 'no-styling' ? "class='{$qr_container_style}'" : ''; $qr_content = str_replace('<pb_quote>', '"', $qr_content); $image = 'https://chart.googleapis.com/chart?chs=' . $qrcode_sizes . 'x' . $qrcode_sizes . '&cht=qr&chld=H|1&chl=' . $qr_content; $qr_alt = !empty($qr_alt) ? "alt='{$qr_alt}'" : ''; $html_element = "<img src='{$image}' {$qr_alt} width='{$qrcode_sizes}' height='{$qrcode_sizes}' {$class_img} />"; if ($cls_alignment != '') { $html_element = "<div {$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 * * @return string */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $styles = array(); if ($div_border_width) { $styles[] = 'border-bottom-width:' . intval($div_border_width) . 'px'; } if ($div_border_style) { $styles[] = 'border-bottom-style:' . $div_border_style; } if ($div_border_color) { $styles[] = 'border-bottom-color:' . urldecode($div_border_color); } //if ( $div_margin_top ) { // $styles[] = 'margin-top:' . intval( $div_margin_top ) . 'px'; //} //if ( $div_margin_bottom ) { // $styles[] = 'margin-bottom:' . intval( $div_margin_bottom ) . 'px'; //} if (count($styles) > 0) { $html_element = '<div style="' . implode(';', $styles) . '"></div><div style="clear: both"></div>'; } else { $html_element = ''; } return $this->element_wrapper($html_element, $arr_params); }
/** * DEFINE shortcode content * * @param array|null $atts * @param array|null $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/tab/assets/css/tab.css', 'text/css'); $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); }
/** * element shortcode * * @see WR_Element::element_shortcode( $atts, $content ) * @access public * @return string */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $html_element = '<li> <label data-original-title="' . $prtbl_item_attr_desc . '" class="pb-prtbl-tipsy">' . $prtbl_item_attr_title . '</label> </li>'; return $html_element; }
/** * 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) { 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) { $content = JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($content); $atts['testimonial_content'] = $content; return serialize($atts) . '<!--seperate-->'; extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts)); $img = !empty($image_file) ? "<img class='pb-testimonial-image {style}' src='{$image_file}' />" : ''; return ""; }
/** * DEFINE setting options of shortcode * * @return type */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $this->load_assets_frontend(); } $output = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_uniform")) { $html_element = JText::_('JSN_PAGEBUILDER_ELEMENT_UNIFORM_MSG_INSTALL_UNIFORM_AND_ENABLE'); return $this->element_wrapper($html_element, $arr_params); } // No matches, skip this $formID = $arr_params['uniform_id']; if (isset($formID)) { $output = $this->loadJSNUniform($formID, $formID); } // We should replace only first occurrence in order to allow positions with the same name to regenerate their content: $html = $output; // Disable submit button in backend $app = JFactory::getApplication(); $isAdmin = $app->isAdmin() ? true : false; if ($isAdmin) { $html .= '<input type="hidden" id="form-preview-backend" name="form_preview_backend" value="1">'; $_errorStyleSheets = array('/administrator/components/com_uniform/assets/css/form.css', 'task=generateStylePages'); $_styleSheets = $document->_styleSheets; foreach ($_styleSheets as $_key => $_value) { unset($document->_styleSheets[$_key]); foreach ($_errorStyleSheets as $_errorStyleSheet) { if (strpos($_key, $_errorStyleSheet) !== false) { $_key = preg_replace("/\\/administrator/", "", $_key); break; } } $document->_styleSheets[$_key] = $_value; } $_errorScripts = array('/administrator/components/com_uniform/assets/js/libs/json-2.3.min.js', '/administrator/components/com_uniform/assets/js/jsn_uf_jquery_safe.js', '/administrator/components/com_uniform/assets/js/jsn_uf_conflict.js', '/administrator/components/com_uniform/assets/js/form.js', '/administrator/components/com_uniform/assets/js/libs/jquery-ui-1.10.3.custom.min.js'); $_scripts = $document->_scripts; foreach ($_scripts as $_key => $_value) { unset($document->_scripts[$_key]); foreach ($_errorScripts as $_errorScript) { if (strpos($_key, $_errorScript) !== false) { $_key = preg_replace("/\\/administrator/", "", $_key); break; } } $document->_scripts[$_key] = $_value; } } else { $html .= '<input type="hidden" id="form-preview-backend" name="form_preview_backend" value="0">'; } return $this->element_wrapper($html, $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); $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 * * @return string */ public function element_shortcode($atts = null, $content = null) { $params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($params); // reassign value for description from content of shortcode $content = JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($content); $params['gmi_desc_content'] = $content; $html_element = "<input type='hidden' value='" . json_encode($params) . "' class='pb-gmi-lat-long' />"; $html_element .= '<!--seperate-->'; return $html_element; }
/** * 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 setting options of shortcode * * @return type */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); if (!JSNPagebuilderHelpersPagebuilder::checkComponentEnabled("com_easyslider")) { $html_element = JText::_('JSN_PAGEBUILDER_ELEMENT_EASYSLIDER_MSG_INSTALL_EASYSLIDER_AND_ENABLE'); return $this->element_wrapper($html_element, $arr_params); } $easySliderId = (int) $arr_params['easyslider_id']; /** @var JSNEasySliderRender $objJSNEasySliderRender */ $objJSNEasySliderRender = new JSNEasySliderRender(); $html = $objJSNEasySliderRender->render($easySliderId, true); return $this->element_wrapper($html, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $html_element = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $alert_style = !$arr_params['alert_style'] ? '' : $arr_params['alert_style']; $alert_close = !$arr_params['alert_close'] || $arr_params['alert_close'] == 'no' ? '' : '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>'; $alert_dismis = !$arr_params['alert_close'] || $arr_params['alert_close'] == 'no' ? '' : ' alert-dismissable'; $content = !$content ? $alert_content : $content; $content = JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($content); $html_element .= "<div class='alert {$alert_style}{$alert_dismis}'>"; $html_element .= $alert_close; $html_element .= $content; $html_element .= '</div>'; $html_element .= '<div style="clear: both"></div>'; return $this->element_wrapper($html_element, $arr_params); }
/** * DEFINE shortcode content * * @param mixed $atts * @param mixed $content * * @return string */ 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); $html_element = ''; $weatherHelper = new JSNPbWeatherHelper(); $weatherHelper->setDataSource($atts['weather_data_source']); $weatherHelper->setAttributes($atts); $weatherHelper->getData(); $currentWeather = $weatherHelper->getCurrentDay(); $html_element .= "<div class='pb-weather-wrapper'>"; if (isset($currentWeather['error'])) { $html_element .= "<div class='alert alert-warning'>" . JText::_($currentWeather['error']['description']) . "</div></div>"; return $this->element_wrapper($html_element, $arr_params); } $html_element .= "<div class='container-fluid pb-weather-current'>"; if ($weatherHelper->getAttribute('weather_layout') == 'advanced') { $html_element .= "\n <div class=''>\n <h3 class='pb-weather-location-name'>" . $currentWeather['location_full_name'] . "</h3>\n </div>"; $html_element .= "<div class='row pb-weather-advanced'>\n <div class='col-md-6'>\n <div class='row'>\n <img src='" . $currentWeather['icon_url'] . "'/>\n <span>" . $currentWeather['weather'] . "</span>\n </div>\n <div class='row'>\n <h1 class='pb-weather-current-temp'>" . $currentWeather['temp_current'] . "</h1>\n </div>\n <div class='row'>\n <span class='pb-weather-max-temp'>" . strtoupper(JText::_('JSN_PAGEBUILDER_DEFAULT_ELEMENT_MAX')) . " " . $currentWeather['temp_max'] . "</span>,\n <span class='pb-weather-min-temp'>" . strtoupper(JText::_('JSN_PAGEBUILDER_DEFAULT_ELEMENT_MIN')) . " " . $currentWeather['temp_min'] . "</span>\n </div>\n </div>"; if ($atts['weather_show_current'] == JSNPagebuilderHelpersType::PB_HELPER_ANSWER_YES) { $html_element .= "<div class='col-md-6 pb-weather-extra'>\n <div class='row'>\n <div class='col-md-4'>" . ucfirst(JText::_('JSN_PAGEBUILDER_ELEMENT_WEATHER_HUMIDITY')) . ":</div>\n <div class='col-md-8'>" . $currentWeather['humidity'] . "</div>\n </div>\n <div class='row'>\n <div class='col-md-4'>" . ucfirst(JText::_('JSN_PAGEBUILDER_ELEMENT_WEATHER_VISIBILITY')) . ":</div>\n <div class='col-md-8'>" . $currentWeather['visibility'] . "</div>\n </div>\n <div class='row'>\n <div class='col-md-4'>" . ucfirst(JText::_('JSN_PAGEBUILDER_ELEMENT_WEATHER_WIND')) . ":</div>\n <div class='col-md-8'>" . $currentWeather['wind'] . " " . $currentWeather['wind_dir'] . "</div>\n </div>\n </div>"; } $html_element .= "</div>"; $html_element .= "</div>"; if ($atts['weather_show_next'] == JSNPagebuilderHelpersType::PB_HELPER_ANSWER_YES) { $html_element .= "<div class='container-fluid pb-weather-forecast'>\n <h4 class='pb-weather-forecast-title'>" . strtoupper(JText::_('JSN_PAGEBUILDER_ELEMENT_WEATHER_FORECAST')) . "</h4>"; $forecastWeather = $weatherHelper->getForecast(); $limit = (int) $weatherHelper->getAttribute('weather_number_day'); for ($_index = 0; $_index < $limit; $_index++) { $_forecastDay = $forecastWeather[$_index]; $html_element .= "\n <div class='pb-weather-forecast-day'>\n <img src='" . $_forecastDay['icon_url'] . "'/>\n <p class='pb-weather-forecast-weekday'>" . $_forecastDay['date']['weekday_short'] . "</p>\n <p class='pb-weather-max-temp'>" . strtoupper(JText::_('JSN_PAGEBUILDER_DEFAULT_ELEMENT_MAX')) . " " . $_forecastDay['temp_max'] . "</p>\n <p class='pb-weather-min-temp'>" . strtoupper(JText::_('JSN_PAGEBUILDER_DEFAULT_ELEMENT_MIN')) . " " . $_forecastDay['temp_min'] . "</p>\n </div>"; } } } else { $html_element .= "\n <div class='pb-weather-current-day'>\n <div class='pb-weather-location-name'>" . $currentWeather['location_full_name'] . "</div>\n <div class='pb-weather-icon'><img src='" . $currentWeather['icon_url'] . "'/></div>\n <div class='pb-weather-info'>\n <span class='pb-weather-current-temp'>" . $currentWeather['temp_current'] . "</span>\n <span class='pb-weather-max-temp'>(" . $currentWeather['temp_max'] . "</span>\n <span class='pb-weather-min-temp'>" . $currentWeather['temp_min'] . ")</span>\n </div>\n </div>"; } $html_element .= "</div></div>"; return $this->element_wrapper($html_element, $arr_params); }
/** * element shortcode * * @see WR_Element::element_shortcode( $atts, $content ) * @access public * @return string */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); if (is_array(@$pricingtable_attrs)) { if (isset($arr_params['prtbl_item_attr_id']) && in_array($arr_params['prtbl_item_attr_id'], $pricingtable_attrs)) { return ''; } } switch ($prtbl_item_attr_type) { case 'text': $html_element = '<li><label data-original-title="' . $prtbl_item_attr_desc . '" class="pb-prtbl-tipsy">' . $prtbl_item_attr_value . '</label></li>'; break; case 'checkbox': $html_element = $prtbl_item_attr_value == 'yes' ? '<li><i class="icon-checkmark"></i></li>' : '<li></li>'; break; } return $html_element; }
/** * define shortcode content * * @param type $atts * @param type $content */ public function element_shortcode($atts = null, $content = null) { $document = JFactory::getDocument(); $app = JFactory::getApplication(); if ($app->isAdmin()) { $this->load_assets_frontend(); } $html_element = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $module_class = 0; $container_style = ''; $container_class = ''; if ($arr_params['module_alignment'] === 'right') { $container_style .= 'float: right;'; } else { if ($arr_params['module_alignment'] === 'center') { $container_style .= 'margin: 0 auto;'; $container_class = 'center'; } else { if ($arr_params['module_alignment'] === 'left') { $container_style .= 'float: left;'; } } } $container_style = $container_style ? ' style=" ' . $container_style . ' " ' : ''; $container_class = $container_class ? 'center' : ''; if (empty($module_name)) { $html_element = "<p class='jsn-bglabel'>" . JText::_('No module selected') . '</p>'; } else { $module_id = preg_replace("/[^0-9^]/", "", substr($module_name, 0, 5)); $show_title = $arr_params['module_show_title']; if (isset($module_id)) { $html_element .= '<div class="jsn-pb-module-element pb-element-container pb-element-module ' . $container_class . '"' . $container_style . '>'; $html_element .= $this->jsn_load_module($module_id, $module_class, $style = 'none', $show_title); $html_element .= '</div>'; $html_element .= '<div style="clear: both"></div>'; } } $html_element = JSNPagebuilderHelpersBuilder::generateShortCode($html_element, false, 'frontend', true); return $this->element_wrapper($html_element, $arr_params); }
/** * DEFINE shortcode content * * @param array $attributes * @param mixed $content * * @return string */ public function element_shortcode($attributes = null, $content = null) { extract(JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $attributes)); $queryString = "http://query.yahooapis.com/v1/public/yql?env=store://datatables.org/alltableswithkeys&format=json&q=select * from yahoo.finance.quotes where symbol in ('" . $attributes['market_item_symbol_code'] . "')"; try { $result = JSNUtilsHttp::get($queryString); $dataRaw = json_decode($result['body'], true); if (isset($dataRaw['error'])) { return "<!--separate-->"; } else { $dataItem['time_stamp'] = $dataRaw['query']['created']; $dataItem['data'] = $dataRaw['query']['results']['quote']; $dataItem['data']['name'] = $attributes['market_item_text']; } return json_encode($dataItem) . '<!--separate-->'; } catch (Exception $e) { $dataItem['error'] = $e->getMessage(); return json_encode($dataItem) . "<!--separate-->"; } }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $button_text = !$button_text ? '' : $button_text; $button_size = !$button_size || strtolower($button_size) == 'default' ? '' : $button_size; $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color; $button_icon = !$icon ? '' : "<i class='{$icon}'></i>"; $tag = 'a'; $href = ''; $script = ''; if (!empty($link_type)) { switch ($link_type) { case 'no_link': $tag = 'button'; break; case 'url': $href = !$button_type_url ? ' href="#"' : " href='{$button_type_url}'"; break; } } $target = ''; if ($open_in) { switch ($open_in) { case 'current_browser': $target = ''; break; case 'new_browser': $target = ' target="_blank"'; break; case 'lightbox': $cls_button_fancy = ' pb-button-fancy'; break; } } $button_type = $tag == 'button' ? " type='button'" : ''; $cls_button_fancy = !isset($cls_button_fancy) ? '' : $cls_button_fancy; $html_result = "<{$tag} class='btn {$button_size} {$button_color}{$cls_button_fancy}'{$href}{$target}{$button_type}>[icon]{$button_icon}[/icon][title]{$button_text}[/title]</{$tag}>"; return $html_result . '<!--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 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) { $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 . '/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 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) { $html_element = ''; if ($atts['video_sources'] == 'local') { $atts['video_local_dimension_width'] = $atts['video_local_dimension_width'] ? $atts['video_local_dimension_width'] : '100%'; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); if (empty($arr_params['video_source_local'])) { $html_element = "<p class='jsn-bglabel'>" . JText::_('JSN_PAGEBUILDER_ELEMENT_VIDEO_NO_VIDEO_FILE_SELECTED') . '</p>'; } else { $app = JFactory::getApplication(); if ($app->isAdmin()) { $this->load_local_video_assets(); } $html_element = $this->generate_local_file($arr_params); } } else { if ($atts['video_sources'] == 'youtube') { $atts['video_youtube_dimension_width'] = $atts['video_youtube_dimension_width'] ? $atts['video_youtube_dimension_width'] : '100%'; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); if (empty($arr_params['video_source_link_youtube'])) { $html_element = "<p class='jsn-bglabel'>" . JText::_('JSN_PAGEBUILDER_ELEMENT_VIDEO_NO_VIDEO_FILE_SELECTED') . '</p>'; } else { $html_element = $this->generate_youtube($arr_params); } } else { if ($atts['video_sources'] == 'vimeo') { $atts['video_vimeo_dimension_width'] = $atts['video_vimeo_dimension_width'] ? $atts['video_vimeo_dimension_width'] : '100%'; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); if (empty($arr_params['video_source_link_vimeo'])) { $html_element = "<p class='jsn-bglabel'>" . JText::_('JSN_PAGEBUILDER_ELEMENT_VIDEO_NO_VIDEO_FILE_SELECTED') . '</p>'; } else { $html_element = $this->generate_vimeo($arr_params); } } } } 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($atts = null, $content = null) { $html_element = ''; $arr_sub_shortcodes = self::sync_sub_content($content); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $arr_elements = explode('__#__', $prtbl_elements); // Build html for cols label. $pr_tbl_label_html = '<div class="pb-prtbl-cols first">'; // Append blank header $header_ = '<div class="pb-prtbl-title">'; if (in_array('image', $arr_elements)) { $header_ .= '<div class="pb-prtbl-image"></div>'; } $header_ .= '<h3> </h3></div>'; if (in_array('price', $arr_elements) || in_array('description', $arr_elements)) { $header_ .= '<div class="pb-prtbl-meta">'; // append blank price if (in_array('price', $arr_elements)) { $header_ .= '<div class="pb-prtbl-price"> </div>'; } // append blank price if (in_array('description', $arr_elements)) { $header_ .= '<p class="pb-prtbl-desc"> </p>'; } $header_ .= '</div>'; } $pr_tbl_label_html .= sprintf('<div class="pb-prtbl-header">%s</div>', $header_); if (in_array('attributes', $arr_elements)) { if (isset($arr_sub_shortcodes['pb_pricingtableattr_item']) && !empty($arr_sub_shortcodes['pb_pricingtableattr_item'])) { $pr_tbl_label_html .= '<ul class="pb-prtbl-features">'; $pr_tbl_label_html .= JSNPagebuilderHelpersBuilder::generateShortCode($arr_sub_shortcodes['pb_pricingtableattr_item'], false, 'frontend', true); $pr_tbl_label_html .= '</ul>'; } } if (in_array('button', $arr_elements)) { $pr_tbl_label_html .= '<div class="pb-prtbl-footer"></div>'; } $pr_tbl_label_html .= '</div>'; // Build html for cols value. $pr_tbl_col_value_html = ''; if (isset($arr_sub_shortcodes['pb_pricingtable_item']) && !empty($arr_sub_shortcodes['pb_pricingtable_item'])) { $pr_tbl_col_value_html = JSNPagebuilderHelpersBuilder::generateShortCode(implode('', $arr_sub_shortcodes['pb_pricingtable_item']), false, 'frontend', true); $pr_tbl_col_value_html = $this->check_field_allow('title', 'prtbl_item_title', $arr_elements, $pr_tbl_col_value_html); $pr_tbl_col_value_html = $this->check_field_allow('description', 'prtbl_item_desc', $arr_elements, $pr_tbl_col_value_html); $pr_tbl_col_value_html = $this->check_field_allow('image', 'prtbl_item_image', $arr_elements, $pr_tbl_col_value_html); $pr_tbl_col_value_html = $this->check_field_allow('button', 'prtbl_item_button', $arr_elements, $pr_tbl_col_value_html); $pr_tbl_col_value_html = $this->check_field_allow('price', 'prtbl_item_price', $arr_elements, $pr_tbl_col_value_html); $pr_tbl_col_value_html = $this->check_field_allow('attributes', 'prtbl_item_attributes', $arr_elements, $pr_tbl_col_value_html); if (!in_array('price', $arr_elements) && !in_array('description', $arr_elements)) { $pattern = '\\[(\\[?)(prtbl_item_meta)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; $pr_tbl_col_value_html = preg_replace("/{$pattern}/s", '', $pr_tbl_col_value_html); } else { $pr_tbl_col_value_html = str_replace("[prtbl_item_meta]", '', $pr_tbl_col_value_html); $pr_tbl_col_value_html = str_replace("[/prtbl_item_meta]", '', $pr_tbl_col_value_html); } } $count_columns = isset($arr_sub_shortcodes['pb_pricingtable_item']) ? count($arr_sub_shortcodes['pb_pricingtable_item']) + 1 : 1; $html_element = $pr_tbl_label_html . $pr_tbl_col_value_html; return $this->element_wrapper($html_element, $arr_params, "table-{$count_columns}-col"); }