/** * 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 . '/button/assets/js/button.js', 'text/javascript'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/button/assets/css/button.css', 'text/css'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $button_text = !$button_text ? '' : $button_text; $button_icon = !$icon ? '' : "<i class='{$icon}'></i>"; $tag = 'a'; $href = ''; $script = ''; @($single_item = explode('__#__', $single_item)); $single_item = $single_item[0]; 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; $script = !isset($script) ? '' : $script; $cls_alignment = $custom_style = ''; if (strtolower($arr_params['button_alignment']) != 'inherit') { if (strtolower($arr_params['button_alignment']) == 'left') { $cls_alignment = 'pull-left'; } if (strtolower($arr_params['button_alignment']) == 'right') { $cls_alignment = 'pull-right'; } if (strtolower($arr_params['button_alignment']) == 'center') { $cls_alignment = 'text-center'; } } $html_element = $script . "<div class='pb-element-button {$cls_alignment}'><{$tag} class='btn {$cls_alignment} {$button_size} {$button_color} {$cls_button_fancy}'{$href}{$target}{$button_type}>{$button_icon}{$button_text}</{$tag}></div>"; return $this->element_wrapper($html_element, $arr_params, null, $custom_style); }
/** * 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); }
/** * Function to sync sub-shortcode content become sub-shortcode array * * @param array $arr_shortcodes */ private function sync_sub_content($sub_shortcode = '') { $document = JFactory::getDocument(); JSNPagebuilderHelpersFunctions::loadFancyboxJS(); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-tipsy/jquery.tipsy.js', 'text/javascript'); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-tipsy/tipsy.css', 'text/css'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/pricingtable/assets/css/pricingtable_frontend.css', 'text/css'); $document->addScript(JSNPB_ELEMENT_URL . '/pricingtable/assets/js/pricingtable_frontend.js', 'text/javascript'); $arr_shortcodes = array(); if (!$sub_shortcode) { return; } // Convert to sub-shortcode array $arr_sub_shortcode = $arr_values = array(); $pattern = '\\[(\\[?)(pb_pricingtableattr_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; preg_match_all("/{$pattern}/s", $sub_shortcode, $matches); $arr_sub_shortcode['pb_pricingtableattr_item'] = $matches[0]; if (isset($arr_sub_shortcode['pb_pricingtableattr_item']) && is_array($arr_sub_shortcode['pb_pricingtableattr_item'])) { $arr_shortcodes['pb_pricingtableattr_item'] = implode('', $arr_sub_shortcode['pb_pricingtableattr_item']); } $pattern = '\\[(\\[?)(pb_pricingtable_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; preg_match_all("/{$pattern}/s", $sub_shortcode, $matches); $arr_sub_shortcode['pb_pricingtable_item'] = $matches[0]; if (isset($arr_sub_shortcode['pb_pricingtable_item']) && is_array($arr_sub_shortcode['pb_pricingtable_item'])) { foreach ($arr_sub_shortcode['pb_pricingtable_item'] as $i => $item) { $pattern = '\\[(\\[?)(pb_pricingtable_item_item)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; preg_match_all("/{$pattern}/s", $item, $matches); $arr_values['pb_pricingtable_item_item'] = $matches[0]; $count = count($arr_values['pb_pricingtable_item_item']); $_item = preg_replace("/{$pattern}/s", '<!--pb-replace-flag-->', $item); // Simulate mechanism process sub-shortcode in modal template $sub_sc_data = JSNPBShortcodePricingTableItem::_sub_items_filter($arr_values, 'pb_pricingtable_item', $arr_sub_shortcode['pb_pricingtableattr_item']); if (isset($sub_sc_data['pb_pricingtable_item_item']) && is_array($sub_sc_data['pb_pricingtable_item_item'])) { $str_pr_tbl_shortcode = str_replace(str_repeat('<!--pb-replace-flag-->', $count), implode('', $sub_sc_data['pb_pricingtable_item_item']), $_item); } $str_pr_tbl_shortcode = str_replace('"prtbl_item_attr_value', '" prtbl_item_attr_value', $str_pr_tbl_shortcode); $arr_shortcodes['pb_pricingtable_item'][] = $str_pr_tbl_shortcode; } } return $arr_shortcodes; }
public function load_assets_frontend() { JSNPagebuilderHelpersFunctions::loadFancyboxJS(); $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/button/assets/js/button.js', 'text/javascript'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/button/assets/css/button.css', 'text/css'); }
public function load_assets_frontend() { $document = JFactory::getDocument(); JSNPagebuilderHelpersFunctions::loadFancyboxJS(); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-tipsy/jquery.tipsy.js', 'text/javascript'); JSNPagebuilderHelpersFunctions::print_asset_tag(JSNPB_FRAMEWORK_ASSETS . '/3rd-party/jquery-tipsy/tipsy.css', 'text/css'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/pricingtable/assets/css/pricingtable_frontend.css', 'text/css'); $document->addScript(JSNPB_ELEMENT_URL . '/pricingtable/assets/js/pricingtable_frontend.js', 'text/javascript'); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content * * @return string */ public function element_shortcode($atts = null, $content = null) { // Load js and style sheet for frontend JSNPagebuilderHelpersFunctions::loadFancyboxJS(); $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/image/assets/jquery-lazyload/jquery.lazyload.js'); $document->addScript(JSNPB_ELEMENT_URL . '/image/assets/js/image.js'); $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $html_elemments = ''; $alt_text = $image_alt ? " alt='{$image_alt}'" : ''; $image_styles = array(); if ($image_margin_top) { $image_styles[] = "margin-top:{$image_margin_top}px"; } if ($image_margin_bottom) { $image_styles[] = "margin-bottom:{$image_margin_bottom}px"; } if ($image_margin_right) { $image_styles[] = "margin-right:{$image_margin_right}px"; } if ($image_margin_left) { $image_styles[] = "margin-left:{$image_margin_left}px"; } $styles = count($image_styles) ? ' style="' . implode(';', $image_styles) . '"' : ''; $class_img = $image_container_style != 'no-styling' ? $image_container_style : ''; $class_img = !empty($class_img) ? ' class="' . $class_img . '"' : ''; if (strtolower($image_size) != 'fullsize') { if (strtolower($image_size) == 'thumbnail') { $img_width = 'width="150"'; } if (strtolower($image_size) == 'medium') { $img_width = 'width="300"'; } if (strtolower($image_size) == 'large') { $img_width = 'width="450"'; } } else { $img_width = ''; } if ($image_file) { $pathRoot = JURI::root(); $url_pattern = '/^(http|https)/'; $image_file = $image_file; preg_match($url_pattern, $image_file, $m); if (count($m)) { $pathRoot = ''; } $html_elemments .= "<img src='{$pathRoot}{$image_file}'{$alt_text}{$styles}{$class_img}{$img_width}/>"; $target = ''; if ($open_in) { switch ($open_in) { case 'current_browser': $target = ''; break; case 'new_browser': case 'lightbox': $target = ' target="_blank"'; break; } } if ($link_type == 'url') { $html_elemments = "<a href='{$image_type_url}'{$target}>" . $html_elemments . '</a>'; } else { if ($link_type == 'image') { $html_elemments = "<a href='{$pathRoot}{$image_file}'{$target} class='pb-image-fancy'>" . $html_elemments . "</a>"; } } if (strtolower($image_alignment) != 'inherit') { if (strtolower($image_alignment) == 'left') { $cls_alignment = 'pull-left'; } if (strtolower($image_alignment) == 'right') { $cls_alignment = 'pull-right'; } if (strtolower($image_alignment) == 'center') { $cls_alignment = 'text-center'; } $html_elemments = "<div class='{$cls_alignment}'>" . $html_elemments . '</div><div style="clear: both"></div>'; } } return $this->element_wrapper($html_elemments, $arr_params); }
public function load_assets_frontend() { // Load js and style sheet for frontend JSNPagebuilderHelpersFunctions::loadFancyboxJS(); $document = JFactory::getDocument(); $document->addScript(JSNPB_ELEMENT_URL . '/image/assets/jquery-lazyload/jquery.lazyload.js'); $document->addScript(JSNPB_ELEMENT_URL . '/image/assets/js/image.js'); }
/** * 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 . '/promobox/assets/js/promobox.js', 'text/javascript'); $document->addStyleSheet(JSNPB_ELEMENT_URL . '/promobox/assets/css/promobox.css', 'text/css'); $html_element = ''; $arr_params = JSNPagebuilderHelpersShortcode::shortcodeAtts($this->config['params'], $atts); extract($arr_params); $styles = array(); if ($pb_bg_color) { $styles[] = 'background-color:' . $pb_bg_color; } if (intval($pb_border_top) > 0) { $styles[] = 'border-top-width:' . (int) $pb_border_top . 'px'; $styles[] = 'border-top-style: solid'; } if (intval($pb_border_left) > 0) { $styles[] = 'border-left-width:' . (int) $pb_border_left . 'px'; $styles[] = 'border-left-style: solid'; } if (intval($pb_border_bottom) > 0) { $styles[] = 'border-bottom-width:' . (int) $pb_border_bottom . 'px'; $styles[] = 'border-bottom-style: solid'; } if (intval($pb_border_right) > 0) { $styles[] = 'border-right-width:' . (int) $pb_border_right . 'px'; $styles[] = 'border-right-style: solid'; } if ($pb_border_color) { $styles[] = 'border-color:' . $pb_border_color; } $elements = explode('__#__', $elements); $class = ''; if ($pb_show_drop == 'yes') { $class .= 'promo-box-shadow'; } $cls_button_fancy = $target = $button = ''; if (in_array('button', $elements)) { switch ($link_type) { case 'no_link': $button_href = ''; break; case 'url': $button_href = !$pb_button_url ? ' href="#"' : " href='{$pb_button_url}'"; break; } if ($pb_button_open_in and $link_type != 'no_link') { switch ($pb_button_open_in) { case 'current_browser': $target = ''; break; case 'new_browser': $target = ' target="_blank"'; break; case 'lightbox': $cls_button_fancy = ' pb-pb-button-fancy'; break; } } $pb_button_size = isset($pb_button_size) && $pb_button_size != 'default' ? $pb_button_size : ''; $pb_button_color = isset($pb_button_color) && $pb_button_color != 'default' ? $pb_button_color : ''; $button = "<a class='pull-right btn {$pb_button_size} {$pb_button_color} {$cls_button_fancy}' {$target} {$button_href}>{$pb_button_title}</a>"; } $styles = implode(';', $styles); $styles = $styles ? "style='{$styles}'" : ''; $html_element .= "<div class='pb-promobox'>"; $html_element .= "<section class='{$class}' {$styles}>"; $html_element .= $button; if (in_array('title', $elements)) { $style_title = array(); if ($title_font == 'custom') { if ($title_font_face_type == 'google fonts') { $document = JFactory::getDocument(); $document->addStyleSheet("http://fonts.googleapis.com/css?family={$title_font_face_value}", 'text/css'); $style_title[] = 'font-family:' . $title_font_face_value; } elseif ($title_font_face_value) { $style_title[] = 'font-family:' . $title_font_face_value; } if (intval($title_font_size) > 0) { $style_title[] = 'font-size:' . intval($title_font_size) . 'px'; } switch ($title_font_style) { case 'bold': $style_title[] = 'font-weight:700'; break; case 'italic': $style_title[] = 'font-style:italic'; break; case 'normal': $style_title[] = 'font-weight:normal'; break; } if (strpos($title_font_color, '#') !== false) { $style_title[] = 'color:' . $title_font_color; } } if ($title_padding_bottom) { $style_title[] = 'padding-bottom:' . $title_padding_bottom . 'px'; } if ($title_margin_bottom) { $style_title[] = 'margin-bottom:' . $title_margin_bottom . 'px'; } if (count($style_title)) { $style_title = 'style="' . implode(';', $style_title) . '"'; } else { $style_title = ''; } $html_element .= "<h2 {$style_title}>{$pb_title}</h2>"; } $content = !$content ? $pb_content : $content; $content = JSNPagebuilderHelpersFunctions::add_absolute_path_to_image_url($content); if (in_array('content', $elements)) { $html_element .= "<p>{$content}</p>"; } $html_element .= '</section>'; $html_element .= '</div>'; $html_element .= "<div style='clear: both'></div>"; return $this->element_wrapper($html_element, $arr_params); }