Bootstrap Shortcodes for WordPress - Version 3.3

Version Description

  • Tested to work with Bootstrap 3.3!
  • Only enqueue tooltip and popover trigger javascript if those shortcodes are in use
  • Added support for offsets, pulls, and pushes of "0" in [column]
  • Added support for Bootstrap's responsive tables in [table-wrap]
  • Better correct for conflicts with Gravity Forms --these two plugins should finally play well together
  • Fix documentation for [modal] and [responsive]
  • Removed use of extract() to better fit with WordPress's best practices.
Download this release

Release Info

Developer FoolsRun
Plugin Icon Bootstrap Shortcodes for WordPress
Version 3.3
Comparing to
See all releases

Code changes from version 3.2.4 to 3.3

README.md CHANGED
@@ -216,7 +216,7 @@ data | Data attribute and value pairs separated by a comma. Pairs separated by p
216
  * * *
217
 
218
  ### Responsive Utilities
219
- [responsive visible_block="lg md" hidden="sn xs"] ... [/responsive]
220
 
221
  #### [reponsive] parameters
222
  Parameter | Description | Required | Values | Default
@@ -229,14 +229,14 @@ inline_block | Sizes at which this element is visible and displayed as an "inlin
229
  xclass | Any extra classes you want to add | optional | any text | none
