public function elementWrapper($htmlElement, $arrParams, $extraClass = '', $customStyle = '') { $shortcodeName = JSNTplMMHelperShortcode::shortcodeName($this->config['shortcode']); // extract margin here then insert inline style to wrapper div $styles = array(); if (!empty($arrParams['div_margin_top'])) { $styles[] = 'margin-top:' . intval($arr_params['div_margin_top']) . 'px'; } if (!empty($arrParams['div_margin_bottom'])) { $styles[] = 'margin-bottom:' . intval($arrParams['div_margin_bottom']) . 'px'; } $style = count($styles) ? implode('; ', $styles) : ''; if (!empty($style) || !empty($customStyle)) { $style = "style='{$style} {$customStyle}'"; } $class = "jsn-mm-element-container jsn-mm-element-{$shortcodeName}"; $extraClass .= !empty($arrParams['css_suffix']) ? ' ' . esc_attr($arrParams['css_suffix']) : ''; $class .= !empty($extraClass) ? ' ' . ltrim($extraClass, ' ') : ''; $extra_id = !empty($arrParams['id_wrapper']) ? ' ' . esc_attr($arrParams['id_wrapper']) : ''; $extra_id = !empty($extra_id) ? "id='" . ltrim($extra_id, ' ') . "'" : ''; return "<div {$extra_id} class='{$class}' {$style}>" . $htmlElement . '</div>'; }
* @package JSNExtension * @subpackage JSNTPLFramework * @author JoomlaShine Team <*****@*****.**> * @copyright Copyright (C) 2015 JoomlaShine.com. All Rights Reserved. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * Websites: http://www.joomlashine.com * Technical Support: Feedback - http://www.joomlashine.com/contact-us/get-support.html */ // No direct access to this file. defined('_JEXEC') || die('Restricted access'); $submodal = !empty($submodal) ? 'submodal_frame' : ''; if (!empty($shortcode)) { ?> <div id="jsn-mm-element-<?php echo JSNTplMMHelperShortcode::shortcodeName($shortcode); ?> "> <div class="jsn-mm-form-container jsn-bootstrap"> <div id="modalOptions" class="form-horizontal <?php echo $submodal; ?> "> <?php if (!empty($params)) { $params = stripslashes($params); $params = urldecode($params); } if ($el_type == 'element') { // get shortcode class $class = JSNTplMMHelperShortcode::getShortcodeClass($shortcode);
/** * get HTML of Modal Settings Box of Shortcode * @param array $options * @return string */ public static function getShortcodeModalSettings($settings, $shortcode = '', $input_params = null, $raw_shortcode = null) { $i = 0; $tabs = $contents = $actions = $general_actions = array(); if ($shortcode != '') { $shortcodeName = strtolower(JSNTplMMHelperShortcode::shortcodeName($shortcode)); if ($shortcodeName != '') { JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/shortcodes/elements/' . $shortcodeName . '/html', 'JSNTplHelperHtml'); } } foreach ($settings as $tab => $options) { $options = self::ignoreSettings($options); if ($tab == 'action') { foreach ($options as $option) { $actions[] = JSNTplMMHelperShortcode::renderParameter($option['type'], $option); } } else { if ($tab == 'generalaction') { foreach ($options as $option) { $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : ''; $general_actions[] = JSNTplMMHelperShortcode::renderParameter($option['type'], $option); } } else { $active = $i++ == 0 ? 'active' : ''; if (strtolower($tab) != 'notab') { $data_ = isset($settings[$tab]['settings']) ? $settings[$tab]['settings'] : array(); $data_['href'] = "#{$tab}"; $data_['data-toggle'] = 'tab'; $content_ = ucfirst($tab); $tabs[] = "<li class='{$active}'>" . self::tabSettings('a', $data_, $content_) . '</li>'; } $has_margin = 0; $param_html = array(); foreach ($options as $idx => $option) { // check if this element has Margin param (1) if (isset($option['name']) && $option['name'] == 'Margin' && $option['id'] != 'div_margin') { $has_margin = 1; } // if (1), don't use the 'auto extended margin ( top, bottom ) option' if ($has_margin && isset($option['id']) && $option['id'] == 'div_margin') { continue; } $type = $option['type']; $option['id'] = isset($option['id']) ? 'param-' . $option['id'] : "{$idx}"; if (!is_array($type)) { $param_html[$option['id']] = JSNTplMMHelperShortcode::renderParameter($type, $option, $input_params); } else { $output_inner = ''; foreach ($type as $sub_options) { $sub_options['id'] = isset($sub_options['id']) ? 'param-' . $sub_options['id'] : ''; /* for sub option, auto assign bound = 0 {not wrapped by <div class='controls'></div> } */ $sub_options['bound'] = '0'; /* for sub option, auto assign 'input-small' class */ $sub_options['class'] = isset($sub_options['class']) ? $sub_options['class'] : ''; $type = $sub_options['type']; $output_inner .= JSNTplMMHelperShortcode::renderParameter($type, $sub_options); } $option = JSNTplMMHelperHtml::getExtraInfo($option); $label = JSNTplMMHelperHtml::getLabel($option); $param_html[$option['id']] = JSNTplMMHelperHtml::finalElement($option, $output_inner, $label); } } if (!empty($param_html['param-copy_style_from'])) { array_pop($param_html); // move "auto extended margin ( top, bottom ) option" to top of output $style_copy = array_shift($param_html); // Shift Preview frame from the array $preview = array_shift($param_html); if (!empty($param_html['param-div_margin'])) { $margin = $param_html['param-div_margin']; $param_html = array_merge(array($preview, $style_copy, $margin), $param_html); } else { $param_html = array_merge(array($preview, $style_copy), $param_html); } } $param_html = implode('', $param_html); $content_tab = "<div class='tab-pane {$active} jsn-mm-setting-tab' id='{$tab}'>{$param_html}</div>"; $contents[] = $content_tab; } } } return self::settingTabHtml($shortcode, $tabs, $contents, $general_actions, $settings, $actions); }