1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131:
<?php
$shortcodes_config['tabs'] = array(
'no_preview' => true,
'options' => array(
'heading' => array(
'name' => __('Heading', 'inbound-pro' ),
'desc' => __('Enter the heading text', 'inbound-pro' ),
'type' => 'text',
'std' => ''
)
),
'child' => array(
'options' => array(
'title' => array(
'name' => __('Tab Title', 'leads'),
'desc' => __('Enter the tab title.', 'leads'),
'type' => 'text',
'std' => ''
),
'icon' => array(
'name' => __('Icon', 'inbound-pro' ),
'desc' => __('Select an icon.', 'inbound-pro' ),
'type' => 'select',
'options' => $fontawesome,
'std' => ''
),
'content' => array(
'name' => __('Tab Content', 'leads'),
'desc' => __('Put the content here.', 'leads'),
'type' => 'textarea',
'std' => ''
)
),
'shortcode' => '[tab title="{{title}}" icon="{{icon}}"]{{content}}[/tab]',
'clone' => __('Add More Tab', 'cta' )
),
'shortcode' => '[tabs]{{child}}[/tabs]',
'popup_title' => 'Insert Tabs Shortcode'
);
$freshbuilder_modules['tabs'] = array(
'name' => __('Tabs', 'inbound-pro' ),
'size' => 'one_half',
'options' => array(
'heading' => array(
'name' => __('Heading', 'inbound-pro' ),
'desc' => __('Enter the heading text', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => '',
'is_content' => 0
)
),
'child' => array(
'title' => array(
'name' => __('Title', 'inbound-pro' ),
'desc' => __('Enter the tab title', 'inbound-pro' ),
'type' => 'text',
'std' => '',
'class' => '',
'is_content' => 0
),
'icon' => array(
'name' => __('Icon', 'inbound-pro' ),
'desc' => __('Select an icon.', 'inbound-pro' ),
'type' => 'select',
'options' => $fontawesome,
'std' => 'none',
'class' => '',
'is_content' => 0
),
'content' => array(
'name' => __('Content', 'inbound-pro' ),
'desc' => __('Enter the tab content', 'inbound-pro' ),
'type' => 'textarea',
'class' => '',
'is_content' => 1
)
),
'child_code' => 'tab'
);
add_shortcode('tabs', 'inbound_shortcode_tabs');
function inbound_shortcode_tabs( $atts, $content = null ) {
extract(shortcode_atts(array(
'heading' => ''
), $atts));
$out = '';
if (!preg_match_all("/(.?)\[(tab)\b(.*?)(?:(\/))?\](?:(.+?)\[\/tab\])?(.?)/s", $content, $matches)) {
return do_shortcode($content);
}
else {
for($i = 0; $i < count($matches[0]); $i++) {
$matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
}
if( $heading != '' ) $out .= '<div class="heading"><h3>'.$heading.'</h3><div class="sep"></div></div>';
$out .= '<div class="tabs-content">';
$out .= '<ul class="tabs-nav clearfix">';
for($i = 0; $i < count($matches[0]); $i++) {
$icon = ($matches[3][$i]['icon'] != '') ? '<i class="tab-icon icon-'.$matches[3][$i]['icon'].'"></i>' : '';
$out .= '<li><a id="tab_'.$i.'_nav" title="'.$matches[3][$i]['title'].'" href="#tab_'.$i.'">'.$icon.'<span>'.$matches[3][$i]['title'].'<span></a></li>';
}
$out .= '</ul>';
$out .= '<div class="tabs">';
for($i = 0; $i < count($matches[0]); $i++) {
$out .= '<div id="tab_'.$i.'">' . do_shortcode(trim($matches[5][$i])) .'</div>';
}
$out .= '</div>';
$out .= '</div>';
return $out;
}
}