230
  data | Data attribute and value pairs separated by a comma. Pairs separated by pipe (see example at [Button Dropdowns](#button-dropdowns)). | optional | any text | none
231
 
232
- [Bootstrap emphasis classes documentation](http://getbootstrap.com/css/#type-emphasis)
233
 
234
  * * *
235
 
236
  ### Components
237
 
238
  ### Icons
239
- [icon type="arrow"]
240
 
241
  #### [icon] parameters
242
  Parameter | Description | Required | Values | Default
@@ -817,7 +817,7 @@ data | Data attribute and value pairs separated by a comma. Pairs separated by p
817
  * * *
818
 
819
  ### Modal
820
- [modal text="This is my modal" title="Modal Title Goes Here" xclass="btn btn-primary btn-large"]
821
  ...
822
  [modal-footer]
823
  [button type="primary" link="#" data="dismiss,modal"]Dismiss[/button]
216
  * * *
217
 
218
  ### Responsive Utilities
219
+ [responsive block="lg md" hidden="sn xs"] ... [/responsive]
220
 
221
  #### [reponsive] parameters
222
  Parameter | Description | Required | Values | Default
229
  xclass | Any extra classes you want to add | optional | any text | none
230
  data | Data attribute and value pairs separated by a comma. Pairs separated by pipe (see example at [Button Dropdowns](#button-dropdowns)). | optional | any text | none
231
 
232
+ [Bootstrap responsive utilities documentation](http://getbootstrap.com/css/#responsive-utilities)
233
 
234
  * * *
235
 
236
  ### Components
237
 
238
  ### Icons
239
+ [icon type="arrow-right"]
240
 
241
  #### [icon] parameters
242
  Parameter | Description | Required | Values | Default
817
  * * *
818
 
819
  ### Modal
820
+ [modal text="This is my modal" title="Modal Title Goes Here" xclass="btn btn-primary btn-lg"]
821
  ...
822
  [modal-footer]
823
  [button type="primary" link="#" data="dismiss,modal"]Dismiss[/button]
bootstrap-shortcodes.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Bootstrap 3 Shortcodes
4
  Plugin URI: http://wp-snippets.com/freebies/bootstrap-shortcodes or https://github.com/filipstefansson/bootstrap-shortcodes
5
  Description: The plugin adds a shortcodes for all Bootstrap elements.
6
- Version: 3.2.4
7
  Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
8
  Author URI:
9
  License: GPL2
@@ -134,7 +134,7 @@ class BoostrapShortcodes {
134
  *-------------------------------------------------------------------------------------*/
135
  function bs_button( $atts, $content = null ) {
136
 
137
- extract( shortcode_atts( array(
138
  "type" => false,
139
  "size" => false,
140
  "block" => false,
@@ -146,25 +146,25 @@ class BoostrapShortcodes {
146
  "xclass" => false,
147
  "title" => false,
148
  "data" => false
149
- ), $atts ) );
150
 
151
  $class = 'btn';
152
- $class .= ( $type ) ? ' btn-' . $type : ' btn-default';
153
- $class .= ( $size ) ? ' btn-' . $size : '';
154
- $class .= ( $block == 'true' ) ? ' btn-block' : '';
155
- $class .= ( $dropdown == 'true' ) ? ' dropdown-toggle' : '';
156
- $class .= ( $disabled == 'true' ) ? ' disabled' : '';
157
- $class .= ( $active == 'true' ) ? ' active' : '';
158
- $class .= ( $xclass ) ? ' ' . $xclass : '';
159
 
160
- $data_props = $this->parse_data_attributes( $data );
161
 
162
  return sprintf(
163
  '<a href="%s" class="%s"%s%s%s>%s</a>',
164
- esc_url( $link ),
165
  esc_attr( $class ),
166
- ( $target ) ? sprintf( ' target="%s"', esc_attr( $target ) ) : '',
167
- ( $title ) ? sprintf( ' title="%s"', esc_attr( $title ) ) : '',
168
  ( $data_props ) ? ' ' . $data_props : '',
169
  do_shortcode( $content )
170
  );
@@ -180,23 +180,23 @@ class BoostrapShortcodes {
180
  *-------------------------------------------------------------------------------------*/
181
  function bs_button_group( $atts, $content = null ) {
182
 
183
- extract( shortcode_atts( array(
184
  "size" => false,
185
  "vertical" => false,
186
  "justified" => false,
187
  "dropup" => false,
188
  "xclass" => false,
189
  "data" => false
190
- ), $atts ) );
191
 
192
  $class = 'btn-group';
193
- $class .= ( $size ) ? ' btn-group-' . $size : '';
194
- $class .= ( $vertical == 'true' ) ? ' btn-group-vertical' : '';
195
- $class .= ( $justified == 'true' ) ? ' btn-group-justified' : '';
196
- $class .= ( $dropup == 'true' ) ? ' dropup' : '';
197
- $class .= ( $xclass ) ? ' ' . $xclass : '';
198
 
199
- $data_props = $this->parse_data_attributes( $data );
200
 
201
  return sprintf(
202
  '<div class="%s"%s>%s</div>',
@@ -213,16 +213,16 @@ class BoostrapShortcodes {
213
  *
214
  *-------------------------------------------------------------------------------------*/
215
  function bs_button_toolbar( $atts, $content = null ) {
216
-
217
- extract( shortcode_atts( array(
218
  "xclass" => false,
219
  "data" => false
220
- ), $atts ) );
221
 
222
  $class = 'btn-toolbar';
223
- $class .= ( $xclass ) ? ' ' . $xclass : '';
224
 
225
- $data_props = $this->parse_data_attributes( $data );
226
 
227
  return sprintf(
228
  '<div class="%s"%s>%s</div>',
@@ -241,16 +241,16 @@ class BoostrapShortcodes {
241
  *
242
  *-------------------------------------------------------------------------------------*/
243
  function bs_caret( $atts, $content = null ) {
244
-
245
- extract( shortcode_atts( array(
246
  "xclass" => false,
247
  "data" => false
248
- ), $atts ) );
249
 
250
  $class = 'caret';
251
- $class .= ( $xclass ) ? ' ' . $xclass : '';
252
 
253
- $data_props = $this->parse_data_attributes( $data );
254
 
255
  return sprintf(
256
  '<span class="%s"%s>%s</span>',
@@ -269,17 +269,17 @@ class BoostrapShortcodes {
269
  *
270
  *-------------------------------------------------------------------------------------*/
271
  function bs_container( $atts, $content = null ) {
272
-
273
- extract( shortcode_atts( array(
274
  "fluid" => false,
275
  "xclass" => false,
276
  "data" => false
277
- ), $atts ) );
278
 
279
- $class = ( $fluid == 'true' ) ? 'container-fluid' : 'container';
280
- $class .= ( $xclass ) ? ' ' . $xclass : '';
281
 
282
- $data_props = $this->parse_data_attributes( $data );
283
 
284
  return sprintf(
285
  '<div class="%s"%s>%s</div>',
@@ -297,16 +297,16 @@ class BoostrapShortcodes {
297
  *
298
  *-------------------------------------------------------------------------------------*/
299
  function bs_dropdown( $atts, $content = null ) {
300
-
301
- extract( shortcode_atts( array(
302
  "xclass" => false,
303
  "data" => false
304
- ), $atts ) );
305
 
306
  $class = 'dropdown-menu';
307
- $class .= ( $xclass ) ? ' ' . $xclass : '';
308
 
309
- $data_props = $this->parse_data_attributes( $data );
310
 
311
  return sprintf(
312
  '<ul role="menu" class="%s"%s>%s</ul>',
@@ -324,26 +324,26 @@ class BoostrapShortcodes {
324
  *
325
  *-------------------------------------------------------------------------------------*/
326
  function bs_dropdown_item( $atts, $content = null ) {
327
-
328
- extract( shortcode_atts( array(
329
  "link" => false,
330
  "disabled" => false,
331
  "xclass" => false,
332
  "data" => false
333
- ), $atts ) );
334
 
335
  $li_class = '';
336
- $li_class .= ( $disabled == 'true' ) ? ' disabled' : '';
337
 
338
  $a_class = '';
339
- $a_class .= ( $xclass ) ? ' ' . $xclass : '';
340
 
341
- $data_props = $this->parse_data_attributes( $data );
342
 
343
  return sprintf(
344
  '<li role="presentation" class="%s"><a role="menuitem" href="%s" class="%s"%s>%s</a></li>',
345
  esc_attr( $li_class ),
346
- esc_url( $link ),
347
  esc_attr( $a_class ),
348
  ( $data_props ) ? ' ' . $data_props : '',
349
  do_shortcode( $content )
@@ -359,15 +359,15 @@ class BoostrapShortcodes {
359
  *-------------------------------------------------------------------------------------*/
360
  function bs_divider( $atts, $content = null ) {
361
 
362
- extract( shortcode_atts( array(
363
  "xclass" => false,
364
  "data" => false
365
- ), $atts ) );
366
 
367
  $class = 'divider';
368
- $class .= ( $xclass ) ? ' ' . $xclass : '';
369
 
370
- $data_props = $this->parse_data_attributes( $data );
371
 
372
  return sprintf(
373
  '<li class="%s"%s>%s</li>',
@@ -386,15 +386,15 @@ class BoostrapShortcodes {
386
  *-------------------------------------------------------------------------------------*/
387
  function bs_dropdown_header( $atts, $content = null ) {
388
 
389
- extract( shortcode_atts( array(
390
  "xclass" => false,
391
  "data" => false
392
- ), $atts ) );
393
 
394
  $class = 'dropdown-header';
395
- $class .= ( $xclass ) ? ' ' . $xclass : '';
396
 
397
- $data_props = $this->parse_data_attributes( $data );
398
 
399
  return sprintf(
400
  '<li class="%s"%s>%s</li>',
@@ -411,22 +411,22 @@ class BoostrapShortcodes {
411
  *
412
  *-------------------------------------------------------------------------------------*/
413
  function bs_nav( $atts, $content = null ) {
414
-
415
- extract( shortcode_atts( array(
416
  "type" => false,
417
  "stacked" => false,
418
  "justified" => false,
419
  "xclass" => false,
420
  "data" => false
421
- ), $atts ) );
422
 
423
  $class = 'nav';
424
- $class .= ( $type ) ? ' nav-' . $type : ' nav-tabs';
425
- $class .= ( $stacked == 'true' ) ? ' nav-stacked' : '';
426
- $class .= ( $justified == 'true' ) ? ' nav-justified' : '';
427
- $class .= ( $xclass ) ? ' ' . $xclass : '';
428
 
429
- $data_props = $this->parse_data_attributes( $data );
430
 
431
  return sprintf(
432
  '<ul class="%s"%s>%s</ul>',
@@ -444,25 +444,25 @@ class BoostrapShortcodes {
444
  *-------------------------------------------------------------------------------------*/
445
  function bs_nav_item( $atts, $content = null ) {
446
 
447
- extract( shortcode_atts( array(
448
  "link" => false,
449
  "active" => false,
450
  "disabled" => false,
451
  "dropdown" => false,
452
  "xclass" => false,
453
  "data" => false,
454
- ), $atts ) );
455
 
456
  $li_classes = '';
457
- $li_classes .= ( $dropdown ) ? 'dropdown' : '';
458
- $li_classes .= ( $active == 'true' ) ? ' active' : '';
459
- $li_classes .= ( $disabled == 'true' ) ? ' disabled' : '';
460
 
461
  $a_classes = '';
462
- $a_classes .= ( $dropdown == 'true' ) ? ' dropdown-toggle' : '';
463
- $a_classes .= ( $xclass ) ? ' ' . $xclass : '';
464
 
465
- $data_props = $this->parse_data_attributes( $data );
466
 
467
  # Wrong idea I guess ....
468
  #$pattern = ( $dropdown ) ? '<li%1$s><a href="%2$s"%3$s%4$s%5$s></a>%6$s</li>' : '<li%1$s><a href="%2$s"%3$s%4$s%5$s>%6$s</a></li>';
@@ -473,9 +473,9 @@ class BoostrapShortcodes {
473
  return sprintf(
474
  '<li%1$s><a href="%2$s"%3$s%4$s%5$s>%6$s</li>',
475
  ( ! empty( $li_classes ) ) ? sprintf( ' class="%s"', esc_attr( $li_classes ) ) : '',
476
- esc_url( $link ),
477
  ( ! empty( $a_classes ) ) ? sprintf( ' class="%s"', esc_attr( $a_classes ) ) : '',
478
- ( $dropdown ) ? ' data-toggle="dropdown"' : '',
479
  ( $data_props ) ? ' ' . $data_props : '',
480
  do_shortcode( $content )
481
  );
@@ -492,21 +492,21 @@ class BoostrapShortcodes {
492
  *-------------------------------------------------------------------------------------*/
493
  function bs_alert( $atts, $content = null ) {
494
 
495
- extract( shortcode_atts( array(
496
  "type" => false,
497
  "dismissable" => false,
498
  "xclass" => false,
499
  "data" => false
500
- ), $atts ) );
501
 
502
  $class = 'alert';
503
- $class .= ( $type ) ? ' alert-' . $type : ' alert-success';
504
- $class .= ( $dismissable == 'true' ) ? ' alert-dismissable' : '';
505
- $class .= ( $xclass ) ? ' ' . $xclass : '';
506
 
507
- $dismissable = ( $dismissable ) ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' : '';
508
 
509
- $data_props = $this->parse_data_attributes( $data );
510
 
511
  return sprintf(
512
  '<div class="%s"%s>%s%s</div>',
@@ -525,19 +525,19 @@ class BoostrapShortcodes {
525
  *-------------------------------------------------------------------------------------*/
526
  function bs_progress( $atts, $content = null ) {
527
 
528
- extract( shortcode_atts( array(
529
  "striped" => false,
530
  "animated" => false,
531
  "xclass" => false,
532
  "data" => false
533
- ), $atts ) );
534
 
535
  $class = 'progress';
536
- $class .= ( $striped == 'true' ) ? ' progress-striped' : '';
537
- $class .= ( $animated == 'true' ) ? ' active' : '';
538
- $class .= ( $xclass ) ? ' ' . $xclass : '';
539
 
540
- $data_props = $this->parse_data_attributes( $data );
541
 
542
  return sprintf(
543
  '<div class="%s"%s>%s</div>',
@@ -555,26 +555,26 @@ class BoostrapShortcodes {
555
  *-------------------------------------------------------------------------------------*/
556
  function bs_progress_bar( $atts, $content = null ) {
557
 
558
- extract( shortcode_atts( array(
559
  "type" => false,
560
  "percent" => false,
561
  "label" => false,
562
  "xclass" => false,
563
  "data" => false
564
- ), $atts ) );
565
 
566
  $class = 'progress-bar';
567
- $class .= ( $type ) ? ' progress-bar-' . $type : '';
568
- $class .= ( $xclass ) ? ' ' . $xclass : '';
569
 
570
- $data_props = $this->parse_data_attributes( $data );
571
 
572
  return sprintf(
573
  '<div class="%s" role="progressbar" %s%s>%s</div>',
574
  esc_attr( $class ),
575
- ( $percent ) ? ' aria-value="' . (int) $percent . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $percent . '%;"' : '',
576
  ( $data_props ) ? ' ' . $data_props : '',
577
- ( $percent ) ? sprintf('<span%s>%s</span>', ( !$label ) ? ' class="sr-only"' : '', (int) $percent . '% Complete') : ''
578
  );
579
  }
580
 
@@ -587,23 +587,23 @@ class BoostrapShortcodes {
587
  *
588
  *-------------------------------------------------------------------------------------*/
589
  function bs_code( $atts, $content = null ) {
590
-
591
- extract( shortcode_atts( array(
592
  "inline" => false,
593
  "scrollable" => false,
594
  "xclass" => false,
595
  "data" => false
596
- ), $atts ) );
597
 
598
  $class = '';
599
- $class .= ( $scrollable == 'true' ) ? ' pre-scrollable' : '';
600
- $class .= ( $xclass ) ? ' ' . $xclass : '';
601
 
602
- $data_props = $this->parse_data_attributes( $data );
603
 
604
  return sprintf(
605
  '<%1$s class="%2$s"%3$s>%4$s</%1$s>',
606
- ( $inline ) ? 'code' : 'pre',
607
  esc_attr( $class ),
608
  ( $data_props ) ? ' ' . $data_props : '',
609
  do_shortcode( $content )
@@ -619,16 +619,16 @@ class BoostrapShortcodes {
619
  *
620
  *-------------------------------------------------------------------------------------*/
621
  function bs_row( $atts, $content = null ) {
622
-
623
- extract( shortcode_atts( array(
624
  "xclass" => false,
625
  "data" => false
626
- ), $atts ) );
627
 
628
  $class = 'row';
629
- $class .= ( $xclass ) ? ' ' . $xclass : '';
630
 
631
- $data_props = $this->parse_data_attributes( $data );
632
 
633
  return sprintf(
634
  '<div class="%s"%s>%s</div>',
@@ -648,7 +648,7 @@ class BoostrapShortcodes {
648
  *-------------------------------------------------------------------------------------*/
649
  function bs_column( $atts, $content = null ) {
650
 
651
- extract( shortcode_atts( array(
652
  "lg" => false,
653
  "md" => false,
654
  "sm" => false,
@@ -667,28 +667,28 @@ class BoostrapShortcodes {
667
  "push_xs" => false,
668
  "xclass" => false,
669
  "data" => false
670
- ), $atts ) );
671
 
672
  $class = '';
673
- $class .= ( $lg ) ? ' col-lg-' . $lg : '';
674
- $class .= ( $md ) ? ' col-md-' . $md : '';
675
- $class .= ( $sm ) ? ' col-sm-' . $sm : '';
676
- $class .= ( $xs ) ? ' col-xs-' . $xs : '';
677
- $class .= ( $offset_lg ) ? ' col-lg-offset-' . $offset_lg : '';
678
- $class .= ( $offset_md ) ? ' col-md-offset-' . $offset_md : '';
679
- $class .= ( $offset_sm ) ? ' col-sm-offset-' . $offset_sm : '';
680
- $class .= ( $offset_xs ) ? ' col-xs-offset-' . $offset_xs : '';
681
- $class .= ( $pull_lg ) ? ' col-lg-pull-' . $pull_lg : '';
682
- $class .= ( $pull_md ) ? ' col-md-pull-' . $pull_md : '';
683
- $class .= ( $pull_sm ) ? ' col-sm-pull-' . $pull_sm : '';
684
- $class .= ( $pull_xs ) ? ' col-xs-pull-' . $pull_xs : '';
685
- $class .= ( $push_lg ) ? ' col-lg-push-' . $push_lg : '';
686
- $class .= ( $push_md ) ? ' col-md-push-' . $push_md : '';
687
- $class .= ( $push_sm ) ? ' col-sm-push-' . $push_sm : '';
688
- $class .= ( $push_xs ) ? ' col-xs-push-' . $push_xs : '';
689
- $class .= ( $xclass ) ? ' ' . $xclass : '';
690
-
691
- $data_props = $this->parse_data_attributes( $data );
692
 
693
  return sprintf(
694
  '<div class="%s"%s>%s</div>',
@@ -707,20 +707,20 @@ class BoostrapShortcodes {
707
  *-------------------------------------------------------------------------------------*/
708
  function bs_list_group( $atts, $content = null ) {
709
 
710
- extract( shortcode_atts( array(
711
  "linked" => false,
712
  "xclass" => false,
713
  "data" => false
714
- ), $atts ) );
715
 
716
  $class = 'list-group';
717
- $class .= ( $xclass ) ? ' ' . $xclass : '';
718
 
719
- $data_props = $this->parse_data_attributes( $data );
720
 
721
  return sprintf(
722
  '<%1$s class="%2$s"%3$s>%4$s</%1$s>',
723
- ( $linked == 'true' ) ? 'div' : 'ul',
724
  esc_attr( $class ),
725
  ( $data_props ) ? ' ' . $data_props : '',
726
  do_shortcode( $content )
@@ -736,27 +736,27 @@ class BoostrapShortcodes {
736
  *-------------------------------------------------------------------------------------*/
737
  function bs_list_group_item( $atts, $content = null ) {
738
 
739
- extract( shortcode_atts( array(
740
  "link" => false,
741
  "type" => false,
742
  "active" => false,
743
  "target" => false,
744
  "xclass" => false,
745
  "data" => false
746
- ), $atts ) );
747
 
748
  $class = 'list-group-item';
749
- $class .= ( $type ) ? ' list-group-item-' . $type : '';
750
- $class .= ( $active == 'true' ) ? ' active' : '';
751
- $class .= ( $xclass ) ? ' ' . $xclass : '';
752
 
753
- $data_props = $this->parse_data_attributes( $data );
754
 
755
  return sprintf(
756
  '<%1$s %2$s %3$s class="%4$s"%5$s>%6$s</%1$s>',
757
- ( $link ) ? 'a' : 'li',
758
- ( $link ) ? 'href="' . esc_url( $link ) . '"' : '',
759
- ( $target ) ? sprintf( ' target="%s"', esc_attr( $target ) ) : '',
760
  esc_attr( $class ),
761
  ( $data_props ) ? ' ' . $data_props : '',
762
  do_shortcode( $content )
@@ -771,15 +771,15 @@ class BoostrapShortcodes {
771
  *-------------------------------------------------------------------------------------*/
772
  function bs_list_group_item_heading( $atts, $content = null ) {
773
 
774
- extract( shortcode_atts( array(
775
  "xclass" => false,
776
  "data" => false
777
- ), $atts ) );
778
 
779
  $class = 'list-group-item-heading';
780
- $class .= ( $xclass ) ? ' ' . $xclass : '';
781
 
782
- $data_props = $this->parse_data_attributes( $data );
783
 
784
  return sprintf(
785
  '<h4 class="%s"%s>%s</h4>',
@@ -796,16 +796,16 @@ class BoostrapShortcodes {
796
  *
797
  *-------------------------------------------------------------------------------------*/
798
  function bs_list_group_item_text( $atts, $content = null ) {
799
-
800
- extract( shortcode_atts( array(
801
- "xclass" => false,
802
- "data" => false
803
- ), $atts ) );
804
 
805
  $class = 'list-group-item-text';
806
- $class .= ( $xclass ) ? ' ' . $xclass : '';
807
 
808
- $data_props = $this->parse_data_attributes( $data );
809
 
810
  return sprintf(
811
  '<p class="%s"%s>%s</p>',
@@ -823,15 +823,15 @@ class BoostrapShortcodes {
823
  *-------------------------------------------------------------------------------------*/
824
  function bs_breadcrumb( $atts, $content = null ) {
825
 
826
- extract( shortcode_atts( array(
827
  "xclass" => false,
828
  "data" => false
829
- ), $atts ) );
830
 
831
  $class = 'breadcrumb';
832
- $class .= ( $xclass ) ? ' ' . $xclass : '';
833
 
834
- $data_props = $this->parse_data_attributes( $data );
835
 
836
  return sprintf(
837
  '<ol class="%s"%s>%s</ol>',
@@ -850,20 +850,20 @@ class BoostrapShortcodes {
850
  *-------------------------------------------------------------------------------------*/
851
  function bs_breadcrumb_item( $atts, $content = null ) {
852
 
853
- extract( shortcode_atts( array(
854
  "link" => false,
855
  "xclass" => false,
856
  "data" => false
857
- ), $atts ) );
858
 
859
  $class = '';
860
- $class .= ( $xclass ) ? ' ' . $xclass : '';
861
 
862
- $data_props = $this->parse_data_attributes( $data );
863
 
864
  return sprintf(
865
  '<li><a href="%s" class="%s"%s>%s</a></li>',
866
- esc_url( $link ),
867
  esc_attr( $class ),
868
  ( $data_props ) ? ' ' . $data_props : '',
869
  do_shortcode( $content )
@@ -880,17 +880,17 @@ class BoostrapShortcodes {
880
  *-------------------------------------------------------------------------------------*/
881
  function bs_label( $atts, $content = null ) {
882
 
883
- extract( shortcode_atts( array(
884
  "type" => false,
885
  "xclass" => false,
886
  "data" => false
887
- ), $atts ) );
888
 
889
  $class = 'label';
890
- $class .= ( $type ) ? ' label-' . $type : ' label-default';
891
- $class .= ( $xclass ) ? ' ' . $xclass : '';
892
 
893
- $data_props = $this->parse_data_attributes( $data );
894
 
895
  return sprintf(
896
  '<span class="%s"%s>%s</span>',
@@ -910,17 +910,17 @@ class BoostrapShortcodes {
910
  *-------------------------------------------------------------------------------------*/
911
  function bs_badge( $atts, $content = null ) {
912
 
913
- extract( shortcode_atts( array(
914
  "right" => false,
915
  "xclass" => false,
916
  "data" => false
917
- ), $atts ) );
918
 
919
  $class = 'badge';
920
- $class .= ( $right == 'true' ) ? ' pull-right' : '';
921
- $class .= ( $xclass ) ? ' ' . $xclass : '';
922
 
923
- $data_props = $this->parse_data_attributes( $data );
924
 
925
  return sprintf(
926
  '<span class="%s"%s>%s</span>',
@@ -940,17 +940,17 @@ class BoostrapShortcodes {
940
  *-------------------------------------------------------------------------------------*/
941
  function bs_icon( $atts, $content = null ) {
942
 
943
- extract( shortcode_atts( array(
944
  "type" => false,
945
  "xclass" => false,
946
  "data" => false
947
- ), $atts ) );
948
 
949
  $class = 'glyphicon';
950
- $class .= ( $type ) ? ' glyphicon-' . $type : '';
951
- $class .= ( $xclass ) ? ' ' . $xclass : '';
952
 
953
- $data_props = $this->parse_data_attributes( $data );
954
 
955
  return sprintf(
956
  '<span class="%s"%s>%s</span>',
@@ -1012,29 +1012,31 @@ class BoostrapShortcodes {
1012
  *
1013
  *-------------------------------------------------------------------------------------*/
1014
  function bs_table_wrap( $atts, $content = null ) {
1015
- extract( shortcode_atts( array(
1016
- 'bordered' => false,
1017
- 'striped' => false,
1018
- 'hover' => false,
1019
- 'condensed' => false,
1020
- 'xclass' => false,
1021
- 'data' => false
1022
- ), $atts ) );
 
 
1023
 
1024
  $class = 'table';
1025
- $class .= ( $bordered == 'true' ) ? ' table-bordered' : '';
1026
- $class .= ( $striped == 'true' ) ? ' table-striped' : '';
1027
- $class .= ( $hover == 'true' ) ? ' table-hover' : '';
1028
- $class .= ( $condensed == 'true' ) ? ' table-condensed' : '';
1029
- $class .= ($xclass) ? ' ' . $xclass : '';
1030
 
1031
  $return = '';
1032
 
1033
  $tag = array('table');
1034
- $title = '';
1035
  $content = do_shortcode($content);
1036
 
1037
- $return .= $this->scrape_dom_element($tag, $content, $class, $title, $data);
 
1038
  return $return;
1039
  }
1040
 
@@ -1052,17 +1054,17 @@ class BoostrapShortcodes {
1052
  *-------------------------------------------------------------------------------------*/
1053
  function bs_well( $atts, $content = null ) {
1054
 
1055
- extract( shortcode_atts( array(
1056
  "size" => false,
1057
  "xclass" => false,
1058
  "data" => false
1059
- ), $atts ) );
1060
 
1061
  $class = 'well';
1062
- $class .= ( $size ) ? ' well-' . $size : '';
1063
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1064
 
1065
- $data_props = $this->parse_data_attributes( $data );
1066
 
1067
  return sprintf(
1068
  '<div class="%s"%s>%s</div>',
@@ -1082,34 +1084,34 @@ class BoostrapShortcodes {
1082
  *-------------------------------------------------------------------------------------*/
1083
  function bs_panel( $atts, $content = null ) {
1084
 
1085
- extract( shortcode_atts( array(
1086
  "title" => false,
1087
  "heading" => false,
1088
  "type" => false,
1089
  "footer" => false,
1090
  "xclass" => false,
1091
  "data" => false
1092
- ), $atts ) );
1093
 
1094
  $class = 'panel';
1095
- $class .= ( $type ) ? ' panel-' . $type : ' panel-default';
1096
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1097
 
1098
- if( ! $heading && $title ) {
1099
- $heading = $title;
1100
- $title = true;
1101
  }
1102
 
1103
- $data_props = $this->parse_data_attributes( $data );
1104
 
1105
- $footer = ( $footer ) ? '<div class="panel-footer">' . $footer . '</div>' : '';
1106
 
1107
- if ( $heading ) {
1108
  $heading = sprintf(
1109
  '<div class="panel-heading">%s%s%s</div>',
1110
- ( $title ) ? '<h3 class="panel-title">' : '',
1111
- esc_html( $heading ),
1112
- ( $title ) ? '</h3>' : ''
1113
  );
1114
  }
1115
  else {
@@ -1143,22 +1145,22 @@ class BoostrapShortcodes {
1143
  $GLOBALS['tabs_count'] = 0;
1144
 
1145
  $GLOBALS['tabs_default_count'] = 0;
1146
-
1147
- extract( shortcode_atts( array(
1148
  "type" => false,
1149
  "xclass" => false,
1150
  "data" => false
1151
- ), $atts ) );
1152
 
1153
  $ul_class = 'nav';
1154
- $ul_class .= ( $type ) ? ' nav-' . $type : ' nav-tabs';
1155
- $ul_class .= ( $xclass ) ? ' ' . $xclass : '';
1156
 
1157
  $div_class = 'tab-content';
1158
 
1159
  $id = 'custom-tabs-'. $GLOBALS['tabs_count'];
1160
 
1161
- $data_props = $this->parse_data_attributes( $data );
1162
 
1163
  $atts_map = bs_attribute_map( $content );
1164
 
@@ -1203,13 +1205,13 @@ class BoostrapShortcodes {
1203
  *-------------------------------------------------------------------------------------*/
1204
  function bs_tab( $atts, $content = null ) {
1205
 
1206
- extract( shortcode_atts( array(
1207
  'title' => false,
1208
  'active' => false,
1209
  'fade' => false,
1210
  'xclass' => false,
1211
  'data' => false
1212
- ), $atts ) );
1213
 
1214
  if( $GLOBALS['tabs_default_active'] && $GLOBALS['tabs_default_count'] == 0 ) {
1215
  $active = true;
@@ -1217,13 +1219,13 @@ class BoostrapShortcodes {
1217
  $GLOBALS['tabs_default_count']++;
1218
 
1219
  $class = 'tab-pane';
1220
- $class .= ( $fade == 'true' ) ? ' fade' : '';
1221
- $class .= ( $active == 'true' ) ? ' active' : '';
1222
- $class .= ( $active == 'true' && $fade == 'true' ) ? ' in' : '';
1223
 
1224
- $id = 'custom-tab-'. $GLOBALS['tabs_count'] . '-'. sanitize_title( $title );
1225
 
1226
- $data_props = $this->parse_data_attributes( $data );
1227
 
1228
  return sprintf(
1229
  '<div id="%s" class="%s"%s>%s</div>',
@@ -1253,17 +1255,17 @@ class BoostrapShortcodes {
1253
  else
1254
  $GLOBALS['collapsibles_count'] = 0;
1255
 
1256
- extract( shortcode_atts( array(
1257
  "xclass" => false,
1258
  "data" => false
1259
- ), $atts ) );
1260
 
1261
  $class = 'panel-group';
1262
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1263
 
1264
  $id = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1265
 
1266
- $data_props = $this->parse_data_attributes( $data );
1267
 
1268
  return sprintf(
1269
  '<div class="%s" id="%s"%s>%s</div>',
@@ -1286,25 +1288,25 @@ class BoostrapShortcodes {
1286
  *-------------------------------------------------------------------------------------*/
1287
  function bs_collapse( $atts, $content = null ) {
1288
 
1289
- extract( shortcode_atts( array(
1290
  "title" => false,
1291
  "type" => false,
1292
  "active" => false,
1293
  "xclass" => false,
1294
  "data" => false
1295
- ), $atts ) );
1296
 
1297
  $panel_class = 'panel';
1298
- $panel_class .= ( $type ) ? ' panel-' . $type : ' panel-default';
1299
- $panel_class .= ( $xclass ) ? ' ' . $xclass : '';
1300
 
1301
  $collapse_class = 'panel-collapse';
1302
- $collapse_class .= ( $active == 'true' ) ? ' in' : ' collapse';
1303
 
1304
  $parent = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1305
- $current_collapse = $parent . '-'. sanitize_title( $title );
1306
 
1307
- $data_props = $this->parse_data_attributes( $data );
1308
 
1309
  return sprintf(
1310
  '<div class="%1$s"%2$s>
@@ -1321,7 +1323,7 @@ class BoostrapShortcodes {
1321
  ( $data_props ) ? ' ' . $data_props : '',
1322
  $parent,
1323
  $current_collapse,
1324
- $title,
1325
  esc_attr( $collapse_class ),
1326
  do_shortcode( $content )
1327
  );
@@ -1344,22 +1346,22 @@ class BoostrapShortcodes {
1344
 
1345
  $GLOBALS['carousel_default_count'] = 0;
1346
 
1347
- extract( shortcode_atts( array(
1348
  "interval" => false,
1349
  "pause" => false,
1350
  "wrap" => false,
1351
  "xclass" => false,
1352
  "data" => false,
1353
- ), $atts ) );
1354
 
1355
  $div_class = 'carousel slide';
1356
- $div_class .= ( $xclass ) ? ' ' . $xclass : '';
1357
 
1358
  $inner_class = 'carousel-inner';
1359
 
1360
  $id = 'custom-carousel-'. $GLOBALS['carousel_count'];
1361
 
1362
- $data_props = $this->parse_data_attributes( $data );
1363
 
1364
  $atts_map = bs_attribute_map( $content );
1365
 
@@ -1387,9 +1389,9 @@ class BoostrapShortcodes {
1387
  '<div class="%s" id="%s" data-ride="carousel"%s%s%s%s>%s<div class="%s">%s</div>%s%s</div>',
1388
  esc_attr( $div_class ),
1389
  esc_attr( $id ),
1390
- ( $interval ) ? sprintf( ' data-interval="%d"', $interval ) : '',
1391
- ( $pause ) ? sprintf( ' data-pause="%s"', esc_attr( $pause ) ) : '',
1392
- ( $wrap == 'true' ) ? sprintf( ' data-wrap="%s"', esc_attr( $wrap ) ) : '',
1393
  ( $data_props ) ? ' ' . $data_props : '',
1394
  ( $indicators ) ? '<ol class="carousel-indicators">' . implode( $indicators ) . '</ol>' : '',
1395
  esc_attr( $inner_class ),
@@ -1409,13 +1411,13 @@ class BoostrapShortcodes {
1409
  *
1410
  *-------------------------------------------------------------------------------------*/
1411
  function bs_carousel_item( $atts, $content = null ) {
1412
-
1413
- extract( shortcode_atts( array(
1414
  "active" => false,
1415
  "caption" => false,
1416
  "xclass" => false,
1417
  "data" => false
1418
- ), $atts ) );
1419
 
1420
  if( $GLOBALS['carousel_default_active'] && $GLOBALS['carousel_default_count'] == 0 ) {
1421
  $active = true;
@@ -1423,10 +1425,10 @@ class BoostrapShortcodes {
1423
  $GLOBALS['carousel_default_count']++;
1424
 
1425
  $class = 'item';
1426
- $class .= ( $active == 'true' ) ? ' active' : '';
1427
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1428
 
1429
- $data_props = $this->parse_data_attributes( $data );
1430
 
1431
  $content = preg_replace('/class=".*?"/', '', $content);
1432
 
@@ -1435,7 +1437,7 @@ class BoostrapShortcodes {
1435
  esc_attr( $class ),
1436
  ( $data_props ) ? ' ' . $data_props : '',
1437
  do_shortcode( $content ),
1438
- ( $caption ) ? '<div class="carousel-caption">' . esc_html( $caption ) . '</div>' : ''
1439
  );
1440
  }
1441
 
@@ -1451,25 +1453,24 @@ class BoostrapShortcodes {
1451
 
1452
  function bs_tooltip( $atts, $content = null ) {
1453
 
1454
- $defaults = array(
1455
  'title' => '',
1456
  'placement' => 'top',
1457
  'animation' => 'true',
1458
  'html' => 'false',
1459
  'data' => ''
1460
- );
1461
- extract( shortcode_atts( $defaults, $atts ) );
1462
 
1463
  $class = 'bs-tooltip';
1464
 
1465
- $data .= ( $animation ) ? $this->check_for_data($data) . 'animation,' . $animation : '';
1466
- $data .= ( $placement ) ? $this->check_for_data($data) . 'placement,' . $placement : '';
1467
- $data .= ( $html ) ? $this->check_for_data($data) . 'html,' . $html : '';
1468
 
1469
  $return = '';
1470
  $tag = 'span';
1471
  $content = do_shortcode($content);
1472
- $return .= $this->get_dom_element($tag, $content, $class, $title, $data);
1473
  return $return;
1474
 
1475
  }
@@ -1483,28 +1484,27 @@ function bs_tooltip( $atts, $content = null ) {
1483
 
1484
  function bs_popover( $atts, $content = null ) {
1485
 
1486
- $defaults = array(
1487
  'title' => false,
1488
  'text' => '',
1489
  'placement' => 'top',
1490
  'animation' => 'true',
1491
  'html' => 'false',
1492
  'data' => ''
1493
- );
1494
- extract( shortcode_atts( $defaults, $atts ) );
1495
 
1496
  $class = 'bs-popover';
1497
 
1498
- $data .= $this->check_for_data($data) . 'toggle,popover';
1499
- $data .= $this->check_for_data($data) . 'content,' . $text;
1500
- $data .= ( $animation ) ? $this->check_for_data($data) . 'animation,' . $animation : '';
1501
- $data .= ( $placement ) ? $this->check_for_data($data) . 'placement,' . $placement : '';
1502
- $data .= ( $html ) ? $this->check_for_data($data) . 'html,' . $html : '';
1503
 
1504
  $return = '';
1505
  $tag = 'span';
1506
  $content = do_shortcode($content);
1507
- $return .= $this->get_dom_element($tag, $content, $class, $title, $data);
1508
  return $return;
1509
 
1510
  }
@@ -1521,15 +1521,15 @@ function bs_popover( $atts, $content = null ) {
1521
 
1522
  function bs_media( $atts, $content = null ) {
1523
 
1524
- extract( shortcode_atts( array(
1525
  "xclass" => false,
1526
  "data" => false
1527
- ), $atts ) );
1528
 
1529
  $class = 'media';
1530
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1531
 
1532
- $data_props = $this->parse_data_attributes( $data );
1533
 
1534
  return sprintf(
1535
  '<div class="%s"%s>%s</div>',
@@ -1541,38 +1541,37 @@ function bs_popover( $atts, $content = null ) {
1541
 
1542
  function bs_media_object( $atts, $content = null ) {
1543
 
1544
- extract( shortcode_atts( array(
1545
  "pull" => "left",
1546
  "xclass" => false,
1547
  "data" => false
1548
- ), $atts ) );
1549
 
1550
  $class = "media-object img-responsive";
1551
- $class .= ($xclass) ? ' ' . $xclass : '';
1552
 
1553
  $return = '';
1554
 
1555
  $tag = array('figure', 'div', 'img', 'i', 'span');
1556
- $title = '';
1557
  $content = do_shortcode(preg_replace('/(<br>)+$/', '', $content));
1558
- $return .= $this->scrape_dom_element($tag, $content, $class, $title, $data);
1559
- $return = '<span class="pull-' . esc_attr($pull) . '">' . $return . '</span>';
1560
  return $return;
1561
  }
1562
 
1563
  function bs_media_body( $atts, $content = null ) {
1564
 
1565
- extract( shortcode_atts( array(
1566
  "title" => false,
1567
  "xclass" => false,
1568
  "data" => false
1569
- ), $atts ) );
1570
 
1571
  $div_class = 'media-body';
1572
- $div_class .= ( $xclass ) ? ' ' . $xclass : '';
1573
 
1574
  $h4_class = 'media-heading';
1575
- $h4_class .= ( $xclass ) ? ' ' . $xclass : '';
1576
 
1577
  $data_props = $this->parse_data_attributes( $data );
1578
 
@@ -1581,7 +1580,7 @@ function bs_popover( $atts, $content = null ) {
1581
  esc_attr( $div_class ),
1582
  ( $data_props ) ? ' ' . $data_props : '',
1583
  esc_attr( $h4_class ),
1584
- esc_html( $title),
1585
  do_shortcode( $content )
1586
  );
1587
  }
@@ -1593,23 +1592,23 @@ function bs_popover( $atts, $content = null ) {
1593
  *
1594
  *-------------------------------------------------------------------------------------*/
1595
  function bs_jumbotron( $atts, $content = null ) {
1596
-
1597
- extract( shortcode_atts( array(
1598
  "title" => false,
1599
  "xclass" => false,
1600
  "data" => false
1601
- ), $atts ) );
1602
 
1603
  $class = 'jumbotron';
1604
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1605
 
1606
- $data_props = $this->parse_data_attributes( $data );
1607
 
1608
  return sprintf(
1609
  '<div class="%s"%s>%s%s</div>',
1610
  esc_attr( $class ),
1611
  ( $data_props ) ? ' ' . $data_props : '',
1612
- ( $title ) ? '<h1>' . esc_html( $title ) . '</h1>' : '',
1613
  do_shortcode( $content )
1614
  );
1615
  }
@@ -1621,21 +1620,23 @@ function bs_popover( $atts, $content = null ) {
1621
  *
1622
  *-------------------------------------------------------------------------------------*/
1623
  function bs_page_header( $atts, $content = null ) {
1624
- extract( shortcode_atts( array(
 
1625
  "xclass" => false,
1626
  "data" => false
1627
- ), $atts ) );
1628
- $data_props = $this->parse_data_attributes( $data );
 
1629
 
1630
  $class = "page-header";
1631
- $class .= ($xclass) ? ' ' . $xclass : '';
1632
 
1633
  $return = '';
1634
  $title = '';
1635
  $tag = 'div';
1636
  $content = $this->strip_paragraph($content);
1637
  $content = $this->nest_dom_element('h1', 'div', $content);
1638
- $return .= $this->get_dom_element($tag, $content, $class, $title, $data);
1639
  return $return;
1640
 
1641
  }
@@ -1647,15 +1648,16 @@ function bs_popover( $atts, $content = null ) {
1647
  *
1648
  *-------------------------------------------------------------------------------------*/
1649
  function bs_lead( $atts, $content = null ) {
1650
- extract( shortcode_atts( array(
 
1651
  "xclass" => false,
1652
  "data" => false
1653
- ), $atts ) );
1654
 
1655
  $class = 'lead';
1656
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1657
 
1658
- $data_props = $this->parse_data_attributes( $data );
1659
 
1660
  return sprintf(
1661
  '<p class="%s"%s>%s</p>',
@@ -1672,18 +1674,18 @@ function bs_popover( $atts, $content = null ) {
1672
  *
1673
  *-------------------------------------------------------------------------------------*/
1674
  function bs_emphasis( $atts, $content = null ) {
1675
-
1676
- extract( shortcode_atts( array(
1677
  "type" => false,
1678
  "xclass" => false,
1679
  "data" => false
1680
- ), $atts ) );
1681
 
1682
  $class = '';
1683
- $class .= ( $type ) ? 'text-' . $type : 'text-muted';
1684
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1685
 
1686
- $data_props = $this->parse_data_attributes( $data );
1687
 
1688
  return sprintf(
1689
  '<span class="%s"%s>%s</span>',
@@ -1700,21 +1702,22 @@ function bs_popover( $atts, $content = null ) {
1700
  *
1701
  *-------------------------------------------------------------------------------------*/
1702
  function bs_img( $atts, $content = null ) {
1703
- extract( shortcode_atts( array(
 
1704
  "type" => false,
1705
  "responsive" => false,
1706
  "xclass" => false,
1707
  "data" => false
1708
- ), $atts ) );
1709
 
1710
- $class .= ( $type ) ? 'img-' . $type . ' ' : '';
1711
- $class .= ( $responsive == 'true' ) ? ' img-responsive' : '';
1712
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1713
 
1714
  $return = '';
1715
  $tag = array('img');
1716
  $content = do_shortcode($content);
1717
- $return .= $this->scrape_dom_element($tag, $content, $class, $title, $data);
1718
  return $return;
1719
 
1720
  }
@@ -1726,24 +1729,25 @@ function bs_popover( $atts, $content = null ) {
1726
  *
1727
  *-------------------------------------------------------------------------------------*/
1728
  function bs_thumbnail( $atts, $content = null ) {
1729
- extract( shortcode_atts( array(
 
1730
  "xclass" => false,
1731
  "has_content" => false,
1732
  "data" => false
1733
- ), $atts ) );
1734
 
1735
  $class = "thumbnail";
1736
- $class .= ($xclass) ? ' ' . $xclass : '';
1737
 
1738
  $return = '';
1739
- if($has_content) {
1740
  $content = '<div>' . $content . '</div>';
1741
  $tag = array('div');
1742
  } else {
1743
  $tag = array('a', 'img');
1744
  }
1745
  $content = do_shortcode($content);
1746
- $return .= $this->scrape_dom_element($tag, $content, $class, $title, $data);
1747
  return $return;
1748
 
1749
  }
@@ -1756,7 +1760,7 @@ function bs_popover( $atts, $content = null ) {
1756
  *-------------------------------------------------------------------------------------*/
1757
  function bs_responsive( $atts, $content = null ) {
1758
 
1759
- extract( shortcode_atts( array(
1760
  "visible" => false,
1761
  "hidden" => false,
1762
  "block" => false,
@@ -1764,42 +1768,42 @@ function bs_popover( $atts, $content = null ) {
1764
  "inline_block" => false,
1765
  "xclass" => false,
1766
  "data" => false
1767
- ), $atts ) );
1768
 
1769
  $class = '';
1770
- if( $visible ) {
1771
- $visible = explode( ' ', $visible );
1772
  foreach($visible as $v):
1773
  $class .= "visible-$v ";
1774
  endforeach;
1775
  }
1776
- if( $hidden ) {
1777
- $hidden = explode( ' ', $hidden );
1778
  foreach( $hidden as $h ):
1779
  $class .= "hidden-$h ";
1780
  endforeach;
1781
  }
1782
- if( $block ) {
1783
- $block = explode( ' ', $block );
1784
  foreach( $block as $b ):
1785
  $class .= "visible-$b-block ";
1786
  endforeach;
1787
  }
1788
- if( $inline ) {
1789
- $inline = explode( ' ', $inline );
1790
  foreach( $inline as $i ):
1791
  $class .= "visible-$i-inline ";
1792
  endforeach;
1793
  }
1794
- if( $inline_block ) {
1795
- $inline_block = explode( ' ', $inline_block );
1796
  foreach( $inline_block as $ib ):
1797
  $class .= "visible-$ib-inline ";
1798
  endforeach;
1799
  }
1800
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1801
 
1802
- $data_props = $this->parse_data_attributes( $data );
1803
 
1804
  return sprintf(
1805
  '<span class="%s"%s>%s</span>',
@@ -1819,23 +1823,23 @@ function bs_popover( $atts, $content = null ) {
1819
  *-------------------------------------------------------------------------------------*/
1820
  function bs_modal( $atts, $content = null ) {
1821
 
1822
- extract( shortcode_atts( array(
1823
  "text" => false,
1824
  "title" => false,
1825
  "size" => false,
1826
  "xclass" => false,
1827
  "data" => false
1828
- ), $atts ) );
1829
 
1830
  $a_class = '';
1831
- $a_class .= ( $xclass ) ? ' ' . $xclass : '';
1832
 
1833
  $div_class = 'modal fade';
1834
- $div_class .= ( $size ) ? ' bs-modal-' . $size : '';
1835
 
1836
- $id = 'custom-modal-' . sanitize_title( $title );
1837
 
1838
- $data_props = $this->parse_data_attributes( $data );
1839
 
1840
  return sprintf(
1841
  '<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>
@@ -1856,9 +1860,9 @@ function bs_popover( $atts, $content = null ) {
1856
  esc_attr( $id ),
1857
  esc_attr( $a_class ),
1858
  ( $data_props ) ? ' ' . $data_props : '',
1859
- esc_html( $text ),
1860
  esc_attr( $div_class ),
1861
- ( $title ) ? '<h4 class="modal-title">' . $title . '</h4>' : '',
1862
  do_shortcode( $content )
1863
  );
1864
  }
@@ -1873,15 +1877,15 @@ function bs_popover( $atts, $content = null ) {
1873
  *-------------------------------------------------------------------------------------*/
1874
  function bs_modal_footer( $atts, $content = null ) {
1875
 
1876
- extract( shortcode_atts( array(
1877
  "xclass" => false,
1878
  "data" => false,
1879
- ), $atts ) );
1880
 
1881
  $class = 'modal-footer';
1882
- $class .= ( $xclass ) ? ' ' . $xclass : '';
1883
 
1884
- $data_props = $this->parse_data_attributes( $data );
1885
 
1886
  return sprintf(
1887
  '<div class="%s"%s>%s</div>',
@@ -1919,7 +1923,7 @@ function bs_popover( $atts, $content = null ) {
1919
  * get DOMDocument element and apply shortcode parameters to it. Create the element if it doesn't exist
1920
  *
1921
  *-------------------------------------------------------------------------------------*/
1922
- function get_dom_element( $tag, $content, $class, $title, $data = null ) {
1923
 
1924
  //clean up content
1925
  $content = trim(trim($content), chr(0xC2).chr(0xA0));
@@ -1955,7 +1959,7 @@ function bs_popover( $atts, $content = null ) {
1955
  * Scrape the shortcode's contents for a particular DOMDocument tag or tags, pull them out, apply attributes, and return just the tags.
1956
  *
1957
  *-------------------------------------------------------------------------------------*/
1958
- function scrape_dom_element( $tag, $content, $class, $title, $data = null ) {
1959
 
1960
  $previous_value = libxml_use_internal_errors(TRUE);
1961
 
@@ -2053,3 +2057,4 @@ function bs_popover( $atts, $content = null ) {
2053
  }
2054
 
2055
  new BoostrapShortcodes();
 
3
  Plugin Name: Bootstrap 3 Shortcodes
4
  Plugin URI: http://wp-snippets.com/freebies/bootstrap-shortcodes or https://github.com/filipstefansson/bootstrap-shortcodes
5
  Description: The plugin adds a shortcodes for all Bootstrap elements.
6
+ Version: 3.3
7
  Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
8
  Author URI:
9
  License: GPL2
134
  *-------------------------------------------------------------------------------------*/
135
  function bs_button( $atts, $content = null ) {
136
 
137
+ $atts = shortcode_atts( array(
138
  "type" => false,
139
  "size" => false,
140
  "block" => false,
146
  "xclass" => false,
147
  "title" => false,
148
  "data" => false
149
+ ), $atts );
150
 
151
  $class = 'btn';
152
+ $class .= ( $atts['type'] ) ? ' btn-' . $atts['type'] : ' btn-default';
153
+ $class .= ( $atts['size'] ) ? ' btn-' . $atts['size'] : '';
154
+ $class .= ( $atts['block'] == 'true' ) ? ' btn-block' : '';
155
+ $class .= ( $atts['dropdown'] == 'true' ) ? ' dropdown-toggle' : '';
156
+ $class .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
157
+ $class .= ( $atts['active'] == 'true' ) ? ' active' : '';
158
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
159
 
160
+ $data_props = $this->parse_data_attributes( $atts['data'] );
161
 
162
  return sprintf(
163
  '<a href="%s" class="%s"%s%s%s>%s</a>',
164
+ esc_url( $atts['link'] ),
165
  esc_attr( $class ),
166
+ ( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
167
+ ( $atts['title'] ) ? sprintf( ' title="%s"', esc_attr( $atts['title'] ) ) : '',
168
  ( $data_props ) ? ' ' . $data_props : '',
169
  do_shortcode( $content )
170
  );
180
  *-------------------------------------------------------------------------------------*/
181
  function bs_button_group( $atts, $content = null ) {
182
 
183
+ $atts = shortcode_atts( array(
184
  "size" => false,
185
  "vertical" => false,
186
  "justified" => false,
187
  "dropup" => false,
188
  "xclass" => false,
189
  "data" => false
190
+ ), $atts );
191
 
192
  $class = 'btn-group';
193
+ $class .= ( $atts['size'] ) ? ' btn-group-' . $atts['size'] : '';
194
+ $class .= ( $atts['vertical'] == 'true' ) ? ' btn-group-vertical' : '';
195
+ $class .= ( $atts['justified'] == 'true' ) ? ' btn-group-justified' : '';
196
+ $class .= ( $atts['dropup'] == 'true' ) ? ' dropup' : '';
197
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
198
 
199
+ $data_props = $this->parse_data_attributes( $atts['data'] );
200
 
201
  return sprintf(
202
  '<div class="%s"%s>%s</div>',
213
  *
214
  *-------------------------------------------------------------------------------------*/
215
  function bs_button_toolbar( $atts, $content = null ) {
216
+
217
+ $atts = shortcode_atts( array(
218
  "xclass" => false,
219
  "data" => false
220
+ ), $atts );
221
 
222
  $class = 'btn-toolbar';
223
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
224
 
225
+ $data_props = $this->parse_data_attributes( $atts['data'] );
226
 
227
  return sprintf(
228
  '<div class="%s"%s>%s</div>',
241
  *
242
  *-------------------------------------------------------------------------------------*/
243
  function bs_caret( $atts, $content = null ) {
244
+
245
+ $atts = shortcode_atts( array(
246
  "xclass" => false,
247
  "data" => false
248
+ ), $atts );
249
 
250
  $class = 'caret';
251
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
252
 
253
+ $data_props = $this->parse_data_attributes( $atts['data'] );
254
 
255
  return sprintf(
256
  '<span class="%s"%s>%s</span>',
269
  *
270
  *-------------------------------------------------------------------------------------*/
271
  function bs_container( $atts, $content = null ) {
272
+
273
+ $atts = shortcode_atts( array(
274
  "fluid" => false,
275
  "xclass" => false,
276
  "data" => false
277
+ ), $atts );
278
 
279
+ $class = ( $atts['fluid'] == 'true' ) ? 'container-fluid' : 'container';
280
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
281
 
282
+ $data_props = $this->parse_data_attributes( $atts['data'] );
283
 
284
  return sprintf(
285
  '<div class="%s"%s>%s</div>',
297
  *
298
  *-------------------------------------------------------------------------------------*/
299
  function bs_dropdown( $atts, $content = null ) {
300
+
301
+ $atts = shortcode_atts( array(
302
  "xclass" => false,
303
  "data" => false
304
+ ), $atts );
305
 
306
  $class = 'dropdown-menu';
307
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
308
 
309
+ $data_props = $this->parse_data_attributes( $atts['data'] );
310
 
311
  return sprintf(
312
  '<ul role="menu" class="%s"%s>%s</ul>',
324
  *
325
  *-------------------------------------------------------------------------------------*/
326
  function bs_dropdown_item( $atts, $content = null ) {
327
+
328
+ $atts = shortcode_atts( array(
329
  "link" => false,
330
  "disabled" => false,
331
  "xclass" => false,
332
  "data" => false
333
+ ), $atts );
334
 
335
  $li_class = '';
336
+ $li_class .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
337
 
338
  $a_class = '';
339
+ $a_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
340
 
341
+ $data_props = $this->parse_data_attributes( $atts['data'] );
342
 
343
  return sprintf(
344
  '<li role="presentation" class="%s"><a role="menuitem" href="%s" class="%s"%s>%s</a></li>',
345
  esc_attr( $li_class ),
346
+ esc_url( $atts['link'] ),
347
  esc_attr( $a_class ),
348
  ( $data_props ) ? ' ' . $data_props : '',
349
  do_shortcode( $content )
359
  *-------------------------------------------------------------------------------------*/
360
  function bs_divider( $atts, $content = null ) {
361
 
362
+ $atts = shortcode_atts( array(
363
  "xclass" => false,
364
  "data" => false
365
+ ), $atts );
366
 
367
  $class = 'divider';
368
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
369
 
370
+ $data_props = $this->parse_data_attributes( $atts['data'] );
371
 
372
  return sprintf(
373
  '<li class="%s"%s>%s</li>',
386
  *-------------------------------------------------------------------------------------*/
387
  function bs_dropdown_header( $atts, $content = null ) {
388
 
389
+ $atts = shortcode_atts( array(
390
  "xclass" => false,
391
  "data" => false
392
+ ), $atts );
393
 
394
  $class = 'dropdown-header';
395
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
396
 
397
+ $data_props = $this->parse_data_attributes( $atts['data'] );
398
 
399
  return sprintf(
400
  '<li class="%s"%s>%s</li>',
411
  *
412
  *-------------------------------------------------------------------------------------*/
413
  function bs_nav( $atts, $content = null ) {
414
+
415
+ $atts = shortcode_atts( array(
416
  "type" => false,
417
  "stacked" => false,
418
  "justified" => false,
419
  "xclass" => false,
420
  "data" => false
421
+ ), $atts );
422
 
423
  $class = 'nav';
424
+ $class .= ( $atts['type'] ) ? ' nav-' . $atts['type'] : ' nav-tabs';
425
+ $class .= ( $atts['stacked'] == 'true' ) ? ' nav-stacked' : '';
426
+ $class .= ( $atts['justified'] == 'true' ) ? ' nav-justified' : '';
427
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
428
 
429
+ $data_props = $this->parse_data_attributes( $atts['data'] );
430
 
431
  return sprintf(
432
  '<ul class="%s"%s>%s</ul>',
444
  *-------------------------------------------------------------------------------------*/
445
  function bs_nav_item( $atts, $content = null ) {
446
 
447
+ $atts = shortcode_atts( array(
448
  "link" => false,
449
  "active" => false,
450
  "disabled" => false,
451
  "dropdown" => false,
452
  "xclass" => false,
453
  "data" => false,
454
+ ), $atts );
455
 
456
  $li_classes = '';
457
+ $li_classes .= ( $atts['dropdown'] ) ? 'dropdown' : '';
458
+ $li_classes .= ( $atts['active'] == 'true' ) ? ' active' : '';
459
+ $li_classes .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
460
 
461
  $a_classes = '';
462
+ $a_classes .= ( $atts['dropdown'] == 'true' ) ? ' dropdown-toggle' : '';
463
+ $a_classes .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
464
 
465
+ $data_props = $this->parse_data_attributes( $atts['data'] );
466
 
467
  # Wrong idea I guess ....
468
  #$pattern = ( $dropdown ) ? '<li%1$s><a href="%2$s"%3$s%4$s%5$s></a>%6$s</li>' : '<li%1$s><a href="%2$s"%3$s%4$s%5$s>%6$s</a></li>';
473
  return sprintf(
474
  '<li%1$s><a href="%2$s"%3$s%4$s%5$s>%6$s</li>',
475
  ( ! empty( $li_classes ) ) ? sprintf( ' class="%s"', esc_attr( $li_classes ) ) : '',
476
+ esc_url( $atts['link'] ),
477
  ( ! empty( $a_classes ) ) ? sprintf( ' class="%s"', esc_attr( $a_classes ) ) : '',
478
+ ( $atts['dropdown'] ) ? ' data-toggle="dropdown"' : '',
479
  ( $data_props ) ? ' ' . $data_props : '',
480
  do_shortcode( $content )
481
  );
492
  *-------------------------------------------------------------------------------------*/
493
  function bs_alert( $atts, $content = null ) {
494
 
495
+ $atts = shortcode_atts( array(
496
  "type" => false,
497
  "dismissable" => false,
498
  "xclass" => false,
499
  "data" => false
500
+ ), $atts );
501
 
502
  $class = 'alert';
503
+ $class .= ( $atts['type'] ) ? ' alert-' . $atts['type'] : ' alert-success';
504
+ $class .= ( $atts['dismissable'] == 'true' ) ? ' alert-dismissable' : '';
505
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
506
 
507
+ $dismissable = ( $atts['dismissable'] ) ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' : '';
508
 
509
+ $data_props = $this->parse_data_attributes( $atts['data'] );
510
 
511
  return sprintf(
512
  '<div class="%s"%s>%s%s</div>',
525
  *-------------------------------------------------------------------------------------*/
526
  function bs_progress( $atts, $content = null ) {
527
 
528
+ $atts = shortcode_atts( array(
529
  "striped" => false,
530
  "animated" => false,
531
  "xclass" => false,
532
  "data" => false
533
+ ), $atts );
534
 
535
  $class = 'progress';
536
+ $class .= ( $atts['striped'] == 'true' ) ? ' progress-striped' : '';
537
+ $class .= ( $atts['animated'] == 'true' ) ? ' active' : '';
538
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
539
 
540
+ $data_props = $this->parse_data_attributes( $atts['data'] );
541
 
542
  return sprintf(
543
  '<div class="%s"%s>%s</div>',
555
  *-------------------------------------------------------------------------------------*/
556
  function bs_progress_bar( $atts, $content = null ) {
557
 
558
+ $atts = shortcode_atts( array(
559
  "type" => false,
560
  "percent" => false,
561
  "label" => false,
562
  "xclass" => false,
563
  "data" => false
564
+ ), $atts );
565
 
566
  $class = 'progress-bar';
567
+ $class .= ( $atts['type'] ) ? ' progress-bar-' . $atts['type'] : '';
568
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
569
 
570
+ $data_props = $this->parse_data_attributes( $atts['data'] );
571
 
572
  return sprintf(
573
  '<div class="%s" role="progressbar" %s%s>%s</div>',
574
  esc_attr( $class ),
575
+ ( $atts['percent'] ) ? ' aria-value="' . (int) $atts['percent'] . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $atts['percent'] . '%;"' : '',
576
  ( $data_props ) ? ' ' . $data_props : '',
577
+ ( $atts['percent'] ) ? sprintf('<span%s>%s</span>', ( !$atts['label'] ) ? ' class="sr-only"' : '', (int) $atts['percent'] . '% Complete') : ''
578
  );
579
  }
580
 
587
  *
588
  *-------------------------------------------------------------------------------------*/
589
  function bs_code( $atts, $content = null ) {
590
+
591
+ $atts = shortcode_atts( array(
592
  "inline" => false,
593
  "scrollable" => false,
594
  "xclass" => false,
595
  "data" => false
596
+ ), $atts );
597
 
598
  $class = '';
599
+ $class .= ( $atts['scrollable'] == 'true' ) ? ' pre-scrollable' : '';
600
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
601
 
602
+ $data_props = $this->parse_data_attributes( $atts['data'] );
603
 
604
  return sprintf(
605
  '<%1$s class="%2$s"%3$s>%4$s</%1$s>',
606
+ ( $atts['inline'] ) ? 'code' : 'pre',
607
  esc_attr( $class ),
608
  ( $data_props ) ? ' ' . $data_props : '',
609
  do_shortcode( $content )
619
  *
620
  *-------------------------------------------------------------------------------------*/
621
  function bs_row( $atts, $content = null ) {
622
+
623
+ $atts = shortcode_atts( array(
624
  "xclass" => false,
625
  "data" => false
626
+ ), $atts );
627
 
628
  $class = 'row';
629
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
630
 
631
+ $data_props = $this->parse_data_attributes( $atts['data'] );
632
 
633
  return sprintf(
634
  '<div class="%s"%s>%s</div>',
648
  *-------------------------------------------------------------------------------------*/
649
  function bs_column( $atts, $content = null ) {
650
 
651
+ $atts = shortcode_atts( array(
652
  "lg" => false,
653
  "md" => false,
654
  "sm" => false,
667
  "push_xs" => false,
668
  "xclass" => false,
669
  "data" => false
670
+ ), $atts );
671
 
672
  $class = '';
673
+ $class .= ( $atts['lg'] ) ? ' col-lg-' . $atts['lg'] : '';
674
+ $class .= ( $atts['md'] ) ? ' col-md-' . $atts['md'] : '';
675
+ $class .= ( $atts['sm'] ) ? ' col-sm-' . $atts['sm'] : '';
676
+ $class .= ( $atts['xs'] ) ? ' col-xs-' . $atts['xs'] : '';
677
+ $class .= ( $atts['offset_lg'] || $atts['offset_lg'] === "0" ) ? ' col-lg-offset-' . $atts['offset_lg'] : '';
678
+ $class .= ( $atts['offset_md'] || $atts['offset_md'] === "0" ) ? ' col-md-offset-' . $atts['offset_md'] : '';
679
+ $class .= ( $atts['offset_sm'] || $atts['offset_sm'] === "0" ) ? ' col-sm-offset-' . $atts['offset_sm'] : '';
680
+ $class .= ( $atts['offset_xs'] || $atts['offset_xs'] === "0" ) ? ' col-xs-offset-' . $atts['offset_xs'] : '';
681
+ $class .= ( $atts['pull_lg'] || $atts['pull_lg'] === "0" ) ? ' col-lg-pull-' . $atts['pull_lg'] : '';
682
+ $class .= ( $atts['pull_md'] || $atts['pull_md'] === "0" ) ? ' col-md-pull-' . $atts['pull_md'] : '';
683
+ $class .= ( $atts['pull_sm'] || $atts['pull_sm'] === "0" ) ? ' col-sm-pull-' . $atts['pull_sm'] : '';
684
+ $class .= ( $atts['pull_xs'] || $atts['pull_xs'] === "0" ) ? ' col-xs-pull-' . $atts['pull_xs'] : '';
685
+ $class .= ( $atts['push_lg'] || $atts['push_lg'] === "0" ) ? ' col-lg-push-' . $atts['push_lg'] : '';
686
+ $class .= ( $atts['push_md'] || $atts['push_md'] === "0" ) ? ' col-md-push-' . $atts['push_md'] : '';
687
+ $class .= ( $atts['push_sm'] || $atts['push_sm'] === "0" ) ? ' col-sm-push-' . $atts['push_sm'] : '';
688
+ $class .= ( $atts['push_xs'] || $atts['push_xs'] === "0" ) ? ' col-xs-push-' . $atts['push_xs'] : '';
689
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
690
+
691
+ $data_props = $this->parse_data_attributes( $atts['data'] );
692
 
693
  return sprintf(
694
  '<div class="%s"%s>%s</div>',
707
  *-------------------------------------------------------------------------------------*/
708
  function bs_list_group( $atts, $content = null ) {
709
 
710
+ $atts = shortcode_atts( array(
711
  "linked" => false,
712
  "xclass" => false,
713
  "data" => false
714
+ ), $atts );
715
 
716
  $class = 'list-group';
717
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
718
 
719
+ $data_props = $this->parse_data_attributes( $atts['data'] );
720
 
721
  return sprintf(
722
  '<%1$s class="%2$s"%3$s>%4$s</%1$s>',
723
+ ( $atts['linked'] == 'true' ) ? 'div' : 'ul',
724
  esc_attr( $class ),
725
  ( $data_props ) ? ' ' . $data_props : '',
726
  do_shortcode( $content )
736
  *-------------------------------------------------------------------------------------*/
737
  function bs_list_group_item( $atts, $content = null ) {
738
 
739
+ $atts = shortcode_atts( array(
740
  "link" => false,
741
  "type" => false,
742
  "active" => false,
743
  "target" => false,
744
  "xclass" => false,
745
  "data" => false
746
+ ), $atts );
747
 
748
  $class = 'list-group-item';
749
+ $class .= ( $atts['type'] ) ? ' list-group-item-' . $atts['type'] : '';
750
+ $class .= ( $atts['active'] == 'true' ) ? ' active' : '';
751
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
752
 
753
+ $data_props = $this->parse_data_attributes( $atts['data'] );
754
 
755
  return sprintf(
756
  '<%1$s %2$s %3$s class="%4$s"%5$s>%6$s</%1$s>',
757
+ ( $atts['link'] ) ? 'a' : 'li',
758
+ ( $atts['link'] ) ? 'href="' . esc_url( $atts['link'] ) . '"' : '',
759
+ ( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
760
  esc_attr( $class ),
761
  ( $data_props ) ? ' ' . $data_props : '',
762
  do_shortcode( $content )
771
  *-------------------------------------------------------------------------------------*/
772
  function bs_list_group_item_heading( $atts, $content = null ) {
773
 
774
+ $atts = shortcode_atts( array(
775
  "xclass" => false,
776
  "data" => false
777
+ ), $atts );
778
 
779
  $class = 'list-group-item-heading';
780
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
781
 
782
+ $data_props = $this->parse_data_attributes( $atts['data'] );
783
 
784
  return sprintf(
785
  '<h4 class="%s"%s>%s</h4>',
796
  *
797
  *-------------------------------------------------------------------------------------*/
798
  function bs_list_group_item_text( $atts, $content = null ) {
799
+
800
+ $atts = shortcode_atts( array(
801
+ "xclass" => false,
802
+ "data" => false
803
+ ), $atts );
804
 
805
  $class = 'list-group-item-text';
806
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
807
 
808
+ $data_props = $this->parse_data_attributes( $atts['data'] );
809
 
810
  return sprintf(
811
  '<p class="%s"%s>%s</p>',
823
  *-------------------------------------------------------------------------------------*/
824
  function bs_breadcrumb( $atts, $content = null ) {
825
 
826
+ $atts = shortcode_atts( array(
827
  "xclass" => false,
828
  "data" => false
829
+ ), $atts );
830
 
831
  $class = 'breadcrumb';
832
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
833
 
834
+ $data_props = $this->parse_data_attributes( $atts['data'] );
835
 
836
  return sprintf(
837
  '<ol class="%s"%s>%s</ol>',
850
  *-------------------------------------------------------------------------------------*/
851
  function bs_breadcrumb_item( $atts, $content = null ) {
852
 
853
+ $atts = shortcode_atts( array(
854
  "link" => false,
855
  "xclass" => false,
856
  "data" => false
857
+ ), $atts );
858
 
859
  $class = '';
860
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
861
 
862
+ $data_props = $this->parse_data_attributes( $atts['data'] );
863
 
864
  return sprintf(
865
  '<li><a href="%s" class="%s"%s>%s</a></li>',
866
+ esc_url( $atts['link'] ),
867
  esc_attr( $class ),
868
  ( $data_props ) ? ' ' . $data_props : '',
869
  do_shortcode( $content )
880
  *-------------------------------------------------------------------------------------*/
881
  function bs_label( $atts, $content = null ) {
882
 
883
+ $atts = shortcode_atts( array(
884
  "type" => false,
885
  "xclass" => false,
886
  "data" => false
887
+ ), $atts );
888
 
889
  $class = 'label';
890
+ $class .= ( $atts['type'] ) ? ' label-' . $atts['type'] : ' label-default';
891
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
892
 
893
+ $data_props = $this->parse_data_attributes( $atts['data'] );
894
 
895
  return sprintf(
896
  '<span class="%s"%s>%s</span>',
910
  *-------------------------------------------------------------------------------------*/
911
  function bs_badge( $atts, $content = null ) {
912
 
913
+ $atts = shortcode_atts( array(
914
  "right" => false,
915
  "xclass" => false,
916
  "data" => false
917
+ ), $atts );
918
 
919
  $class = 'badge';
920
+ $class .= ( $atts['right'] == 'true' ) ? ' pull-right' : '';
921
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
922
 
923
+ $data_props = $this->parse_data_attributes( $atts['data'] );
924
 
925
  return sprintf(
926
  '<span class="%s"%s>%s</span>',
940
  *-------------------------------------------------------------------------------------*/
941
  function bs_icon( $atts, $content = null ) {
942
 
943
+ $atts = shortcode_atts( array(
944
  "type" => false,
945
  "xclass" => false,
946
  "data" => false
947
+ ), $atts );
948
 
949
  $class = 'glyphicon';
950
+ $class .= ( $atts['type'] ) ? ' glyphicon-' . $atts['type'] : '';
951
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
952
 
953
+ $data_props = $this->parse_data_attributes( $atts['data'] );
954
 
955
  return sprintf(
956
  '<span class="%s"%s>%s</span>',
1012
  *
1013
  *-------------------------------------------------------------------------------------*/
1014
  function bs_table_wrap( $atts, $content = null ) {
1015
+
1016
+ $atts = shortcode_atts( array(
1017
+ 'bordered' => false,
1018
+ 'striped' => false,
1019
+ 'hover' => false,
1020
+ 'condensed' => false,
1021
+ 'responsive' => false,
1022
+ 'xclass' => false,
1023
+ 'data' => false
1024
+ ), $atts );
1025
 
1026
  $class = 'table';
1027
+ $class .= ( $atts['bordered'] == 'true' ) ? ' table-bordered' : '';
1028
+ $class .= ( $atts['striped'] == 'true' ) ? ' table-striped' : '';
1029
+ $class .= ( $atts['hover'] == 'true' ) ? ' table-hover' : '';
1030
+ $class .= ( $atts['condensed'] == 'true' ) ? ' table-condensed' : '';
1031
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1032
 
1033
  $return = '';
1034
 
1035
  $tag = array('table');
 
1036
  $content = do_shortcode($content);
1037
 
1038
+ $return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
1039
+ $return = ( $atts['responsive'] ) ? '<div class="table-responsive">' . $return . '</div>' : $return;
1040
  return $return;
1041
  }
1042
 
1054
  *-------------------------------------------------------------------------------------*/
1055
  function bs_well( $atts, $content = null ) {
1056
 
1057
+ $atts = shortcode_atts( array(
1058
  "size" => false,
1059
  "xclass" => false,
1060
  "data" => false
1061
+ ), $atts );
1062
 
1063
  $class = 'well';
1064
+ $class .= ( $atts['size'] ) ? ' well-' . $atts['size'] : '';
1065
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1066
 
1067
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1068
 
1069
  return sprintf(
1070
  '<div class="%s"%s>%s</div>',
1084
  *-------------------------------------------------------------------------------------*/
1085
  function bs_panel( $atts, $content = null ) {
1086
 
1087
+ $atts = shortcode_atts( array(
1088
  "title" => false,
1089
  "heading" => false,
1090
  "type" => false,
1091
  "footer" => false,
1092
  "xclass" => false,
1093
  "data" => false
1094
+ ), $atts );
1095
 
1096
  $class = 'panel';
1097
+ $class .= ( $atts['type'] ) ? ' panel-' . $atts['type'] : ' panel-default';
1098
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1099
 
1100
+ if( ! $atts['heading'] && $atts['title'] ) {
1101
+ $atts['heading'] = $atts['title'];
1102
+ $atts['title'] = true;
1103
  }
1104
 
1105
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1106
 
1107
+ $footer = ( $atts['footer'] ) ? '<div class="panel-footer">' . $atts['footer'] . '</div>' : '';
1108
 
1109
+ if ( $atts['heading'] ) {
1110
  $heading = sprintf(
1111
  '<div class="panel-heading">%s%s%s</div>',
1112
+ ( $atts['title'] ) ? '<h3 class="panel-title">' : '',
1113
+ esc_html( $atts['heading'] ),
1114
+ ( $atts['title'] ) ? '</h3>' : ''
1115
  );
1116
  }
1117
  else {
1145
  $GLOBALS['tabs_count'] = 0;
1146
 
1147
  $GLOBALS['tabs_default_count'] = 0;
1148
+
1149
+ $atts = shortcode_atts( array(
1150
  "type" => false,
1151
  "xclass" => false,
1152
  "data" => false
1153
+ ), $atts );
1154
 
1155
  $ul_class = 'nav';
1156
+ $ul_class .= ( $atts['type'] ) ? ' nav-' . $atts['type'] : ' nav-tabs';
1157
+ $ul_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1158
 
1159
  $div_class = 'tab-content';
1160
 
1161
  $id = 'custom-tabs-'. $GLOBALS['tabs_count'];
1162
 
1163
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1164
 
1165
  $atts_map = bs_attribute_map( $content );
1166
 
1205
  *-------------------------------------------------------------------------------------*/
1206
  function bs_tab( $atts, $content = null ) {
1207
 
1208
+ $atts = shortcode_atts( array(
1209
  'title' => false,
1210
  'active' => false,
1211
  'fade' => false,
1212
  'xclass' => false,
1213
  'data' => false
1214
+ ), $atts );
1215
 
1216
  if( $GLOBALS['tabs_default_active'] && $GLOBALS['tabs_default_count'] == 0 ) {
1217
  $active = true;
1219
  $GLOBALS['tabs_default_count']++;
1220
 
1221
  $class = 'tab-pane';
1222
+ $class .= ( $atts['fade'] == 'true' ) ? ' fade' : '';
1223
+ $class .= ( $atts['active'] == 'true' ) ? ' active' : '';
1224
+ $class .= ( $atts['active'] == 'true' && $atts['fade'] == 'true' ) ? ' in' : '';
1225
 
1226
+ $id = 'custom-tab-'. $GLOBALS['tabs_count'] . '-'. sanitize_title( $atts['title'] );
1227
 
1228
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1229
 
1230
  return sprintf(
1231
  '<div id="%s" class="%s"%s>%s</div>',
1255
  else
1256
  $GLOBALS['collapsibles_count'] = 0;
1257
 
1258
+ $atts = shortcode_atts( array(
1259
  "xclass" => false,
1260
  "data" => false
1261
+ ), $atts );
1262
 
1263
  $class = 'panel-group';
1264
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1265
 
1266
  $id = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1267
 
1268
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1269
 
1270
  return sprintf(
1271
  '<div class="%s" id="%s"%s>%s</div>',
1288
  *-------------------------------------------------------------------------------------*/
1289
  function bs_collapse( $atts, $content = null ) {
1290
 
1291
+ $atts = shortcode_atts( array(
1292
  "title" => false,
1293
  "type" => false,
1294
  "active" => false,
1295
  "xclass" => false,
1296
  "data" => false
1297
+ ), $atts );
1298
 
1299
  $panel_class = 'panel';
1300
+ $panel_class .= ( $atts['type'] ) ? ' panel-' . $atts['type'] : ' panel-default';
1301
+ $panel_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1302
 
1303
  $collapse_class = 'panel-collapse';
1304
+ $collapse_class .= ( $atts['active'] == 'true' ) ? ' in' : ' collapse';
1305
 
1306
  $parent = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1307
+ $current_collapse = $parent . '-'. sanitize_title( $atts['title'] );
1308
 
1309
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1310
 
1311
  return sprintf(
1312
  '<div class="%1$s"%2$s>
1323
  ( $data_props ) ? ' ' . $data_props : '',
1324
  $parent,
1325
  $current_collapse,
1326
+ $atts['title'],
1327
  esc_attr( $collapse_class ),
1328
  do_shortcode( $content )
1329
  );
1346
 
1347
  $GLOBALS['carousel_default_count'] = 0;
1348
 
1349
+ $atts = shortcode_atts( array(
1350
  "interval" => false,
1351
  "pause" => false,
1352
  "wrap" => false,
1353
  "xclass" => false,
1354
  "data" => false,
1355
+ ), $atts );
1356
 
1357
  $div_class = 'carousel slide';
1358
+ $div_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1359
 
1360
  $inner_class = 'carousel-inner';
1361
 
1362
  $id = 'custom-carousel-'. $GLOBALS['carousel_count'];
1363
 
1364
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1365
 
1366
  $atts_map = bs_attribute_map( $content );
1367
 
1389
  '<div class="%s" id="%s" data-ride="carousel"%s%s%s%s>%s<div class="%s">%s</div>%s%s</div>',
1390
  esc_attr( $div_class ),
1391
  esc_attr( $id ),
1392
+ ( $atts['interval'] ) ? sprintf( ' data-interval="%d"', $atts['interval'] ) : '',
1393
+ ( $atts['pause'] ) ? sprintf( ' data-pause="%s"', esc_attr( $atts['pause'] ) ) : '',
1394
+ ( $atts['wrap'] == 'true' ) ? sprintf( ' data-wrap="%s"', esc_attr( $atts['wrap'] ) ) : '',
1395
  ( $data_props ) ? ' ' . $data_props : '',
1396
  ( $indicators ) ? '<ol class="carousel-indicators">' . implode( $indicators ) . '</ol>' : '',
1397
  esc_attr( $inner_class ),
1411
  *
1412
  *-------------------------------------------------------------------------------------*/
1413
  function bs_carousel_item( $atts, $content = null ) {
1414
+
1415
+ $atts = shortcode_atts( array(
1416
  "active" => false,
1417
  "caption" => false,
1418
  "xclass" => false,
1419
  "data" => false
1420
+ ), $atts );
1421
 
1422
  if( $GLOBALS['carousel_default_active'] && $GLOBALS['carousel_default_count'] == 0 ) {
1423
  $active = true;
1425
  $GLOBALS['carousel_default_count']++;
1426
 
1427
  $class = 'item';
1428
+ $class .= ( $atts['active'] == 'true' ) ? ' active' : '';
1429
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1430
 
1431
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1432
 
1433
  $content = preg_replace('/class=".*?"/', '', $content);
1434
 
1437
  esc_attr( $class ),
1438
  ( $data_props ) ? ' ' . $data_props : '',
1439
  do_shortcode( $content ),
1440
+ ( $atts['caption'] ) ? '<div class="carousel-caption">' . esc_html( $atts['caption'] ) . '</div>' : ''
1441
  );
1442
  }
1443
 
1453
 
1454
  function bs_tooltip( $atts, $content = null ) {
1455
 
1456
+ $atts = shortcode_atts( array(
1457
  'title' => '',
1458
  'placement' => 'top',
1459
  'animation' => 'true',
1460
  'html' => 'false',
1461
  'data' => ''
1462
+ ), $atts );
 
1463
 
1464
  $class = 'bs-tooltip';
1465
 
1466
+ $atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
1467
+ $atts['data'] .= ( $atts['placement'] ) ? $this->check_for_data($atts['data']) . 'placement,' . $atts['placement'] : '';
1468
+ $atts['data'] .= ( $atts['html'] ) ? $this->check_for_data($atts['data']) . 'html,' .$atts['html'] : '';
1469
 
1470
  $return = '';
1471
  $tag = 'span';
1472
  $content = do_shortcode($content);
1473
+ $return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
1474
  return $return;
1475
 
1476
  }
1484
 
1485
  function bs_popover( $atts, $content = null ) {
1486
 
1487
+ $atts = shortcode_atts( array(
1488
  'title' => false,
1489
  'text' => '',
1490
  'placement' => 'top',
1491
  'animation' => 'true',
1492
  'html' => 'false',
1493
  'data' => ''
1494
+ ), $atts );
 
1495
 
1496
  $class = 'bs-popover';
1497
 
1498
+ $atts['data'] .= $this->check_for_data($atts['data']) . 'toggle,popover';
1499
+ $atts['data'] .= $this->check_for_data($atts['data']) . 'content,' . $atts['text'];
1500
+ $atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
1501
+ $atts['data'] .= ( $atts['placement'] ) ? $this->check_for_data($atts['data']) . 'placement,' . $atts['placement'] : '';
1502
+ $atts['data'] .= ( $atts['html'] ) ? $this->check_for_data($atts['data']) . 'html,' . $atts['html'] : '';
1503
 
1504
  $return = '';
1505
  $tag = 'span';
1506
  $content = do_shortcode($content);
1507
+ $return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
1508
  return $return;
1509
 
1510
  }
1521
 
1522
  function bs_media( $atts, $content = null ) {
1523
 
1524
+ $atts = shortcode_atts( array(
1525
  "xclass" => false,
1526
  "data" => false
1527
+ ), $atts );
1528
 
1529
  $class = 'media';
1530
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass']: '';
1531
 
1532
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1533
 
1534
  return sprintf(
1535
  '<div class="%s"%s>%s</div>',
1541
 
1542
  function bs_media_object( $atts, $content = null ) {
1543
 
1544
+ $atts = shortcode_atts( array(
1545
  "pull" => "left",
1546
  "xclass" => false,
1547
  "data" => false
1548
+ ), $atts );
1549
 
1550
  $class = "media-object img-responsive";
1551
+ $class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
1552
 
1553
  $return = '';
1554
 
1555
  $tag = array('figure', 'div', 'img', 'i', 'span');
 
1556
  $content = do_shortcode(preg_replace('/(<br>)+$/', '', $content));
1557
+ $return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
1558
+ $return = '<span class="media-' . esc_attr($atts['pull']) . '">' . $return . '</span>';
1559
  return $return;
1560
  }
1561
 
1562
  function bs_media_body( $atts, $content = null ) {
1563
 
1564
+ $atts = shortcode_atts( array(
1565
  "title" => false,
1566
  "xclass" => false,
1567
  "data" => false
1568
+ ), $atts );
1569
 
1570
  $div_class = 'media-body';
1571
+ $div_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1572
 
1573
  $h4_class = 'media-heading';
1574
+ $h4_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1575
 
1576
  $data_props = $this->parse_data_attributes( $data );
1577
 
1580
  esc_attr( $div_class ),
1581
  ( $data_props ) ? ' ' . $data_props : '',
1582
  esc_attr( $h4_class ),
1583
+ esc_html( $atts['title']),
1584
  do_shortcode( $content )
1585
  );
1586
  }
1592
  *
1593
  *-------------------------------------------------------------------------------------*/
1594
  function bs_jumbotron( $atts, $content = null ) {
1595
+
1596
+ $atts = shortcode_atts( array(
1597
  "title" => false,
1598
  "xclass" => false,
1599
  "data" => false
1600
+ ), $atts );
1601
 
1602
  $class = 'jumbotron';
1603
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1604
 
1605
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1606
 
1607
  return sprintf(
1608
  '<div class="%s"%s>%s%s</div>',
1609
  esc_attr( $class ),
1610
  ( $data_props ) ? ' ' . $data_props : '',
1611
+ ( $atts['title'] ) ? '<h1>' . esc_html( $atts['title'] ) . '</h1>' : '',
1612
  do_shortcode( $content )
1613
  );
1614
  }
1620
  *
1621
  *-------------------------------------------------------------------------------------*/
1622
  function bs_page_header( $atts, $content = null ) {
1623
+
1624
+ $atts = shortcode_atts( array(
1625
  "xclass" => false,
1626
  "data" => false
1627
+ ), $atts );
1628
+
1629
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1630
 
1631
  $class = "page-header";
1632
+ $class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
1633
 
1634
  $return = '';
1635
  $title = '';
1636
  $tag = 'div';
1637
  $content = $this->strip_paragraph($content);
1638
  $content = $this->nest_dom_element('h1', 'div', $content);
1639
+ $return .= $this->get_dom_element($tag, $content, $class, '', $atts['data']);
1640
  return $return;
1641
 
1642
  }
1648
  *
1649
  *-------------------------------------------------------------------------------------*/
1650
  function bs_lead( $atts, $content = null ) {
1651
+
1652
+ $atts = shortcode_atts( array(
1653
  "xclass" => false,
1654
  "data" => false
1655
+ ), $atts );
1656
 
1657
  $class = 'lead';
1658
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1659
 
1660
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1661
 
1662
  return sprintf(
1663
  '<p class="%s"%s>%s</p>',
1674
  *
1675
  *-------------------------------------------------------------------------------------*/
1676
  function bs_emphasis( $atts, $content = null ) {
1677
+
1678
+ $atts = shortcode_atts( array(
1679
  "type" => false,
1680
  "xclass" => false,
1681
  "data" => false
1682
+ ), $atts );
1683
 
1684
  $class = '';
1685
+ $class .= ( $atts['type'] ) ? 'text-' . $atts['type'] : 'text-muted';
1686
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1687
 
1688
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1689
 
1690
  return sprintf(
1691
  '<span class="%s"%s>%s</span>',
1702
  *
1703
  *-------------------------------------------------------------------------------------*/
1704
  function bs_img( $atts, $content = null ) {
1705
+
1706
+ $atts = shortcode_atts( array(
1707
  "type" => false,
1708
  "responsive" => false,
1709
  "xclass" => false,
1710
  "data" => false
1711
+ ), $atts );
1712
 
1713
+ $class .= ( $atts['type'] ) ? 'img-' . $atts['type'] . ' ' : '';
1714
+ $class .= ( $atts['responsive'] == 'true' ) ? ' img-responsive' : '';
1715
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1716
 
1717
  $return = '';
1718
  $tag = array('img');
1719
  $content = do_shortcode($content);
1720
+ $return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
1721
  return $return;
1722
 
1723
  }
1729
  *
1730
  *-------------------------------------------------------------------------------------*/
1731
  function bs_thumbnail( $atts, $content = null ) {
1732
+
1733
+ $atts = shortcode_atts( array(
1734
  "xclass" => false,
1735
  "has_content" => false,
1736
  "data" => false
1737
+ ), $atts );
1738
 
1739
  $class = "thumbnail";
1740
+ $class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
1741
 
1742
  $return = '';
1743
+ if($atts['has_content']) {
1744
  $content = '<div>' . $content . '</div>';
1745
  $tag = array('div');
1746
  } else {
1747
  $tag = array('a', 'img');
1748
  }
1749
  $content = do_shortcode($content);
1750
+ $return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
1751
  return $return;
1752
 
1753
  }
1760
  *-------------------------------------------------------------------------------------*/
1761
  function bs_responsive( $atts, $content = null ) {
1762
 
1763
+ $atts = shortcode_atts( array(
1764
  "visible" => false,
1765
  "hidden" => false,
1766
  "block" => false,
1768
  "inline_block" => false,
1769
  "xclass" => false,
1770
  "data" => false
1771
+ ), $atts );
1772
 
1773
  $class = '';
1774
+ if( $atts['visible'] ) {
1775
+ $visible = explode( ' ', $atts['visible'] );
1776
  foreach($visible as $v):
1777
  $class .= "visible-$v ";
1778
  endforeach;
1779
  }
1780
+ if( $atts['hidden'] ) {
1781
+ $hidden = explode( ' ', $atts['hidden'] );
1782
  foreach( $hidden as $h ):
1783
  $class .= "hidden-$h ";
1784
  endforeach;
1785
  }
1786
+ if( $atts['block'] ) {
1787
+ $block = explode( ' ', $atts['block'] );
1788
  foreach( $block as $b ):
1789
  $class .= "visible-$b-block ";
1790
  endforeach;
1791
  }
1792
+ if( $atts['inline'] ) {
1793
+ $inline = explode( ' ', $atts['inline'] );
1794
  foreach( $inline as $i ):
1795
  $class .= "visible-$i-inline ";
1796
  endforeach;
1797
  }
1798
+ if( $atts['inline_block'] ) {
1799
+ $inline_block = explode( ' ', $atts['inline_block'] );
1800
  foreach( $inline_block as $ib ):
1801
  $class .= "visible-$ib-inline ";
1802
  endforeach;
1803
  }
1804
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1805
 
1806
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1807
 
1808
  return sprintf(
1809
  '<span class="%s"%s>%s</span>',
1823
  *-------------------------------------------------------------------------------------*/
1824
  function bs_modal( $atts, $content = null ) {
1825
 
1826
+ $atts = shortcode_atts( array(
1827
  "text" => false,
1828
  "title" => false,
1829
  "size" => false,
1830
  "xclass" => false,
1831
  "data" => false
1832
+ ), $atts );
1833
 
1834
  $a_class = '';
1835
+ $a_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1836
 
1837
  $div_class = 'modal fade';
1838
+ $div_class .= ( $atts['size'] ) ? ' bs-modal-' . $atts['size'] : '';
1839
 
1840
+ $id = 'custom-modal-' . sanitize_title( $atts['title'] );
1841
 
1842
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1843
 
1844
  return sprintf(
1845
  '<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>
1860
  esc_attr( $id ),
1861
  esc_attr( $a_class ),
1862
  ( $data_props ) ? ' ' . $data_props : '',
1863
+ esc_html( $atts['text'] ),
1864
  esc_attr( $div_class ),
1865
+ ( $atts['title'] ) ? '<h4 class="modal-title">' . $atts['title'] . '</h4>' : '',
1866
  do_shortcode( $content )
1867
  );
1868
  }
1877
  *-------------------------------------------------------------------------------------*/
1878
  function bs_modal_footer( $atts, $content = null ) {
1879
 
1880
+ $atts = shortcode_atts( array(
1881
  "xclass" => false,
1882
  "data" => false,
1883
+ ), $atts );
1884
 
1885
  $class = 'modal-footer';
1886
+ $class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
1887
 
1888
+ $data_props = $this->parse_data_attributes( $atts['data'] );
1889
 
1890
  return sprintf(
1891
  '<div class="%s"%s>%s</div>',
1923
  * get DOMDocument element and apply shortcode parameters to it. Create the element if it doesn't exist
1924
  *
1925
  *-------------------------------------------------------------------------------------*/
1926
+ function get_dom_element( $tag, $content, $class, $title = '', $data = null ) {
1927
 
1928
  //clean up content
1929
  $content = trim(trim($content), chr(0xC2).chr(0xA0));
1959
  * Scrape the shortcode's contents for a particular DOMDocument tag or tags, pull them out, apply attributes, and return just the tags.
1960
  *
1961
  *-------------------------------------------------------------------------------------*/
1962
+ function scrape_dom_element( $tag, $content, $class, $title = '', $data = null ) {
1963
 
1964
  $previous_value = libxml_use_internal_errors(TRUE);
1965
 
2057
  }
2058
 
2059
  new BoostrapShortcodes();
2060
+
includes/actions-filters.php CHANGED
@@ -12,14 +12,17 @@ add_action( 'admin_enqueue_scripts', 'bootstrap_shortcodes_styles_all' );
12
 
13
 
14
  function bootstrap_shortcodes_help_styles() {
15
- wp_register_style( 'bs-font', plugins_url( 'bootstrap-3-shortcodes/includes/help/bs-font.css' ) );
16
- wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
17
- wp_register_style( 'bootstrap-modal', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-modal.css' ) );
18
- wp_register_script( 'bootstrap', plugins_url( 'bootstrap-3-shortcodes/includes/help/js/bootstrap.min.js' ) );
19
- wp_enqueue_style( 'bootstrap-shortcodes-help' );
20
- wp_enqueue_style( 'bootstrap-modal' );
21
- wp_enqueue_style( 'bs-font' );
22
- wp_enqueue_script( 'bootstrap' );
 
 
 
23
 
24
  }
25
  add_action( 'media_buttons', 'bootstrap_shortcodes_help_styles' );
@@ -28,22 +31,24 @@ add_filter('the_content', 'bs_fix_shortcodes');
28
 
29
  //action to add a custom button to the content editor
30
  function add_bootstrap_button() {
31
-
32
- //the id of the container I want to show in the popup
33
- $popup_id = 'bootstrap-shortcodes-help';
34
-
35
- //our popup's title
36
- $title = 'Bootstrap Shortcodes Help';
37
-
38
- //append the icon
39
- printf(
40
- '<a data-toggle="modal" data-target="#bootstrap-shortcodes-help" title="%2$s" href="%3$s" class="%4$s"><span class="bs_bootstrap-logo wp-media-buttons-icon"></span></a>',
41
- esc_attr( $popup_id ),
42
- esc_attr( $title ),
43
- esc_url( '#' ),
44
- esc_attr( 'button add_media bootstrap-shortcodes-button')
45
- //sprintf( '<img src="%s" style="height: 20px; position: relative; top: -2px;">', esc_url( $img ) )
46
- );
 
 
47
  }
48
 
49
 
12
 
13
 
14
  function bootstrap_shortcodes_help_styles() {
15
+ $screen = get_current_screen();
16
+ if($screen->parent_base != "gf_edit_forms") {
17
+ wp_register_style( 'bs-font', plugins_url( 'bootstrap-3-shortcodes/includes/help/bs-font.css' ) );
18
+ wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
19
+ wp_register_style( 'bootstrap-modal', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-modal.css' ) );
20
+ wp_register_script( 'bootstrap', plugins_url( 'bootstrap-3-shortcodes/includes/help/js/bootstrap.min.js' ) );
21
+ wp_enqueue_style( 'bootstrap-shortcodes-help' );
22
+ wp_enqueue_style( 'bootstrap-modal' );
23
+ wp_enqueue_style( 'bs-font' );
24
+ wp_enqueue_script( 'bootstrap' );
25
+ }
26
 
27
  }
28
  add_action( 'media_buttons', 'bootstrap_shortcodes_help_styles' );
31
 
32
  //action to add a custom button to the content editor
33
  function add_bootstrap_button() {
34
+ $screen = get_current_screen();
35
+ if($screen->parent_base != "gf_edit_forms") {
36
+ //the id of the container I want to show in the popup
37
+ $popup_id = 'bootstrap-shortcodes-help';
38
+
39
+ //our popup's title
40
+ $title = 'Bootstrap Shortcodes Help';
41
+
42
+ //append the icon
43
+ printf(
44
+ '<a data-toggle="modal" data-target="#bootstrap-shortcodes-help" title="%2$s" href="%3$s" class="%4$s"><span class="bs_bootstrap-logo wp-media-buttons-icon"></span></a>',
45
+ esc_attr( $popup_id ),
46
+ esc_attr( $title ),
47
+ esc_url( '#' ),
48
+ esc_attr( 'button add_media bootstrap-shortcodes-button')
49
+ //sprintf( '<img src="%s" style="height: 20px; position: relative; top: -2px;">', esc_url( $img ) )
50
+ );
51
+ }
52
  }
53
 
54
 
includes/help/README.html CHANGED
@@ -2,7 +2,7 @@
2
  <p>WordPress plugin that provides shortcodes for easier use of the Bootstrap styles and components in your content.</p>
3
  <h2 id="requirements">Requirements</h2>
4
  <p>This plugin won&#39;t do anything if you don&#39;t have WordPress theme built with the <a href="http://getbootstrap.com/">Bootstrap</a> framework. <strong>This plugin does not include the Bootstrap framework</strong>.</p>
5
- <p>The plugin is tested to work with <code>Bootstrap 3.2</code> and <code>WordPress 3.9</code>.</p>
6
  <p>This plugin contains a <code>composer.json</code> file for those of you who manage your PHP dependencies with <a href="https://getcomposer.org">Composer</a>.</p>
7
  <h2 id="shortcode-reference">Shortcode Reference</h2>
8
  <h3 id="css">CSS</h3>
@@ -588,7 +588,7 @@
588
  <p><a href="http://getbootstrap.com/css/#images">Bootstrap images documentation</a></p>
589
  <hr>
590
  <h3 id="responsive-utilities">Responsive Utilities</h3>
591
- <pre><code>[responsive visible_block=&quot;lg md&quot; hidden=&quot;sn xs&quot;] ... [/responsive]</code></pre>
592
  <h4 id="-reponsive-parameters">[reponsive] parameters</h4>
593
  <table>
594
  <thead>
@@ -652,11 +652,11 @@
652
  </tr>
653
  </tbody>
654
  </table>
655
- <p><a href="http://getbootstrap.com/css/#type-emphasis">Bootstrap emphasis classes documentation</a></p>
656
  <hr>
657
  <h3 id="components">Components</h3>
658
  <h3 id="icons">Icons</h3>
659
- <pre><code>[icon type=&quot;arrow&quot;]</code></pre>
660
  <h4 id="-icon-parameters">[icon] parameters</h4>
661
  <table>
662
  <thead>
@@ -2296,7 +2296,7 @@
2296
  <p><a href="http://getbootstrap.com/javascript/#carousel">Bootstrap carousel documentation</a></p>
2297
  <hr>
2298
  <h3 id="modal">Modal</h3>
2299
- <pre><code>[modal text=&quot;This is my modal&quot; title=&quot;Modal Title Goes Here&quot; xclass=&quot;btn btn-primary btn-large&quot;]
2300
  ...
2301
  [modal-footer]
2302
  [button type=&quot;primary&quot; link=&quot;#&quot; data=&quot;dismiss,modal&quot;]Dismiss[/button]
2
  <p>WordPress plugin that provides shortcodes for easier use of the Bootstrap styles and components in your content.</p>
3
  <h2 id="requirements">Requirements</h2>
4
  <p>This plugin won&#39;t do anything if you don&#39;t have WordPress theme built with the <a href="http://getbootstrap.com/">Bootstrap</a> framework. <strong>This plugin does not include the Bootstrap framework</strong>.</p>
5
+ <p>The plugin is tested to work with <code>Bootstrap 3.2</code> and <code>WordPress 4.0</code>.</p>
6
  <p>This plugin contains a <code>composer.json</code> file for those of you who manage your PHP dependencies with <a href="https://getcomposer.org">Composer</a>.</p>
7
  <h2 id="shortcode-reference">Shortcode Reference</h2>
8
  <h3 id="css">CSS</h3>
588
  <p><a href="http://getbootstrap.com/css/#images">Bootstrap images documentation</a></p>
589
  <hr>
590
  <h3 id="responsive-utilities">Responsive Utilities</h3>
591
+ <pre><code>[responsive block=&quot;lg md&quot; hidden=&quot;sn xs&quot;] ... [/responsive]</code></pre>
592
  <h4 id="-reponsive-parameters">[reponsive] parameters</h4>
593
  <table>
594
  <thead>
652
  </tr>
653
  </tbody>
654
  </table>
655
+ <p><a href="http://getbootstrap.com/css/#responsive-utilities">Bootstrap responsive utilities documentation</a></p>
656
  <hr>
657
  <h3 id="components">Components</h3>
658
  <h3 id="icons">Icons</h3>
659
+ <pre><code>[icon type=&quot;arrow-right&quot;]</code></pre>
660
  <h4 id="-icon-parameters">[icon] parameters</h4>
661
  <table>
662
  <thead>
2296
  <p><a href="http://getbootstrap.com/javascript/#carousel">Bootstrap carousel documentation</a></p>
2297
  <hr>
2298
  <h3 id="modal">Modal</h3>
2299
+ <pre><code>[modal text=&quot;This is my modal&quot; title=&quot;Modal Title Goes Here&quot; xclass=&quot;btn btn-primary btn-lg&quot;]
2300
  ...
2301
  [modal-footer]
2302
  [button type=&quot;primary&quot; link=&quot;#&quot; data=&quot;dismiss,modal&quot;]Dismiss[/button]
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: filipstefansson, nodley, FoolsRun
3
  Tags: bootstrap, shortcode, shortcodes, responsive, grid
4
  Requires at least: 3.8
5
  Tested up to: 4.0
6
- Stable tag: 3.2.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -18,8 +18,8 @@ This plugin creates a simple, out of the way button just above the WordPress Tin
18
 
19
  For questions, support, or to contribute to this plugin, check out [our GitHub project](https://github.com/filipstefansson/bootstrap-3-shortcodes)
20
 
21
- ####Updated for Bootstrap 3.2
22
- Now supporting the changes to Responsive Utilities introduced in Bootstrap 3.2!
23
 
24
  If you like this plugin, check out our companion plugin for Font Awesome, [Font Awesome Shortcodes](http://www.wordpress.org/plugins/font-awesome-shortcodes/)
25
 
@@ -71,6 +71,15 @@ No, we assume you are already working with a WordPress theme that includes the B
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
 
74
  = 3.2.4 =
75
  * NOTE: this update changes the way the [table-wrap], [tooltip], [popover], [page-header], [img], and [media-object] shortcodes function to better correct for unexpected input. Please report any problems you have with these shortcodes following this update.
76
  * Add Bootstrap shortcode help popup button to Distraction Free Writing Mode toolbar
3
  Tags: bootstrap, shortcode, shortcodes, responsive, grid
4
  Requires at least: 3.8
5
  Tested up to: 4.0
6
+ Stable tag: 3.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
18
 
19
  For questions, support, or to contribute to this plugin, check out [our GitHub project](https://github.com/filipstefansson/bootstrap-3-shortcodes)
20
 
21
+ ####Updated for Bootstrap 3.3.x
22
+ Tested and working in the latest version of Bootstrap!
23
 
24
  If you like this plugin, check out our companion plugin for Font Awesome, [Font Awesome Shortcodes](http://www.wordpress.org/plugins/font-awesome-shortcodes/)
25
 
71
 
72
  == Changelog ==
73
 
74
+ = 3.3 =
75
+ * Tested to work with Bootstrap 3.3!
76
+ * Only enqueue tooltip and popover trigger javascript if those shortcodes are in use
77
+ * Added support for offsets, pulls, and pushes of "0" in [column]
78
+ * Added support for Bootstrap's responsive tables in [table-wrap]
79
+ * Better correct for conflicts with Gravity Forms --these two plugins should finally play well together
80
+ * Fix documentation for [modal] and [responsive]
81
+ * Removed use of extract() to better fit with WordPress's best practices.
82
+
83
  = 3.2.4 =
84
  * NOTE: this update changes the way the [table-wrap], [tooltip], [popover], [page-header], [img], and [media-object] shortcodes function to better correct for unexpected input. Please report any problems you have with these shortcodes following this update.
85
  * Add Bootstrap shortcode help popup button to Distraction Free Writing Mode toolbar