Exemple #1
0
 /**
  * Field constructor
  *
  * @param   JForm  $form  Form object
  */
 public function __construct($form = null)
 {
     // Call parent constructor
     parent::__construct($form);
     JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/helpers', 'JSNTplMMHelper');
     $this->objJSNTplMMElement = new JSNTplMMElement();
 }
 /**
  * Field constructor
  *
  * @param   JForm  $form  Form object
  */
 public function __construct($form = null)
 {
     // Call parent constructor
     parent::__construct($form);
     JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/helpers', 'JSNTplMMHelper');
     JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/helpers/html', 'JSNTplHelperHtml');
     $this->app = JFactory::getApplication();
     $this->objJSNTplMMElement = new JSNTplMMElement();
     $this->objJSNTplMMElement->init();
 }
Exemple #3
0
 public static function getshortcodeTags()
 {
     self::registerProvider();
     // Get list of shortcode directories
     $scPath = self::shortcodeDirs();
     foreach ($scPath as $path) {
         JSNTplMMLoader::register($path, 'JSNTplMMShortcode');
     }
     // Get list of shortcodes
     $shortcodes = self::shortcodesList($scPath);
     return $shortcodes;
 }
Exemple #4
0
 public function __construct()
 {
     JSNTplMMLoader::register(JSN_PATH_TPLFRAMEWORK_MEGAMENU_LIBRARIES . '/helpers', 'JSNTplMMHelper');
     self::$_document = JFactory::getDocument();
     if (self::$_document->getType() !== 'html') {
         // do nothing
     } else {
         self::$_templateParameters = isset(self::$_document->params) ? self::$_document->params : null;
     }
     if (empty(self::$_templateParameters)) {
         $getTemplate = JFactory::getApplication()->getTemplate(true);
         self::$_templateParameters = $getTemplate->params;
     }
 }
Exemple #5
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);
 }