Bootstrap Shortcodes for WordPress - Version 3.0.3.6

Version Description

  • Significant rewrite to properly escape inputs
  • [tabs] now supports "pills" and "fade" styles
  • [tabs] and [carousel] now support setting a tab or image other than the first one as "active". If no tab or carousel item is set to "active" the first one is set by default.
  • [panel] titles are now optional (see documentation for new shortcode parameters)
  • [list-group-item] now supports optional "type" parameter (Bootstrap 3.1 only)
  • [button] now supports "disabled" and "active" parameters
  • [progress-bar] now supports showing labels
  • Add [dropdown-header] shortcode
  • [container] now includes optional "fluid" parameter (Bootstrap 3.1 only)
  • [modal] now supports sizes (Bootstrap 3.1 only)
  • Composer support
  • Resolve errors regarding uninitialized variables experienced by some users
  • Resolve image path icons for non-standard WordPress directory names
  • Resolved DOMDocument errors experienced by some users (if you still see these errors or warnings please let us know)
Download this release

Release Info

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

Code changes from version 3.0.3 to 3.0.3.6

README.md CHANGED
@@ -8,6 +8,8 @@ This plugin won't do anything if you don't have WordPress theme built with the [
8
 
9
  The plugin is tested to work with ```Bootstrap 3``` and ```WordPress 3.8```.
10
 
 
 
11
  ## Supported shortcodes
12
 
13
  ### CSS
@@ -17,16 +19,22 @@ The plugin is tested to work with ```Bootstrap 3``` and ```WordPress 3.8```.
17
  * [Code](#code)
18
  * [Tables](#tables)
19
  * [Buttons](#buttons)
 
20
  * [Responsive utilities](#responsive-utilities)
21
 
22
  ### Components
23
  * [Icons](#icons)
24
  * [Button Groups](#button-groups)
 
 
 
25
  * [Labels](#labels)
26
  * [Badges](#badges)
27
  * [Jumbotron](#jumbotron)
 
28
  * [Thumbnails](#thumbnails)
29
  * [Alerts](#alerts)
 
30
  * [Media Objects](#media-objects)
31
  * [List Groups](#list-groups)
32
  * [Panels](#panels)
@@ -36,7 +44,8 @@ The plugin is tested to work with ```Bootstrap 3``` and ```WordPress 3.8```.
36
  * [Tabs](#tabs)
37
  * [Tooltip](#tooltip)
38
  * [Popover](#popover)
39
- * [Collapse (Accordion)](#collapse-(accordion))
 
40
  * [Modal](#modal)
41
 
42
 
@@ -45,18 +54,40 @@ The plugin is tested to work with ```Bootstrap 3``` and ```WordPress 3.8```.
45
  ## CSS
46
 
47
  ### Grid
48
- [row]
49
- [column md="6"]
50
-
51
- [/column]
52
- [column md="6"]
53
-
54
- [/column]
55
- [/row]
56
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  #### [row] parameters
59
- None
 
 
 
60
 
61
  #### [column] parameters
62
  Parameter | Description | Required | Values | Default
@@ -77,6 +108,8 @@ push_xs | Push on extra small screens | optional | 1-12 | false
77
  push_sm | Push on small screens | optional | 1-12 | false
78
  push_md | Push on column on medium screens | optional | 1-12 | false
79
  push_lg | Push on column on large screens | optional | 1-12 | false
 
 
80
 
81
  [Bootstrap grid documentation](http://getbootstrap.com/css/#grid).
82
 
@@ -84,7 +117,10 @@ push_lg | Push on column on large screens | optional | 1-12 | false
84
  [lead] … [/lead]
85
 
86
  #### [lead] parameters
87
- None
 
 
 
88
 
89
  [Bootstrap body copy documentation](http://getbootstrap.com/css/#type-body-copy)
90
 
@@ -95,6 +131,8 @@ None
95
  Parameter | Description | Required | Values | Default
96
  --- | --- | --- | --- | ---
97
  type | The type of label to display | required | muted, primary, success, info, warning, danger | muted
 
 
98
 
99
  [Bootstrap emphasis classes documentation](http://getbootstrap.com/css/#type-emphasis)
100
 
@@ -106,6 +144,8 @@ Parameter | Description | Required | Values | Default
106
  --- | --- | --- | --- | ---
107
  inline | Display inline code | optional | true, false | false
108
  scrollable | Set a max height of 350px and provide a scroll bar. Not usable with inline="true". | optional | true, false | false
 
 
109
 
110
  [Bootstrap code documentation](http://getbootstrap.com/css/#code)
111
 
@@ -123,6 +163,8 @@ bordered | Set "bordered" table style (see Bootstrap documentation) | optional |
123
  striped | Set "striped" table style (see Bootstrap documentation) | optional | true, false | false
124
  hover | Set "hover" table style (see Bootstrap documentation) | optional | true, false | false
125
  condensed | Set "condensed" table style (see Bootstrap documentation) | optional | true, false | false
 
 
126
 
127
  [Bootstrap table documentation](http://getbootstrap.com/css/#tables)
128
 
@@ -135,13 +177,30 @@ Parameter | Description | Required | Values | Default
135
  type | The type of the button | optional | default, primary, success, info, warning, danger, link | default
136
  size | The size of the button | optional | xs, sm, lg | none
137
  block | Whether the button should be a block-level button | optional | true, false | false
 
 
 
138
  xclass | Any extra classes you want to add | optional | any text | none
139
  link | The url you want the button to link to | optional | any valid link | none
140
  target | Target for the link | optional | any valid target | none
141
- data | Data attribute and value pairs separated by a comma. Pairs separated by pipe (see example below). | optional | any text | none
142
 
143
  [Bootstrap button documentation](http://getbootstrap.com/css/#buttons)
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  ### Responsive Utilities
146
  [responsive visible="sm xs" hidden="lg"] … [/responsive]
147
 
@@ -150,6 +209,8 @@ Parameter | Description | Required | Values | Default
150
  --- | --- | --- | --- | ---
151
  visible | Sizes at which this element is visible (separated by spaces) | optional | xs, sm, md, lg | false
152
  hidden | Sizes at which this element is hidden (separated by spaces) | optional | xs, sm, md, lg | false
 
 
153
 
154
  [Bootstrap emphasis classes documentation](http://getbootstrap.com/css/#type-emphasis)
155
 
@@ -162,15 +223,35 @@ hidden | Sizes at which this element is hidden (separated by spaces) | optional
162
  Parameter | Description | Required | Values | Default
163
  --- | --- | --- | --- | ---
164
  type | The type of icon you want to display | required | See Bootstrap docs | none
 
 
165
 
166
  [Bootstrap Glyphicons documentation](http://getbootstrap.com/components/#glyphicons)
167
 
168
  ### Button Groups
 
169
  [button-group size="lg" justified="" vertical=""]
170
  [button link="#"] … [/button]
171
  [button link="#"] … [/button]
172
  [button link="#"] … [/button]
173
  [/button-group]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  #### [button-group] parameters
176
  Parameter | Description | Required | Values | Default
@@ -178,9 +259,151 @@ Parameter | Description | Required | Values | Default
178
  size | The size of the button group | optional | xs, sm, lg | none
179
  justified | Whether button group is justified | optional | true, false | false
180
  vertical | Whether button group is vertical | optional | true, false | false
 
 
 
 
 
 
 
 
 
181
 
182
  [Bootstrap button groups documentation](http://getbootstrap.com/css/#btn-groups)
183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  ### Labels
185
  [label type="success"] … [/label]
186
 
@@ -188,6 +411,8 @@ vertical | Whether button group is vertical | optional | true, false | false
188
  Parameter | Description | Required | Values | Default
189
  --- | --- | --- | --- | ---
190
  type | The type of label to display | optional | default, primary, success, info, warning, danger | default
 
 
191
 
192
  [Bootstrap label documentation](http://getbootstrap.com/components/#labels)
193
 
@@ -198,6 +423,8 @@ type | The type of label to display | optional | default, primary, success, info
198
  Parameter | Description | Required | Values | Default
199
  --- | --- | --- | --- | ---
200
  right | Whether the badge should align to the right of its container | optional | true, false | false
 
 
201
 
202
  [Bootstrap badges documentation](http://getbootstrap.com/components/#badges)
203
 
@@ -208,16 +435,33 @@ right | Whether the badge should align to the right of its container | optional
208
  Parameter | Description | Required | Values | Default
209
  --- | --- | --- | --- | ---
210
  title | The jumbotron title | optional | Any text | none
 
 
211
 
212
  [Bootstrap jumbotron documentation](http://getbootstrap.com/components/#jumbotron)
213
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  ### Thumbnails
215
  [thumbnail] … [/thumbnail]
216
  [thumbnail] … [/thumbnail]
217
  [thumbnail] … [/thumbnail]
218
 
219
  #### [thumbnail] parameters
220
- None
 
 
 
221
 
222
  [Bootstrap thumbnails documentation](http://getbootstrap.com/components/#thumbnails)
223
 
@@ -229,10 +473,37 @@ Parameter | Description | Required | Values | Default
229
  --- | --- | --- | --- | ---
230
  type | The type of the alert | required | success, info, warning, danger | success
231
  dismissable | If the alert should be dismissable | optional | true, false | false
232
- strong | Text to display in bold at the beginning | optional | any text | false
 
233
 
234
  [Bootstrap alert documentation](http://getbootstrap.com/components/#alerts)
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  ### Media Objects
237
  [media]
238
  [media-object pull="right"]
@@ -244,23 +515,32 @@ strong | Text to display in bold at the beginning | optional | any text | false
244
  [/media]
245
 
246
  #### [media] parameters
247
- None
 
 
 
248
 
249
  #### [media-object] parameters
250
  Parameter | Description | Required | Values | Default
251
  --- | --- | --- | --- | ---
252
  pull | Whether the image pulls to the left or right | optional | left, right | right
 
 
253
 
254
  #### [media-body] parameters
255
  Parameter | Description | Required | Values | Default
256
  --- | --- | --- | --- | ---
257
  title | The object title | required | Any text | none
 
 
258
 
259
  __NOTE: media-object should contain an image, or linked image, inserted using the WordPress TinyMCE editor__
260
 
261
  [Bootstrap media objects documentation](http://getbootstrap.com/components/#media)
262
 
263
  ### List Groups
 
 
264
  [list-group]
265
  [list-group-item]
266
 
@@ -273,20 +553,77 @@ __NOTE: media-object should contain an image, or linked image, inserted using th
273
  [/list-group-item]
274
  [/list-group]
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  #### [list-group] parameters
277
- None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
  [Bootstrap list groups documentation](http://getbootstrap.com/components/#list-group)
280
 
281
  ### Panels
282
- [panel type="info" title="Panel Title" footer="Footer text"] … [/panel]
283
 
284
  #### [panel] parameters
285
  Parameter | Description | Required | Values | Default
286
  --- | --- | --- | --- | ---
287
  type | The type of the panel | optional | default, primary, success, info, warning, danger, link | default
288
- title | The panel title | required | any text | none
 
289
  footer | The panel footer text if desired | optional | any text | none
 
 
290
 
291
  [Bootstrap panels documentation](http://getbootstrap.com/components/#panels)
292
 
@@ -297,14 +634,16 @@ footer | The panel footer text if desired | optional | any text | none
297
  Parameter | Description | Required | Values | Default
298
  --- | --- | --- | --- | ---
299
  size | Modifies the amount of padding inside the well | optional | sm, lg | normal
 
 
300
 
301
  [Bootstrap wells documentation](http://getbootstrap.com/components/#wells)
302
 
303
  ## Javascript
304
 
305
  ### Tabs
306
- [tabs]
307
- [tab title="Home"]
308
 
309
  [/tab]
310
  [tab title="Profile"]
@@ -316,12 +655,20 @@ size | Modifies the amount of padding inside the well | optional | sm, lg | norm
316
  [/tabs]
317
 
318
  #### [tabs] parameters
319
- None
 
 
 
 
320
 
321
  #### [tab] parameters
322
  Parameter | Description | Required | Values | Default
323
  --- | --- | --- | --- | ---
324
  title | The title of the tab | required | any text | false
 
 
 
 
325
 
326
  [Bootstrap tabs documentation](http://getbootstrap.com/javascript/#tabs)
327
 
@@ -366,17 +713,49 @@ html | Insert HTML into the tooltip | optional | true, false | false
366
  [/collapsibles]
367
 
368
  #### [collapsibles] parameters
369
- None
 
 
 
370
 
371
  #### [collapse] parameters
372
  Parameter | Description | Required | Values | Default
373
  --- | --- | --- | --- | ---
374
  title | The title of the collapsible, visible when collapsed | required | any text | false
375
  type | The type of the panel | optional | default, primary, success, info, warning, danger, link | default
376
- state | Whether the tab is expanded at load time | optional | active | false
 
 
377
 
378
  [Bootstrap collapse documentation](http://getbootstrap.com/javascript/#collapse)
379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  ### Modal
381
  [modal text="This is my modal" title="Modal Title Goes Here" xclass="btn btn-primary btn-large"]
382
 
@@ -390,9 +769,14 @@ Parameter | Description | Required | Values | Default
390
  --- | --- | --- | --- | ---
391
  text | Text of the modal trigger link | required | any text | none
392
  title | Title of the modal popup | required | any text | none
 
393
  xclass | Any extra classes you want to add to the trigger link | optional | any text | none
 
394
 
395
  #### [modal-footer] parameters
396
- None
 
 
 
397
 
398
  [Bootstrap modal documentation](http://getbootstrap.com/javascript/#modals)
8
 
9
  The plugin is tested to work with ```Bootstrap 3``` and ```WordPress 3.8```.
10
 
11
+ This plugin contains a ```composer.json``` file for those of you who manage your PHP dependencies with [Composer](https://getcomposer.org).
12
+
13
  ## Supported shortcodes
14
 
15
  ### CSS
19
  * [Code](#code)
20
  * [Tables](#tables)
21
  * [Buttons](#buttons)
22
+ * [Images](#images)
23
  * [Responsive utilities](#responsive-utilities)
24
 
25
  ### Components
26
  * [Icons](#icons)
27
  * [Button Groups](#button-groups)
28
+ * [Button Dropdowns](#button-dropdowns)
29
+ * [Navs](#navs)
30
+ * [Breadcrumbs](#breadcrumbs)
31
  * [Labels](#labels)
32
  * [Badges](#badges)
33
  * [Jumbotron](#jumbotron)
34
+ * [Page Header](#page-header)
35
  * [Thumbnails](#thumbnails)
36
  * [Alerts](#alerts)
37
+ * [Progress Bars](#progress-bars)
38
  * [Media Objects](#media-objects)
39
  * [List Groups](#list-groups)
40
  * [Panels](#panels)
44
  * [Tabs](#tabs)
45
  * [Tooltip](#tooltip)
46
  * [Popover](#popover)
47
+ * [Collapse (Accordion)](#collapse-accordion)
48
+ * [Carousel](#carousel)
49
  * [Modal](#modal)
50
 
51
 
54
  ## CSS
55
 
56
  ### Grid
57
+ [row]
58
+ [column md="6"]
59
+
60
+ [/column]
61
+ [column md="6"]
62
+
63
+ [/column]
64
+ [/row]
65
+
66
+ The container component is also supported in case your theme doesn't incude a container.
67
+
68
+ [container]
69
+ [row]
70
+ [column md="6"]
71
+
72
+ [/column]
73
+ [column md="6"]
74
+
75
+ [/column]
76
+ [/row]
77
+ [/container]
78
+
79
+ #### [container] parameters
80
+ Parameter | Description | Required | Values | Default
81
+ --- | --- | --- | --- | ---
82
+ fluid | Is the container fluid? (see Bootstrap documentation for details) | optional | true, false | false
83
+ xclass | Any extra classes you want to add | optional | any text | none
84
+ 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
85
 
86
  #### [row] parameters
87
+ Parameter | Description | Required | Values | Default
88
+ --- | --- | --- | --- | ---
89
+ xclass | Any extra classes you want to add | optional | any text | none
90
+ 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
91
 
92
  #### [column] parameters
93
  Parameter | Description | Required | Values | Default
108
  push_sm | Push on small screens | optional | 1-12 | false
109
  push_md | Push on column on medium screens | optional | 1-12 | false
110
  push_lg | Push on column on large screens | optional | 1-12 | false
111
+ xclass | Any extra classes you want to add | optional | any text | none
112
+ 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
113
 
114
  [Bootstrap grid documentation](http://getbootstrap.com/css/#grid).
115
 
117
  [lead] … [/lead]
118
 
119
  #### [lead] parameters
120
+ Parameter | Description | Required | Values | Default
121
+ --- | --- | --- | --- | ---
122
+ xclass | Any extra classes you want to add | optional | any text | none
123
+ 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
124
 
125
  [Bootstrap body copy documentation](http://getbootstrap.com/css/#type-body-copy)
126
 
131
  Parameter | Description | Required | Values | Default
132
  --- | --- | --- | --- | ---
133
  type | The type of label to display | required | muted, primary, success, info, warning, danger | muted
134
+ xclass | Any extra classes you want to add | optional | any text | none
135
+ 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
136
 
137
  [Bootstrap emphasis classes documentation](http://getbootstrap.com/css/#type-emphasis)
138
 
144
  --- | --- | --- | --- | ---
145
  inline | Display inline code | optional | true, false | false
146
  scrollable | Set a max height of 350px and provide a scroll bar. Not usable with inline="true". | optional | true, false | false
147
+ xclass | Any extra classes you want to add | optional | any text | none
148
+ 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
149
 
150
  [Bootstrap code documentation](http://getbootstrap.com/css/#code)
151
 
163
  striped | Set "striped" table style (see Bootstrap documentation) | optional | true, false | false
164
  hover | Set "hover" table style (see Bootstrap documentation) | optional | true, false | false
165
  condensed | Set "condensed" table style (see Bootstrap documentation) | optional | true, false | false
166
+ xclass | Any extra classes you want to add | optional | any text | none
167
+ 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
168
 
169
  [Bootstrap table documentation](http://getbootstrap.com/css/#tables)
170
 
177
  type | The type of the button | optional | default, primary, success, info, warning, danger, link | default
178
  size | The size of the button | optional | xs, sm, lg | none
179
  block | Whether the button should be a block-level button | optional | true, false | false
180
+ dropdown | Whether the button triggers a dropdown menu (see [Button Dropdowns](#button-dropdowns)) | optional | true, false | false
181
+ active | Apply the "active" style | optional | true, false | false
182
+ disabled | Whether the button be disabled | optional | true, false | false
183
  xclass | Any extra classes you want to add | optional | any text | none
184
  link | The url you want the button to link to | optional | any valid link | none
185
  target | Target for the link | optional | any valid target | none
186
+ 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
187
 
188
  [Bootstrap button documentation](http://getbootstrap.com/css/#buttons)
189
 
190
+ ### Images
191
+ [img type="circle" responsive="true"] … [/img]
192
+
193
+ Wrap any number of HTML image tags or images inserted via the WordPress media manager.
194
+ #### [img] parameters
195
+ Parameter | Description | Required | Values | Default
196
+ --- | --- | --- | --- | ---
197
+ type | The effect to apply to wrapped images | optional | rounded, circle, thumbnail | false
198
+ responsive | Make the wrapped images responsive | optional | true, false | false
199
+ xclass | Any extra classes you want to add | optional | any text | none
200
+ 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
201
+
202
+ [Bootstrap images documentation](http://getbootstrap.com/css/#images)
203
+
204
  ### Responsive Utilities
205
  [responsive visible="sm xs" hidden="lg"] … [/responsive]
206
 
209
  --- | --- | --- | --- | ---
210
  visible | Sizes at which this element is visible (separated by spaces) | optional | xs, sm, md, lg | false
211
  hidden | Sizes at which this element is hidden (separated by spaces) | optional | xs, sm, md, lg | false
212
+ xclass | Any extra classes you want to add | optional | any text | none
213
+ 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
214
 
215
  [Bootstrap emphasis classes documentation](http://getbootstrap.com/css/#type-emphasis)
216
 
223
  Parameter | Description | Required | Values | Default
224
  --- | --- | --- | --- | ---
225
  type | The type of icon you want to display | required | See Bootstrap docs | none
226
+ xclass | Any extra classes you want to add | optional | any text | none
227
+ 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
228
 
229
  [Bootstrap Glyphicons documentation](http://getbootstrap.com/components/#glyphicons)
230
 
231
  ### Button Groups
232
+ #### Basic example
233
  [button-group size="lg" justified="" vertical=""]
234
  [button link="#"] … [/button]
235
  [button link="#"] … [/button]
236
  [button link="#"] … [/button]
237
  [/button-group]
238
+
239
+ #### Button toolbar
240
+ [button-toolbar]
241
+ [button-group]
242
+ [button link="#"] … [/button]
243
+ [button link="#"] … [/button]
244
+ [button link="#"] … [/button]
245
+ [/button-group]
246
+ [button-group]
247
+ [button link="#"] … [/button]
248
+ [button link="#"] … [/button]
249
+ [button link="#"] … [/button]
250
+ [/button-group]
251
+ [button-group]
252
+ [button link="#"] … [/button]
253
+ [/button-group]
254
+ [/button-toolbar]
255
 
256
  #### [button-group] parameters
257
  Parameter | Description | Required | Values | Default
259
  size | The size of the button group | optional | xs, sm, lg | none
260
  justified | Whether button group is justified | optional | true, false | false
261
  vertical | Whether button group is vertical | optional | true, false | false
262
+ dropup | **Must correspond with the use of [dropdown]** | optional | true, false | false
263
+ xclass | Any extra classes you want to add | optional | any text | none
264
+ 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
265
+
266
+ #### [button-toolbar] parameters
267
+ Parameter | Description | Required | Values | Default
268
+ --- | --- | --- | --- | ---
269
+ xclass | Any extra classes you want to add | optional | any text | none
270
+ 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
271
 
272
  [Bootstrap button groups documentation](http://getbootstrap.com/css/#btn-groups)
273
 
274
+ ### Button Dropdowns
275
+ Button Dropdowns can be accomplished by combining the [button-group] shortcode, the "data" parameters of the [button] shortcode, and [dropdown] shortcode as follows.
276
+
277
+ #### Single button dropdowns
278
+ [button-group]
279
+ [button link="#" dropdown="true" data="toggle,dropdown"] … [caret][/button]
280
+ [dropdown]
281
+ [dropdown-header] … [/dropdown-header]
282
+ [dropdown-item link="#"] … [/dropdown-item]
283
+ [dropdown-item link="#"] … [/dropdown-item]
284
+ [dropdown-item link="#"] … [/dropdown-item]
285
+ [divider]
286
+ [dropdown-item link="#"] … [/dropdown-item]
287
+ [/dropdown]
288
+ [/button-group]
289
+
290
+ #### Split button dropdowns
291
+ [button-group]
292
+ [button link="#"] … [/button]
293
+ [button dropdown="true" data="toggle,dropdown"][caret][/button]
294
+ [dropdown]
295
+ [dropdown-item link="#"] … [/dropdown-item]
296
+ [divider]
297
+ [dropdown-item link="#"] … [/dropdown-item]
298
+ [/dropdown]
299
+ [/button-group]
300
+
301
+ #### Dropup variation
302
+ [button-group dropup="true"]
303
+ [button link="#"] … [/button]
304
+ [button dropdown="true" data="toggle,dropdown"][caret][/button]
305
+ [dropdown]
306
+ [dropdown-item link="#"] … [/dropdown-item]
307
+ [divider]
308
+ [dropdown-item link="#"] … [/dropdown-item]
309
+ [/dropdown]
310
+ [/button-group]
311
+
312
+ #### [dropdown] parameters
313
+ Parameter | Description | Required | Values | Default
314
+ --- | --- | --- | --- | ---
315
+ xclass | Any extra classes you want to add | optional | any text | none
316
+ 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
317
+
318
+ #### [dropdown-item] parameters
319
+ Parameter | Description | Required | Values | Default
320
+ --- | --- | --- | --- | ---
321
+ link | The url you want the dropdown-item to link to | optional | any valid link | none
322
+ disabled | Whether this menu-item is disabled | optional | true, false | false
323
+ xclass | Any extra classes you want to add | optional | any text | none
324
+ 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
325
+
326
+ #### [dropdown-header] parameters
327
+ Parameter | Description | Required | Values | Default
328
+ --- | --- | --- | --- | ---
329
+ xclass | Any extra classes you want to add | optional | any text | none
330
+ 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
331
+
332
+ #### [caret] parameters
333
+ Parameter | Description | Required | Values | Default
334
+ --- | --- | --- | --- | ---
335
+ xclass | Any extra classes you want to add | optional | any text | none
336
+ 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
337
+
338
+ #### [divider] parameters
339
+ Parameter | Description | Required | Values | Default
340
+ --- | --- | --- | --- | ---
341
+ xclass | Any extra classes you want to add | optional | any text | none
342
+ 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
343
+
344
+ [Bootstrap button dropdowns documentation](http://getbootstrap.com/components/#btn-dropdowns)
345
+
346
+ ### Navs
347
+ [nav type="pills"]
348
+ [nav-item link="#"] … [/nav-item]
349
+ [nav-item link="#"] … [/nav-item]
350
+ [nav-item link="#"] … [/nav-item]
351
+ [/nav]
352
+
353
+ #### Nav with dropdowns
354
+ [nav type="pills"]
355
+ [nav-item link="#" active="true"] … [/nav-item]
356
+ [nav-item dropdown="true" link="#"] … [caret]
357
+ [dropdown]
358
+ [dropdown-item link="#"] … [/dropdown-item]
359
+ [dropdown-item link="#"] … [/dropdown-item]
360
+ [/dropdown]
361
+ [/nav-item]
362
+ [/nav]
363
+
364
+ #### [nav] parameters
365
+ Parameter | Description | Required | Values | Default
366
+ --- | --- | --- | --- | ---
367
+ type | The type of nav | required | tabs, pills | tabs
368
+ stacked | Whether the nav is stacked (should be used with "pills" type | optional | true, false | false
369
+ justified | Whether the nav is justified | optional | true, false | false
370
+ xclass | Any extra classes you want to add | optional | any text | none
371
+ 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
372
+
373
+ #### [nav-item] parameters
374
+ Parameter | Description | Required | Values | Default
375
+ --- | --- | --- | --- | ---
376
+ link | The url you want the dropdown-item to link to | optional | any valid link | none
377
+ active | Whether the item has the "active" style applied | optional | true, false | false
378
+ disabled | Whether the item is disabled | optional | true, false | false
379
+ xclass | Any extra classes you want to add | optional | any text | none
380
+ 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
381
+
382
+ [Bootstrap button navs documentation](http://getbootstrap.com/components/#nav)
383
+
384
+
385
+ ### Breadcrumbs
386
+ [breadcrumb]
387
+ [breadcrumb-item link="#"] … [/breadcrumb-item]
388
+ [breadcrumb-item link="#"] … [/breadcrumb-item]
389
+ [breadcrumb-item link="#"] … [/breadcrumb-item]
390
+ [/breadcrumb]
391
+
392
+ #### [breadcrumb] parameters
393
+ Parameter | Description | Required | Values | Default
394
+ --- | --- | --- | --- | ---
395
+ xclass | Any extra classes you want to add | optional | any text | none
396
+ 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
397
+
398
+ #### [breadcrumb-item] parameters
399
+ Parameter | Description | Required | Values | Default
400
+ --- | --- | --- | --- | ---
401
+ link | The url you want the breadcrumb-item to link to | optional | any valid link | none
402
+ xclass | Any extra classes you want to add | optional | any text | none
403
+ 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
404
+
405
+ [Bootstrap breadcrumbs documentation](http://getbootstrap.com/components/#breadcrumbs)
406
+
407
  ### Labels
408
  [label type="success"] … [/label]
409
 
411
  Parameter | Description | Required | Values | Default
412
  --- | --- | --- | --- | ---
413
  type | The type of label to display | optional | default, primary, success, info, warning, danger | default
414
+ xclass | Any extra classes you want to add | optional | any text | none
415
+ 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
416
 
417
  [Bootstrap label documentation](http://getbootstrap.com/components/#labels)
418
 
423
  Parameter | Description | Required | Values | Default
424
  --- | --- | --- | --- | ---
425
  right | Whether the badge should align to the right of its container | optional | true, false | false
426
+ xclass | Any extra classes you want to add | optional | any text | none
427
+ 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
428
 
429
  [Bootstrap badges documentation](http://getbootstrap.com/components/#badges)
430
 
435
  Parameter | Description | Required | Values | Default
436
  --- | --- | --- | --- | ---
437
  title | The jumbotron title | optional | Any text | none
438
+ xclass | Any extra classes you want to add | optional | any text | none
439
+ 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
440
 
441
  [Bootstrap jumbotron documentation](http://getbootstrap.com/components/#jumbotron)
442
 
443
+ ### Page Header
444
+ [page-header] … [/page-header]
445
+
446
+ Automatically inserts H1 tag if not present
447
+ #### [page-header] parameters
448
+ Parameter | Description | Required | Values | Default
449
+ --- | --- | --- | --- | ---
450
+ xclass | Any extra classes you want to add | optional | any text | none
451
+ 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
452
+
453
+ [Bootstrap page-header documentation](http://getbootstrap.com/components/#page-header)
454
+
455
  ### Thumbnails
456
  [thumbnail] … [/thumbnail]
457
  [thumbnail] … [/thumbnail]
458
  [thumbnail] … [/thumbnail]
459
 
460
  #### [thumbnail] parameters
461
+ Parameter | Description | Required | Values | Default
462
+ --- | --- | --- | --- | ---
463
+ xclass | Any extra classes you want to add | optional | any text | none
464
+ 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
465
 
466
  [Bootstrap thumbnails documentation](http://getbootstrap.com/components/#thumbnails)
467
 
473
  --- | --- | --- | --- | ---
474
  type | The type of the alert | required | success, info, warning, danger | success
475
  dismissable | If the alert should be dismissable | optional | true, false | false
476
+ xclass | Any extra classes you want to add | optional | any text | none
477
+ 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
478
 
479
  [Bootstrap alert documentation](http://getbootstrap.com/components/#alerts)
480
 
481
+ ### Progress Bars
482
+ [progress striped="true"]
483
+ [progress-bar percent="50"]
484
+ [progress-bar percent="25" type="success"]
485
+ [/progress]
486
+
487
+ #### [progress] parameters
488
+ Parameter | Description | Required | Values | Default
489
+ --- | --- | --- | --- | ---
490
+ striped | Whether enclosed progress bars will be striped | optional | true, false | false
491
+ animated | Whether enclosed progress bars will be animated | optional | true, false | false
492
+ xclass | Any extra classes you want to add | optional | any text | none
493
+ 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
494
+
495
+ #### [progress-bar] parameters
496
+ Parameter | Description | Required | Values | Default
497
+ --- | --- | --- | --- | ---
498
+ percent | The percentage amount to show in the progress bar | required | any number between 0 and 100 | false
499
+ label | Whether to show the percentage as a text label inside the bar | optional | true, false | false
500
+ type | The type of the progress bar | optional | default, primary, success, info, warning, danger | default
501
+ xclass | Any extra classes you want to add | optional | any text | none
502
+ 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
503
+
504
+ [Bootstrap progress bars documentation](http://getbootstrap.com/components/#progress)
505
+
506
+
507
  ### Media Objects
508
  [media]
509
  [media-object pull="right"]
515
  [/media]
516
 
517
  #### [media] parameters
518
+ Parameter | Description | Required | Values | Default
519
+ --- | --- | --- | --- | ---
520
+ xclass | Any extra classes you want to add | optional | any text | none
521
+ 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
522
 
523
  #### [media-object] parameters
524
  Parameter | Description | Required | Values | Default
525
  --- | --- | --- | --- | ---
526
  pull | Whether the image pulls to the left or right | optional | left, right | right
527
+ xclass | Any extra classes you want to add | optional | any text | none
528
+ 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
529
 
530
  #### [media-body] parameters
531
  Parameter | Description | Required | Values | Default
532
  --- | --- | --- | --- | ---
533
  title | The object title | required | Any text | none
534
+ xclass | Any extra classes you want to add | optional | any text | none
535
+ 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
536
 
537
  __NOTE: media-object should contain an image, or linked image, inserted using the WordPress TinyMCE editor__
538
 
539
  [Bootstrap media objects documentation](http://getbootstrap.com/components/#media)
540
 
541
  ### List Groups
542
+
543
+ #### Basic Example
544
  [list-group]
545
  [list-group-item]
546
 
553
  [/list-group-item]
554
  [/list-group]
555
 
556
+ #### Linked Items
557
+ [list-group linked="true"]
558
+ [list-group-item link="#" active="true"]
559
+
560
+ [/list-group-item]
561
+ [list-group-item link="#"]
562
+
563
+ [/list-group-item]
564
+ [list-group-item link="#"]
565
+
566
+ [/list-group-item]
567
+ [/list-group]
568
+
569
+ #### Custom Content
570
+ [list-group linked="true"]
571
+ [list-group-item link="#" active="true"]
572
+ [list-group-item-heading]…[/list-group-item-heading]
573
+ [list-group-item-text]…[/list-group-item-text]
574
+ [/list-group-item]
575
+ [list-group-item link="#"]
576
+ [list-group-item-heading]…[/list-group-item-heading]
577
+ [list-group-item-text]…[/list-group-item-text]
578
+ [/list-group-item]
579
+ [list-group-item link="#"]
580
+ [list-group-item-heading]…[/list-group-item-heading]
581
+ [list-group-item-text]…[/list-group-item-text]
582
+ [/list-group-item]
583
+ [/list-group]
584
+
585
  #### [list-group] parameters
586
+ Parameter | Description | Required | Values | Default
587
+ --- | --- | --- | --- | ---
588
+ linked | Whether this is a linked list group, or a standard one | optional | true, false | false
589
+ xclass | Any extra classes you want to add | optional | any text | none
590
+ 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
591
+
592
+ #### [list-group-item] parameters
593
+ Parameter | Description | Required | Values | Default
594
+ --- | --- | --- | --- | ---
595
+ link | The url you want the list item to link to **Must correspond with the "linked" parameter in [list-group]** | optional | any text | false
596
+ type | The type of the list-group-item | optional | primary, success, info, warning, danger, link | none
597
+ active | Whether the item has the "active" style applied | optional | true, false | false
598
+ xclass | Any extra classes you want to add | optional | any text | none
599
+ 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
600
+
601
+ #### [list-group-item-heading] parameters
602
+ Parameter | Description | Required | Values | Default
603
+ --- | --- | --- | --- | ---
604
+ xclass | Any extra classes you want to add | optional | any text | none
605
+ 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
606
+
607
+ #### [list-group-item-text] parameters
608
+ Parameter | Description | Required | Values | Default
609
+ --- | --- | --- | --- | ---
610
+ xclass | Any extra classes you want to add | optional | any text | none
611
+ 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
612
 
613
  [Bootstrap list groups documentation](http://getbootstrap.com/components/#list-group)
614
 
615
  ### Panels
616
+ [panel type="info" heading="Panel Title" footer="Footer text"] … [/panel]
617
 
618
  #### [panel] parameters
619
  Parameter | Description | Required | Values | Default
620
  --- | --- | --- | --- | ---
621
  type | The type of the panel | optional | default, primary, success, info, warning, danger, link | default
622
+ heading | The panel heading | optional | any text | none
623
+ title | Whether the panel heading should have a title tag around it | optional | true, false | false
624
  footer | The panel footer text if desired | optional | any text | none
625
+ xclass | Any extra classes you want to add | optional | any text | none
626
+ 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
627
 
628
  [Bootstrap panels documentation](http://getbootstrap.com/components/#panels)
629
 
634
  Parameter | Description | Required | Values | Default
635
  --- | --- | --- | --- | ---
636
  size | Modifies the amount of padding inside the well | optional | sm, lg | normal
637
+ xclass | Any extra classes you want to add | optional | any text | none
638
+ 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
639
 
640
  [Bootstrap wells documentation](http://getbootstrap.com/components/#wells)
641
 
642
  ## Javascript
643
 
644
  ### Tabs
645
+ [tabs type="tabs"]
646
+ [tab title="Home" active="true"]
647
 
648
  [/tab]
649
  [tab title="Profile"]
655
  [/tabs]
656
 
657
  #### [tabs] parameters
658
+ Parameter | Description | Required | Values | Default
659
+ --- | --- | --- | --- | ---
660
+ type | The type of nav | required | tabs, pills | tabs
661
+ xclass | Any extra classes you want to add | optional | any text | none
662
+ 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
663
 
664
  #### [tab] parameters
665
  Parameter | Description | Required | Values | Default
666
  --- | --- | --- | --- | ---
667
  title | The title of the tab | required | any text | false
668
+ active | Whether this tab should be "active" or selected | optional | true, false | false
669
+ fade | Whether to use the "fade" effect when showing this tab | optional | true, false | false
670
+ xclass | Any extra classes you want to add | optional | any text | none
671
+ 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
672
 
673
  [Bootstrap tabs documentation](http://getbootstrap.com/javascript/#tabs)
674
 
713
  [/collapsibles]
714
 
715
  #### [collapsibles] parameters
716
+ Parameter | Description | Required | Values | Default
717
+ --- | --- | --- | --- | ---
718
+ xclass | Any extra classes you want to add | optional | any text | none
719
+ 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
720
 
721
  #### [collapse] parameters
722
  Parameter | Description | Required | Values | Default
723
  --- | --- | --- | --- | ---
724
  title | The title of the collapsible, visible when collapsed | required | any text | false
725
  type | The type of the panel | optional | default, primary, success, info, warning, danger, link | default
726
+ active | Whether the tab is expanded at load time | optional | true, false | false
727
+ xclass | Any extra classes you want to add | optional | any text | none
728
+ 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
729
 
730
  [Bootstrap collapse documentation](http://getbootstrap.com/javascript/#collapse)
731
 
732
+ ### Carousel
733
+ [carousel]
734
+ [carousel-item active="true"] … [/carousel-item]
735
+ [carousel-item] … [/carousel-item]
736
+ [carousel-item] … [/carousel-item]
737
+ [/carousel]
738
+
739
+ [carousel-item] wraps an HTML image tag or image inserted via the WordPress editor.
740
+ #### [carousel] parameters
741
+ Parameter | Description | Required | Values | Default
742
+ --- | --- | --- | --- | ---
743
+ interval | The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. | optional | any number (in ms) or "false" | 5000
744
+ wrap | Whether the carousel should cycle continuously or have hard stops. | optional | true, false | false
745
+ xclass | Any extra classes you want to add | optional | any text | none
746
+ 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
747
+
748
+ #### [carousel-item] parameters
749
+ Parameter | Description | Required | Values | Default
750
+ --- | --- | --- | --- | ---
751
+ active | Whether the item has the "active" style applied. One item MUST be set as active. | optional | true, false | false
752
+ caption | This carousel slide's caption | optional | Any text | none
753
+ xclass | Any extra classes you want to add | optional | any text | none
754
+ 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
755
+
756
+ [Bootstrap carousel documentation](http://getbootstrap.com/javascript/#carousel)
757
+
758
+
759
  ### Modal
760
  [modal text="This is my modal" title="Modal Title Goes Here" xclass="btn btn-primary btn-large"]
761
 
769
  --- | --- | --- | --- | ---
770
  text | Text of the modal trigger link | required | any text | none
771
  title | Title of the modal popup | required | any text | none
772
+ size | Optional modal size | optional | lg, sm | none
773
  xclass | Any extra classes you want to add to the trigger link | optional | any text | none
774
+ 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
775
 
776
  #### [modal-footer] parameters
777
+ Parameter | Description | Required | Values | Default
778
+ --- | --- | --- | --- | ---
779
+ xclass | Any extra classes you want to add | optional | any text | none
780
+ 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
781
 
782
  [Bootstrap modal documentation](http://getbootstrap.com/javascript/#modals)
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.0.3
7
  Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
8
  Author URI:
9
  License: GPL2
@@ -27,28 +27,30 @@ License: GPL2
27
 
28
  /* ============================================================= */
29
 
30
- require_once(dirname(__FILE__) . '/includes/defaults.php');
31
- require_once(dirname(__FILE__) . '/includes/functions.php');
32
- require_once(dirname(__FILE__) . '/includes/actions-filters.php');
33
-
34
- function bootsrap_shortcodes_scripts() {
35
-
36
- // Bootstrap tooltip js
37
- wp_enqueue_script( 'bootstrap-shortcodes-tooltip', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-tooltip.js', array( 'jquery' ), false, true );
38
-
39
- // Bootstrap popover js
40
- wp_enqueue_script( 'bootstrap-shortcodes-popover', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-popover.js', array( 'jquery' ), false, true );
41
-
42
- }
43
- add_action( 'wp_enqueue_scripts', 'bootsrap_shortcodes_scripts', 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
44
 
45
  // Begin Shortcodes
46
  class BoostrapShortcodes {
47
 
48
  function __construct() {
49
  add_action( 'init', array( $this, 'add_shortcodes' ) );
 
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  /*--------------------------------------------------------------------------------------
54
  *
@@ -60,82 +62,114 @@ class BoostrapShortcodes {
60
  *-------------------------------------------------------------------------------------*/
61
  function add_shortcodes() {
62
 
63
- add_shortcode('button', array( $this, 'bs_button' ));
64
- add_shortcode('button-group', array( $this, 'bs_button_group' ));
65
- add_shortcode('alert', array( $this, 'bs_alert' ));
66
- add_shortcode('code', array( $this, 'bs_code' ));
67
- add_shortcode('span', array( $this, 'bs_span' ));
68
- add_shortcode('row', array( $this, 'bs_row' ));
69
- add_shortcode('column', array( $this, 'bs_column' ));
70
- add_shortcode('label', array( $this, 'bs_label' ));
71
- add_shortcode('list-group', array( $this, 'bs_list_group' ));
72
- add_shortcode('list-group-item', array( $this, 'bs_list_group_item' ));
73
- add_shortcode('badge', array( $this, 'bs_badge' ));
74
- add_shortcode('icon', array( $this, 'bs_icon' ));
75
- add_shortcode('icon_white', array( $this, 'bs_icon_white' ));
76
- add_shortcode('table', array( $this, 'bs_table' ));
77
- add_shortcode('table-wrap', array( $this, 'bs_table_wrap' ));
78
- add_shortcode('collapsibles', array( $this, 'bs_collapsibles' ));
79
- add_shortcode('collapse', array( $this, 'bs_collapse' ));
80
- add_shortcode('well', array( $this, 'bs_well' ));
81
- add_shortcode('tabs', array( $this, 'bs_tabs' ));
82
- add_shortcode('tab', array( $this, 'bs_tab' ));
83
- add_shortcode('tooltip', array( $this, 'bs_tooltip' ));
84
- add_shortcode('popover', array( $this, 'bs_popover' ));
85
- add_shortcode('panel', array( $this, 'bs_panel' ));
86
- add_shortcode('media', array( $this, 'bs_media' ));
87
- add_shortcode('media-object', array( $this, 'bs_media_object' ));
88
- add_shortcode('media-body', array( $this, 'bs_media_body' ));
89
- add_shortcode('jumbotron', array( $this, 'bs_jumbotron' ));
90
- add_shortcode('lead', array( $this, 'bs_lead' ));
91
- add_shortcode('emphasis', array( $this, 'bs_emphasis' ));
92
- add_shortcode('thumbnail', array( $this, 'bs_thumbnail' ));
93
- add_shortcode('responsive', array( $this, 'bs_responsive' ));
94
- add_shortcode('modal', array( $this, 'bs_modal' ));
95
- add_shortcode('modal-footer', array( $this, 'bs_modal_footer' ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
- }
98
 
 
 
 
 
99
 
 
100
 
101
  /*--------------------------------------------------------------------------------------
102
  *
103
  * bs_button
104
  *
105
- * @author Filip Stefansson
106
  * @since 1.0
107
  * //DW mod added xclass var
108
  *-------------------------------------------------------------------------------------*/
109
- function bs_button($atts, $content = null) {
110
- extract(shortcode_atts(array(
111
- "type" => false,
112
- "size" => false,
113
- "block" => false,
114
- "link" => '',
115
- "target" => false,
116
- "xclass" => false,
117
- "title" => false,
118
- "data" => false
119
- ), $atts));
120
- if($data) {
121
- $data = explode('|',$data);
122
- foreach($data as $d):
123
- $d = explode(',',$d);
124
- $data_props .= 'data-'.$d[0]. '="'.$d[1].'" ';
125
- endforeach;
126
- } else { $data_props = false; }
127
- $return = '<a href="' . $link . '" class="btn';
128
- $return .= ($type) ? ' btn-' . $type : ' btn-default';
129
- $return .= ($size) ? ' btn-' . $size : '';
130
- $return .= ($block) ? ' btn-block' : '';
131
- $return .= ($xclass) ? ' ' . $xclass : '';
132
- $return .= '"';
133
- $return .= ($target) ? ' target="' . $target . '"' : '';
134
- $return .= ($title) ? ' title="' . $title . '"' : '';
135
- $return .= ($data_props) ? ' ' . $data_props : '';
136
- $return .= '>' . do_shortcode( $content ) . '</a>';
137
-
138
- return $return;
 
 
 
 
 
 
 
139
  }
140
 
141
  /*--------------------------------------------------------------------------------------
@@ -146,24 +180,309 @@ class BoostrapShortcodes {
146
  *
147
  *-------------------------------------------------------------------------------------*/
148
  function bs_button_group( $atts, $content = null ) {
149
- extract(shortcode_atts(array(
150
- "size" => false,
151
- "vertical" => false,
152
- "justified" => false
153
- ), $atts));
154
- if($size) {
155
- $classes .= ' btn-group-'.$size;
156
- }
157
- if($vertical) {
158
- $classes .= ' btn-group-vertical';
159
- }
160
- if($justified) {
161
- $classes .= ' btn-group-justified';
162
- }
163
- return '<div class="btn-group '.$classes.'">' . do_shortcode( $content ) . '</div>';
 
 
 
 
 
 
 
 
 
 
 
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
 
 
167
  /*--------------------------------------------------------------------------------------
168
  *
169
  * bs_alert
@@ -172,23 +491,93 @@ class BoostrapShortcodes {
172
  * @since 1.0
173
  *
174
  *-------------------------------------------------------------------------------------*/
175
- function bs_alert($atts, $content = null) {
176
- extract(shortcode_atts(array(
177
- "type" => 'success',
178
- "strong" => false,
179
- "dismissable" => false
180
- ), $atts));
181
- $return = '<div class="alert alert-' . $type;
182
- $return .= ($dismissable) ? ' alert-dismissable' : '';
183
- $return .= '">';
184
- $return .= ($dismissable) ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' : '';
185
- $return .= ($strong) ? '<strong>'.$strong.'</strong>' : '';
186
- $return .= do_shortcode( $content ) . '</div>';
187
- return $return;
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
  /*--------------------------------------------------------------------------------------
194
  *
@@ -198,24 +587,30 @@ class BoostrapShortcodes {
198
  * @since 1.0
199
  *
200
  *-------------------------------------------------------------------------------------*/
201
- function bs_code($atts, $content = null) {
202
- extract(shortcode_atts(array(
203
- "inline" => false,
204
- "scrollable" => false
205
- ), $atts));
206
- if($inline) {
207
- $return = '<code>' . $content . '</code>';
208
- } else {
209
- $return = '<pre';
210
- $return .= ($scrollable) ? ' class="pre-scrollable"': '';
211
- $return .= '>' . $content . '</pre>';
212
- }
213
- return $return;
 
 
 
 
 
 
 
 
 
214
  }
215
 
216
-
217
-
218
-
219
  /*--------------------------------------------------------------------------------------
220
  *
221
  * bs_span
@@ -226,17 +621,14 @@ class BoostrapShortcodes {
226
  * @see bs_column
227
  *-------------------------------------------------------------------------------------*/
228
  function bs_span( $atts, $content = null ) {
229
- extract(shortcode_atts(array(
230
  "size" => 'size'
231
- ), $atts));
232
-
233
- return '<div class="span' . $size . '">' . do_shortcode( $content ) . '</div>';
234
 
 
 
235
  }
236
 
237
-
238
-
239
-
240
  /*--------------------------------------------------------------------------------------
241
  *
242
  * bs_row
@@ -246,14 +638,25 @@ class BoostrapShortcodes {
246
  *
247
  *-------------------------------------------------------------------------------------*/
248
  function bs_row( $atts, $content = null ) {
249
-
250
- return '<div class="row">' . do_shortcode( $content ) . '</div>';
251
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
  }
253
 
254
-
255
-
256
-
257
  /*--------------------------------------------------------------------------------------
258
  *
259
  * bs_column
@@ -263,44 +666,55 @@ class BoostrapShortcodes {
263
  * @todo pull and offset
264
  *-------------------------------------------------------------------------------------*/
265
  function bs_column( $atts, $content = null ) {
266
- extract(shortcode_atts(array(
267
- "lg" => false,
268
- "md" => false,
269
- "sm" => false,
270
- "xs" => false,
271
- "offset_lg" => false,
272
- "offset_md" => false,
273
- "offset_sm" => false,
274
- "offset_xs" => false,
275
- "pull_lg" => false,
276
- "pull_md" => false,
277
- "pull_sm" => false,
278
- "pull_xs" => false,
279
- "push_lg" => false,
280
- "push_md" => false,
281
- "push_sm" => false,
282
- "push_xs" => false,
283
- ), $atts));
284
- $return = '<div class="';
285
- $return .= ($lg) ? 'col-lg-' . $lg . ' ' : '';
286
- $return .= ($md) ? 'col-md-' . $md . ' ' : '';
287
- $return .= ($sm) ? 'col-sm-' . $sm . ' ' : '';
288
- $return .= ($xs) ? 'col-xs-' . $xs . ' ' : '';
289
- $return .= ($offset_lg) ? 'col-lg-offset-' . $offset_lg . ' ' : '';
290
- $return .= ($offset_md) ? 'col-md-offset-' . $offset_md . ' ' : '';
291
- $return .= ($offset_sm) ? 'col-sm-offset-' . $offset_sm . ' ' : '';
292
- $return .= ($offset_xs) ? 'col-xs-offset-' . $offset_xs . ' ' : '';
293
- $return .= ($pull_lg) ? 'col-lg-pull-' . $pull_lg . ' ' : '';
294
- $return .= ($pull_md) ? 'col-md-pull-' . $pull_md . ' ' : '';
295
- $return .= ($pull_sm) ? 'col-sm-pull-' . $pull_sm . ' ' : '';
296
- $return .= ($pull_xs) ? 'col-xs-pull-' . $pull_xs . ' ' : '';
297
- $return .= ($push_lg) ? 'col-lg-push-' . $push_lg . ' ' : '';
298
- $return .= ($push_md) ? 'col-md-push-' . $push_md . ' ' : '';
299
- $return .= ($push_sm) ? 'col-sm-push-' . $push_sm . ' ' : '';
300
- $return .= ($push_xs) ? 'col-xs-push-' . $push_xs . ' ' : '';
301
- $return .= '">' . do_shortcode( $content ) . '</div>';
302
 
303
- return $return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  }
305
 
306
  /*--------------------------------------------------------------------------------------
@@ -312,9 +726,25 @@ class BoostrapShortcodes {
312
  *-------------------------------------------------------------------------------------*/
313
  function bs_list_group( $atts, $content = null ) {
314
 
315
- return '<ul class="list-group">' . do_shortcode( $content ) . '</ul>';
316
-
317
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
 
319
  /*--------------------------------------------------------------------------------------
320
  *
@@ -325,8 +755,134 @@ class BoostrapShortcodes {
325
  *-------------------------------------------------------------------------------------*/
326
  function bs_list_group_item( $atts, $content = null ) {
327
 
328
- return '<li class="list-group-item">' . do_shortcode( $content ) . '</li>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  }
331
 
332
  /*--------------------------------------------------------------------------------------
@@ -338,17 +894,27 @@ class BoostrapShortcodes {
338
  *
339
  *-------------------------------------------------------------------------------------*/
340
  function bs_label( $atts, $content = null ) {
341
- extract(shortcode_atts(array(
342
- "type" => 'default'
343
- ), $atts));
344
 
345
- return '<span class="label label-' . $type . '">' . do_shortcode( $content ) . '</span>';
 
 
 
 
 
 
 
 
 
 
346
 
 
 
 
 
 
 
347
  }
348
 
349
-
350
-
351
-
352
  /*--------------------------------------------------------------------------------------
353
  *
354
  * bs_badge
@@ -358,17 +924,27 @@ class BoostrapShortcodes {
358
  *
359
  *-------------------------------------------------------------------------------------*/
360
  function bs_badge( $atts, $content = null ) {
361
- extract(shortcode_atts(array(
362
- "right" => false
363
- ), $atts));
364
- $right = ($right) ? " pull-right" : "";
365
- return '<span class="badge' . $right . '">' . do_shortcode( $content ) . '</span>';
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  }
368
 
369
-
370
-
371
-
372
  /*--------------------------------------------------------------------------------------
373
  *
374
  * bs_icon
@@ -378,12 +954,25 @@ class BoostrapShortcodes {
378
  *
379
  *-------------------------------------------------------------------------------------*/
380
  function bs_icon( $atts, $content = null ) {
381
- extract(shortcode_atts(array(
382
- "type" => 'type',
383
- ), $atts));
384
-
385
- return '<span class="glyphicon glyphicon-' . $type . '"></span>';
386
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  }
388
 
389
  /*--------------------------------------------------------------------------------------
@@ -438,20 +1027,32 @@ class BoostrapShortcodes {
438
  *
439
  *-------------------------------------------------------------------------------------*/
440
  function bs_table_wrap( $atts, $content = null ) {
441
- extract( shortcode_atts( array(
442
- 'bordered' => false,
443
- 'striped' => false,
444
- 'hover' => false,
445
- 'condensed' => false,
446
- ), $atts ) );
447
- $classes = 'table';
448
- $classes .= ($bordered) ? ' table-bordered' : '';
449
- $classes .= ($striped) ? ' table-striped' : '';
450
- $classes .= ($hover) ? ' table-hover' : '';
451
- $classes .= ($condensed) ? ' table-condensed' : '';
 
 
 
 
 
452
  $dom = new DOMDocument;
453
  $dom->loadXML($content);
454
- $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . $classes);
 
 
 
 
 
 
 
455
  $return = $dom->saveXML();
456
  return $return;
457
  }
@@ -468,17 +1069,27 @@ class BoostrapShortcodes {
468
  * size: sm = small, lg = large
469
  *
470
  *-------------------------------------------------------------------------------------*/
471
- function bs_well( $atts, $content = null ) {
472
- extract(shortcode_atts(array(
473
- "size" => false
474
- ), $atts));
475
-
476
- if($size) {
477
- $size = ' well-'.$size;
478
- }
479
-
480
- return '<div class="well' . $size . '">' . do_shortcode( $content ) . '</div>';
481
- }
 
 
 
 
 
 
 
 
 
 
482
 
483
  /*--------------------------------------------------------------------------------------
484
  *
@@ -489,16 +1100,49 @@ class BoostrapShortcodes {
489
  *
490
  *-------------------------------------------------------------------------------------*/
491
  function bs_panel( $atts, $content = null ) {
492
- extract(shortcode_atts(array(
493
- "title" => '',
494
- "type" => 'default',
495
- "footer" => false
496
- ), $atts));
497
- if($footer) {
498
- $footer = '<div class="panel-footer">' . $footer . '</div>';
499
- }
500
- return '<div class="panel panel-' . $type . '"><div class="panel-heading"><h3 class="panel-title">' . $title . '</h3></div><div class="panel-body">' . do_shortcode( $content ) . '</div>' . $footer . '</div>';
501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  }
503
 
504
  /*--------------------------------------------------------------------------------------
@@ -512,51 +1156,63 @@ class BoostrapShortcodes {
512
  *-------------------------------------------------------------------------------------*/
513
  function bs_tabs( $atts, $content = null ) {
514
 
515
- if( isset($GLOBALS['tabs_count']) )
516
  $GLOBALS['tabs_count']++;
517
  else
518
  $GLOBALS['tabs_count'] = 0;
519
 
520
- $defaults = array('class' => 'nav-tabs');
521
- extract( shortcode_atts( $defaults, $atts ) );
522
-
523
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
524
  // Extract the tab titles for use in the tab widget.
525
- preg_match_all( '/tab title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE );
526
-
527
- $tab_titles = array();
528
- if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
529
-
530
- $output = '';
531
-
532
- if( count($tab_titles) ){
533
- $output .= '<ul class="nav ' . $class . '" id="custom-tabs-'. rand(1, 100) .'">';
534
-
535
  $i = 0;
536
- foreach( $tab_titles as $tab ){
537
- if($i == 0)
538
- $output .= '<li class="active">';
539
- else
540
- $output .= '<li>';
541
-
542
- $output .= '<a href="#custom-tab-' . $GLOBALS['tabs_count'] . '-' . sanitize_title( $tab[0] ) . '" data-toggle="tab">' . $tab[0] . '</a></li>';
 
543
  $i++;
544
  }
545
-
546
- $output .= '</ul>';
547
- $output .= '<div class="tab-content">';
548
- $output .= do_shortcode( $content );
549
- $output .= '</div>';
550
- } else {
551
- $output .= do_shortcode( $content );
552
  }
553
-
554
- return $output;
 
 
 
 
 
 
 
555
  }
556
 
557
-
558
-
559
-
560
  /*--------------------------------------------------------------------------------------
561
  *
562
  * bs_tab
@@ -567,23 +1223,36 @@ class BoostrapShortcodes {
567
  *-------------------------------------------------------------------------------------*/
568
  function bs_tab( $atts, $content = null ) {
569
 
570
- if( !isset($GLOBALS['current_tabs']) ) {
571
- $GLOBALS['current_tabs'] = $GLOBALS['tabs_count'];
572
- $state = 'active';
573
- } else {
574
-
575
- if( $GLOBALS['current_tabs'] == $GLOBALS['tabs_count'] ) {
576
- $state = '';
577
- } else {
578
- $GLOBALS['current_tabs'] = $GLOBALS['tabs_count'];
579
- $state = 'active';
580
- }
581
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
582
 
583
- $defaults = array( 'title' => 'Tab');
584
- extract( shortcode_atts( $defaults, $atts ) );
585
-
586
- return '<div id="custom-tab-' . $GLOBALS['tabs_count'] . '-'. sanitize_title( $title ) .'" class="tab-pane ' . $state . '">'. do_shortcode( $content ) .'</div>';
587
  }
588
 
589
 
@@ -604,31 +1273,29 @@ class BoostrapShortcodes {
604
  else
605
  $GLOBALS['collapsibles_count'] = 0;
606
 
607
- $defaults = array();
608
- extract( shortcode_atts( $defaults, $atts ) );
609
-
610
- // Extract the tab titles for use in the tab widget.
611
- preg_match_all( '/collapse title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE );
612
-
613
- $tab_titles = array();
614
- if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
615
-
616
- $output = '';
617
-
618
- if( count($tab_titles) ){
619
- $output .= '<div class="panel-group" id="accordion-' . $GLOBALS['collapsibles_count'] . '">';
620
- $output .= do_shortcode( $content );
621
- $output .= '</div>';
622
- } else {
623
- $output .= do_shortcode( $content );
624
- }
 
625
 
626
- return $output;
627
  }
628
 
629
 
630
-
631
-
632
  /*--------------------------------------------------------------------------------------
633
  *
634
  * bs_collapse
@@ -639,24 +1306,161 @@ class BoostrapShortcodes {
639
  *-------------------------------------------------------------------------------------*/
640
  function bs_collapse( $atts, $content = null ) {
641
 
642
- if( !isset($GLOBALS['current_collapse']) )
643
- $GLOBALS['current_collapse'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
  else
645
- $GLOBALS['current_collapse']++;
646
 
647
- extract(shortcode_atts(array(
648
- "title" => '',
649
- "type" => 'default',
650
- "state" => false
651
- ), $atts));
652
 
653
- if ($state == "active")
654
- $state = 'in';
 
 
 
 
 
655
 
656
- return '<div class="panel panel-' . $type . '"><div class="panel-heading"><h3 class="panel-title"><a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion-' . $GLOBALS['collapsibles_count'] . '" href="#collapse_' . $GLOBALS['current_collapse'] . '_'. sanitize_title( $title ) .'">' . $title . '</a></h3></div><div id="collapse_' . $GLOBALS['current_collapse'] . '_'. sanitize_title( $title ) .'" class="panel-collapse collapse ' . $state . '"><div class="panel-body">' . do_shortcode($content) . ' </div></div></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  }
658
 
659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
  /*--------------------------------------------------------------------------------------
661
  *
662
  * bs_tooltip
@@ -669,21 +1473,25 @@ class BoostrapShortcodes {
669
  function bs_tooltip( $atts, $content = null ) {
670
 
671
  $defaults = array(
672
- 'title' => '',
673
- 'placement' => 'top',
674
- 'animation' => 'true',
675
- 'html' => 'false'
676
  );
677
  extract( shortcode_atts( $defaults, $atts ) );
678
- $classes = 'bs-tooltip';
 
679
 
 
680
  $dom = new DOMDocument;
681
  $dom->loadXML($content);
 
 
682
  if(!$dom->documentElement) {
683
  $element = $dom->createElement('span', $content);
684
  $dom->appendChild($element);
685
  }
686
- $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . $classes);
687
  $dom->documentElement->setAttribute('title', $title );
688
  if($animation) { $dom->documentElement->setAttribute('data-animation', $animation ); }
689
  if($placement) { $dom->documentElement->setAttribute('data-placement', $placement ); }
@@ -704,22 +1512,26 @@ function bs_tooltip( $atts, $content = null ) {
704
  function bs_popover( $atts, $content = null ) {
705
 
706
  $defaults = array(
707
- 'title' => false,
708
- 'text' => '',
709
- 'placement' => 'top',
710
- 'animation' => 'true',
711
- 'html' => 'false'
712
  );
713
  extract( shortcode_atts( $defaults, $atts ) );
714
- $classes = 'bs-popover';
715
 
 
 
 
716
  $dom = new DOMDocument;
717
  $dom->loadXML($content);
 
 
718
  if(!$dom->documentElement) {
719
  $element = $dom->createElement('span', $content);
720
  $dom->appendChild($element);
721
  }
722
- $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . $classes);
723
  $dom->documentElement->setAttribute('data-toggle', 'popover' );
724
  if($title) { $dom->documentElement->setAttribute('data-original-title', $title ); }
725
  $dom->documentElement->setAttribute('data-content', $text );
@@ -742,41 +1554,80 @@ function bs_popover( $atts, $content = null ) {
742
  *
743
  *-------------------------------------------------------------------------------------*/
744
 
745
- function bs_media( $atts, $content = null ) {
746
-
747
- $defaults = array(
748
- 'title' => false,
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  );
750
- extract( shortcode_atts( $defaults, $atts ) );
751
- return '<div class="media">' . do_shortcode( $content ) . '</div>';
752
  }
753
 
754
- function bs_media_object( $atts, $content = null ) {
755
 
756
- $defaults = array(
757
- 'pull' => "left",
758
- );
759
- extract( shortcode_atts( $defaults, $atts ) );
 
760
 
761
- $classes = "media-object";
 
 
 
762
  $dom = new DOMDocument;
763
  $dom->loadXML($content);
764
- $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . $classes);
 
 
 
 
 
 
 
 
 
765
  $return = $dom->saveXML();
766
- $return = '<span class="pull-'. $pull . '">' . $return . '</span>';
 
767
  return $return;
768
  }
769
 
770
- function bs_media_body( $atts, $content = null ) {
771
-
772
- $defaults = array(
773
- 'title' => false,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  );
775
- extract( shortcode_atts( $defaults, $atts ) );
776
- $return .= '<div class="media-body">';
777
- $return .= ($title) ? '<h4 class="media-heading">' . $title . '</h4>' : '';
778
- $return .= $content . '</div>';
779
- return $return;
780
  }
781
 
782
  /*--------------------------------------------------------------------------------------
@@ -786,16 +1637,78 @@ function bs_media_body( $atts, $content = null ) {
786
  *
787
  *-------------------------------------------------------------------------------------*/
788
  function bs_jumbotron( $atts, $content = null ) {
789
- extract(shortcode_atts(array(
790
- "title" => false
791
- ), $atts));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
792
 
793
- $return .='<div class="jumbotron">';
794
- $return .= ($title) ? '<h1>' . $title . '</h1>' : '';
795
- $return .= do_shortcode( $content ) . '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
796
  return $return;
797
- }
798
 
 
 
799
  /*--------------------------------------------------------------------------------------
800
  *
801
  * bs_lead
@@ -803,8 +1716,22 @@ function bs_media_body( $atts, $content = null ) {
803
  *
804
  *-------------------------------------------------------------------------------------*/
805
  function bs_lead( $atts, $content = null ) {
806
- return '<p class="lead">' . do_shortcode( $content ) . '</p>';
807
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
808
  }
809
 
810
  /*--------------------------------------------------------------------------------------
@@ -814,13 +1741,66 @@ function bs_media_body( $atts, $content = null ) {
814
  *
815
  *-------------------------------------------------------------------------------------*/
816
  function bs_emphasis( $atts, $content = null ) {
817
- extract(shortcode_atts(array(
818
- "type" => 'muted'
819
- ), $atts));
820
- return '<p class="text-' . $type . '">' . do_shortcode( $content ) . '</p>';
821
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
822
  }
823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  /*--------------------------------------------------------------------------------------
825
  *
826
  * bs_thumbnail
@@ -828,15 +1808,30 @@ function bs_media_body( $atts, $content = null ) {
828
  *
829
  *-------------------------------------------------------------------------------------*/
830
  function bs_thumbnail( $atts, $content = null ) {
831
- $classes = "thumbnail";
 
 
 
 
 
 
 
 
832
  $dom = new DOMDocument;
833
  $dom->loadXML($content);
834
- if(!$dom->documentElement) {
 
835
  $element = $dom->createElement('div', $content);
836
  $dom->appendChild($element);
837
  }
838
- $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . $classes);
839
-
 
 
 
 
 
 
840
  $return = $dom->saveXML();
841
 
842
  return $return;
@@ -850,34 +1845,37 @@ function bs_media_body( $atts, $content = null ) {
850
  *
851
  *-------------------------------------------------------------------------------------*/
852
  function bs_responsive( $atts, $content = null ) {
853
- extract( shortcode_atts( array(
854
- 'visible' => '',
855
- 'hidden' => '',
856
- ), $atts ) );
857
- if($visible) {
858
- $visible = explode(' ',$visible);
859
- foreach($visible as $v):
860
- $classes .= 'visible-'.$v.' ';
861
- endforeach;
862
- }
863
- if($hidden) {
864
- $hidden = explode(' ',$hidden);
865
- foreach($hidden as $h):
866
- $classes .= 'hidden-'.$h.' ';
867
- endforeach;
868
- }
869
- $dom = new DOMDocument;
870
- $dom->loadXML($content);
871
- if(!$dom->documentElement) {
872
- $element = $dom->createElement('p', $content);
873
- $dom->appendChild($element);
874
  }
875
- $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . $classes);
876
-
877
- $return = $dom->saveXML();
878
-
879
- return $return;
880
-
 
 
 
 
 
 
 
 
 
 
881
  }
882
 
883
  /*--------------------------------------------------------------------------------------
@@ -889,28 +1887,49 @@ function bs_media_body( $atts, $content = null ) {
889
  *
890
  *-------------------------------------------------------------------------------------*/
891
  function bs_modal( $atts, $content = null ) {
892
- extract(shortcode_atts(array(
893
- "text" => '',
894
- "title" => '',
895
- "xclass" => ''
896
- ), $atts));
897
- $sani_title = 'modal'. sanitize_title( $title );
898
- $return .='<a data-toggle="modal" href="#'. $sani_title .'" class="'. $xclass .'">'. $text .'</a>';
899
- $return .='<div class="modal fade" id="'. $sani_title .'" tabindex="-1" role="dialog" aria-hidden="true">';
900
- $return .='<div class="modal-dialog">';
901
- $return .='<div class="modal-content">';
902
- $return .='<div class="modal-header">';
903
- $return .='<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>';
904
- $return .='<h4 class="modal-title">'. $title .'</h4>';
905
- $return .='</div>';
906
- $return .='<div class="modal-body">';
907
- $return .= do_shortcode($content);
908
- $return .='</div>';
909
- $return .='</div><!-- /.modal-content -->';
910
- $return .='</div><!-- /.modal-dialog -->';
911
- $return .='</div><!-- /.modal -->';
912
- return $return;
913
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
914
  }
915
 
916
  /*--------------------------------------------------------------------------------------
@@ -922,8 +1941,41 @@ function bs_media_body( $atts, $content = null ) {
922
  *
923
  *-------------------------------------------------------------------------------------*/
924
  function bs_modal_footer( $atts, $content = null ) {
925
- return '<div class="modal-footer">' . do_shortcode( $content ) . '</div>';
926
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
927
  }
928
 
929
  }
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.0.3.6
7
  Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
8
  Author URI:
9
  License: GPL2
27
 
28
  /* ============================================================= */
29
 
30
+ require_once( dirname( __FILE__ ) . '/includes/defaults.php' );
31
+ require_once( dirname( __FILE__ ) . '/includes/functions.php' );
32
+ require_once( dirname( __FILE__ ) . '/includes/actions-filters.php' );
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  // Begin Shortcodes
35
  class BoostrapShortcodes {
36
 
37
  function __construct() {
38
  add_action( 'init', array( $this, 'add_shortcodes' ) );
39
+ add_action( 'wp_enqueue_scripts', array( $this, 'bootstrap_shortcodes_scripts' ), 9999 ); // Register this fxn and allow Wordpress to call it automatcally in the header
40
  }
41
 
42
+ function bootstrap_shortcodes_scripts() {
43
+
44
+ // Bootstrap tooltip js
45
+ wp_enqueue_script( 'bootstrap-shortcodes-tooltip', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-tooltip.js', array( 'jquery' ), false, true );
46
+
47
+ // Bootstrap popover js
48
+ wp_enqueue_script( 'bootstrap-shortcodes-popover', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-popover.js', array( 'jquery' ), false, true );
49
+
50
+ // Bootstrap scrollspy js
51
+ //wp_enqueue_script( 'bootstrap-shortcodes-scrollspy', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-scrollspy.js', array( 'jquery' ), false, true );
52
+
53
+ }
54
 
55
  /*--------------------------------------------------------------------------------------
56
  *
62
  *-------------------------------------------------------------------------------------*/
63
  function add_shortcodes() {
64
 
65
+ $shortcodes = array(
66
+ 'alert',
67
+ 'badge',
68
+ 'breadcrumb',
69
+ 'breadcrumb-item',
70
+ 'button',
71
+ 'button-group',
72
+ 'button-toolbar',
73
+ 'caret',
74
+ 'carousel',
75
+ 'carousel-item',
76
+ 'code',
77
+ 'collapse',
78
+ 'collapsibles',
79
+ 'column',
80
+ 'container',
81
+ 'divider',
82
+ 'dropdown',
83
+ 'dropdown-header',
84
+ 'dropdown-item',
85
+ 'emphasis',
86
+ 'icon',
87
+ 'img',
88
+ 'jumbotron',
89
+ 'label',
90
+ 'lead',
91
+ 'list-group',
92
+ 'list-group-item',
93
+ 'list-group-item-heading',
94
+ 'list-group-item-text',
95
+ 'media',
96
+ 'media-body',
97
+ 'media-object',
98
+ 'modal',
99
+ 'modal-footer',
100
+ 'nav',
101
+ 'nav-item',
102
+ 'page-header',
103
+ 'panel',
104
+ 'popover',
105
+ 'progress',
106
+ 'progress-bar',
107
+ 'responsive',
108
+ 'row',
109
+ 'span',
110
+ 'tab',
111
+ 'table',
112
+ 'table-wrap',
113
+ 'tabs',
114
+ 'thumbnail',
115
+ 'tooltip',
116
+ 'well',
117
+ );
118
 
119
+ foreach ( $shortcodes as $shortcode ) {
120
 
121
+ $function = 'bs_' . str_replace( '-', '_', $shortcode );
122
+ add_shortcode( $shortcode, array( $this, $function ) );
123
+
124
+ }
125
 
126
+ }
127
 
128
  /*--------------------------------------------------------------------------------------
129
  *
130
  * bs_button
131
  *
132
+ * @author Filip Stefansson, Nicolas Jonas
133
  * @since 1.0
134
  * //DW mod added xclass var
135
  *-------------------------------------------------------------------------------------*/
136
+ function bs_button( $atts, $content = null ) {
137
+
138
+ extract( shortcode_atts( array(
139
+ "type" => false,
140
+ "size" => false,
141
+ "block" => false,
142
+ "dropdown" => false,
143
+ "link" => '',
144
+ "target" => false,
145
+ "disabled" => false,
146
+ "active" => false,
147
+ "xclass" => false,
148
+ "title" => false,
149
+ "data" => false
150
+ ), $atts ) );
151
+
152
+ $class = 'btn';
153
+ $class .= ( $type ) ? ' btn-' . $type : ' btn-default';
154
+ $class .= ( $size ) ? ' btn-' . $size : '';
155
+ $class .= ( $block ) ? ' btn-block' : '';
156
+ $class .= ( $dropdown ) ? ' dropdown-toggle' : '';
157
+ $class .= ( $disabled ) ? ' disabled' : '';
158
+ $class .= ( $active ) ? ' active' : '';
159
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
160
+
161
+ $data_props = $this->parse_data_attributes( $data );
162
+
163
+ return sprintf(
164
+ '<a href="%s" class="%s"%s%s%s>%s</a>',
165
+ esc_url( $link ),
166
+ esc_attr( $class ),
167
+ ( $target ) ? sprintf( ' target="%s"', esc_attr( $target ) ) : '',
168
+ ( $title ) ? sprintf( ' title="%s"', esc_attr( $title ) ) : '',
169
+ ( $data_props ) ? ' ' . $data_props : '',
170
+ do_shortcode( $content )
171
+ );
172
+
173
  }
174
 
175
  /*--------------------------------------------------------------------------------------
180
  *
181
  *-------------------------------------------------------------------------------------*/
182
  function bs_button_group( $atts, $content = null ) {
183
+
184
+ extract( shortcode_atts( array(
185
+ "size" => false,
186
+ "vertical" => false,
187
+ "justified" => false,
188
+ "dropup" => false,
189
+ "xclass" => false,
190
+ "data" => false
191
+ ), $atts ) );
192
+
193
+ $class = 'btn-group';
194
+ $class .= ( $size ) ? ' btn-group-' . $size : '';
195
+ $class .= ( $vertical ) ? ' btn-group-vertical' : '';
196
+ $class .= ( $justified ) ? ' btn-group-justified' : '';
197
+ $class .= ( $dropup ) ? ' dropup' : '';
198
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
199
+
200
+ $data_props = $this->parse_data_attributes( $data );
201
+
202
+ return sprintf(
203
+ '<div class="%s"%s>%s</div>',
204
+ esc_attr( $class ),
205
+ ( $data_props ) ? ' ' . $data_props : '',
206
+ do_shortcode( $content )
207
+ );
208
+ }
209
 
210
+ /*--------------------------------------------------------------------------------------
211
+ *
212
+ * bs_button_toolbar
213
+ *
214
+ *
215
+ *-------------------------------------------------------------------------------------*/
216
+ function bs_button_toolbar( $atts, $content = null ) {
217
+
218
+ extract( shortcode_atts( array(
219
+ "xclass" => false,
220
+ "data" => false
221
+ ), $atts ) );
222
+
223
+ $class = 'btn-toolbar';
224
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
225
+
226
+ $data_props = $this->parse_data_attributes( $data );
227
+
228
+ return sprintf(
229
+ '<div class="%s"%s>%s</div>',
230
+ esc_attr( $class ),
231
+ ( $data_props ) ? ' ' . $data_props : '',
232
+ do_shortcode( $content )
233
+ );
234
+ }
235
+
236
+ /*--------------------------------------------------------------------------------------
237
+ *
238
+ * bs_caret
239
+ *
240
+ * @author Filip Stefansson
241
+ * @since 1.0
242
+ *
243
+ *-------------------------------------------------------------------------------------*/
244
+ function bs_caret( $atts, $content = null ) {
245
+
246
+ extract( shortcode_atts( array(
247
+ "xclass" => false,
248
+ "data" => false
249
+ ), $atts ) );
250
+
251
+ $class = 'caret';
252
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
253
+
254
+ $data_props = $this->parse_data_attributes( $data );
255
+
256
+ return sprintf(
257
+ '<span class="%s"%s>%s</span>',
258
+ esc_attr( $class ),
259
+ ( $data_props ) ? ' ' . $data_props : '',
260
+ do_shortcode( $content )
261
+ );
262
+ }
263
+
264
+ /*--------------------------------------------------------------------------------------
265
+ *
266
+ * bs_container
267
+ *
268
+ * @author Robin Wouters
269
+ * @since 3.0.3.3
270
+ *
271
+ *-------------------------------------------------------------------------------------*/
272
+ function bs_container( $atts, $content = null ) {
273
+
274
+ extract( shortcode_atts( array(
275
+ "fluid" => false,
276
+ "xclass" => false,
277
+ "data" => false
278
+ ), $atts ) );
279
+
280
+ $class = ( $fluid ) ? 'container-fluid' : 'container';
281
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
282
+
283
+ $data_props = $this->parse_data_attributes( $data );
284
+
285
+ return sprintf(
286
+ '<div class="%s"%s>%s</div>',
287
+ esc_attr( $class ),
288
+ ( $data_props ) ? ' ' . $data_props : '',
289
+ do_shortcode( $content )
290
+ );
291
+ }
292
+
293
+ /*--------------------------------------------------------------------------------------
294
+ *
295
+ * bs_dropdown
296
+ *
297
+ * @author M. W. Delaney
298
+ *
299
+ *-------------------------------------------------------------------------------------*/
300
+ function bs_dropdown( $atts, $content = null ) {
301
+
302
+ extract( shortcode_atts( array(
303
+ "xclass" => false,
304
+ "data" => false
305
+ ), $atts ) );
306
+
307
+ $class = 'dropdown-menu';
308
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
309
+
310
+ $data_props = $this->parse_data_attributes( $data );
311
+
312
+ return sprintf(
313
+ '<ul role="menu" class="%s"%s role="menu">%s</ul>',
314
+ esc_attr( $class ),
315
+ ( $data_props ) ? ' ' . $data_props : '',
316
+ do_shortcode( $content )
317
+ );
318
+ }
319
+
320
+ /*--------------------------------------------------------------------------------------
321
+ *
322
+ * bs_dropdown_item
323
+ *
324
+ * @author M. W. Delaney
325
+ *
326
+ *-------------------------------------------------------------------------------------*/
327
+ function bs_dropdown_item( $atts, $content = null ) {
328
+
329
+ extract( shortcode_atts( array(
330
+ "link" => false,
331
+ "disabled" => false,
332
+ "xclass" => false,
333
+ "data" => false
334
+ ), $atts ) );
335
+
336
+ $li_class = '';
337
+ $li_class .= ( $disabled ) ? ' disabled' : '';
338
+
339
+ $a_class = '';
340
+ $a_class .= ( $xclass ) ? ' ' . $xclass : '';
341
+
342
+ $data_props = $this->parse_data_attributes( $data );
343
+
344
+ return sprintf(
345
+ '<li role="presentation" class="%s"><a role="menuitem" href="%s" class="%s"%s>%s</a></li>',
346
+ esc_url( $link ),
347
+ esc_attr( $li_class ),
348
+ esc_attr( $a_class ),
349
+ ( $data_props ) ? ' ' . $data_props : '',
350
+ do_shortcode( $content )
351
+ );
352
+ }
353
+
354
+ /*--------------------------------------------------------------------------------------
355
+ *
356
+ * bs_dropdown_divider
357
+ *
358
+ * @author M. W. Delaney
359
+ *
360
+ *-------------------------------------------------------------------------------------*/
361
+ function bs_divider( $atts, $content = null ) {
362
+
363
+ extract( shortcode_atts( array(
364
+ "xclass" => false,
365
+ "data" => false
366
+ ), $atts ) );
367
+
368
+ $class = 'divider';
369
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
370
+
371
+ $data_props = $this->parse_data_attributes( $data );
372
+
373
+ return sprintf(
374
+ '<li class="%s"%s>%s</li>',
375
+ esc_attr( $class ),
376
+ ( $data_props ) ? ' ' . $data_props : '',
377
+ do_shortcode( $content )
378
+ );
379
  }
380
+
381
+ /*--------------------------------------------------------------------------------------
382
+ *
383
+ * bs_dropdown_header
384
+ *
385
+ * @author M. W. Delaney
386
+ *
387
+ *-------------------------------------------------------------------------------------*/
388
+ function bs_dropdown_header( $atts, $content = null ) {
389
+
390
+ extract( shortcode_atts( array(
391
+ "xclass" => false,
392
+ "data" => false
393
+ ), $atts ) );
394
+
395
+ $class = 'dropdown-header';
396
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
397
+
398
+ $data_props = $this->parse_data_attributes( $data );
399
+
400
+ return sprintf(
401
+ '<li class="%s"%s>%s</li>',
402
+ esc_attr( $class ),
403
+ ( $data_props ) ? ' ' . $data_props : '',
404
+ do_shortcode( $content )
405
+ );
406
+ }
407
+
408
+ /*--------------------------------------------------------------------------------------
409
+ *
410
+ * bs_nav
411
+ *
412
+ *
413
+ *-------------------------------------------------------------------------------------*/
414
+ function bs_nav( $atts, $content = null ) {
415
+
416
+ extract( shortcode_atts( array(
417
+ "type" => false,
418
+ "stacked" => false,
419
+ "justified" => false,
420
+ "xclass" => false,
421
+ "data" => false
422
+ ), $atts ) );
423
+
424
+ $class = 'nav';
425
+ $class .= ( $type ) ? ' nav-' . $type : ' nav-tabs';
426
+ $class .= ( $stacked ) ? ' nav-stacked' : '';
427
+ $class .= ( $justified ) ? ' nav-justified' : '';
428
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
429
+
430
+ $data_props = $this->parse_data_attributes( $data );
431
+
432
+ return sprintf(
433
+ '<ul class="%s"%s>%s</ul>',
434
+ esc_attr( $class ),
435
+ ( $data_props ) ? ' ' . $data_props : '',
436
+ do_shortcode( $content )
437
+ );
438
+ }
439
+
440
+ /*--------------------------------------------------------------------------------------
441
+ *
442
+ * bs_nav_item
443
+ *
444
+ *
445
+ *-------------------------------------------------------------------------------------*/
446
+ function bs_nav_item( $atts, $content = null ) {
447
+
448
+ extract( shortcode_atts( array(
449
+ "link" => false,
450
+ "active" => false,
451
+ "disabled" => false,
452
+ "dropdown" => false,
453
+ "xclass" => false,
454
+ "data" => false,
455
+ ), $atts ) );
456
+
457
+ $li_classes = '';
458
+ $li_classes .= ( $dropdown ) ? 'dropdown' : '';
459
+ $li_classes .= ( $active ) ? ' active' : '';
460
+ $li_classes .= ( $disabled ) ? ' disabled' : '';
461
+
462
+ $a_classes = '';
463
+ $a_classes .= ( $dropdown ) ? ' dropdown-toggle' : '';
464
+ $a_classes .= ( $xclass ) ? ' ' . $xclass : '';
465
+
466
+ $data_props = $this->parse_data_attributes( $data );
467
+
468
+ # Wrong idea I guess ....
469
+ #$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>';
470
+
471
+ //* If we have a dropdown shortcode inside the content we end the link before the dropdown shortcode, else all content goes inside the link
472
+ $content = ( $dropdown ) ? str_replace( '[dropdown]', '</a>[dropdown]', $content ) : $content . '</a>';
473
+
474
+ return sprintf(
475
+ '<li%1$s><a href="%2$s"%3$s%4$s%5$s>%6$s</li>',
476
+ ( ! empty( $li_classes ) ) ? sprintf( ' class="%s"', esc_attr( $li_classes ) ) : '',
477
+ esc_url( $link ),
478
+ ( ! empty( $a_classes ) ) ? sprintf( ' class="%s"', esc_attr( $a_classes ) ) : '',
479
+ ( $dropdown ) ? ' data-toggle="dropdown"' : '',
480
+ ( $data_props ) ? ' ' . $data_props : '',
481
+ do_shortcode( $content )
482
+ );
483
 
484
+ }
485
+
486
  /*--------------------------------------------------------------------------------------
487
  *
488
  * bs_alert
491
  * @since 1.0
492
  *
493
  *-------------------------------------------------------------------------------------*/
494
+ function bs_alert( $atts, $content = null ) {
495
+
496
+ extract( shortcode_atts( array(
497
+ "type" => false,
498
+ "dismissable" => false,
499
+ "xclass" => false,
500
+ "data" => false
501
+ ), $atts ) );
502
+
503
+ $class = 'alert';
504
+ $class .= ( $type ) ? ' alert-' . $type : ' alert-success';
505
+ $class .= ( $dismissable ) ? ' alert-dismissable' : '';
506
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
507
+
508
+ $dismissable = ( $dismissable ) ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' : '';
509
+
510
+ $data_props = $this->parse_data_attributes( $data );
511
+
512
+ return sprintf(
513
+ '<div class="%s"%s>%s%s</div>',
514
+ esc_attr( $class ),
515
+ ( $data_props ) ? ' ' . $data_props : '',
516
+ $dismissable,
517
+ do_shortcode( $content )
518
+ );
519
  }
520
 
521
+ /*--------------------------------------------------------------------------------------
522
+ *
523
+ * bs_progress
524
+ *
525
+ *
526
+ *-------------------------------------------------------------------------------------*/
527
+ function bs_progress( $atts, $content = null ) {
528
+
529
+ extract( shortcode_atts( array(
530
+ "striped" => false,
531
+ "animated" => false,
532
+ "xclass" => false,
533
+ "data" => false
534
+ ), $atts ) );
535
+
536
+ $class = 'progress';
537
+ $class .= ( $striped ) ? ' progress-striped' : '';
538
+ $class .= ( $animated ) ? ' active' : '';
539
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
540
+
541
+ $data_props = $this->parse_data_attributes( $data );
542
+
543
+ return sprintf(
544
+ '<div class="%s"%s>%s</div>',
545
+ esc_attr( $class ),
546
+ ( $data_props ) ? ' ' . $data_props : '',
547
+ do_shortcode( $content )
548
+ );
549
+ }
550
 
551
+ /*--------------------------------------------------------------------------------------
552
+ *
553
+ * bs_progress_bar
554
+ *
555
+ *
556
+ *-------------------------------------------------------------------------------------*/
557
+ function bs_progress_bar( $atts, $content = null ) {
558
+
559
+ extract( shortcode_atts( array(
560
+ "type" => false,
561
+ "percent" => false,
562
+ "label" => false,
563
+ "xclass" => false,
564
+ "data" => false
565
+ ), $atts ) );
566
+
567
+ $class = 'progress-bar';
568
+ $class .= ( $type ) ? ' progress-bar-' . $type : '';
569
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
570
+
571
+ $data_props = $this->parse_data_attributes( $data );
572
+
573
+ return sprintf(
574
+ '<div class="%s" role="progressbar" %s%s>%s</div>',
575
+ esc_attr( $class ),
576
+ ( $percent ) ? ' aria-value="' . (int) $percent . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $percent . '%;"' : '',
577
+ ( $data_props ) ? ' ' . $data_props : '',
578
+ ( $percent ) ? sprintf('<span%s>%s</span>', ( !$label ) ? ' class="sr-only"' : '', (int) $percent . '% Complete') : ''
579
+ );
580
+ }
581
 
582
  /*--------------------------------------------------------------------------------------
583
  *
587
  * @since 1.0
588
  *
589
  *-------------------------------------------------------------------------------------*/
590
+ function bs_code( $atts, $content = null ) {
591
+
592
+ extract( shortcode_atts( array(
593
+ "inline" => false,
594
+ "scrollable" => false,
595
+ "xclass" => false,
596
+ "data" => false
597
+ ), $atts ) );
598
+
599
+ $class = '';
600
+ $class .= ( $scrollable ) ? ' pre-scrollable' : '';
601
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
602
+
603
+ $data_props = $this->parse_data_attributes( $data );
604
+
605
+ return sprintf(
606
+ '<%1$s class="%2$s"%3$s>%4$s</%1$s>',
607
+ ( $inline ) ? 'code' : 'pre',
608
+ esc_attr( $class ),
609
+ ( $data_props ) ? ' ' . $data_props : '',
610
+ do_shortcode( $content )
611
+ );
612
  }
613
 
 
 
 
614
  /*--------------------------------------------------------------------------------------
615
  *
616
  * bs_span
621
  * @see bs_column
622
  *-------------------------------------------------------------------------------------*/
623
  function bs_span( $atts, $content = null ) {
624
+ extract( shortcode_atts( array(
625
  "size" => 'size'
626
+ ), $atts ) );
 
 
627
 
628
+ $return = '<div class="span' . $size . '">' . do_shortcode( $content ) . '</div>';
629
+ return $return;
630
  }
631
 
 
 
 
632
  /*--------------------------------------------------------------------------------------
633
  *
634
  * bs_row
638
  *
639
  *-------------------------------------------------------------------------------------*/
640
  function bs_row( $atts, $content = null ) {
641
+
642
+ extract( shortcode_atts( array(
643
+ "xclass" => false,
644
+ "data" => false
645
+ ), $atts ) );
646
+
647
+ $class = 'row';
648
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
649
+
650
+ $data_props = $this->parse_data_attributes( $data );
651
+
652
+ return sprintf(
653
+ '<div class="%s"%s>%s</div>',
654
+ esc_attr( $class ),
655
+ ( $data_props ) ? ' ' . $data_props : '',
656
+ do_shortcode( $content )
657
+ );
658
  }
659
 
 
 
 
660
  /*--------------------------------------------------------------------------------------
661
  *
662
  * bs_column
666
  * @todo pull and offset
667
  *-------------------------------------------------------------------------------------*/
668
  function bs_column( $atts, $content = null ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
669
 
670
+ extract( shortcode_atts( array(
671
+ "lg" => false,
672
+ "md" => false,
673
+ "sm" => false,
674
+ "xs" => false,
675
+ "offset_lg" => false,
676
+ "offset_md" => false,
677
+ "offset_sm" => false,
678
+ "offset_xs" => false,
679
+ "pull_lg" => false,
680
+ "pull_md" => false,
681
+ "pull_sm" => false,
682
+ "pull_xs" => false,
683
+ "push_lg" => false,
684
+ "push_md" => false,
685
+ "push_sm" => false,
686
+ "push_xs" => false,
687
+ "xclass" => false,
688
+ "data" => false
689
+ ), $atts ) );
690
+
691
+ $class = '';
692
+ $class .= ( $lg ) ? ' col-lg-' . $lg : '';
693
+ $class .= ( $md ) ? ' col-md-' . $md : '';
694
+ $class .= ( $sm ) ? ' col-sm-' . $sm : '';
695
+ $class .= ( $xs ) ? ' col-xs-' . $xs : '';
696
+ $class .= ( $offset_lg ) ? ' col-lg-offset-' . $offset_lg : '';
697
+ $class .= ( $offset_md ) ? ' col-md-offset-' . $offset_md : '';
698
+ $class .= ( $offset_sm ) ? ' col-sm-offset-' . $offset_sm : '';
699
+ $class .= ( $offset_xs ) ? ' col-xs-offset-' . $offset_xs : '';
700
+ $class .= ( $pull_lg ) ? ' col-lg-pull-' . $pull_lg : '';
701
+ $class .= ( $pull_md ) ? ' col-md-pull-' . $pull_md : '';
702
+ $class .= ( $pull_sm ) ? ' col-sm-pull-' . $pull_sm : '';
703
+ $class .= ( $pull_xs ) ? ' col-xs-pull-' . $pull_xs : '';
704
+ $class .= ( $push_lg ) ? ' col-lg-push-' . $push_lg : '';
705
+ $class .= ( $push_md ) ? ' col-md-push-' . $push_md : '';
706
+ $class .= ( $push_sm ) ? ' col-sm-push-' . $push_sm : '';
707
+ $class .= ( $push_xs ) ? ' col-xs-push-' . $push_xs : '';
708
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
709
+
710
+ $data_props = $this->parse_data_attributes( $data );
711
+
712
+ return sprintf(
713
+ '<div class="%s"%s>%s</div>',
714
+ esc_attr( $class ),
715
+ ( $data_props ) ? ' ' . $data_props : '',
716
+ do_shortcode( $content )
717
+ );
718
  }
719
 
720
  /*--------------------------------------------------------------------------------------
726
  *-------------------------------------------------------------------------------------*/
727
  function bs_list_group( $atts, $content = null ) {
728
 
729
+ extract( shortcode_atts( array(
730
+ "linked" => false,
731
+ "xclass" => false,
732
+ "data" => false
733
+ ), $atts ) );
734
+
735
+ $class = 'list-group';
736
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
737
+
738
+ $data_props = $this->parse_data_attributes( $data );
739
+
740
+ return sprintf(
741
+ '<%1$s class="%2$s"%3$s>%4$s</%1$s>',
742
+ ( $linked ) ? 'div' : 'ul',
743
+ esc_attr( $class ),
744
+ ( $data_props ) ? ' ' . $data_props : '',
745
+ do_shortcode( $content )
746
+ );
747
+ }
748
 
749
  /*--------------------------------------------------------------------------------------
750
  *
755
  *-------------------------------------------------------------------------------------*/
756
  function bs_list_group_item( $atts, $content = null ) {
757
 
758
+ extract( shortcode_atts( array(
759
+ "link" => false,
760
+ "type" => false,
761
+ "active" => false,
762
+ "xclass" => false,
763
+ "data" => false
764
+ ), $atts ) );
765
+
766
+ $class = 'list-group-item';
767
+ $class .= ( $type ) ? ' list-group-item-' . $type : '';
768
+ $class .= ( $active ) ? ' active' : '';
769
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
770
+
771
+ $data_props = $this->parse_data_attributes( $data );
772
+
773
+ return sprintf(
774
+ '<%1$s %2$s class="%3$s"%4$s>%5$s</%1$s>',
775
+ ( $link ) ? 'a' : 'li',
776
+ ( $link ) ? 'href="' . esc_url( $link ) . '"' : '',
777
+ esc_attr( $class ),
778
+ ( $data_props ) ? ' ' . $data_props : '',
779
+ do_shortcode( $content )
780
+ );
781
+ }
782
+
783
+ /*--------------------------------------------------------------------------------------
784
+ *
785
+ * bs_list_group_item_heading
786
+ *
787
+ *
788
+ *-------------------------------------------------------------------------------------*/
789
+ function bs_list_group_item_heading( $atts, $content = null ) {
790
+
791
+ extract( shortcode_atts( array(
792
+ "xclass" => false,
793
+ "data" => false
794
+ ), $atts ) );
795
+
796
+ $class = 'list-group-item-heading';
797
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
798
+
799
+ $data_props = $this->parse_data_attributes( $data );
800
+
801
+ return sprintf(
802
+ '<h4 class="%s"%s>%s</h4>',
803
+ esc_attr( $class ),
804
+ ( $data_props ) ? ' ' . $data_props : '',
805
+ do_shortcode( $content )
806
+ );
807
+ }
808
+
809
+ /*--------------------------------------------------------------------------------------
810
+ *
811
+ * bs_list_group_item_text
812
+ *
813
+ *
814
+ *-------------------------------------------------------------------------------------*/
815
+ function bs_list_group_item_text( $atts, $content = null ) {
816
+
817
+ extract( shortcode_atts( array(
818
+ "xclass" => false,
819
+ "data" => false
820
+ ), $atts ) );
821
+
822
+ $class = 'list-group-item-text';
823
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
824
+
825
+ $data_props = $this->parse_data_attributes( $data );
826
+
827
+ return sprintf(
828
+ '<p class="%s"%s>%s</p>',
829
+ esc_attr( $class ),
830
+ ( $data_props ) ? ' ' . $data_props : '',
831
+ do_shortcode( $content )
832
+ );
833
+ }
834
 
835
+ /*--------------------------------------------------------------------------------------
836
+ *
837
+ * bs_breadcrumb
838
+ *
839
+ *
840
+ *-------------------------------------------------------------------------------------*/
841
+ function bs_breadcrumb( $atts, $content = null ) {
842
+
843
+ extract( shortcode_atts( array(
844
+ "xclass" => false,
845
+ "data" => false
846
+ ), $atts ) );
847
+
848
+ $class = 'breadcrumb';
849
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
850
+
851
+ $data_props = $this->parse_data_attributes( $data );
852
+
853
+ return sprintf(
854
+ '<ol class="%s"%s>%s</ol>',
855
+ esc_attr( $class ),
856
+ ( $data_props ) ? ' ' . $data_props : '',
857
+ do_shortcode( $content )
858
+ );
859
+ }
860
+
861
+ /*--------------------------------------------------------------------------------------
862
+ *
863
+ * bs_breadcrumb_item
864
+ *
865
+ * @author M. W. Delaney
866
+ *
867
+ *-------------------------------------------------------------------------------------*/
868
+ function bs_breadcrumb_item( $atts, $content = null ) {
869
+
870
+ extract( shortcode_atts( array(
871
+ "link" => false,
872
+ "xclass" => false,
873
+ "data" => false
874
+ ), $atts ) );
875
+
876
+ $class = '';
877
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
878
+
879
+ return sprintf(
880
+ '<li><a href="%s" class="%s"%s>%s</a></li>',
881
+ esc_url( $link ),
882
+ esc_attr( $class ),
883
+ ( $data_props ) ? ' ' . $data_props : '',
884
+ do_shortcode( $content )
885
+ );
886
  }
887
 
888
  /*--------------------------------------------------------------------------------------
894
  *
895
  *-------------------------------------------------------------------------------------*/
896
  function bs_label( $atts, $content = null ) {
 
 
 
897
 
898
+ extract( shortcode_atts( array(
899
+ "type" => false,
900
+ "xclass" => false,
901
+ "data" => false
902
+ ), $atts ) );
903
+
904
+ $class = 'label';
905
+ $class .= ( $type ) ? ' label-' . $type : ' label-default';
906
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
907
+
908
+ $data_props = $this->parse_data_attributes( $data );
909
 
910
+ return sprintf(
911
+ '<span class="%s"%s>%s</span>',
912
+ esc_attr( $class ),
913
+ ( $data_props ) ? ' ' . $data_props : '',
914
+ do_shortcode( $content )
915
+ );
916
  }
917
 
 
 
 
918
  /*--------------------------------------------------------------------------------------
919
  *
920
  * bs_badge
924
  *
925
  *-------------------------------------------------------------------------------------*/
926
  function bs_badge( $atts, $content = null ) {
 
 
 
 
 
927
 
928
+ extract( shortcode_atts( array(
929
+ "right" => false,
930
+ "xclass" => false,
931
+ "data" => false
932
+ ), $atts ) );
933
+
934
+ $class = 'badge';
935
+ $class .= ( $right ) ? ' pull-right' : '';
936
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
937
+
938
+ $data_props = $this->parse_data_attributes( $data );
939
+
940
+ return sprintf(
941
+ '<span class="%s"%s>%s</span>',
942
+ esc_attr( $class ),
943
+ ( $data_props ) ? ' ' . $data_props : '',
944
+ do_shortcode( $content )
945
+ );
946
  }
947
 
 
 
 
948
  /*--------------------------------------------------------------------------------------
949
  *
950
  * bs_icon
954
  *
955
  *-------------------------------------------------------------------------------------*/
956
  function bs_icon( $atts, $content = null ) {
 
 
 
 
 
957
 
958
+ extract( shortcode_atts( array(
959
+ "type" => false,
960
+ "xclass" => false,
961
+ "data" => false
962
+ ), $atts ) );
963
+
964
+ $class = 'glyphicon';
965
+ $class .= ( $type ) ? ' glyphicon-' . $type : '';
966
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
967
+
968
+ $data_props = $this->parse_data_attributes( $data );
969
+
970
+ return sprintf(
971
+ '<span class="%s"%s>%s</span>',
972
+ esc_attr( $class ),
973
+ ( $data_props ) ? ' ' . $data_props : '',
974
+ do_shortcode( $content )
975
+ );
976
  }
977
 
978
  /*--------------------------------------------------------------------------------------
1027
  *
1028
  *-------------------------------------------------------------------------------------*/
1029
  function bs_table_wrap( $atts, $content = null ) {
1030
+ extract( shortcode_atts( array(
1031
+ 'bordered' => false,
1032
+ 'striped' => false,
1033
+ 'hover' => false,
1034
+ 'condensed' => false,
1035
+ 'xclass' => false,
1036
+ 'data' => false
1037
+ ), $atts ) );
1038
+
1039
+ $class = 'table';
1040
+ $class .= ($bordered) ? ' table-bordered' : '';
1041
+ $class .= ($striped) ? ' table-striped' : '';
1042
+ $class .= ($hover) ? ' table-hover' : '';
1043
+ $class .= ($condensed) ? ' table-condensed' : '';
1044
+ $class .= ($xclass) ? ' ' . $xclass : '';
1045
+
1046
  $dom = new DOMDocument;
1047
  $dom->loadXML($content);
1048
+ $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
1049
+ if( $data ) {
1050
+ $data = explode( '|', $data );
1051
+ foreach( $data as $d ):
1052
+ $d = explode(',',$d);
1053
+ $dom->documentElement->setAttribute('data-'.$d[0],trim($d[1]));
1054
+ endforeach;
1055
+ }
1056
  $return = $dom->saveXML();
1057
  return $return;
1058
  }
1069
  * size: sm = small, lg = large
1070
  *
1071
  *-------------------------------------------------------------------------------------*/
1072
+ function bs_well( $atts, $content = null ) {
1073
+
1074
+ extract( shortcode_atts( array(
1075
+ "size" => false,
1076
+ "xclass" => false,
1077
+ "data" => false
1078
+ ), $atts ) );
1079
+
1080
+ $class = 'well';
1081
+ $class .= ( $size ) ? ' well-' . $size : '';
1082
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1083
+
1084
+ $data_props = $this->parse_data_attributes( $data );
1085
+
1086
+ return sprintf(
1087
+ '<div class="%s"%s>%s</div>',
1088
+ esc_attr( $class ),
1089
+ ( $data_props ) ? ' ' . $data_props : '',
1090
+ do_shortcode( $content )
1091
+ );
1092
+ }
1093
 
1094
  /*--------------------------------------------------------------------------------------
1095
  *
1100
  *
1101
  *-------------------------------------------------------------------------------------*/
1102
  function bs_panel( $atts, $content = null ) {
 
 
 
 
 
 
 
 
 
1103
 
1104
+ extract( shortcode_atts( array(
1105
+ "title" => false,
1106
+ "heading" => false,
1107
+ "type" => false,
1108
+ "footer" => false,
1109
+ "xclass" => false,
1110
+ "data" => false
1111
+ ), $atts ) );
1112
+
1113
+ $class = 'panel';
1114
+ $class .= ( $type ) ? ' panel-' . $type : ' panel-default';
1115
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1116
+
1117
+ if( ! $heading && $title ) {
1118
+ $heading = $title;
1119
+ $title = true;
1120
+ }
1121
+
1122
+ $data_props = $this->parse_data_attributes( $data );
1123
+
1124
+ $footer = ( $footer ) ? '<div class="panel-footer">' . $footer . '</div>' : '';
1125
+
1126
+ if ( $heading ) {
1127
+ $heading = sprintf(
1128
+ '<div class="panel-heading">%s%s%s</div>',
1129
+ ( $title ) ? '<h3 class="panel-title">' : '',
1130
+ esc_html( $heading ),
1131
+ ( $title ) ? '</h3>' : ''
1132
+ );
1133
+ }
1134
+ else {
1135
+ $heading = '';
1136
+ }
1137
+
1138
+ return sprintf(
1139
+ '<div class="%s"%s>%s<div class="panel-body">%s</div>%s</div>',
1140
+ esc_attr( $class ),
1141
+ ( $data_props ) ? ' ' . $data_props : '',
1142
+ $heading,
1143
+ do_shortcode( $content ),
1144
+ ( $footer ) ? ' ' . $footer : ''
1145
+ );
1146
  }
1147
 
1148
  /*--------------------------------------------------------------------------------------
1156
  *-------------------------------------------------------------------------------------*/
1157
  function bs_tabs( $atts, $content = null ) {
1158
 
1159
+ if( isset( $GLOBALS['tabs_count'] ) )
1160
  $GLOBALS['tabs_count']++;
1161
  else
1162
  $GLOBALS['tabs_count'] = 0;
1163
 
1164
+ $GLOBALS['tabs_default_count'] = 0;
1165
+
1166
+ extract( shortcode_atts( array(
1167
+ "type" => false,
1168
+ "xclass" => false,
1169
+ "data" => false
1170
+ ), $atts ) );
1171
+
1172
+ $ul_class = 'nav';
1173
+ $ul_class .= ( $type ) ? ' nav-' . $type : ' nav-tabs';
1174
+ $ul_class .= ( $xclass ) ? ' ' . $xclass : '';
1175
+
1176
+ $div_class = 'tab-content';
1177
+
1178
+ $id = 'custom-tabs-'. $GLOBALS['tabs_count'];
1179
+
1180
+ $data_props = $this->parse_data_attributes( $data );
1181
+
1182
+ $atts_map = bs_attribute_map( $content );
1183
+
1184
  // Extract the tab titles for use in the tab widget.
1185
+ if ( $atts_map ) {
1186
+ $tabs = array();
1187
+ $GLOBALS['tabs_default_active'] = true;
1188
+ foreach( $atts_map as $check ) {
1189
+ if( $check["tab"]["active"] ) {
1190
+ $GLOBALS['tabs_default_active'] = false;
1191
+ }
1192
+ }
 
 
1193
  $i = 0;
1194
+ foreach( $atts_map as $tab ) {
1195
+
1196
+ $tabs[] = sprintf(
1197
+ '<li%s><a href="#%s" data-toggle="tab">%s</a></li>',
1198
+ ( ($tab["tab"]["active"]) || ($GLOBALS['tabs_default_active'] && $i == 0) ) ? ' class="active"' : '',
1199
+ 'custom-tab-' . $GLOBALS['tabs_count'] . '-' . sanitize_title( $tab["tab"]["title"] ),
1200
+ $tab["tab"]["title"]
1201
+ );
1202
  $i++;
1203
  }
 
 
 
 
 
 
 
1204
  }
1205
+ return sprintf(
1206
+ '<ul class="%s" id="%s"%s>%s</ul><div class="%s">%s</div>',
1207
+ esc_attr( $ul_class ),
1208
+ esc_attr( $id ),
1209
+ ( $data_props ) ? ' ' . $data_props : '',
1210
+ ( $tabs ) ? implode( $tabs ) : '',
1211
+ esc_attr( $div_class ),
1212
+ do_shortcode( $content )
1213
+ );
1214
  }
1215
 
 
 
 
1216
  /*--------------------------------------------------------------------------------------
1217
  *
1218
  * bs_tab
1223
  *-------------------------------------------------------------------------------------*/
1224
  function bs_tab( $atts, $content = null ) {
1225
 
1226
+ extract( shortcode_atts( array(
1227
+ 'title' => false,
1228
+ 'active' => false,
1229
+ 'fade' => false,
1230
+ 'xclass' => false,
1231
+ 'data' => false
1232
+ ), $atts ) );
1233
+
1234
+ if( $GLOBALS['tabs_default_active'] && $GLOBALS['tabs_default_count'] == 0 ) {
1235
+ $active = true;
 
1236
  }
1237
+ $GLOBALS['tabs_default_count']++;
1238
+
1239
+ $class = 'tab-pane';
1240
+ $class .= ( $fade ) ? ' fade' : '';
1241
+ $class .= ( $active ) ? ' active' : '';
1242
+ $class .= ( $active && $fade ) ? ' in' : '';
1243
+
1244
+ $id = 'custom-tab-'. $GLOBALS['tabs_count'] . '-'. sanitize_title( $title );
1245
+
1246
+ $data_props = $this->parse_data_attributes( $data );
1247
+
1248
+ return sprintf(
1249
+ '<div id="%s" class="%s"%s>%s</div>',
1250
+ esc_attr( $id ),
1251
+ esc_attr( $class ),
1252
+ ( $data_props ) ? ' ' . $data_props : '',
1253
+ do_shortcode( $content )
1254
+ );
1255
 
 
 
 
 
1256
  }
1257
 
1258
 
1273
  else
1274
  $GLOBALS['collapsibles_count'] = 0;
1275
 
1276
+ extract( shortcode_atts( array(
1277
+ "xclass" => false,
1278
+ "data" => false
1279
+ ), $atts ) );
1280
+
1281
+ $class = 'panel-group';
1282
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1283
+
1284
+ $id = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1285
+
1286
+ $data_props = $this->parse_data_attributes( $data );
1287
+
1288
+ return sprintf(
1289
+ '<div class="%s" id="%s"%s>%s</div>',
1290
+ esc_attr( $class ),
1291
+ esc_attr( $id ),
1292
+ ( $data_props ) ? ' ' . $data_props : '',
1293
+ do_shortcode( $content )
1294
+ );
1295
 
 
1296
  }
1297
 
1298
 
 
 
1299
  /*--------------------------------------------------------------------------------------
1300
  *
1301
  * bs_collapse
1306
  *-------------------------------------------------------------------------------------*/
1307
  function bs_collapse( $atts, $content = null ) {
1308
 
1309
+ extract( shortcode_atts( array(
1310
+ "title" => false,
1311
+ "type" => false,
1312
+ "active" => false,
1313
+ "xclass" => false,
1314
+ "data" => false
1315
+ ), $atts ) );
1316
+
1317
+ $panel_class = 'panel';
1318
+ $panel_class .= ( $type ) ? ' panel-' . $type : ' panel-default';
1319
+ $panel_class .= ( $xclass ) ? ' ' . $xclass : '';
1320
+
1321
+ $collapse_class = 'panel-collapse collapse';
1322
+ $collapse_class .= ( $active ) ? ' in' . $type : '';
1323
+
1324
+ $parent = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
1325
+ $current_collapse = $parent . '-'. sanitize_title( $title );
1326
+
1327
+ $data_props = $this->parse_data_attributes( $data );
1328
+
1329
+ return sprintf(
1330
+ '<div class="%1$s"%2$s>
1331
+ <div class="panel-heading">
1332
+ <h4 class="panel-title">
1333
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#%3$s" href="#%4$s">%5$s</a>
1334
+ </h4>
1335
+ </div>
1336
+ <div id="%4$s" class="%6$s">
1337
+ <div class="panel-body">%7$s</div>
1338
+ </div>
1339
+ </div>',
1340
+ esc_attr( $panel_class ),
1341
+ ( $data_props ) ? ' ' . $data_props : '',
1342
+ $parent,
1343
+ $current_collapse,
1344
+ $title,
1345
+ esc_attr( $collapse_class ),
1346
+ do_shortcode( $content )
1347
+ );
1348
+ }
1349
+
1350
+
1351
+ /*--------------------------------------------------------------------------------------
1352
+ *
1353
+ * bs_carousel
1354
+ *
1355
+ * @author Filip Stefansson
1356
+ * @since 1.0
1357
+ *
1358
+ *-------------------------------------------------------------------------------------*/
1359
+ function bs_carousel( $atts, $content = null ) {
1360
+
1361
+ if( isset($GLOBALS['carousel_count']) )
1362
+ $GLOBALS['carousel_count']++;
1363
  else
1364
+ $GLOBALS['carousel_count'] = 0;
1365
 
1366
+ $GLOBALS['tabs_default_count'] = 0;
 
 
 
 
1367
 
1368
+ extract( shortcode_atts( array(
1369
+ "interval" => false,
1370
+ "pause" => false,
1371
+ "wrap" => false,
1372
+ "xclass" => false,
1373
+ "data" => false,
1374
+ ), $atts ) );
1375
 
1376
+ $div_class = 'carousel slide';
1377
+ $div_class .= ( $xclass ) ? ' ' . $xclass : '';
1378
+
1379
+ $inner_class = 'carousel-inner';
1380
+
1381
+ $id = 'custom-carousel-'. $GLOBALS['carousel_count'];
1382
+
1383
+ $data_props = $this->parse_data_attributes( $data );
1384
+
1385
+ $atts_map = bs_attribute_map( $content );
1386
+
1387
+ // Extract the tab titles for use in the tab widget.
1388
+ if ( $atts_map ) {
1389
+ $indicators = array();
1390
+ $GLOBALS['carousel_default_active'] = true;
1391
+ foreach( $atts_map as $check ) {
1392
+ if( $check["carousel-item"]["active"] ) {
1393
+ $GLOBALS['carousel_default_active'] = false;
1394
+ }
1395
+ }
1396
+ // Extract the tab titles for use in the tab widget.
1397
+ $i = 0;
1398
+ foreach( $atts_map as $slide ) {
1399
+ $indicators[] = sprintf(
1400
+ '<li class="%s" data-target="%s" data-slide-to="%s"></li>',
1401
+ ( ($slide["carousel-item"]["active"]) || ($GLOBALS['carousel_default_active'] && $i == 0) ) ? 'active' : '',
1402
+ esc_attr( '#' . $id ),
1403
+ esc_attr( '#' . $i )
1404
+ );
1405
+ $i++;
1406
+ }
1407
+ }
1408
+ return sprintf(
1409
+ '<div class="%s" id="%s" data-ride="carousel"%s%s%s%s>%s<div class="%s">%s</div>%s%s</div>',
1410
+ esc_attr( $div_class ),
1411
+ esc_attr( $id ),
1412
+ ( $interval ) ? sprintf( ' data-interval="%"', (int) $interval ) : '',
1413
+ ( $pause ) ? sprintf( ' data-pause="%"', esc_attr( $pause ) ) : '',
1414
+ ( $wrap ) ? sprintf( ' data-wrap="%"', esc_attr( $wrap ) ) : '',
1415
+ ( $data_props ) ? ' ' . $data_props : '',
1416
+ ( $indicators ) ? '<ol class="carousel-indicators">' . implode( $indicators ) . '</ol>' : '',
1417
+ esc_attr( $inner_class ),
1418
+ do_shortcode( $content ),
1419
+ '<a class="left carousel-control" href="' . esc_url( '#' . $id ) . '" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>',
1420
+ '<a class="right carousel-control" href="' . esc_url( '#' . $id ) . '" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>'
1421
+ );
1422
  }
1423
 
1424
 
1425
+ /*--------------------------------------------------------------------------------------
1426
+ *
1427
+ * bs_carousel_item
1428
+ *
1429
+ * @author Filip Stefansson
1430
+ * @since 1.0
1431
+ *
1432
+ *-------------------------------------------------------------------------------------*/
1433
+ function bs_carousel_item( $atts, $content = null ) {
1434
+
1435
+ extract( shortcode_atts( array(
1436
+ "active" => false,
1437
+ "caption" => false,
1438
+ "xclass" => false,
1439
+ "data" => false
1440
+ ), $atts ) );
1441
+
1442
+ if( $GLOBALS['carousel_default_active'] && $GLOBALS['carousel_default_count'] == 0 ) {
1443
+ $active = true;
1444
+ }
1445
+ $GLOBALS['carousel_default_count']++;
1446
+
1447
+ $class = 'item';
1448
+ $class .= ( $active ) ? ' active' : '';
1449
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1450
+
1451
+ $data_props = $this->parse_data_attributes( $data );
1452
+
1453
+ $content = preg_replace('/class=".*?"/', '', $content);
1454
+
1455
+ return sprintf(
1456
+ '<div class="%s"%s>%s%s</div>',
1457
+ esc_attr( $class ),
1458
+ ( $data_props ) ? ' ' . $data_props : '',
1459
+ do_shortcode( $content ),
1460
+ ( $caption ) ? '<div class="carousel-caption">' . esc_html( $caption ) . '</div>' : ''
1461
+ );
1462
+ }
1463
+
1464
  /*--------------------------------------------------------------------------------------
1465
  *
1466
  * bs_tooltip
1473
  function bs_tooltip( $atts, $content = null ) {
1474
 
1475
  $defaults = array(
1476
+ 'title' => '',
1477
+ 'placement' => 'top',
1478
+ 'animation' => 'true',
1479
+ 'html' => 'false'
1480
  );
1481
  extract( shortcode_atts( $defaults, $atts ) );
1482
+
1483
+ $class = 'bs-tooltip';
1484
 
1485
+ $previous_value = libxml_use_internal_errors(TRUE);
1486
  $dom = new DOMDocument;
1487
  $dom->loadXML($content);
1488
+ libxml_clear_errors();
1489
+ libxml_use_internal_errors($previous_value);
1490
  if(!$dom->documentElement) {
1491
  $element = $dom->createElement('span', $content);
1492
  $dom->appendChild($element);
1493
  }
1494
+ $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
1495
  $dom->documentElement->setAttribute('title', $title );
1496
  if($animation) { $dom->documentElement->setAttribute('data-animation', $animation ); }
1497
  if($placement) { $dom->documentElement->setAttribute('data-placement', $placement ); }
1512
  function bs_popover( $atts, $content = null ) {
1513
 
1514
  $defaults = array(
1515
+ 'title' => false,
1516
+ 'text' => '',
1517
+ 'placement' => 'top',
1518
+ 'animation' => 'true',
1519
+ 'html' => 'false'
1520
  );
1521
  extract( shortcode_atts( $defaults, $atts ) );
 
1522
 
1523
+ $class = 'bs-popover';
1524
+
1525
+ $previous_value = libxml_use_internal_errors(TRUE);
1526
  $dom = new DOMDocument;
1527
  $dom->loadXML($content);
1528
+ libxml_clear_errors();
1529
+ libxml_use_internal_errors($previous_value);
1530
  if(!$dom->documentElement) {
1531
  $element = $dom->createElement('span', $content);
1532
  $dom->appendChild($element);
1533
  }
1534
+ $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
1535
  $dom->documentElement->setAttribute('data-toggle', 'popover' );
1536
  if($title) { $dom->documentElement->setAttribute('data-original-title', $title ); }
1537
  $dom->documentElement->setAttribute('data-content', $text );
1554
  *
1555
  *-------------------------------------------------------------------------------------*/
1556
 
1557
+ function bs_media( $atts, $content = null ) {
1558
+
1559
+ extract( shortcode_atts( array(
1560
+ "xclass" => false,
1561
+ "data" => false
1562
+ ), $atts ) );
1563
+
1564
+ $class = 'media';
1565
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1566
+
1567
+ $data_props = $this->parse_data_attributes( $data );
1568
+
1569
+ return sprintf(
1570
+ '<div class="%s"%s>%s</div>',
1571
+ esc_attr( $class ),
1572
+ ( $data_props ) ? ' ' . $data_props : '',
1573
+ do_shortcode( $content )
1574
  );
 
 
1575
  }
1576
 
1577
+ function bs_media_object( $atts, $content = null ) {
1578
 
1579
+ extract( shortcode_atts( array(
1580
+ "pull" => "left",
1581
+ "xclass" => false,
1582
+ "data" => false
1583
+ ), $atts ) );
1584
 
1585
+ $class = "media-object img-responsive";
1586
+ $class .= ($xclass) ? ' ' . $xclass : '';
1587
+
1588
+ $previous_value = libxml_use_internal_errors(TRUE);
1589
  $dom = new DOMDocument;
1590
  $dom->loadXML($content);
1591
+ libxml_clear_errors();
1592
+ libxml_use_internal_errors($previous_value);
1593
+ $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
1594
+ if( $data ) {
1595
+ $data = explode( '|', $data );
1596
+ foreach( $data as $d ):
1597
+ $d = explode(',',$d);
1598
+ $image->setAttribute('data-'.$d[0],trim($d[1]));
1599
+ endforeach;
1600
+ }
1601
  $return = $dom->saveXML();
1602
+ $return = '<span class="pull-' . esc_attr($pull) . '">' . $return . '</span>';
1603
+
1604
  return $return;
1605
  }
1606
 
1607
+ function bs_media_body( $atts, $content = null ) {
1608
+
1609
+ extract( shortcode_atts( array(
1610
+ "title" => false,
1611
+ "xclass" => false,
1612
+ "data" => false
1613
+ ), $atts ) );
1614
+
1615
+ $div_class = 'media-body';
1616
+ $div_class .= ( $xclass ) ? ' ' . $xclass : '';
1617
+
1618
+ $h4_class = 'media-heading';
1619
+ $h4_class .= ( $xclass ) ? ' ' . $xclass : '';
1620
+
1621
+ $data_props = $this->parse_data_attributes( $data );
1622
+
1623
+ return sprintf(
1624
+ '<div class="%s"%s><h4 class="%s">%s</h4>%s</div>',
1625
+ esc_attr( $div_class ),
1626
+ ( $data_props ) ? ' ' . $data_props : '',
1627
+ esc_attr( $h4_class ),
1628
+ esc_html( $title),
1629
+ do_shortcode( $content )
1630
  );
 
 
 
 
 
1631
  }
1632
 
1633
  /*--------------------------------------------------------------------------------------
1637
  *
1638
  *-------------------------------------------------------------------------------------*/
1639
  function bs_jumbotron( $atts, $content = null ) {
1640
+
1641
+ extract( shortcode_atts( array(
1642
+ "title" => false,
1643
+ "xclass" => false,
1644
+ "data" => false
1645
+ ), $atts ) );
1646
+
1647
+ $class = 'jumbotron';
1648
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1649
+
1650
+ $data_props = $this->parse_data_attributes( $data );
1651
+
1652
+ return sprintf(
1653
+ '<div class="%s"%s>%s%s</div>',
1654
+ esc_attr( $class ),
1655
+ ( $data_props ) ? ' ' . $data_props : '',
1656
+ ( $title ) ? '<h1>' . esc_html( $title ) . '</h1>' : '',
1657
+ do_shortcode( $content )
1658
+ );
1659
+ }
1660
+
1661
+ /*--------------------------------------------------------------------------------------
1662
+ *
1663
+ * bs_page_header
1664
+ *
1665
+ *
1666
+ *-------------------------------------------------------------------------------------*/
1667
+ function bs_page_header( $atts, $content = null ) {
1668
+ extract( shortcode_atts( array(
1669
+ "xclass" => false,
1670
+ "data" => false
1671
+ ), $atts ) );
1672
+ $data_props = $this->parse_data_attributes( $data );
1673
+
1674
+ $class = "page-header";
1675
+ $class .= ($xclass) ? ' ' . $xclass : '';
1676
+
1677
+ $previous_value = libxml_use_internal_errors(TRUE);
1678
+ $dom = new DOMDocument;
1679
+ $dom->loadXML($content);
1680
+ libxml_clear_errors();
1681
+ libxml_use_internal_errors($previous_value);
1682
+ $hasHeader = $dom->getElementsByTagName('h1');
1683
+
1684
+ if( $hasHeader->length == 0 ) {
1685
+
1686
+ $wrapper = $dom->createElement('div');
1687
+ $dom->appendChild($wrapper);
1688
+
1689
+ $header = $dom->createElement('h1', $content);
1690
+ $wrapper->appendChild($header);
1691
 
1692
+ }
1693
+ else {
1694
+ $new_root = $dom->createElement('div');
1695
+ $new_root->appendChild($dom->documentElement);
1696
+ $dom->appendChild($new_root);
1697
+ }
1698
+ $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
1699
+ if( $data ) {
1700
+ $data = explode( '|', $data );
1701
+ foreach( $data as $d ):
1702
+ $d = explode( ',', $d );
1703
+ $dom->documentElement->setAttribute( 'data-' . $d[0], trim( $d[1] ) );
1704
+ endforeach;
1705
+ }
1706
+ $return = $dom->saveXML();
1707
+
1708
  return $return;
 
1709
 
1710
+ }
1711
+
1712
  /*--------------------------------------------------------------------------------------
1713
  *
1714
  * bs_lead
1716
  *
1717
  *-------------------------------------------------------------------------------------*/
1718
  function bs_lead( $atts, $content = null ) {
1719
+ extract( shortcode_atts( array(
1720
+ "xclass" => false,
1721
+ "data" => false
1722
+ ), $atts ) );
1723
+
1724
+ $class = 'lead';
1725
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1726
+
1727
+ $data_props = $this->parse_data_attributes( $data );
1728
+
1729
+ return sprintf(
1730
+ '<p class="%s"%s>%s</p>',
1731
+ esc_attr( $class ),
1732
+ ( $data_props ) ? ' ' . $data_props : '',
1733
+ do_shortcode( $content )
1734
+ );
1735
  }
1736
 
1737
  /*--------------------------------------------------------------------------------------
1741
  *
1742
  *-------------------------------------------------------------------------------------*/
1743
  function bs_emphasis( $atts, $content = null ) {
1744
+
1745
+ extract( shortcode_atts( array(
1746
+ "type" => false,
1747
+ "xclass" => false,
1748
+ "data" => false
1749
+ ), $atts ) );
1750
+
1751
+ $class = '';
1752
+ $class .= ( $type ) ? 'text-' . $type : 'text-muted';
1753
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1754
+
1755
+ $data_props = $this->parse_data_attributes( $data );
1756
+
1757
+ return sprintf(
1758
+ '<span class="%s"%s>%s</span>',
1759
+ esc_attr( $class ),
1760
+ ( $data_props ) ? ' ' . $data_props : '',
1761
+ do_shortcode( $content )
1762
+ );
1763
  }
1764
 
1765
+ /*--------------------------------------------------------------------------------------
1766
+ *
1767
+ * bs_img
1768
+ *
1769
+ *
1770
+ *-------------------------------------------------------------------------------------*/
1771
+ function bs_img( $atts, $content = null ) {
1772
+ extract( shortcode_atts( array(
1773
+ "type" => false,
1774
+ "responsive" => false,
1775
+ "xclass" => false,
1776
+ "data" => false
1777
+ ), $atts ) );
1778
+
1779
+ $class .= ( $type ) ? 'img-' . $type . ' ' : '';
1780
+ $class .= ( $responsive ) ? ' img-responsive' : '';
1781
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1782
+
1783
+ $previous_value = libxml_use_internal_errors(TRUE);
1784
+ $dom = new DOMDocument;
1785
+ $dom->loadXML($content);
1786
+ libxml_clear_errors();
1787
+ libxml_use_internal_errors($previous_value);
1788
+ foreach($dom->getElementsByTagName('img') as $image) {
1789
+ $image->setAttribute('class', $image->getAttribute('class') . ' ' . esc_attr( $class ));
1790
+ if( $data ) {
1791
+ $data = explode( '|', $data );
1792
+ foreach( $data as $d ):
1793
+ $d = explode(',',$d);
1794
+ $image->setAttribute('data-'.$d[0],trim($d[1]));
1795
+ endforeach;
1796
+ }
1797
+ }
1798
+ $return = $dom->saveXML();
1799
+
1800
+ return $return;
1801
+
1802
+ }
1803
+
1804
  /*--------------------------------------------------------------------------------------
1805
  *
1806
  * bs_thumbnail
1808
  *
1809
  *-------------------------------------------------------------------------------------*/
1810
  function bs_thumbnail( $atts, $content = null ) {
1811
+ extract( shortcode_atts( array(
1812
+ "xclass" => false,
1813
+ "data" => false
1814
+ ), $atts ) );
1815
+
1816
+ $class = "thumbnail";
1817
+ $class .= ($xclass) ? ' ' . $xclass : '';
1818
+
1819
+ $previous_value = libxml_use_internal_errors(TRUE);
1820
  $dom = new DOMDocument;
1821
  $dom->loadXML($content);
1822
+ libxml_clear_errors();
1823
+ libxml_use_internal_errors($previous_value); if( ! $dom->documentElement ) {
1824
  $element = $dom->createElement('div', $content);
1825
  $dom->appendChild($element);
1826
  }
1827
+ $dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
1828
+ if( $data ) {
1829
+ $data = explode( '|', $data );
1830
+ foreach( $data as $d ):
1831
+ $d = explode(',',$d);
1832
+ $dom->documentElement->setAttribute('data-'.$d[0],trim($d[1]));
1833
+ endforeach;
1834
+ }
1835
  $return = $dom->saveXML();
1836
 
1837
  return $return;
1845
  *
1846
  *-------------------------------------------------------------------------------------*/
1847
  function bs_responsive( $atts, $content = null ) {
1848
+
1849
+ extract( shortcode_atts( array(
1850
+ "visible" => false,
1851
+ "hidden" => false,
1852
+ "xclass" => false,
1853
+ "data" => false
1854
+ ), $atts ) );
1855
+
1856
+ $class = '';
1857
+ if( $visible ) {
1858
+ $visible = explode( ' ', $visible );
1859
+ foreach($visible as $v):
1860
+ $class .= "visible-$v ";
1861
+ endforeach;
 
 
 
 
 
 
 
1862
  }
1863
+ if( $hidden ) {
1864
+ $hidden = explode( ' ', $hidden );
1865
+ foreach( $hidden as $h ):
1866
+ $classes .= "hidden-$h ";
1867
+ endforeach;
1868
+ }
1869
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1870
+
1871
+ $data_props = $this->parse_data_attributes( $data );
1872
+
1873
+ return sprintf(
1874
+ '<span class="%s"%s>%s</span>',
1875
+ esc_attr( $class ),
1876
+ ( $data_props ) ? ' ' . $data_props : '',
1877
+ do_shortcode( $content )
1878
+ );
1879
  }
1880
 
1881
  /*--------------------------------------------------------------------------------------
1887
  *
1888
  *-------------------------------------------------------------------------------------*/
1889
  function bs_modal( $atts, $content = null ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1890
 
1891
+ extract( shortcode_atts( array(
1892
+ "text" => false,
1893
+ "title" => false,
1894
+ "size" => false,
1895
+ "xclass" => false,
1896
+ "data" => false
1897
+ ), $atts ) );
1898
+
1899
+ $a_class = '';
1900
+ $a_class .= ( $xclass ) ? ' ' . $xclass : '';
1901
+
1902
+ $div_class = 'modal fade';
1903
+ $div_class .= ( $size ) ? ' bs-modal-' . $size : '';
1904
+
1905
+ $id = 'custom-modal-' . sanitize_title( $title );
1906
+
1907
+ $data_props = $this->parse_data_attributes( $data );
1908
+
1909
+ return sprintf(
1910
+ '<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>
1911
+ <div class="%5$s" id="%1$s" tabindex="-1" role="dialog" aria-hidden="true">
1912
+ <div class="modal-dialog">
1913
+ <div class="modal-content">
1914
+ <div class="modal-header">
1915
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
1916
+ %6$s
1917
+ </div>
1918
+ <div class="modal-body">
1919
+ %7$s
1920
+ </div>
1921
+ </div> <!-- /.modal-content -->
1922
+ </div> <!-- /.modal-dialog -->
1923
+ </div> <!-- /.modal -->
1924
+ ',
1925
+ esc_attr( $id ),
1926
+ esc_attr( $a_class ),
1927
+ ( $data_props ) ? ' ' . $data_props : '',
1928
+ esc_html( $text ),
1929
+ esc_attr( $div_class ),
1930
+ ( $title ) ? '<h4 class="modal-title">' . $title . '</h4>' : '',
1931
+ do_shortcode( $content )
1932
+ );
1933
  }
1934
 
1935
  /*--------------------------------------------------------------------------------------
1941
  *
1942
  *-------------------------------------------------------------------------------------*/
1943
  function bs_modal_footer( $atts, $content = null ) {
 
1944
 
1945
+ extract( shortcode_atts( array(
1946
+ "xclass" => false,
1947
+ "data" => false,
1948
+ ), $atts ) );
1949
+
1950
+ $class = 'modal-footer';
1951
+ $class .= ( $xclass ) ? ' ' . $xclass : '';
1952
+
1953
+ $data_props = $this->parse_data_attributes( $data );
1954
+
1955
+ return sprintf(
1956
+ '<div class="%s"%s>%s</div>',
1957
+ esc_attr( $class ),
1958
+ ( $data_props ) ? ' ' . $data_props : '',
1959
+ do_shortcode( $content )
1960
+ );
1961
+ }
1962
+
1963
+ function parse_data_attributes( $data ) {
1964
+
1965
+ $data_props = '';
1966
+
1967
+ if( $data ) {
1968
+ $data = explode( '|', $data );
1969
+
1970
+ foreach( $data as $d ) {
1971
+ $d = explode( ',', $d );
1972
+ $data_props .= sprintf( 'data-%s="%s" ', esc_html( $d[0] ), esc_attr( trim( $d[1] ) ) );
1973
+ }
1974
+ }
1975
+ else {
1976
+ $data_props = false;
1977
+ }
1978
+ return $data_props;
1979
  }
1980
 
1981
  }
composer.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "filipstefansson/bootstrap-3-shortcodes",
3
+ "version": "3.0.3.5",
4
+ "description": "WordPress shortcodes for easier use of Bootstrap elements in your content.",
5
+ "keywords": [
6
+ "bootstrap",
7
+ "shortcodes",
8
+ "wordpress",
9
+ "plugin"
10
+ ],
11
+ "homepage": "https://github.com/filipstefansson/bootstrap-3-shortcodes",
12
+ "license": "GPL2",
13
+ "authors": [
14
+ {
15
+ "name": "Filip Stefansson",
16
+ "email": "filip.stefansson@gmail.com",
17
+ "homepage": "http://filipstefansson.com",
18
+ "role": "Developer"
19
+ },
20
+ {
21
+ "name": "Simon Yeldon"
22
+ },
23
+ {
24
+ "name": "Michael W. Delaney"
25
+ }
26
+ ],
27
+ "type": "wordpress-plugin",
28
+ "require": {
29
+ "php": ">=5.3.2",
30
+ "composer/installers": "v1.0.6"
31
+ }
32
+ }
includes/actions-filters.php CHANGED
@@ -1,38 +1,42 @@
1
  <?php
2
- wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
3
- wp_enqueue_style( 'bootstrap-shortcodes-help' );
4
 
5
- add_filter('the_content', 'bs_fix_shortcodes');
 
 
 
 
 
 
6
 
7
- // Create a Media Button for the help file
8
- //add a button to the content editor, next to the media button
9
- //this button will show a popup that contains inline content
10
- add_action('media_buttons_context', 'add_bootstrap_button');
11
 
12
  //action to add a custom button to the content editor
13
- function add_bootstrap_button($context) {
14
 
15
  //path to my icon
16
  $img = BS_SHORTCODES_URL . 'images/Twitter_Boostrap_logo.svg';
17
 
18
  //the id of the container I want to show in the popup
19
- $popup_url = 'bootstrap-shortcodes-help-popup';
20
 
21
  //our popup's title
22
  $title = 'Bootstrap Shortcodes Help';
23
 
24
  //append the icon
25
- $context .= "<a title='{$title}'
26
- href='#TB_inline?inlineId={$popup_url}&width=640&height=550' class='thickbox button add_media' style='padding-left: 0px; padding-right: 0px;' title='Bootstrap Shortcodes Help'>
27
- <img src='{$img}' style='height: 20px; position: relative; top: -2px;'></a>";
28
-
29
- return $context;
 
 
30
  }
 
 
 
 
31
 
32
  function boostrap_shortcodes_help() {
33
  include('bootstrap-shortcodes-help.php');
34
  }
35
  add_action( 'admin_footer', 'boostrap_shortcodes_help' );
36
-
37
-
38
- ?>
1
  <?php
 
 
2
 
3
+ /* Include the styling for the help tab in the admin
4
+ */
5
+ function bootstrap_shortcodes_help_styles() {
6
+ wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
7
+ wp_enqueue_style( 'bootstrap-shortcodes-help' );
8
+ }
9
+ add_action( 'admin_enqueue_scripts', 'bootstrap_shortcodes_help_styles' );
10
 
11
+ add_filter('the_content', 'bs_fix_shortcodes');
 
 
 
12
 
13
  //action to add a custom button to the content editor
14
+ function add_bootstrap_button() {
15
 
16
  //path to my icon
17
  $img = BS_SHORTCODES_URL . 'images/Twitter_Boostrap_logo.svg';
18
 
19
  //the id of the container I want to show in the popup
20
+ $popup_id = 'bootstrap-shortcodes-help-popup';
21
 
22
  //our popup's title
23
  $title = 'Bootstrap Shortcodes Help';
24
 
25
  //append the icon
26
+ printf(
27
+ '<a title="%s" href="%s" class="thickbox button add_media" style="padding-left: 0px; padding-right: 0px;" title="Bootstrap Shortcodes Help">%s</a>',
28
+ esc_attr( $title ),
29
+ esc_url( '#TB_inline?width=640&height=650&inlineId=' . $popup_id ),
30
+ sprintf( '<img src="%s" style="height: 20px; position: relative; top: -2px;">', esc_url( $img ) )
31
+ );
32
+
33
  }
34
+ // Create a Media Button for the help file
35
+ //add a button to the content editor, next to the media button
36
+ //this button will show a popup that contains inline content
37
+ add_action('media_buttons', 'add_bootstrap_button', 11);
38
 
39
  function boostrap_shortcodes_help() {
40
  include('bootstrap-shortcodes-help.php');
41
  }
42
  add_action( 'admin_footer', 'boostrap_shortcodes_help' );
 
 
 
includes/bootstrap-shortcodes-help.php CHANGED
@@ -9,11 +9,15 @@ function retitle($match) {
9
  return "<$h3 id='$id'>$title</$h3>";
10
  }
11
 
12
- $thisfile = realpath(dirname(__FILE__));
13
  # Install PSR-0-compatible class autoloader
14
- spl_autoload_register(function($class){
15
- require 'php_markdown/' . preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
16
- });
 
 
 
 
17
 
18
  # Get Markdown class
19
  //use \Michelf\Markdown;
@@ -45,8 +49,10 @@ $html = MarkdownExtra::defaultTransform($text);
45
  # Put HTML content in the document
46
  $html = preg_replace('/(<a href="http:[^"]+")>/is','\\1 target="_blank">',$html);
47
  $html = str_replace('<table>', '<table class="table table-striped">', $html);
48
- $html = str_replace('<ul>', '<ul class="list-group">', $html);
49
- $html = str_replace('<li>', '<li class="list-group-item">', $html);
 
 
50
  $html = preg_replace_callback("#<(h[1-6])>(.*?)</\\1>#", "retitle", $html);
51
  $html = str_replace('</pre>', '</pre><p><button class="btn btn-primary btn-sm insert-code">Insert Example <i class="glyphicon glyphicon-share-alt"></i></button></p>', $html);
52
  echo $html;
9
  return "<$h3 id='$id'>$title</$h3>";
10
  }
11
 
12
+ //$thisfile = realpath(dirname(__FILE__));
13
  # Install PSR-0-compatible class autoloader
14
+ //spl_autoload_register(function($class){
15
+ // require 'php_markdown/' . preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
16
+ //});
17
+
18
+ if(!class_exists('\Michelf\MarkdownExtra' )) {
19
+ require_once 'php_markdown/Michelf/MarkdownExtra.inc.php';
20
+ }
21
 
22
  # Get Markdown class
23
  //use \Michelf\Markdown;
49
  # Put HTML content in the document
50
  $html = preg_replace('/(<a href="http:[^"]+")>/is','\\1 target="_blank">',$html);
51
  $html = str_replace('<table>', '<table class="table table-striped">', $html);
52
+ $html = str_replace('<ul>', '<div class="list-group">', $html);
53
+ $html = str_replace('</ul>', '</div">', $html);
54
+ $html = str_replace('<li><a ', '<a class="list-group-item" ', $html);
55
+ $html = str_replace('</li>', '', $html);
56
  $html = preg_replace_callback("#<(h[1-6])>(.*?)</\\1>#", "retitle", $html);
57
  $html = str_replace('</pre>', '</pre><p><button class="btn btn-primary btn-sm insert-code">Insert Example <i class="glyphicon glyphicon-share-alt"></i></button></p>', $html);
58
  echo $html;
includes/defaults.php CHANGED
@@ -1,15 +1,13 @@
1
  <?php
2
 
3
  // Windows-proof constants: replace backward by forward slashes - thanks to: https://github.com/peterbouwmeester
4
- $fslashed_dir = trailingslashit(str_replace('\\','/', dirname(__FILE__)));
5
- $fslashed_abs = trailingslashit(str_replace('\\','/', ABSPATH));
6
 
7
  if(!defined('BS_SHORTCODES_DIR')) {
8
- define('BS_SHORTCODES_DIR', $fslashed_dir);
9
  }
10
 
11
  if(!defined('BS_SHORTCODES_URL')) {
12
- define('BS_SHORTCODES_URL', site_url(str_replace($fslashed_abs, '', $fslashed_dir)));
13
  }
14
-
15
- ?>
1
  <?php
2
 
3
  // Windows-proof constants: replace backward by forward slashes - thanks to: https://github.com/peterbouwmeester
4
+ //$fslashed_dir = trailingslashit(str_replace('\\','/', dirname(__FILE__)));
5
+ //$fslashed_abs = trailingslashit(str_replace('\\','/', ABSPATH));
6
 
7
  if(!defined('BS_SHORTCODES_DIR')) {
8
+ define('BS_SHORTCODES_DIR', plugin_dir_path( __FILE__ ));
9
  }
10
 
11
  if(!defined('BS_SHORTCODES_URL')) {
12
+ define('BS_SHORTCODES_URL', plugin_dir_url( __FILE__ ));
13
  }
 
 
includes/functions.php CHANGED
@@ -10,4 +10,21 @@ function bs_fix_shortcodes($content){
10
  $content = strtr($content, $array);
11
  return $content;
12
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ?>
10
  $content = strtr($content, $array);
11
  return $content;
12
  }
13
+
14
+ // We need to be able to figure out the attributes of a wrapped shortcode
15
+ function bs_attribute_map($str, $att = null) {
16
+ $res = array();
17
+ $return = array();
18
+ $reg = get_shortcode_regex();
19
+ preg_match_all('~'.$reg.'~',$str, $matches);
20
+ foreach($matches[2] as $key => $name) {
21
+ $parsed = shortcode_parse_atts($matches[3][$key]);
22
+ $parsed = is_array($parsed) ? $parsed : array();
23
+
24
+ $res[$name] = $parsed;
25
+ $return[] = $res;
26
+ }
27
+ return $return;
28
+ }
29
+
30
  ?>
includes/help/css/bootstrap-shortcodes-help.css CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  /* CSS crunched with Crunch - http://crunchapp.net/ */
2
  #bootstrap-shortcodes-help {
3
  /*! normalize.css v2.1.3 | MIT License | git.io/normalize */
1
+ #bootstrap-shortcodes-help a:link,
2
+ #bootstrap-shortcodes-help a:visited {
3
+ color: #428bca;
4
+ font-size: 14px;
5
+ }
6
+
7
+
8
  /* CSS crunched with Crunch - http://crunchapp.net/ */
9
  #bootstrap-shortcodes-help {
10
  /*! normalize.css v2.1.3 | MIT License | git.io/normalize */
includes/php_markdown/Michelf/Markdown.inc.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ # Use this file if you cannot use class autoloading. It will include all the
4
+ # files needed for the Markdown parser.
5
+ #
6
+ # Take a look at the PSR-0-compatible class autoloading implementation
7
+ # in the Readme.php file if you want a simple autoloader setup.
8
+
9
+ require_once dirname(__FILE__) . '/MarkdownInterface.php';
10
+ require_once dirname(__FILE__) . '/Markdown.php';
includes/php_markdown/Michelf/Markdown.php CHANGED
@@ -17,11 +17,11 @@ namespace Michelf;
17
  # Markdown Parser Class
18
  #
19
 
20
- class Markdown {
21
 
22
  ### Version ###
23
 
24
- const MARKDOWNLIB_VERSION = "1.3";
25
 
26
  ### Simple Function Interface ###
27
 
@@ -1269,7 +1269,7 @@ class Markdown {
1269
  # Ampersand-encoding based entirely on Nat Irons's Amputator
1270
  # MT plugin: <http://bumppo.net/projects/amputator/>
1271
  $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
1272
- '&amp;', $text);;
1273
  }
1274
  # Encode remaining <'s
1275
  $text = str_replace('<', '&lt;', $text);
@@ -1302,9 +1302,16 @@ class Markdown {
1302
  >
1303
  }xi',
1304
  array(&$this, '_doAutoLinks_email_callback'), $text);
 
1305
 
1306
  return $text;
1307
  }
 
 
 
 
 
 
1308
  protected function _doAutoLinks_url_callback($matches) {
1309
  $url = $this->encodeAttribute($matches[1]);
1310
  $link = "<a href=\"$url\">$url</a>";
@@ -1524,7 +1531,7 @@ class Markdown {
1524
  # one.
1525
  #
1526
 
1527
- class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1528
 
1529
  ### Configuration Variables ###
1530
 
@@ -1832,9 +1839,6 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1832
  <\?.*?\?> | <%.*?%> # Processing instruction
1833
  |
1834
  <!\[CDATA\[.*?\]\]> # CData Block
1835
- |
1836
- # Code span marker
1837
- `+
1838
  '. ( !$span ? ' # If not in span.
1839
  |
1840
  # Indented code block
@@ -1846,7 +1850,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1846
  |
1847
  # Fenced code block marker
1848
  (?<= ^ | \n )
1849
- [ ]{0,'.($indent+3).'}~{3,}
1850
  [ ]*
1851
  (?:
1852
  \.?[-_:a-zA-Z0-9]+ # standalone class name
@@ -1854,8 +1858,14 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1854
  '.$this->id_class_attr_nocatch_re.' # extra attributes
1855
  )?
1856
  [ ]*
1857
- \n
1858
  ' : '' ). ' # End (if not is span).
 
 
 
 
 
 
1859
  )
1860
  }xs';
1861
 
@@ -1897,28 +1907,12 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1897
  $text = $parts[2]; # Remaining text after current tag.
1898
  $tag_re = preg_quote($tag); # For use in a regular expression.
1899
 
1900
- #
1901
- # Check for: Code span marker
1902
- #
1903
- if ($tag{0} == "`") {
1904
- # Find corresponding end marker.
1905
- $tag_re = preg_quote($tag);
1906
- if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}',
1907
- $text, $matches))
1908
- {
1909
- # End marker found: pass text unchanged until marker.
1910
- $parsed .= $tag . $matches[0];
1911
- $text = substr($text, strlen($matches[0]));
1912
- }
1913
- else {
1914
- # Unmatched marker: just skip it.
1915
- $parsed .= $tag;
1916
- }
1917
- }
1918
  #
1919
  # Check for: Fenced code block marker.
 
 
1920
  #
1921
- else if (preg_match('{^\n?([ ]{0,'.($indent+3).'})(~+)}', $tag, $capture)) {
1922
  # Fenced code block marker: find matching end marker.
1923
  $fence_indent = strlen($capture[1]); # use captured indent in re
1924
  $fence_re = $capture[2]; # use captured fence in re
@@ -1943,6 +1937,25 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1943
  $parsed .= $tag;
1944
  }
1945
  #
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1946
  # Check for: Opening Block level tag or
1947
  # Opening Context Block tag (like ins and del)
1948
  # used as a block tag (tag is alone on it's line).
@@ -2767,7 +2780,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
2767
  (?:\n|\A)
2768
  # 1: Opening marker
2769
  (
2770
- ~{3,} # Marker: three tilde or more.
2771
  )
2772
  [ ]*
2773
  (?:
@@ -2786,7 +2799,7 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
2786
  )
2787
 
2788
  # Closing marker.
2789
- \1 [ ]* \n
2790
  }xm',
2791
  array(&$this, '_doFencedCodeBlocks_callback'), $text);
2792
 
@@ -2936,8 +2949,8 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
2936
  $text .= "<div class=\"footnotes\">\n";
2937
  $text .= "<hr". $this->empty_element_suffix ."\n";
2938
  $text .= "<ol>\n\n";
2939
-
2940
- $attr = " rev=\"footnote\"";
2941
  if ($this->fn_backlink_class != "") {
2942
  $class = $this->fn_backlink_class;
2943
  $class = $this->encodeAttribute($class);
@@ -3091,4 +3104,3 @@ class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
3091
  }
3092
 
3093
  }
3094
-
17
  # Markdown Parser Class
18
  #
19
 
20
+ class Markdown implements MarkdownInterface {
21
 
22
  ### Version ###
23
 
24
+ const MARKDOWNLIB_VERSION = "1.4.0";
25
 
26
  ### Simple Function Interface ###
27
 
1269
  # Ampersand-encoding based entirely on Nat Irons's Amputator
1270
  # MT plugin: <http://bumppo.net/projects/amputator/>
1271
  $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
1272
+ '&amp;', $text);
1273
  }
1274
  # Encode remaining <'s
1275
  $text = str_replace('<', '&lt;', $text);
1302
  >
1303
  }xi',
1304
  array(&$this, '_doAutoLinks_email_callback'), $text);
1305
+ $text = preg_replace_callback('{<(tel:([^\'">\s]+))>}i',array(&$this, '_doAutoLinks_tel_callback'), $text);
1306
 
1307
  return $text;
1308
  }
1309
+ protected function _doAutoLinks_tel_callback($matches) {
1310
+ $url = $this->encodeAttribute($matches[1]);
1311
+ $tel = $this->encodeAttribute($matches[2]);
1312
+ $link = "<a href=\"$url\">$tel</a>";
1313
+ return $this->hashPart($link);
1314
+ }
1315
  protected function _doAutoLinks_url_callback($matches) {
1316
  $url = $this->encodeAttribute($matches[1]);
1317
  $link = "<a href=\"$url\">$url</a>";
1531
  # one.
1532
  #
1533
 
1534
+ abstract class _MarkdownExtra_TmpImpl extends \Michelf\Markdown {
1535
 
1536
  ### Configuration Variables ###
1537
 
1839
  <\?.*?\?> | <%.*?%> # Processing instruction
1840
  |
1841
  <!\[CDATA\[.*?\]\]> # CData Block
 
 
 
1842
  '. ( !$span ? ' # If not in span.
1843
  |
1844
  # Indented code block
1850
  |
1851
  # Fenced code block marker
1852
  (?<= ^ | \n )
1853
+ [ ]{0,'.($indent+3).'}(?:~{3,}|`{3,})
1854
  [ ]*
1855
  (?:
1856
  \.?[-_:a-zA-Z0-9]+ # standalone class name
1858
  '.$this->id_class_attr_nocatch_re.' # extra attributes
1859
  )?
1860
  [ ]*
1861
+ (?= \n )
1862
  ' : '' ). ' # End (if not is span).
1863
+ |
1864
+ # Code span marker
1865
+ # Note, this regex needs to go after backtick fenced
1866
+ # code blocks but it should also be kept outside of the
1867
+ # "if not in span" condition adding backticks to the parser
1868
+ `+
1869
  )
1870
  }xs';
1871
 
1907
  $text = $parts[2]; # Remaining text after current tag.
1908
  $tag_re = preg_quote($tag); # For use in a regular expression.
1909
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1910
  #
1911
  # Check for: Fenced code block marker.
1912
+ # Note: need to recheck the whole tag to disambiguate backtick
1913
+ # fences from code spans
1914
  #
1915
+ if (preg_match('{^\n?([ ]{0,'.($indent+3).'})(~{3,}|`{3,})[ ]*(?:\.?[-_:a-zA-Z0-9]+|'.$this->id_class_attr_nocatch_re.')?[ ]*\n?$}', $tag, $capture)) {
1916
  # Fenced code block marker: find matching end marker.
1917
  $fence_indent = strlen($capture[1]); # use captured indent in re
1918
  $fence_re = $capture[2]; # use captured fence in re
1937
  $parsed .= $tag;
1938
  }
1939
  #
1940
+ # Check for: Code span marker
1941
+ # Note: need to check this after backtick fenced code blocks
1942
+ #
1943
+ else if ($tag{0} == "`") {
1944
+ # Find corresponding end marker.
1945
+ $tag_re = preg_quote($tag);
1946
+ if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}',
1947
+ $text, $matches))
1948
+ {
1949
+ # End marker found: pass text unchanged until marker.
1950
+ $parsed .= $tag . $matches[0];
1951
+ $text = substr($text, strlen($matches[0]));
1952
+ }
1953
+ else {
1954
+ # Unmatched marker: just skip it.
1955
+ $parsed .= $tag;
1956
+ }
1957
+ }
1958
+ #
1959
  # Check for: Opening Block level tag or
1960
  # Opening Context Block tag (like ins and del)
1961
  # used as a block tag (tag is alone on it's line).
2780
  (?:\n|\A)
2781
  # 1: Opening marker
2782
  (
2783
+ (?:~{3,}|`{3,}) # 3 or more tildes/backticks.
2784
  )
2785
  [ ]*
2786
  (?:
2799
  )
2800
 
2801
  # Closing marker.
2802
+ \1 [ ]* (?= \n )
2803
  }xm',
2804
  array(&$this, '_doFencedCodeBlocks_callback'), $text);
2805
 
2949
  $text .= "<div class=\"footnotes\">\n";
2950
  $text .= "<hr". $this->empty_element_suffix ."\n";
2951
  $text .= "<ol>\n\n";
2952
+
2953
+ $attr = "";
2954
  if ($this->fn_backlink_class != "") {
2955
  $class = $this->fn_backlink_class;
2956
  $class = $this->encodeAttribute($class);
3104
  }
3105
 
3106
  }
 
includes/php_markdown/Michelf/MarkdownExtra.inc.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ # Use this file if you cannot use class autoloading. It will include all the
4
+ # files needed for the MarkdownExtra parser.
5
+ #
6
+ # Take a look at the PSR-0-compatible class autoloading implementation
7
+ # in the Readme.php file if you want a simple autoloader setup.
8
+
9
+ require_once dirname(__FILE__) . '/MarkdownInterface.php';
10
+ require_once dirname(__FILE__) . '/Markdown.php';
11
+ require_once dirname(__FILE__) . '/MarkdownExtra.php';
includes/php_markdown/Michelf/MarkdownInterface.inc.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ # Use this file if you cannot use class autoloading. It will include all the
4
+ # files needed for the MarkdownInterface interface.
5
+ #
6
+ # Take a look at the PSR-0-compatible class autoloading implementation
7
+ # in the Readme.php file if you want a simple autoloader setup.
8
+
9
+ require_once dirname(__FILE__) . '/MarkdownInterface.php';
includes/php_markdown/Michelf/MarkdownInterface.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ #
3
+ # Markdown - A text-to-HTML conversion tool for web writers
4
+ #
5
+ # PHP Markdown
6
+ # Copyright (c) 2004-2013 Michel Fortin
7
+ # <http://michelf.com/projects/php-markdown/>
8
+ #
9
+ # Original Markdown
10
+ # Copyright (c) 2004-2006 John Gruber
11
+ # <http://daringfireball.net/projects/markdown/>
12
+ #
13
+ namespace Michelf;
14
+
15
+
16
+ #
17
+ # Markdown Parser Interface
18
+ #
19
+
20
+ interface MarkdownInterface {
21
+
22
+ #
23
+ # Initialize the parser and return the result of its transform method.
24
+ # This will work fine for derived classes too.
25
+ #
26
+ public static function defaultTransform($text);
27
+
28
+ #
29
+ # Main function. Performs some preprocessing on the input text
30
+ # and pass it through the document gamut.
31
+ #
32
+ public function transform($text);
33
+
34
+ }
35
+
36
+
37
+ ?>
includes/php_markdown/Readme.md CHANGED
@@ -1,7 +1,7 @@
1
  PHP Markdown
2
  ============
3
 
4
- PHP Markdown Lib 1.3 - 11 Apr 2013
5
 
6
  by Michel Fortin
7
  <http://michelf.ca/>
@@ -14,19 +14,21 @@ Introduction
14
  ------------
15
 
16
  This is a library package that includes the PHP Markdown parser and its
17
- sibling PHP Markdown Extra which additional features.
18
 
19
  Markdown is a text-to-HTML conversion tool for web writers. Markdown
20
  allows you to write using an easy-to-read, easy-to-write plain text
21
  format, then convert it to structurally valid XHTML (or HTML).
22
 
23
- "Markdown" is two things: a plain text markup syntax, and a software
24
- tool, written in Perl, that converts the plain text markup to HTML.
25
- PHP Markdown is a port to PHP of the original Markdown program by
26
- John Gruber.
27
 
28
- Full documentation of Markdown's syntax is available on John's
29
- Markdown page: <http://daringfireball.net/projects/markdown/>
 
 
30
 
31
 
32
  Requirement
@@ -47,9 +49,8 @@ Usage
47
 
48
  This library package is meant to be used with class autoloading. For autoloading
49
  to work, your project needs have setup a PSR-0-compatible autoloader. See the
50
- included Readme.php file for a minimal autoloader setup. (If you don't want to
51
- use autoloading you can do a classic `require_once` to manually include the
52
- files prior use instead.)
53
 
54
  With class autoloading in place, putting the 'Michelf' folder in your
55
  include path should be enough for this to work:
@@ -85,6 +86,22 @@ To learn more, see the full list of [configuration variables].
85
  [configuration variables]: http://michelf.ca/projects/php-markdown/configuration/
86
 
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  Public API and Versioning Policy
89
  ---------------------------------
90
 
@@ -128,13 +145,51 @@ that the backtrack limit is not too low by running `php --info | grep pcre`.
128
  See Installation and Requirement above for details.
129
 
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  Version History
132
  ---------------
133
 
134
- PHP Markdown Lib 1.3 (11 Apr 2013):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  This is the first release of PHP Markdown Lib. This package requires PHP
137
- version 4.3 or later and is designed to work with PSR-0 autoloading and,
138
  optionally with Composer. Here is a list of the changes since
139
  PHP Markdown Extra 1.2.6:
140
 
1
  PHP Markdown
2
  ============
3
 
4
+ PHP Markdown Lib 1.4.0 - 29 Nov 2013
5
 
6
  by Michel Fortin
7
  <http://michelf.ca/>
14
  ------------
15
 
16
  This is a library package that includes the PHP Markdown parser and its
17
+ sibling PHP Markdown Extra with additional features.
18
 
19
  Markdown is a text-to-HTML conversion tool for web writers. Markdown
20
  allows you to write using an easy-to-read, easy-to-write plain text
21
  format, then convert it to structurally valid XHTML (or HTML).
22
 
23
+ "Markdown" is actually two things: a plain text markup syntax, and a
24
+ software tool, originally written in Perl, that converts the plain text
25
+ markup to HTML. PHP Markdown is a port to PHP of the original Markdown
26
+ program by John Gruber.
27
 
28
+ * [Full documentation of the Markdown syntax](<http://daringfireball.net/projects/markdown/>)
29
+ - Daring Fireball (John Gruber)
30
+ * [Markdown Extra syntax additions](<http://michelf.ca/projects/php-markdown/extra/>)
31
+ - Michel Fortin
32
 
33
 
34
  Requirement
49
 
50
  This library package is meant to be used with class autoloading. For autoloading
51
  to work, your project needs have setup a PSR-0-compatible autoloader. See the
52
+ included Readme.php file for a minimal autoloader setup. (If you cannot use
53
+ autoloading, see below.)
 
54
 
55
  With class autoloading in place, putting the 'Michelf' folder in your
56
  include path should be enough for this to work:
86
  [configuration variables]: http://michelf.ca/projects/php-markdown/configuration/
87
 
88
 
89
+ ### Usage without an autoloader
90
+
91
+ If you cannot use class autoloading, you can still use `include` or `require`
92
+ to access the parser. To load the `\Michelf\Markdown` parser, do it this way:
93
+
94
+ require_once 'Michelf/Markdown.inc.php';
95
+
96
+ Or, if you need the `\Michelf\MarkdownExtra` parser:
97
+
98
+ require_once 'Michelf/MarkdownExtra.inc.php';
99
+
100
+ While the plain `.php` files depend on autoloading to work correctly, using the
101
+ `.inc.php` files instead will eagerly load the dependencies that would be
102
+ loaded on demand if you were using autoloading.
103
+
104
+
105
  Public API and Versioning Policy
106
  ---------------------------------
107
 
145
  See Installation and Requirement above for details.
146
 
147
 
148
+ Development and Testing
149
+ -----------------------
150
+
151
+ Pull requests for fixing bugs are welcome. Proposed new features are
152
+ going meticulously reviewed -- taking into account backward compatibility,
153
+ potential side effects, and future extensibility -- before deciding on
154
+ acceptance or rejection.
155
+
156
+ If you make a pull request that includes changes to the parser please add
157
+ tests for what is being changed to [MDTest][] and make a pull request there
158
+ too.
159
+
160
+ [MDTest]: https://github.com/michelf/mdtest/
161
+
162
+
163
  Version History
164
  ---------------
165
 
166
+ PHP Markdown Lib 1.4.0 (29 Nov 2013)
167
+
168
+ * Added support for the `tel:` URL scheme in automatic links.
169
+
170
+ <tel:+1-111-111-1111>
171
+
172
+ It gets converted to this (note the `tel:` prefix becomes invisible):
173
+
174
+ <a href="tel:+1-111-111-1111">+1-111-111-1111</a>
175
+
176
+ * Added backtick fenced code blocks to MarkdownExtra, originally from
177
+ Github-Flavored Markdown.
178
+
179
+ * Added an interface called MarkdownInterface implemented by both
180
+ the Markdown and MarkdownExtra parsers. You can use the interface if
181
+ you want to create a mockup parser object for unit testing.
182
+
183
+ * For those of you who cannot use class autoloading, you can now
184
+ include `Michelf/Markdown.inc.php` or `Michelf/MarkdownExtra.inc.php` (note
185
+ the `.inc.php` extension) to automatically include other files required
186
+ by the parser.
187
+
188
+
189
+ PHP Markdown Lib 1.3 (11 Apr 2013)
190
 
191
  This is the first release of PHP Markdown Lib. This package requires PHP
192
+ version 5.3 or later and is designed to work with PSR-0 autoloading and,
193
  optionally with Composer. Here is a list of the changes since
194
  PHP Markdown Extra 1.2.6:
195
 
includes/php_markdown/Readme.php CHANGED
@@ -12,7 +12,7 @@ spl_autoload_register(function($class){
12
  # Get Markdown class
13
  use \Michelf\Markdown;
14
 
15
- # Read file and pass content through the Markdown praser
16
  $text = file_get_contents('Readme.md');
17
  $html = Markdown::defaultTransform($text);
18
 
12
  # Get Markdown class
13
  use \Michelf\Markdown;
14
 
15
+ # Read file and pass content through the Markdown parser
16
  $text = file_get_contents('Readme.md');
17
  $html = Markdown::defaultTransform($text);
18
 
includes/php_markdown/composer.json CHANGED
@@ -25,7 +25,7 @@
25
  },
26
  "extra": {
27
  "branch-alias": {
28
- "dev-lib": "1.3.x-dev"
29
  }
30
  }
31
  }
25
  },
26
  "extra": {
27
  "branch-alias": {
28
+ "dev-lib": "1.4.x-dev"
29
  }
30
  }
31
  }
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: 3.8
6
- Stable tag: 3.0.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -16,11 +16,13 @@ Plenty of great WordPress plugins focus on providing or including the Bootstrap
16
 
17
  This plugin creates a simple, out of the way button just above the WordPress TinyMCE editor (next to the "Add Media" button) which pops up the plugin's documentation and shortcode examples for reference and handy "Insert Example" links to send the example shortcodes straight to the editor. There are no additional TinyMCE buttons to clutter up your screen, just great, easy to use shortcodes!
18
 
 
 
19
  If you like this plugin, check out our companion plugin for Font Awesome, [Font Awesome Shortcodes](http://www.wordpress.org/plugins/font-awesome-shortcodes/)
20
 
21
  ###Supported Shortcodes
22
  ####CSS
23
- * Grid
24
  * Lead body copy
25
  * Emphasis classes
26
  * Code
@@ -49,6 +51,7 @@ If you like this plugin, check out our companion plugin for Font Awesome, [Font
49
  * Tooltip
50
  * Popover
51
  * Collapse (Accordion)
 
52
  * Modal
53
 
54
  == Installation ==
@@ -65,6 +68,31 @@ No, we assume you are already working with a WordPress theme that includes the B
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  = 3.0.3.1 =
69
  * Change help-tab to inline rather than iframe in to meet WordPress.org submission requirements
70
  * Add support for images (http://getbootstrap.com/css/#images)
3
  Tags: bootstrap, shortcode, shortcodes, responsive, grid
4
  Requires at least: 3.8
5
  Tested up to: 3.8
6
+ Stable tag: 3.0.3.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
16
 
17
  This plugin creates a simple, out of the way button just above the WordPress TinyMCE editor (next to the "Add Media" button) which pops up the plugin's documentation and shortcode examples for reference and handy "Insert Example" links to send the example shortcodes straight to the editor. There are no additional TinyMCE buttons to clutter up your screen, just great, easy to use shortcodes!
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
  If you like this plugin, check out our companion plugin for Font Awesome, [Font Awesome Shortcodes](http://www.wordpress.org/plugins/font-awesome-shortcodes/)
22
 
23
  ###Supported Shortcodes
24
  ####CSS
25
+ * Grid (container, row, columns, fully responsive)
26
  * Lead body copy
27
  * Emphasis classes
28
  * Code
51
  * Tooltip
52
  * Popover
53
  * Collapse (Accordion)
54
+ * Carousel
55
  * Modal
56
 
57
  == Installation ==
68
 
69
  == Changelog ==
70
 
71
+ = 3.0.3.6 =
72
+ * Significant rewrite to properly escape inputs
73
+ * [tabs] now supports "pills" and "fade" styles
74
+ * [tabs] and [carousel] now support setting a tab or image other than the first one as "active". If no tab or carousel item is set to "active" the first one is set by default.
75
+ * [panel] titles are now optional (see documentation for new shortcode parameters)
76
+ * [list-group-item] now supports optional "type" parameter (Bootstrap 3.1 only)
77
+ * [button] now supports "disabled" and "active" parameters
78
+ * [progress-bar] now supports showing labels
79
+ * Add [dropdown-header] shortcode
80
+ * [container] now includes optional "fluid" parameter (Bootstrap 3.1 only)
81
+ * [modal] now supports sizes (Bootstrap 3.1 only)
82
+ * Composer support
83
+ * Resolve errors regarding uninitialized variables experienced by some users
84
+ * Resolve image path icons for non-standard WordPress directory names
85
+ * Resolved DOMDocument errors experienced by some users (if you still see these errors or warnings please let us know)
86
+
87
+ = 3.0.3.5 =
88
+ * Add support for [container] shortcode for themes without a container defined
89
+ * Add support for [carousel] and [carousel-item] shortcodes
90
+ * Add support for "xclass" and "data" parameters to all shortcodes
91
+ * Plenty of bugfixes and code cleanup to fix common issues
92
+
93
+ = 3.0.3.2 =
94
+ * Fix help tab popup on edit pages
95
+
96
  = 3.0.3.1 =
97
  * Change help-tab to inline rather than iframe in to meet WordPress.org submission requirements
98
  * Add support for images (http://getbootstrap.com/css/#images)