'',
"size" => '',
"link" => '',
"xclass" => ''
), $atts));
return '' . do_shortcode( $content ) . '';
}
/**
* bs_alert
*
* @author Filip Stefansson
* @since 1.0
*
**/
function bs_alert($atts, $content = null) {
extract(shortcode_atts(array(
"type" => '',
"close" => true
), $atts));
return '
' . do_shortcode( $content ) . '
';
}
/*--------------------------------------------------------------------------------------
*
* bs_code
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_code($atts, $content = null) {
extract(shortcode_atts(array(
"type" => '',
"size" => '',
"link" => ''
), $atts));
return '' . do_shortcode( $content ) . '
';
}
/*--------------------------------------------------------------------------------------
*
* bs_span
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_span( $atts, $content = null ) {
extract(shortcode_atts(array(
"size" => 'size'
), $atts));
return '' . do_shortcode( $content ) . '
';
}
/*--------------------------------------------------------------------------------------
*
* bs_row
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_row( $atts, $content = null ) {
return '' . do_shortcode( $content ) . '
';
}
/*--------------------------------------------------------------------------------------
*
* bs_label
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_label( $atts, $content = null ) {
extract(shortcode_atts(array(
"type" => 'type'
), $atts));
return '' . do_shortcode( $content ) . '';
}
/*--------------------------------------------------------------------------------------
*
* bs_badge
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_badge( $atts, $content = null ) {
extract(shortcode_atts(array(
"type" => 'type'
), $atts));
return '' . do_shortcode( $content ) . '';
}
/*--------------------------------------------------------------------------------------
*
* bs_icon
*
* @author Filip Stefansson
* @since 1.0
* //DW Mod to add icon sizing
*-------------------------------------------------------------------------------------*/
function bs_icon( $atts, $content = null ) {
extract(shortcode_atts(array(
"type" => 'type',
"size" => 'normal',
), $atts));
return '';
}
/*--------------------------------------------------------------------------------------
*
* bs_icon_white
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_icon_white( $atts, $content = null ) {
extract(shortcode_atts(array(
"type" => 'type'
), $atts));
return '';
}
/*--------------------------------------------------------------------------------------
*
* simple_table
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_table( $atts ) {
extract( shortcode_atts( array(
'cols' => 'none',
'data' => 'none',
'type' => 'type'
), $atts ) );
$cols = explode(',',$cols);
$data = explode(',',$data);
$total = count($cols);
$output = '';
$output .= '';
foreach($cols as $col):
$output .= '| '.$col.' | ';
endforeach;
$output .= '
';
$counter = 1;
foreach($data as $datum):
$output .= '| '.$datum.' | ';
if($counter%$total==0):
$output .= '
';
endif;
$counter++;
endforeach;
$output .= '
';
return $output;
}
/*--------------------------------------------------------------------------------------
*
* bs_well
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_well( $atts, $content = null ) {
extract(shortcode_atts(array(
"size" => 'size'
), $atts));
return '' . do_shortcode( $content ) . '
';
}
/*--------------------------------------------------------------------------------------
*
* bs_tabs
*
* @author Filip Stefansson
* @since 1.0
* Modified by TwItCh twitch@designweapon.com
*Now acts a whole nav/tab/pill shortcode solution!
*-------------------------------------------------------------------------------------*/
function bs_tabs( $atts, $content = null ) {
if( isset($GLOBALS['tabs_count']) )
$GLOBALS['tabs_count']++;
else
$GLOBALS['tabs_count'] = 0;
extract( shortcode_atts( array(
'tabtype' => 'nav-tabs',
'tabdirection' => '',
), $atts ) );
//DW $defaults = array('tabtype' => 'bla', 'tabdirection' => 'one');
//DW extract( shortcode_atts( $defaults, array(), $atts ) );
// Extract the tab titles for use in the tab widget.
preg_match_all( '/tab title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE );
$tab_titles = array();
if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
$output = '';
if( count($tab_titles) ){
$output .= '';
$i = 0;
foreach( $tab_titles as $tab ){
if($i == 0)
$output .= '- ';
else
$output .= '
- ';
$output .= '' . $tab[0] . '
';
$i++;
}
$output .= '
';
$output .= '
';
$output .= do_shortcode( $content );
$output .= '
';
} else {
$output .= do_shortcode( $content );
}
return $output;
}
/*--------------------------------------------------------------------------------------
*
* bs_tab
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_tab( $atts, $content = null ) {
if( !isset($GLOBALS['current_tabs']) ) {
$GLOBALS['current_tabs'] = $GLOBALS['tabs_count'];
$state = 'active';
} else {
if( $GLOBALS['current_tabs'] == $GLOBALS['tabs_count'] ) {
$state = '';
} else {
$GLOBALS['current_tabs'] = $GLOBALS['tabs_count'];
$state = 'active';
}
}
$defaults = array( 'title' => 'Tab');
extract( shortcode_atts( $defaults, $atts ) );
return ''. do_shortcode( $content ) .'
';
}
/*--------------------------------------------------------------------------------------
*
* bs_collapsibles
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_collapsibles( $atts, $content = null ) {
if( isset($GLOBALS['collapsibles_count']) )
$GLOBALS['collapsibles_count']++;
else
$GLOBALS['collapsibles_count'] = 0;
$defaults = array();
extract( shortcode_atts( $defaults, $atts ) );
// Extract the tab titles for use in the tab widget.
preg_match_all( '/collapse title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE );
$tab_titles = array();
if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
$output = '';
if( count($tab_titles) ){
$output .= '';
$output .= do_shortcode( $content );
$output .= '
';
} else {
$output .= do_shortcode( $content );
}
return $output;
}
/*--------------------------------------------------------------------------------------
*
* bs_collapse
*
* @author Filip Stefansson
* @since 1.0
*
*-------------------------------------------------------------------------------------*/
function bs_collapse( $atts, $content = null ) {
if( !isset($GLOBALS['current_collapse']) )
$GLOBALS['current_collapse'] = 0;
else
$GLOBALS['current_collapse']++;
$defaults = array( 'title' => 'Tab', 'state' => '');
extract( shortcode_atts( $defaults, $atts ) );
if (!empty($state))
$state = 'in';
return '
';
}
}
new BREBoostrapShortcodes()
?>