Пример #1
0
 public function elementShortcode($atts = null, $content = null)
 {
     extract(JSNTplMMHelperShortcode::shortcodeAtts(array('span' => 'span6', 'style' => ''), $atts));
     $span = intval(substr($span, 4));
     //$class   = "col-md-$span col-sm-$span col-xs-12";
     //$spanSmall	= intval($span * 3 / 2);
     $class = "col-md-{$span} col-sm-{$span}";
     $content = empty($content) ? JSNTplMMHelperShortcode::removeAutop($content) : JSNTplMMHelperShortcode::doShortcodeFrontend($content);
     $html = '';
     $html .= '<div class="jsn-tpl-mm-column-element ' . $class . '">' . $content . '</div>';
     return $html;
 }
Пример #2
0
 public function elementShortcode($atts = null, $content = null)
 {
     $html = '';
     $arrParams = JSNTplMMHelperShortcode::shortcodeAtts($this->config['params'], $atts);
     extract($arrParams);
     $html .= '<div class="jsn-tpl-mm-module-element jsn-tpl-mm-module-element-container ' . $css_suffix . '" id="' . $id_wrapper . '">';
     if ((string) $module_id == '' || (int) $module_id <= 0) {
         $html .= '<div class="alert alert-block">' . JText::_('JSN_TPLFW_MEGAMENU_ELEMENT_MODULE_NO_MODULE_SELECTED', true) . '</div>';
     } else {
         $moduleID = (int) $module_id;
         $html .= $this->loadModule($moduleID, $show_module_title);
     }
     $html .= '</div>';
     return $html;
 }
Пример #3
0
 /**
  * Register all Parent & No-child element, for Add Element popover
  */
 public function registerElement()
 {
     $currentShortcode = null;
     $megamenuShortcodes = JSNTplMMHelperShortcode::getshortcodeTags();
     foreach ($megamenuShortcodes as $name => $scInfo) {
         $arr = explode('_', $name);
         $type = $scInfo['type'];
         if (!$currentShortcode || in_array($currentShortcode, $arr) || !$currentShortcode && $type == 'layout') {
             $class = JSNTplMMHelperShortcode::getShortcodeClass($name);
             $element = new $class();
             $this->setElement($type, $class, $element);
             $this->registerSubEl($class, 1);
         }
     }
 }
Пример #4
0
 public function elementShortcode($atts = null, $content = null)
 {
     $templateParameters = $this->getTemplateParams();
     $arrParams = JSNTplMMHelperShortcode::shortcodeAtts($this->config['params'], $atts);
     extract($arrParams);
     $html = '<div class="jsn-tpl-megamenu-submenu-container jsn_tpl_mm_menu_element">';
     $items = self::getList($templateParameters, $parent_id);
     $html .= self::beginMenu();
     if (count($items)) {
         $html .= self::middleMenu($items, $parent_id);
     } else {
         $html .= '<li><div class="alert alert-block">' . JText::_('JSN_TPLFW_MEGAMENU_ELEMENT_SUBMENU_NO_SUBMENU', true) . '</div></li>';
     }
     $html .= self::endMenu();
     $html .= '</div>';
     return $html;
 }
Пример #5
0
 public function elementShortcode($atts = null, $content = null)
 {
     $arrParams = JSNTplMMHelperShortcode::shortcodeAtts($this->config['params'], $atts);
     extract($arrParams);
     $html = '';
     $html .= '<div class="jsn-tpl-mm-module-position-element jsn-tpl-mm-module-position-container ' . $css_suffix . '" id="' . $id_wrapper . '">';
     if (trim((string) $position_id) == '') {
         $html .= '<div class="alert alert-block">' . JText::_('JSN_TPLFW_MEGAMENU_ELEMENT_MODULE_POSITION_NO_POSITION_SELECTED', true) . '</div>';
     } else {
         $position = trim((string) $position_id);
         $modules = $this->getModules($position);
         if (!count($modules)) {
             $html .= '<div class="alert alert-block">' . JText::_('JSN_TPLFW_MEGAMENU_ELEMENT_MODULE_POSITION_NO_POSITION_SELECTED', true) . '</div>';
         }
         $html .= $this->renderModule($modules, $show_module_title);
     }
     $html .= '</div>';
     return $html;
 }
Пример #6
0
 /**
  * render Shortcode
  * @param object $mmItems
  *
  * @return array
  */
 public static function renderShortcode($mmItems)
 {
     $items = array();
     foreach ($mmItems as $key => $mmItem) {
         if ($mmItem['isMegamenu'] == 'true') {
             $shortcodeContent = $mmItem['shortcodeContent'];
             $shortcodeContent = urldecode($shortcodeContent);
             $items[$key] = JSNTplMMHelperShortcode::doShortcodeFrontend($shortcodeContent);
         }
     }
     return $items;
 }
Пример #7
0
 /**
  * Radio
  * @param type $element
  * @return string
  */
 public static function render($element)
 {
     $element['class'] = isset($element['class']) ? $element['class'] : 'radio inline';
     $element['type_input'] = 'radio';
     return JSNTplMMHelperShortcode::renderParameter('checkbox', $element);
 }
