Example #1
0
 public static function tabs($atts = null, $content = null)
 {
     $atts = shortcode_atts(array('active' => 1, 'vertical' => 'no', 'style' => 'default', 'class' => ''), $atts, 'tabs');
     if ($atts['style'] === '3') {
         $atts['vertical'] = 'yes';
     }
     do_shortcode($content);
     $return = '';
     $tabs = $panes = array();
     if (is_array(self::$tabs)) {
         if (self::$tab_count < $atts['active']) {
             $atts['active'] = self::$tab_count;
         }
         foreach (self::$tabs as $tab) {
             $tabs[] = '<span class="' . su_ecssc($tab) . $tab['disabled'] . '"' . $tab['anchor'] . $tab['url'] . $tab['target'] . '>' . su_scattr($tab['title']) . '</span>';
             $panes[] = '<div class="su-tabs-pane su-clearfix' . su_ecssc($tab) . '">' . $tab['content'] . '</div>';
         }
         $atts['vertical'] = $atts['vertical'] === 'yes' ? ' su-tabs-vertical' : '';
         $return = '<div class="su-tabs su-tabs-style-' . $atts['style'] . $atts['vertical'] . su_ecssc($atts) . '" data-active="' . (string) $atts['active'] . '"><div class="su-tabs-nav">' . implode('', $tabs) . '</div><div class="su-tabs-panes">' . implode("\n", $panes) . '</div></div>';
     }
     // Reset tabs
     self::$tabs = array();
     self::$tab_count = 0;
     su_query_asset('css', 'su-box-shortcodes');
     su_query_asset('js', 'jquery');
     su_query_asset('js', 'su-other-shortcodes');
     do_action('su/shortcode/tabs', $atts);
     return $return;
 }