/** * Render the parent shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render_parent($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => $smof_data['tabs_bg_color'], 'bordercolor' => $smof_data['tabs_border_color'], 'design' => 'classic', 'inactivecolor' => $smof_data['tabs_inactive_color'], 'justified' => 'yes', 'layout' => 'horizontal'), $args); extract($defaults); self::$parent_args = $defaults; $justified_class = ''; if ($justified == 'yes' && $layout != 'vertical') { $justified_class = ' nav-justified'; } $styles = sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li a{border-top-color:%s;background-color:%s;}', $this->tabs_counter, self::$parent_args['inactivecolor'], self::$parent_args['inactivecolor']); if ($design != 'clean') { $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs{background-color:%s;}', $this->tabs_counter, self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a,.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a:hover,.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a:focus{border-right-color:%s;}', $this->tabs_counter, $this->tabs_counter, $this->tabs_counter, self::$parent_args['backgroundcolor']); } else { $styles = sprintf('#wrapper .fusion-tabs.fusion-tabs-%s.clean .nav-tabs li a{border-color:%s;}.fusion-tabs.fusion-tabs-%s .nav-tabs li a{background-color:%s;}', $this->tabs_counter, self::$parent_args['bordercolor'], $this->tabs_counter, self::$parent_args['inactivecolor']); } $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a,.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a:hover,.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a:focus{background-color:%s;}', $this->tabs_counter, $this->tabs_counter, $this->tabs_counter, self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li a:hover{background-color:%s;border-top-color:%s;}', $this->tabs_counter, self::$parent_args['backgroundcolor'], self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .tab-pane{background-color:%s;}', $this->tabs_counter, self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav,.fusion-tabs.fusion-tabs-%s .nav-tabs,.fusion-tabs.fusion-tabs-%s .tab-content .tab-pane{border-color:%s;}', $this->tabs_counter, $this->tabs_counter, $this->tabs_counter, self::$parent_args['bordercolor']); $styles = sprintf('<style type="text/css">%s</style>', $styles); $html = sprintf('<div %s>%s<div %s><ul %s>', FusionCore_Plugin::attributes('tabs-shortcode'), $styles, FusionCore_Plugin::attributes('nav'), FusionCore_Plugin::attributes('nav-tabs' . $justified_class)); $is_first_tab = true; if (empty($this->tabs)) { $this->parse_tab_parameter($content, 'tab', $args); } if (strpos($content, 'fusion_tab')) { preg_match_all('/(\\[fusion_tab (.*?)\\](.*?)\\[\\/fusion_tab\\])/s', $content, $matches); } else { preg_match_all('/(\\[tab (.*?)\\](.*?)\\[\\/tab\\])/s', $content, $matches); } $tab_content = ''; for ($i = 0; $i < count($this->tabs); $i++) { $icon = ''; if ($this->tabs[$i]['icon'] != 'none') { $icon = sprintf('<i %s></i>', FusionCore_Plugin::attributes('tabs-shortcode-icon', array('index' => $i))); } if ($is_first_tab) { $tab_nav = sprintf('<li %s><a %s><h4 %s>%s%s</h4></a></li>', FusionCore_Plugin::attributes('active'), FusionCore_Plugin::attributes('tabs-shortcode-link', array('index' => $i)), FusionCore_Plugin::attributes('fusion-tab-heading'), $icon, $this->tabs[$i]['title']); $is_first_tab = false; } else { $tab_nav = sprintf('<li><a %s><h4 %s>%s%s</h4></a></li>', FusionCore_Plugin::attributes('tabs-shortcode-link', array('index' => $i)), FusionCore_Plugin::attributes('fusion-tab-heading'), $icon, $this->tabs[$i]['title']); } $html .= $tab_nav; $tab_content .= sprintf('<div %s><ul %s>%s</ul></div>%s', FusionCore_Plugin::attributes('nav fusion-mobile-tab-nav'), FusionCore_Plugin::attributes('nav-tabs' . $justified_class), $tab_nav, do_shortcode($matches[1][$i])); } $html .= ''; $html .= sprintf('</ul></div><div %s>%s</div></div>', FusionCore_Plugin::attributes('tab-content'), $tab_content); $this->tabs_counter++; $this->tab_counter = 1; $this->active = false; unset($this->tabs); return $html; }
/** * Render the parent shortcode * @param array $args Shortcode paramters * @param string $content Content between shortcode * @return string HTML output */ function render_parent($args, $content = '') { global $smof_data; $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'backgroundcolor' => $smof_data['tabs_bg_color'], 'inactivecolor' => $smof_data['tabs_inactive_color'], 'justified' => 'yes', 'layout' => 'horizontal'), $args); extract($defaults); self::$parent_args = $defaults; unset($this->tab_ids); $justified_class = ''; if ($justified == 'yes' && $layout != 'vertical') { $justified_class = ' nav-justified'; } $styles = sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li a{border-top-color:%s;background-color:%s;}', $this->tabs_counter, self::$parent_args['inactivecolor'], self::$parent_args['inactivecolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs{background-color:%s;}', $this->tabs_counter, self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a,.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a:hover,.fusion-tabs.fusion-tabs-%s .nav-tabs li.active a:focus{background-color:%s;border-right-color:%s;}', $this->tabs_counter, $this->tabs_counter, $this->tabs_counter, self::$parent_args['backgroundcolor'], self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav-tabs li a:hover{background-color:%s;border-top-color:%s;}', $this->tabs_counter, self::$parent_args['backgroundcolor'], self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .tab-pane{background-color:%s;}', $this->tabs_counter, self::$parent_args['backgroundcolor']); $styles .= sprintf('.fusion-tabs.fusion-tabs-%s .nav,.fusion-tabs.fusion-tabs-%s .nav-tabs,.fusion-tabs.fusion-tabs-%s .tab-content .tab-pane{border-color:%s;}', $this->tabs_counter, $this->tabs_counter, $this->tabs_counter, self::$parent_args['inactivecolor']); $styles = sprintf('<style>%s</style>', $styles); $html = sprintf('<div %s>%s<div %s><ul %s>', FusionCore_Plugin::attributes('tabs-shortcode'), $styles, FusionCore_Plugin::attributes('nav'), FusionCore_Plugin::attributes('nav-tabs' . $justified_class)); $is_first_tab = true; foreach ($args as $key => $tab) { if (substr($key, 0, 3) === "tab") { self::$parent_args['key'] = $this->tab_ids[$key] = substr(md5($this->tabs_counter . '-' . $key), 15); $this->current_tab_name = strtolower(preg_replace('/\\s+/', '', $tab)); if ($is_first_tab) { $html .= sprintf('<li %s><a %s>%s</a></li>', FusionCore_Plugin::attributes('active'), FusionCore_Plugin::attributes('tabs-shortcode-link'), $tab); $is_first_tab = false; } else { $html .= sprintf('<li><a %s>%s</a></li>', FusionCore_Plugin::attributes('tabs-shortcode-link'), $tab); } } } $html .= ''; $html .= sprintf('</ul></div><div %s>%s</div></div>', FusionCore_Plugin::attributes('tab-content'), do_shortcode($content)); $this->tabs_counter++; $this->active = false; return $html; }