Пример #8
0
 public function getMegamenuLayoutAction()
 {
     $menuID = $this->app->input->getInt('menu_id', 0);
     $styleID = $this->app->input->getInt('style_id', 0);
     $template = $this->app->input->getString('template', '');
     $menuType = $this->app->input->getString('menutype', '');
     $style = $this->getTemplateStyle($styleID, $template);
     if (count($style)) {
         $params = json_decode($style->params, true);
         if (isset($params['megamenu'])) {
             if ($params['megamenu']['menuType'] == $menuType) {
                 if (isset($params['megamenu']['items'][$menuID])) {
                     //echo json_encode($params['megamenu']['items'][$menuID]);
                     if ($params['megamenu']['items'][$menuID]['shortcodeContent'] != '') {
                         $content = urldecode($params['megamenu']['items'][$menuID]['shortcodeContent']);
                         $content = preg_replace('/^<p>(.*)<\\/p>$/', '$1', $content);
                         echo JSNTplMMHelperShortcode::doShortcodeAdmin($content, false, true);
                     }
                     exit;
                 }
             }
         }
     }
     echo '';
     exit;
 }
Пример #9
0
foreach ($layouts as $columns) {
    $columns_name = implode('x', $columns);
    $icon_class = implode('-', $columns);
    $icon_class = 'jsn-mm-layout-' . $icon_class;
    $icon = "<i class='{$icon_class}'></i>";
    printf('<div class="thumb-wrapper col-md-1 col-xs-2" data-columns="%s" title="%s">%s</div>', implode(',', $columns), $columns_name, $icon);
}
?>
						</div>					
				</div>
				
			</div>
			<div class="clearfix"></div>
			<?php 
$elements = $this->getElements();
$megaMenuShortcodes = JSNTplMMHelperShortcode::getshortcodeTags();
$elementsHtml = array();
$categories = array("All");
foreach ($elements['element'] as $element) {
    // don't show sub-shortcode
    if (!isset($element->config['name'])) {
        continue;
    }
    // get shortcode category
    $category = '';
    // category name of this shortcode
    if (!empty($megaMenuShortcodes[$element->config['shortcode']])) {
        $categoryName = $megaMenuShortcodes[$element->config['shortcode']]['provider']['name'] || '';
        $category = strtolower(str_replace(' ', '', $categoryName));
        if (!array_key_exists($category, $categories)) {
            $categories[$category] = $categoryName;
Пример #10
0
 public function elementShortcode($atts = null, $content = null)
 {
     $extraClass = '';
     $html = '';
     $extraClass .= !empty($atts['css_suffix']) ? ' ' . $atts['css_suffix'] : '';
     $content = empty($content) ? JSNTplMMHelperShortcode::removeAutop($content) : JSNTplMMHelperShortcode::doShortcodeFrontend($content);
     $html .= '<div class="row jsn-tpl-mm-row-element' . $extraClass . '">' . $content . '</div>';
     return $html;
 }
Пример #11
0
 /**
  * Extract sub-shortcode content of a shortcode
  * @param type $content
  * @param type $recursion
  * @return type
  */
 public static function extractSubShortcode($content = '', $recursion = false)
 {
     if (empty(self::$pattern)) {
         self::$pattern = self::shortcodesPattern();
     }
     preg_match_all(self::$pattern, $content, $out);
     if ($recursion) {
         return self::extractSubShortcode($out[5][0]);
     }
     // categorize sub shortcodes content
     $subScTags = array();
     // sub sortcodes content
     $subScData = $out[0];
     foreach ($subScData as $scSata) {
         // get shortcode name
         preg_match('/\\[([^\\s]+)/', $scSata, $matches);
         if ($matches) {
             $scClass = self::getShortcodeClass($matches[1]);
             $subScTags[$scClass][] = $scSata;
         }
     }
     return $subScTags;
 }
Пример #12
0
 // get shortcode class
 $class = JSNTplMMHelperShortcode::getShortcodeClass($shortcode);
 if (class_exists($class) && $this->parent != null) {
     $elements = $objJSNTplMMElement->getElements();
     $instance = isset($elements['element'][strtolower($class)]) ? $elements['element'][strtolower($class)] : null;
     if (!is_object($instance)) {
         $instance = new $class();
     }
     if (!empty($params)) {
         $extractParams = JSNTplMMHelperShortcode::extractParams($params, $shortcode);
         // if have sub-shortcode, extract sub shortcodes content
         if (!empty($instance->config['has_subshortcode'])) {
             $subScData = JSNTplMMHelperShortcode::extractSubShortcode($params, true);
             $extractParams['sub_items_content'] = true;
         }
         JSNTplMMHelperShortcode::generateShortcodeParams($instance->items, null, $extractParams, true);
         // if have sub-shortcode, re-generate shortcode structure
         if (!empty($instance->config['has_subshortcode'])) {
             $instance->shortcodeData();
         }
     }
     $settings = $instance->items;
     $settingsHtml = '';
     if ($shortcode == 'jsn_tpl_mm_row') {
         $settingsHtml .= '<div class="col-sm-12 jsn-mm-row-setting">' . JSNTplMMHelperModal::getShortcodeModalSettings($settings, $shortcode, $extractParams, $params) . '</div>';
     } else {
         $settingsHtml .= '<div class="jsn-tpl-mm-setting-resize">' . JSNTplMMHelperModal::getShortcodeModalSettings($settings, $shortcode, $extractParams, $params) . '</div>';
         //$settingsHtml .= '<div class="wr-preview-resize">' . WR_Megamenu_Helpers_Shortcode::render_parameter( 'preview' ) . '</div>';
     }
 }
 echo $settingsHtml;
Пример #13
0
 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>';
 }
Пример #14
0
 /**
  * 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);
 }