/** * 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) { 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 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 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) { $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); }
/** * 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) { $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 ""; }
/** * Search content (articles). * The SQL must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav. * * @param string $text Target search string. * @param string $phrase Matching option (possible values: exact|any|all). Default is "any". * @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest". * @param mixed $areas An array if the search it to be restricted to areas or null to search all areas. * * @return array Search results. * * @since 1.6 */ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null) { $shortCodeRegex = JSNPagebuilderHelpersShortcode::getShortcodeRegex(); $results = @parent::onContentSearch($text, $phrase, $ordering, $areas); foreach ($results as $_result) { $_result->text = self::removeShortCode($_result->text, $shortCodeRegex); } return $results; }
/** * 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 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) { 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 * * @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); }
/** * get params & structure of shortcode * OVERWRIGE parent function */ public function shortcode_data() { $params = JSNPagebuilderHelpersShortcode::generateShortcodeParams($this->items); $this->config['params'] = array_merge(array('div_margin_top' => '', 'div_margin_bottom' => '', 'disabled_el' => 'no', 'css_suffix' => ''), $params); // get content of sub-shortcode $sub_items_content = array(); $sub_items = isset($this->config['params']['sub_sc_content']) ? $this->config['params']['sub_sc_content'] : array(); foreach ($sub_items as $sub_item_type => &$sub_shortcodes) { foreach ($sub_shortcodes as $sub_shortcode) { $sub_sc = new $sub_item_type(); // $sub_sc->init_element(); // empty std if (empty($sub_shortcode['std'])) { // only empty 'std' if (count($sub_shortcode) == 1) { // get default shortcode structure of sub-shortcode $sub_sc->config['params'] = JSNPagebuilderHelpersShortcode::generateShortcodeParams($sub_sc->items, null, null, false, true); // re-generate shortcode structure $sub_shortcode['std'] = JSNPagebuilderHelpersShortcode::generateShortcodeStructure($sub_sc->config['shortcode'], $sub_sc->config['params']); } else { // MODIFY $instance->items JSNPagebuilderHelpersShortcode::generateShortcodeParams($sub_sc->items, NULL, $sub_shortcode, TRUE); // re-generate shortcode structure $sub_sc->shortcode_data(); // get updated std of sub-shortcode $sub_shortcode['std'] = $sub_sc->config['shortcode_structure']; } } else { // if std of sub-shortcode is predefined ( such as GoogleMap ) $params = stripslashes($sub_shortcode['std']); $extract_params = JSNPagebuilderHelpersShortcode::generateShortcodeParams(urldecode($params)); // MODIFY $instance->items JSNPagebuilderHelpersShortcode::generateShortcodeParams($sub_sc->items, NULL, $extract_params, TRUE); // re-generate shortcode structure $sub_sc->shortcode_data(); } $sub_items_content[] = $sub_shortcode['std']; } } $sub_items_content = implode('', $sub_items_content); // END get content of sub-shortcode $this->config['shortcode_structure'] = JSNPagebuilderHelpersShortcode::generateShortcodeStructure($this->config['shortcode'], $this->config['params'], $sub_items_content); }
/** * 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-->"; } }
/** * Function to validate video file * * @return string */ public function validateFile() { $file_url = isset($_POST['file_url']) ? $_POST['file_url'] : ''; $file_type = isset($_POST['file_type']) ? $_POST['file_type'] : ''; if ($file_type == 'youtube') { $content = JSNPbVideoHelper::getYoutubeVideoInfo($file_url); $info = json_decode($content); if (count($info)) { $data = array(); $content = ''; $content .= 'Title' . ': <b>' . (string) $info->title . '</b><br>'; $content .= 'Author Name' . ': <b>' . (string) $info->author_name . '</b><br>'; $info->description = isset($info->description) ? JSNPagebuilderHelpersShortcode::pbTrimWords((string) $info->description, 20) : ''; $content .= 'Description' . ': <b>' . (string) $info->description . '</b><br>'; $data['content'] = $content; $data['type'] = 'video'; // Check if url had this format "list=SJHkjhlKJHSA". $pattern = '#list=[A-Za-z0-9^/]*#i'; if (preg_match($pattern, $file_url) && stripos($info->html, 'videoseries?') === false) { $data['type'] = 'list'; } exit(json_encode($data)); } } else { if ($file_type == 'vimeo') { $content = JSNPbVideoHelper::getVimeoVideoInfo($file_url); $info = json_decode($content); if (count($info)) { $data = array(); $content = ''; $content .= 'Title' . ': <b>' . (string) $info->title . '</b><br>'; $content .= 'Author Name' . ': <b>' . (string) $info->author_name . '</b><br>'; $info->description = isset($info->description) ? JSNPagebuilderHelpersShortcode::pbTrimWords((string) $info->description, 20) : ''; $content .= 'Description' . ': <b>' . (string) $info->description . '</b><br>'; $data['content'] = $content; exit(json_encode($data)); } } } exit('false'); }
/** * 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); }
/** * get params & structure of shortcode * * @return void */ public function shortcode_data() { $this->config['params'] = JSNPagebuilderHelpersShortcode::generateShortcodeParams($this->items, null, null, false, true); $this->config['shortcode_structure'] = JSNPagebuilderHelpersShortcode::generateShortcodeStructure($this->config['shortcode'], $this->config['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'] : ''; $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) { $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); }