Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Commit

Permalink
Trim classes to remove whitespace from beginning and end
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdelaney committed Apr 16, 2016
1 parent 37aa8cb commit 30372b5
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions bootstrap-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function bs_button( $atts, $content = null ) {
return sprintf(
'<a href="%s" class="%s"%s%s%s>%s</a>',
esc_url( $atts['link'] ),
esc_attr( $class ),
esc_attr( trim($class) ),
( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
( $atts['title'] ) ? sprintf( ' title="%s"', esc_attr( $atts['title'] ) ) : '',
( $data_props ) ? ' ' . $data_props : '',
Expand Down Expand Up @@ -206,7 +206,7 @@ function bs_button_group( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand All @@ -232,7 +232,7 @@ function bs_button_toolbar( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -260,7 +260,7 @@ function bs_caret( $atts, $content = null ) {

return sprintf(
'<span class="%s"%s>%s</span>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -289,7 +289,7 @@ function bs_container( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand All @@ -316,7 +316,7 @@ function bs_dropdown( $atts, $content = null ) {

return sprintf(
'<ul role="menu" class="%s"%s>%s</ul>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -377,7 +377,7 @@ function bs_divider( $atts, $content = null ) {

return sprintf(
'<li class="%s"%s>%s</li>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand All @@ -404,7 +404,7 @@ function bs_dropdown_header( $atts, $content = null ) {

return sprintf(
'<li class="%s"%s>%s</li>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -436,7 +436,7 @@ function bs_nav( $atts, $content = null ) {

return sprintf(
'<ul class="%s"%s>%s</ul>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -516,7 +516,7 @@ function bs_alert( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
$dismissable,
do_shortcode( $content )
Expand Down Expand Up @@ -547,7 +547,7 @@ function bs_progress( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -577,7 +577,7 @@ function bs_progress_bar( $atts, $content = null ) {

return sprintf(
'<div class="%s" role="progressbar" %s%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $atts['percent'] ) ? ' aria-value="' . (int) $atts['percent'] . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $atts['percent'] . '%;"' : '',
( $data_props ) ? ' ' . $data_props : '',
( $atts['percent'] ) ? sprintf('<span%s>%s</span>', ( !$atts['label'] ) ? ' class="sr-only"' : '', (int) $atts['percent'] . '% Complete') : ''
Expand Down Expand Up @@ -610,7 +610,7 @@ function bs_code( $atts, $content = null ) {
return sprintf(
'<%1$s class="%2$s"%3$s>%4$s</%1$s>',
( $atts['inline'] ) ? 'code' : 'pre',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -638,7 +638,7 @@ function bs_row( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -698,7 +698,7 @@ function bs_column( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -727,7 +727,7 @@ function bs_list_group( $atts, $content = null ) {
return sprintf(
'<%1$s class="%2$s"%3$s>%4$s</%1$s>',
( $atts['linked'] == 'true' ) ? 'div' : 'ul',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -763,7 +763,7 @@ function bs_list_group_item( $atts, $content = null ) {
( $atts['link'] ) ? 'a' : 'li',
( $atts['link'] ) ? 'href="' . esc_url( $atts['link'] ) . '"' : '',
( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand All @@ -789,7 +789,7 @@ function bs_list_group_item_heading( $atts, $content = null ) {

return sprintf(
'<h4 class="%s"%s>%s</h4>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand All @@ -815,7 +815,7 @@ function bs_list_group_item_text( $atts, $content = null ) {

return sprintf(
'<p class="%s"%s>%s</p>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand All @@ -841,7 +841,7 @@ function bs_breadcrumb( $atts, $content = null ) {

return sprintf(
'<ol class="%s"%s>%s</ol>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -870,7 +870,7 @@ function bs_breadcrumb_item( $atts, $content = null ) {
return sprintf(
'<li><a href="%s" class="%s"%s>%s</a></li>',
esc_url( $atts['link'] ),
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -900,7 +900,7 @@ function bs_label( $atts, $content = null ) {

return sprintf(
'<span class="%s"%s>%s</span>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -930,7 +930,7 @@ function bs_badge( $atts, $content = null ) {

return sprintf(
'<span class="%s"%s>%s</span>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -960,7 +960,7 @@ function bs_icon( $atts, $content = null ) {

return sprintf(
'<span class="%s"%s>%s</span>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1074,7 +1074,7 @@ function bs_well( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1126,7 +1126,7 @@ function bs_panel( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s<div class="panel-body">%s</div>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
$heading,
do_shortcode( $content ),
Expand Down Expand Up @@ -1264,7 +1264,7 @@ function bs_tab( $atts, $content = null ) {
return sprintf(
'<div id="%s" class="%s"%s>%s</div>',
sanitize_html_class($id),
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1303,7 +1303,7 @@ function bs_collapsibles( $atts, $content = null ) {

return sprintf(
'<div class="%s" id="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
esc_attr($id),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
Expand Down Expand Up @@ -1481,7 +1481,7 @@ function bs_carousel_item( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content ),
( $atts['caption'] ) ? '<div class="carousel-caption">' . esc_html( $atts['caption'] ) . '</div>' : ''
Expand Down Expand Up @@ -1580,7 +1580,7 @@ function bs_media( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1658,7 +1658,7 @@ function bs_jumbotron( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
( $atts['title'] ) ? '<h1>' . esc_html( $atts['title'] ) . '</h1>' : '',
do_shortcode( $content )
Expand Down Expand Up @@ -1713,7 +1713,7 @@ function bs_lead( $atts, $content = null ) {

return sprintf(
'<p class="%s"%s>%s</p>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1741,7 +1741,7 @@ function bs_emphasis( $atts, $content = null ) {

return sprintf(
'<span class="%s"%s>%s</span>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1801,7 +1801,7 @@ function bs_embed_responsive( $atts, $content = null ) {

return sprintf(
'<div class="%s"%s>%s</div>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
$this->scrape_dom_element($tag, $content, $embed_class, '', '')
);
Expand Down Expand Up @@ -1893,7 +1893,7 @@ function bs_responsive( $atts, $content = null ) {

return sprintf(
'<span class="%s"%s>%s</span>',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down Expand Up @@ -1991,7 +1991,7 @@ function bs_modal_footer( $atts, $content = null ) {

return sprintf(
'</div><div class="%s"%s>%s',
esc_attr( $class ),
esc_attr( trim($class) ),
( $data_props ) ? ' ' . $data_props : '',
do_shortcode( $content )
);
Expand Down

0 comments on commit 30372b5

Please sign in to comment.