From 30372b5c79df6f6163935213efcc1d08fd383bcb Mon Sep 17 00:00:00 2001 From: mwdelaney Date: Sat, 16 Apr 2016 15:36:28 -0400 Subject: [PATCH] Trim classes to remove whitespace from beginning and end --- bootstrap-shortcodes.php | 72 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/bootstrap-shortcodes.php b/bootstrap-shortcodes.php index c75be68..1a5d480 100644 --- a/bootstrap-shortcodes.php +++ b/bootstrap-shortcodes.php @@ -168,7 +168,7 @@ function bs_button( $atts, $content = null ) { return sprintf( '%s', 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 : '', @@ -206,7 +206,7 @@ function bs_button_group( $atts, $content = null ) { return sprintf( '
%s
', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -232,7 +232,7 @@ function bs_button_toolbar( $atts, $content = null ) { return sprintf( '
%s
', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -260,7 +260,7 @@ function bs_caret( $atts, $content = null ) { return sprintf( '%s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -289,7 +289,7 @@ function bs_container( $atts, $content = null ) { return sprintf( '
%s
', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -316,7 +316,7 @@ function bs_dropdown( $atts, $content = null ) { return sprintf( '', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -377,7 +377,7 @@ function bs_divider( $atts, $content = null ) { return sprintf( '
  • %s
  • ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -404,7 +404,7 @@ function bs_dropdown_header( $atts, $content = null ) { return sprintf( '
  • %s
  • ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -436,7 +436,7 @@ function bs_nav( $atts, $content = null ) { return sprintf( '', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -516,7 +516,7 @@ function bs_alert( $atts, $content = null ) { return sprintf( '
    %s%s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', $dismissable, do_shortcode( $content ) @@ -547,7 +547,7 @@ function bs_progress( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -577,7 +577,7 @@ function bs_progress_bar( $atts, $content = null ) { return sprintf( '
    %s
    ', - 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('%s', ( !$atts['label'] ) ? ' class="sr-only"' : '', (int) $atts['percent'] . '% Complete') : '' @@ -610,7 +610,7 @@ function bs_code( $atts, $content = null ) { return sprintf( '<%1$s class="%2$s"%3$s>%4$s', ( $atts['inline'] ) ? 'code' : 'pre', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -638,7 +638,7 @@ function bs_row( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -698,7 +698,7 @@ function bs_column( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -727,7 +727,7 @@ function bs_list_group( $atts, $content = null ) { return sprintf( '<%1$s class="%2$s"%3$s>%4$s', ( $atts['linked'] == 'true' ) ? 'div' : 'ul', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -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 ) ); @@ -789,7 +789,7 @@ function bs_list_group_item_heading( $atts, $content = null ) { return sprintf( '

    %s

    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -815,7 +815,7 @@ function bs_list_group_item_text( $atts, $content = null ) { return sprintf( '

    %s

    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -841,7 +841,7 @@ function bs_breadcrumb( $atts, $content = null ) { return sprintf( '
      %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -870,7 +870,7 @@ function bs_breadcrumb_item( $atts, $content = null ) { return sprintf( '
  • %s
  • ', esc_url( $atts['link'] ), - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -900,7 +900,7 @@ function bs_label( $atts, $content = null ) { return sprintf( '%s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -930,7 +930,7 @@ function bs_badge( $atts, $content = null ) { return sprintf( '%s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -960,7 +960,7 @@ function bs_icon( $atts, $content = null ) { return sprintf( '%s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1074,7 +1074,7 @@ function bs_well( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1126,7 +1126,7 @@ function bs_panel( $atts, $content = null ) { return sprintf( '
    %s
    %s
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', $heading, do_shortcode( $content ), @@ -1264,7 +1264,7 @@ function bs_tab( $atts, $content = null ) { return sprintf( '
    %s
    ', sanitize_html_class($id), - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1303,7 +1303,7 @@ function bs_collapsibles( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), esc_attr($id), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) @@ -1481,7 +1481,7 @@ function bs_carousel_item( $atts, $content = null ) { return sprintf( '
    %s%s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ), ( $atts['caption'] ) ? '' : '' @@ -1580,7 +1580,7 @@ function bs_media( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1658,7 +1658,7 @@ function bs_jumbotron( $atts, $content = null ) { return sprintf( '
    %s%s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', ( $atts['title'] ) ? '

    ' . esc_html( $atts['title'] ) . '

    ' : '', do_shortcode( $content ) @@ -1713,7 +1713,7 @@ function bs_lead( $atts, $content = null ) { return sprintf( '

    %s

    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1741,7 +1741,7 @@ function bs_emphasis( $atts, $content = null ) { return sprintf( '%s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1801,7 +1801,7 @@ function bs_embed_responsive( $atts, $content = null ) { return sprintf( '
    %s
    ', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', $this->scrape_dom_element($tag, $content, $embed_class, '', '') ); @@ -1893,7 +1893,7 @@ function bs_responsive( $atts, $content = null ) { return sprintf( '%s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) ); @@ -1991,7 +1991,7 @@ function bs_modal_footer( $atts, $content = null ) { return sprintf( '
    %s', - esc_attr( $class ), + esc_attr( trim($class) ), ( $data_props ) ? ' ' . $data_props : '', do_shortcode( $content ) );