Version Description
- Tested to work with WordPress 4.6
- Fixed bug in collapse
- Note PHP 5.3 or greater requirement in documentation
- Update documentation for clarity
- Fix issue with xclass in active tabs (thanks who all who reported it!)
Download this release
Release Info
Developer | FoolsRun |
Plugin | Bootstrap Shortcodes for WordPress |
Version | 3.3.9 |
Comparing to | |
See all releases |
Code changes from version 3.3.8 to 3.3.9
- README.md +34 -10
- bootstrap-shortcodes.php +418 -366
- composer.json +2 -2
- includes/actions-filters.php +123 -50
- includes/bootstrap-shortcodes-help.php +126 -52
- includes/defaults.php +14 -7
- includes/functions.php +39 -33
- includes/help/README.html +48 -4
- includes/help/css/bootstrap-shortcodes-help.css +1 -2
- readme.txt +14 -7
README.md
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
-
Bootstrap Shortcodes for WordPress
|
2 |
===
|
3 |
|
|
|
|
|
4 |
WordPress plugin that provides shortcodes for easier use of the Bootstrap styles and components in your content.
|
5 |
|
|
|
|
|
6 |
## Requirements
|
7 |
-
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
13 |
## Shortcode Reference
|
14 |
|
@@ -63,8 +67,8 @@ This plugin contains a ```composer.json``` file for those of you who manage your
|
|
63 |
...
|
64 |
[/column]
|
65 |
[/row]
|
66 |
-
|
67 |
-
The container component is also supported in case your theme doesn't
|
68 |
|
69 |
[container]
|
70 |
[row]
|
@@ -77,6 +81,20 @@ The container component is also supported in case your theme doesn't incude a co
|
|
77 |
[/row]
|
78 |
[/container]
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
#### [container] parameters
|
81 |
Parameter | Description | Required | Values | Default
|
82 |
--- | --- | --- | --- | ---
|
@@ -84,6 +102,12 @@ fluid | Is the container fluid? (see Bootstrap documentation for details) | opti
|
|
84 |
xclass | Any extra classes you want to add | optional | any text | none
|
85 |
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
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
#### [row] parameters
|
88 |
Parameter | Description | Required | Values | Default
|
89 |
--- | --- | --- | --- | ---
|
@@ -160,9 +184,9 @@ data | Data attribute and value pairs separated by a comma. Pairs separated by p
|
|
160 |
|
161 |
### Tables
|
162 |
[table-wrap bordered="true" striped="true"]
|
163 |
-
|
164 |
Standard HTML table code goes here.
|
165 |
-
|
166 |
[/table-wrap]
|
167 |
|
168 |
#### [table-wrap] parameters
|
@@ -273,7 +297,7 @@ data | Data attribute and value pairs separated by a comma. Pairs separated by p
|
|
273 |
[button link="#"] ... [/button]
|
274 |
[button link="#"] ... [/button]
|
275 |
[/button-group]
|
276 |
-
|
277 |
#### Button toolbar
|
278 |
[button-toolbar]
|
279 |
[button-group]
|
@@ -780,7 +804,7 @@ html | Insert HTML into the tooltip | optional | true, false | false
|
|
780 |
[collapse title="Collapse 1" active="true"]
|
781 |
...
|
782 |
[/collapse]
|
783 |
-
|
784 |
#### Set of Collapsibles
|
785 |
[collapsibles]
|
786 |
[collapse title="Collapse 1" active="true"]
|
1 |
+
Bootstrap 3 Shortcodes for WordPress
|
2 |
===
|
3 |
|
4 |
+
![WordPress Rating](https://img.shields.io/wordpress/plugin/r/bootstrap-3-shortcodes.svg) ![WordPress Downloads](https://img.shields.io/wordpress/plugin/dt/bootstrap-3-shortcodes.svg)
|
5 |
+
|
6 |
WordPress plugin that provides shortcodes for easier use of the Bootstrap styles and components in your content.
|
7 |
|
8 |
+
**Bootstrap 3 Shortcodes for WordPress** 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!
|
9 |
+
|
10 |
## Requirements
|
11 |
+
![Tested in WordPress](https://img.shields.io/wordpress/v/bootstrap-3-shortcodes.svg) ![PHP 5.3+](https://img.shields.io/badge/PHP-5.3%2B-blue.svg) ![Bootstrap](https://img.shields.io/badge/Bootstrap-3.3.x-6f5499.svg)
|
12 |
|
13 |
+
This plugin won't do anything if you don't have WordPress theme built with the [Bootstrap](http://getbootstrap.com/) framework. **This plugin does not include the Bootstrap framework**.
|
14 |
|
15 |
+
The plugin is tested to work with ```Bootstrap 3``` and ```WordPress 4.5``` and **requires PHP 5.3 or later**.
|
16 |
|
17 |
## Shortcode Reference
|
18 |
|
67 |
...
|
68 |
[/column]
|
69 |
[/row]
|
70 |
+
|
71 |
+
The container component is also supported in case your theme doesn't include a container.
|
72 |
|
73 |
[container]
|
74 |
[row]
|
81 |
[/row]
|
82 |
[/container]
|
83 |
|
84 |
+
The container-fluid component is supported as a discrete shortcode for cases where you want to wrap a container.
|
85 |
+
[container-fluid]
|
86 |
+
[container]
|
87 |
+
[row]
|
88 |
+
[column md="6"]
|
89 |
+
...
|
90 |
+
[/column]
|
91 |
+
[column md="6"]
|
92 |
+
...
|
93 |
+
[/column]
|
94 |
+
[/row]
|
95 |
+
[/container]
|
96 |
+
[/container-fluid]
|
97 |
+
|
98 |
#### [container] parameters
|
99 |
Parameter | Description | Required | Values | Default
|
100 |
--- | --- | --- | --- | ---
|
102 |
xclass | Any extra classes you want to add | optional | any text | none
|
103 |
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
|
104 |
|
105 |
+
#### [container-fluid] parameters
|
106 |
+
Parameter | Description | Required | Values | Default
|
107 |
+
--- | --- | --- | --- | ---
|
108 |
+
xclass | Any extra classes you want to add | optional | any text | none
|
109 |
+
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
|
110 |
+
|
111 |
#### [row] parameters
|
112 |
Parameter | Description | Required | Values | Default
|
113 |
--- | --- | --- | --- | ---
|
184 |
|
185 |
### Tables
|
186 |
[table-wrap bordered="true" striped="true"]
|
187 |
+
|
188 |
Standard HTML table code goes here.
|
189 |
+
|
190 |
[/table-wrap]
|
191 |
|
192 |
#### [table-wrap] parameters
|
297 |
[button link="#"] ... [/button]
|
298 |
[button link="#"] ... [/button]
|
299 |
[/button-group]
|
300 |
+
|
301 |
#### Button toolbar
|
302 |
[button-toolbar]
|
303 |
[button-group]
|
804 |
[collapse title="Collapse 1" active="true"]
|
805 |
...
|
806 |
[/collapse]
|
807 |
+
|
808 |
#### Set of Collapsibles
|
809 |
[collapsibles]
|
810 |
[collapse title="Collapse 1" active="true"]
|
bootstrap-shortcodes.php
CHANGED
@@ -1,61 +1,84 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Bootstrap 3 Shortcodes
|
4 |
-
Plugin URI:
|
5 |
-
Description: The plugin adds a shortcodes for all Bootstrap elements.
|
6 |
-
Version: 3.3.
|
7 |
-
Author:
|
8 |
-
Author URI:
|
9 |
-
License:
|
10 |
*/
|
11 |
|
12 |
-
/*
|
13 |
-
|
14 |
-
This program is free software; you can redistribute it and/or modify
|
15 |
-
it under the terms of the GNU General Public License, version 2, as
|
16 |
-
published by the Free Software Foundation.
|
17 |
-
|
18 |
-
This program is distributed in the hope that it will be useful,
|
19 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
-
GNU General Public License for more details.
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
*/
|
27 |
|
28 |
-
|
|
|
|
|
29 |
|
30 |
-
|
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 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
/*--------------------------------------------------------------------------------------
|
61 |
*
|
@@ -68,65 +91,66 @@ class BoostrapShortcodes {
|
|
68 |
function add_shortcodes() {
|
69 |
|
70 |
$shortcodes = array(
|
71 |
-
'alert',
|
72 |
-
'badge',
|
73 |
-
'breadcrumb',
|
74 |
-
'breadcrumb-item',
|
75 |
-
'button',
|
76 |
-
'button-group',
|
77 |
-
'button-toolbar',
|
78 |
-
'caret',
|
79 |
-
'carousel',
|
80 |
-
'carousel-item',
|
81 |
-
'code',
|
82 |
-
'collapse',
|
83 |
-
'collapsibles',
|
84 |
-
'column',
|
85 |
-
'container',
|
86 |
-
|
87 |
-
'
|
88 |
-
'dropdown
|
89 |
-
'dropdown-
|
90 |
-
'
|
91 |
-
'
|
92 |
-
'
|
93 |
-
'
|
94 |
-
'
|
95 |
-
'
|
96 |
-
'
|
97 |
-
'
|
98 |
-
'list-group
|
99 |
-
'list-group-item
|
100 |
-
'list-group-item-
|
101 |
-
'
|
102 |
-
'media
|
103 |
-
'media-
|
104 |
-
'
|
|
|
105 |
'modal-footer',
|
106 |
-
'nav',
|
107 |
-
'nav-item',
|
108 |
-
'page-header',
|
109 |
-
'panel',
|
110 |
-
'popover',
|
111 |
-
'progress',
|
112 |
-
'progress-bar',
|
113 |
-
'responsive',
|
114 |
-
'row',
|
115 |
-
'span',
|
116 |
-
'tab',
|
117 |
-
'table',
|
118 |
-
'table-wrap',
|
119 |
-
'tabs',
|
120 |
-
'thumbnail',
|
121 |
-
'tooltip',
|
122 |
-
'well',
|
123 |
);
|
124 |
|
125 |
foreach ( $shortcodes as $shortcode ) {
|
126 |
|
127 |
$function = 'bs_' . str_replace( '-', '_', $shortcode );
|
128 |
add_shortcode( $shortcode, array( $this, $function ) );
|
129 |
-
|
130 |
}
|
131 |
}
|
132 |
|
@@ -162,13 +186,13 @@ class BoostrapShortcodes {
|
|
162 |
$class .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
|
163 |
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
164 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
165 |
-
|
166 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
167 |
|
168 |
-
return sprintf(
|
169 |
'<a href="%s" class="%s"%s%s%s>%s</a>',
|
170 |
esc_url( $atts['link'] ),
|
171 |
-
esc_attr( $class ),
|
172 |
( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
|
173 |
( $atts['title'] ) ? sprintf( ' title="%s"', esc_attr( $atts['title'] ) ) : '',
|
174 |
( $data_props ) ? ' ' . $data_props : '',
|
@@ -185,7 +209,7 @@ class BoostrapShortcodes {
|
|
185 |
*
|
186 |
*-------------------------------------------------------------------------------------*/
|
187 |
function bs_button_group( $atts, $content = null ) {
|
188 |
-
|
189 |
$atts = shortcode_atts( array(
|
190 |
"size" => false,
|
191 |
"vertical" => false,
|
@@ -194,19 +218,19 @@ class BoostrapShortcodes {
|
|
194 |
"xclass" => false,
|
195 |
"data" => false
|
196 |
), $atts );
|
197 |
-
|
198 |
$class = 'btn-group';
|
199 |
$class .= ( $atts['size'] ) ? ' btn-group-' . $atts['size'] : '';
|
200 |
$class .= ( $atts['vertical'] == 'true' ) ? ' btn-group-vertical' : '';
|
201 |
$class .= ( $atts['justified'] == 'true' ) ? ' btn-group-justified' : '';
|
202 |
$class .= ( $atts['dropup'] == 'true' ) ? ' dropup' : '';
|
203 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
204 |
-
|
205 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
206 |
-
|
207 |
-
return sprintf(
|
208 |
'<div class="%s"%s>%s</div>',
|
209 |
-
esc_attr( $class ),
|
210 |
( $data_props ) ? ' ' . $data_props : '',
|
211 |
do_shortcode( $content )
|
212 |
);
|
@@ -219,25 +243,25 @@ class BoostrapShortcodes {
|
|
219 |
*
|
220 |
*-------------------------------------------------------------------------------------*/
|
221 |
function bs_button_toolbar( $atts, $content = null ) {
|
222 |
-
|
223 |
$atts = shortcode_atts( array(
|
224 |
"xclass" => false,
|
225 |
"data" => false
|
226 |
), $atts );
|
227 |
|
228 |
-
$class = 'btn-toolbar';
|
229 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
230 |
-
|
231 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
232 |
-
|
233 |
-
return sprintf(
|
234 |
'<div class="%s"%s>%s</div>',
|
235 |
-
esc_attr( $class ),
|
236 |
( $data_props ) ? ' ' . $data_props : '',
|
237 |
do_shortcode( $content )
|
238 |
);
|
239 |
-
}
|
240 |
-
|
241 |
/*--------------------------------------------------------------------------------------
|
242 |
*
|
243 |
* bs_caret
|
@@ -253,18 +277,18 @@ class BoostrapShortcodes {
|
|
253 |
"data" => false
|
254 |
), $atts );
|
255 |
|
256 |
-
$class = 'caret';
|
257 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
258 |
-
|
259 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
260 |
-
|
261 |
-
return sprintf(
|
262 |
'<span class="%s"%s>%s</span>',
|
263 |
-
esc_attr( $class ),
|
264 |
( $data_props ) ? ' ' . $data_props : '',
|
265 |
do_shortcode( $content )
|
266 |
);
|
267 |
-
}
|
268 |
|
269 |
/*--------------------------------------------------------------------------------------
|
270 |
*
|
@@ -273,7 +297,7 @@ class BoostrapShortcodes {
|
|
273 |
* @author Robin Wouters
|
274 |
* @since 3.0.3.3
|
275 |
*
|
276 |
-
*-------------------------------------------------------------------------------------*/
|
277 |
function bs_container( $atts, $content = null ) {
|
278 |
|
279 |
$atts = shortcode_atts( array(
|
@@ -282,19 +306,48 @@ class BoostrapShortcodes {
|
|
282 |
"data" => false
|
283 |
), $atts );
|
284 |
|
285 |
-
$class = ( $atts['fluid'] == 'true' ) ? 'container-fluid' : 'container';
|
286 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
287 |
|
288 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
289 |
-
|
290 |
-
return sprintf(
|
291 |
'<div class="%s"%s>%s</div>',
|
292 |
-
esc_attr( $class ),
|
293 |
( $data_props ) ? ' ' . $data_props : '',
|
294 |
do_shortcode( $content )
|
295 |
);
|
296 |
-
}
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
/*--------------------------------------------------------------------------------------
|
299 |
*
|
300 |
* bs_dropdown
|
@@ -309,19 +362,19 @@ class BoostrapShortcodes {
|
|
309 |
"data" => false
|
310 |
), $atts );
|
311 |
|
312 |
-
$class = 'dropdown-menu';
|
313 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
314 |
-
|
315 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
316 |
-
|
317 |
-
return sprintf(
|
318 |
'<ul role="menu" class="%s"%s>%s</ul>',
|
319 |
-
esc_attr( $class ),
|
320 |
( $data_props ) ? ' ' . $data_props : '',
|
321 |
do_shortcode( $content )
|
322 |
);
|
323 |
}
|
324 |
-
|
325 |
/*--------------------------------------------------------------------------------------
|
326 |
*
|
327 |
* bs_dropdown_item
|
@@ -338,15 +391,15 @@ class BoostrapShortcodes {
|
|
338 |
"data" => false
|
339 |
), $atts );
|
340 |
|
341 |
-
$li_class = '';
|
342 |
$li_class .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
|
343 |
|
344 |
-
$a_class = '';
|
345 |
$a_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
346 |
|
347 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
348 |
|
349 |
-
return sprintf(
|
350 |
'<li role="presentation" class="%s"><a role="menuitem" href="%s" class="%s"%s>%s</a></li>',
|
351 |
esc_attr( $li_class ),
|
352 |
esc_url( $atts['link'] ),
|
@@ -355,7 +408,7 @@ class BoostrapShortcodes {
|
|
355 |
do_shortcode( $content )
|
356 |
);
|
357 |
}
|
358 |
-
|
359 |
/*--------------------------------------------------------------------------------------
|
360 |
*
|
361 |
* bs_dropdown_divider
|
@@ -364,25 +417,25 @@ class BoostrapShortcodes {
|
|
364 |
*
|
365 |
*-------------------------------------------------------------------------------------*/
|
366 |
function bs_divider( $atts, $content = null ) {
|
367 |
-
|
368 |
$atts = shortcode_atts( array(
|
369 |
"xclass" => false,
|
370 |
"data" => false
|
371 |
), $atts );
|
372 |
|
373 |
-
$class = 'divider';
|
374 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
375 |
|
376 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
377 |
-
|
378 |
-
return sprintf(
|
379 |
'<li class="%s"%s>%s</li>',
|
380 |
-
esc_attr( $class ),
|
381 |
( $data_props ) ? ' ' . $data_props : '',
|
382 |
do_shortcode( $content )
|
383 |
);
|
384 |
}
|
385 |
-
|
386 |
/*--------------------------------------------------------------------------------------
|
387 |
*
|
388 |
* bs_dropdown_header
|
@@ -391,25 +444,25 @@ class BoostrapShortcodes {
|
|
391 |
*
|
392 |
*-------------------------------------------------------------------------------------*/
|
393 |
function bs_dropdown_header( $atts, $content = null ) {
|
394 |
-
|
395 |
$atts = shortcode_atts( array(
|
396 |
"xclass" => false,
|
397 |
"data" => false
|
398 |
), $atts );
|
399 |
|
400 |
-
$class = 'dropdown-header';
|
401 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
402 |
|
403 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
404 |
-
|
405 |
-
return sprintf(
|
406 |
'<li class="%s"%s>%s</li>',
|
407 |
-
esc_attr( $class ),
|
408 |
( $data_props ) ? ' ' . $data_props : '',
|
409 |
do_shortcode( $content )
|
410 |
);
|
411 |
}
|
412 |
-
|
413 |
/*--------------------------------------------------------------------------------------
|
414 |
*
|
415 |
* bs_nav
|
@@ -425,23 +478,23 @@ class BoostrapShortcodes {
|
|
425 |
"xclass" => false,
|
426 |
"data" => false
|
427 |
), $atts );
|
428 |
-
|
429 |
$class = 'nav';
|
430 |
$class .= ( $atts['type'] ) ? ' nav-' . $atts['type'] : ' nav-tabs';
|
431 |
$class .= ( $atts['stacked'] == 'true' ) ? ' nav-stacked' : '';
|
432 |
$class .= ( $atts['justified'] == 'true' ) ? ' nav-justified' : '';
|
433 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
434 |
-
|
435 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
436 |
-
|
437 |
-
return sprintf(
|
438 |
'<ul class="%s"%s>%s</ul>',
|
439 |
-
esc_attr( $class ),
|
440 |
( $data_props ) ? ' ' . $data_props : '',
|
441 |
do_shortcode( $content )
|
442 |
);
|
443 |
}
|
444 |
-
|
445 |
/*--------------------------------------------------------------------------------------
|
446 |
*
|
447 |
* bs_nav_item
|
@@ -487,7 +540,7 @@ class BoostrapShortcodes {
|
|
487 |
);
|
488 |
|
489 |
}
|
490 |
-
|
491 |
/*--------------------------------------------------------------------------------------
|
492 |
*
|
493 |
* bs_alert
|
@@ -504,19 +557,19 @@ class BoostrapShortcodes {
|
|
504 |
"xclass" => false,
|
505 |
"data" => false
|
506 |
), $atts );
|
507 |
-
|
508 |
$class = 'alert';
|
509 |
$class .= ( $atts['type'] ) ? ' alert-' . $atts['type'] : ' alert-success';
|
510 |
$class .= ( $atts['dismissable'] == 'true' ) ? ' alert-dismissable' : '';
|
511 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
512 |
-
|
513 |
$dismissable = ( $atts['dismissable'] ) ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' : '';
|
514 |
-
|
515 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
516 |
-
|
517 |
-
return sprintf(
|
518 |
'<div class="%s"%s>%s%s</div>',
|
519 |
-
esc_attr( $class ),
|
520 |
( $data_props ) ? ' ' . $data_props : '',
|
521 |
$dismissable,
|
522 |
do_shortcode( $content )
|
@@ -537,17 +590,17 @@ class BoostrapShortcodes {
|
|
537 |
"xclass" => false,
|
538 |
"data" => false
|
539 |
), $atts );
|
540 |
-
|
541 |
$class = 'progress';
|
542 |
$class .= ( $atts['striped'] == 'true' ) ? ' progress-striped' : '';
|
543 |
$class .= ( $atts['animated'] == 'true' ) ? ' active' : '';
|
544 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
545 |
-
|
546 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
547 |
-
|
548 |
-
return sprintf(
|
549 |
'<div class="%s"%s>%s</div>',
|
550 |
-
esc_attr( $class ),
|
551 |
( $data_props ) ? ' ' . $data_props : '',
|
552 |
do_shortcode( $content )
|
553 |
);
|
@@ -568,16 +621,16 @@ class BoostrapShortcodes {
|
|
568 |
"xclass" => false,
|
569 |
"data" => false
|
570 |
), $atts );
|
571 |
-
|
572 |
$class = 'progress-bar';
|
573 |
$class .= ( $atts['type'] ) ? ' progress-bar-' . $atts['type'] : '';
|
574 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
575 |
-
|
576 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
577 |
-
|
578 |
-
return sprintf(
|
579 |
'<div class="%s" role="progressbar" %s%s>%s</div>',
|
580 |
-
esc_attr( $class ),
|
581 |
( $atts['percent'] ) ? ' aria-value="' . (int) $atts['percent'] . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $atts['percent'] . '%;"' : '',
|
582 |
( $data_props ) ? ' ' . $data_props : '',
|
583 |
( $atts['percent'] ) ? sprintf('<span%s>%s</span>', ( !$atts['label'] ) ? ' class="sr-only"' : '', (int) $atts['percent'] . '% Complete') : ''
|
@@ -607,10 +660,10 @@ class BoostrapShortcodes {
|
|
607 |
|
608 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
609 |
|
610 |
-
return sprintf(
|
611 |
'<%1$s class="%2$s"%3$s>%4$s</%1$s>',
|
612 |
( $atts['inline'] ) ? 'code' : 'pre',
|
613 |
-
esc_attr( $class ),
|
614 |
( $data_props ) ? ' ' . $data_props : '',
|
615 |
do_shortcode( $content )
|
616 |
);
|
@@ -631,14 +684,14 @@ class BoostrapShortcodes {
|
|
631 |
"data" => false
|
632 |
), $atts );
|
633 |
|
634 |
-
$class = 'row';
|
635 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
636 |
-
|
637 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
638 |
-
|
639 |
-
return sprintf(
|
640 |
'<div class="%s"%s>%s</div>',
|
641 |
-
esc_attr( $class ),
|
642 |
( $data_props ) ? ' ' . $data_props : '',
|
643 |
do_shortcode( $content )
|
644 |
);
|
@@ -693,12 +746,12 @@ class BoostrapShortcodes {
|
|
693 |
$class .= ( $atts['push_sm'] || $atts['push_sm'] === "0" ) ? ' col-sm-push-' . $atts['push_sm'] : '';
|
694 |
$class .= ( $atts['push_xs'] || $atts['push_xs'] === "0" ) ? ' col-xs-push-' . $atts['push_xs'] : '';
|
695 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
696 |
-
|
697 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
698 |
-
|
699 |
-
return sprintf(
|
700 |
'<div class="%s"%s>%s</div>',
|
701 |
-
esc_attr( $class ),
|
702 |
( $data_props ) ? ' ' . $data_props : '',
|
703 |
do_shortcode( $content )
|
704 |
);
|
@@ -719,19 +772,19 @@ class BoostrapShortcodes {
|
|
719 |
"data" => false
|
720 |
), $atts );
|
721 |
|
722 |
-
$class = 'list-group';
|
723 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
724 |
-
|
725 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
726 |
-
|
727 |
-
return sprintf(
|
728 |
'<%1$s class="%2$s"%3$s>%4$s</%1$s>',
|
729 |
( $atts['linked'] == 'true' ) ? 'div' : 'ul',
|
730 |
-
esc_attr( $class ),
|
731 |
( $data_props ) ? ' ' . $data_props : '',
|
732 |
do_shortcode( $content )
|
733 |
);
|
734 |
-
}
|
735 |
|
736 |
/*--------------------------------------------------------------------------------------
|
737 |
*
|
@@ -755,20 +808,20 @@ class BoostrapShortcodes {
|
|
755 |
$class .= ( $atts['type'] ) ? ' list-group-item-' . $atts['type'] : '';
|
756 |
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
757 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
758 |
-
|
759 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
760 |
-
|
761 |
-
return sprintf(
|
762 |
'<%1$s %2$s %3$s class="%4$s"%5$s>%6$s</%1$s>',
|
763 |
( $atts['link'] ) ? 'a' : 'li',
|
764 |
( $atts['link'] ) ? 'href="' . esc_url( $atts['link'] ) . '"' : '',
|
765 |
( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
|
766 |
-
esc_attr( $class ),
|
767 |
( $data_props ) ? ' ' . $data_props : '',
|
768 |
do_shortcode( $content )
|
769 |
);
|
770 |
}
|
771 |
-
|
772 |
/*--------------------------------------------------------------------------------------
|
773 |
*
|
774 |
* bs_list_group_item_heading
|
@@ -782,19 +835,19 @@ class BoostrapShortcodes {
|
|
782 |
"data" => false
|
783 |
), $atts );
|
784 |
|
785 |
-
$class = 'list-group-item-heading';
|
786 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
787 |
-
|
788 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
789 |
-
|
790 |
-
return sprintf(
|
791 |
'<h4 class="%s"%s>%s</h4>',
|
792 |
-
esc_attr( $class ),
|
793 |
( $data_props ) ? ' ' . $data_props : '',
|
794 |
do_shortcode( $content )
|
795 |
);
|
796 |
}
|
797 |
-
|
798 |
/*--------------------------------------------------------------------------------------
|
799 |
*
|
800 |
* bs_list_group_item_text
|
@@ -808,14 +861,14 @@ class BoostrapShortcodes {
|
|
808 |
"data" => false
|
809 |
), $atts );
|
810 |
|
811 |
-
$class = 'list-group-item-text';
|
812 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
813 |
-
|
814 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
815 |
-
|
816 |
-
return sprintf(
|
817 |
'<p class="%s"%s>%s</p>',
|
818 |
-
esc_attr( $class ),
|
819 |
( $data_props ) ? ' ' . $data_props : '',
|
820 |
do_shortcode( $content )
|
821 |
);
|
@@ -834,18 +887,18 @@ class BoostrapShortcodes {
|
|
834 |
"data" => false
|
835 |
), $atts );
|
836 |
|
837 |
-
$class = 'breadcrumb';
|
838 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
839 |
-
|
840 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
841 |
-
|
842 |
-
return sprintf(
|
843 |
'<ol class="%s"%s>%s</ol>',
|
844 |
-
esc_attr( $class ),
|
845 |
( $data_props ) ? ' ' . $data_props : '',
|
846 |
do_shortcode( $content )
|
847 |
);
|
848 |
-
}
|
849 |
|
850 |
/*--------------------------------------------------------------------------------------
|
851 |
*
|
@@ -862,15 +915,15 @@ class BoostrapShortcodes {
|
|
862 |
"data" => false
|
863 |
), $atts );
|
864 |
|
865 |
-
$class = '';
|
866 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
867 |
|
868 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
869 |
|
870 |
-
return sprintf(
|
871 |
'<li><a href="%s" class="%s"%s>%s</a></li>',
|
872 |
esc_url( $atts['link'] ),
|
873 |
-
esc_attr( $class ),
|
874 |
( $data_props ) ? ' ' . $data_props : '',
|
875 |
do_shortcode( $content )
|
876 |
);
|
@@ -891,16 +944,16 @@ class BoostrapShortcodes {
|
|
891 |
"xclass" => false,
|
892 |
"data" => false
|
893 |
), $atts );
|
894 |
-
|
895 |
$class = 'label';
|
896 |
$class .= ( $atts['type'] ) ? ' label-' . $atts['type'] : ' label-default';
|
897 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
898 |
-
|
899 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
900 |
|
901 |
-
return sprintf(
|
902 |
'<span class="%s"%s>%s</span>',
|
903 |
-
esc_attr( $class ),
|
904 |
( $data_props ) ? ' ' . $data_props : '',
|
905 |
do_shortcode( $content )
|
906 |
);
|
@@ -921,16 +974,16 @@ class BoostrapShortcodes {
|
|
921 |
"xclass" => false,
|
922 |
"data" => false
|
923 |
), $atts );
|
924 |
-
|
925 |
$class = 'badge';
|
926 |
$class .= ( $atts['right'] == 'true' ) ? ' pull-right' : '';
|
927 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
928 |
-
|
929 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
930 |
-
|
931 |
-
return sprintf(
|
932 |
'<span class="%s"%s>%s</span>',
|
933 |
-
esc_attr( $class ),
|
934 |
( $data_props ) ? ' ' . $data_props : '',
|
935 |
do_shortcode( $content )
|
936 |
);
|
@@ -951,16 +1004,16 @@ class BoostrapShortcodes {
|
|
951 |
"xclass" => false,
|
952 |
"data" => false
|
953 |
), $atts );
|
954 |
-
|
955 |
$class = 'glyphicon';
|
956 |
$class .= ( $atts['type'] ) ? ' glyphicon-' . $atts['type'] : '';
|
957 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
958 |
-
|
959 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
960 |
-
|
961 |
-
return sprintf(
|
962 |
'<span class="%s"%s>%s</span>',
|
963 |
-
esc_attr( $class ),
|
964 |
( $data_props ) ? ' ' . $data_props : '',
|
965 |
do_shortcode( $content )
|
966 |
);
|
@@ -1035,9 +1088,9 @@ class BoostrapShortcodes {
|
|
1035 |
$class .= ( $atts['hover'] == 'true' ) ? ' table-hover' : '';
|
1036 |
$class .= ( $atts['condensed'] == 'true' ) ? ' table-condensed' : '';
|
1037 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1038 |
-
|
1039 |
$return = '';
|
1040 |
-
|
1041 |
$tag = array('table');
|
1042 |
$content = do_shortcode($content);
|
1043 |
|
@@ -1045,8 +1098,8 @@ class BoostrapShortcodes {
|
|
1045 |
$return = ( $atts['responsive'] ) ? '<div class="table-responsive">' . $return . '</div>' : $return;
|
1046 |
return $return;
|
1047 |
}
|
1048 |
-
|
1049 |
-
|
1050 |
/*--------------------------------------------------------------------------------------
|
1051 |
*
|
1052 |
* bs_well
|
@@ -1065,16 +1118,16 @@ class BoostrapShortcodes {
|
|
1065 |
"xclass" => false,
|
1066 |
"data" => false
|
1067 |
), $atts );
|
1068 |
-
|
1069 |
$class = 'well';
|
1070 |
$class .= ( $atts['size'] ) ? ' well-' . $atts['size'] : '';
|
1071 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1072 |
-
|
1073 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1074 |
-
|
1075 |
-
return sprintf(
|
1076 |
'<div class="%s"%s>%s</div>',
|
1077 |
-
esc_attr( $class ),
|
1078 |
( $data_props ) ? ' ' . $data_props : '',
|
1079 |
do_shortcode( $content )
|
1080 |
);
|
@@ -1098,7 +1151,7 @@ class BoostrapShortcodes {
|
|
1098 |
"xclass" => false,
|
1099 |
"data" => false
|
1100 |
), $atts );
|
1101 |
-
|
1102 |
$class = 'panel';
|
1103 |
$class .= ( $atts['type'] ) ? ' panel-' . $atts['type'] : ' panel-default';
|
1104 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
@@ -1107,14 +1160,14 @@ class BoostrapShortcodes {
|
|
1107 |
$atts['heading'] = $atts['title'];
|
1108 |
$atts['title'] = true;
|
1109 |
}
|
1110 |
-
|
1111 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1112 |
|
1113 |
$footer = ( $atts['footer'] ) ? '<div class="panel-footer">' . $atts['footer'] . '</div>' : '';
|
1114 |
|
1115 |
if ( $atts['heading'] ) {
|
1116 |
-
$heading = sprintf(
|
1117 |
-
'<div class="panel-heading">%s%s%s</div>',
|
1118 |
( $atts['title'] ) ? '<h3 class="panel-title">' : '',
|
1119 |
esc_html( $atts['heading'] ),
|
1120 |
( $atts['title'] ) ? '</h3>' : ''
|
@@ -1126,7 +1179,7 @@ class BoostrapShortcodes {
|
|
1126 |
|
1127 |
return sprintf(
|
1128 |
'<div class="%s"%s>%s<div class="panel-body">%s</div>%s</div>',
|
1129 |
-
esc_attr( $class ),
|
1130 |
( $data_props ) ? ' ' . $data_props : '',
|
1131 |
$heading,
|
1132 |
do_shortcode( $content ),
|
@@ -1160,11 +1213,11 @@ class BoostrapShortcodes {
|
|
1160 |
"data" => false,
|
1161 |
"name" => false,
|
1162 |
), $atts );
|
1163 |
-
|
1164 |
$ul_class = 'nav';
|
1165 |
$ul_class .= ( $atts['type'] ) ? ' nav-' . $atts['type'] : ' nav-tabs';
|
1166 |
$ul_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1167 |
-
|
1168 |
$div_class = 'tab-content';
|
1169 |
|
1170 |
// If user defines name of group, use that for ID for tab history purposes
|
@@ -1176,9 +1229,9 @@ class BoostrapShortcodes {
|
|
1176 |
|
1177 |
|
1178 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1179 |
-
|
1180 |
$atts_map = bs_attribute_map( $content );
|
1181 |
-
|
1182 |
// Extract the tab titles for use in the tab widget.
|
1183 |
if ( $atts_map ) {
|
1184 |
$tabs = array();
|
@@ -1190,10 +1243,10 @@ class BoostrapShortcodes {
|
|
1190 |
}
|
1191 |
$i = 0;
|
1192 |
foreach( $atts_map as $tab ) {
|
1193 |
-
|
1194 |
$class ='';
|
1195 |
$class .= ( !empty($tab["tab"]["active"]) || ($GLOBALS['tabs_default_active'] && $i == 0) ) ? 'active' : '';
|
1196 |
-
$class .= ( !empty($tab["tab"]["xclass"]) ) ? ' ' . $tab["tab"]["xclass"] : '';
|
1197 |
|
1198 |
if(!isset($tab["tab"]["link"])) {
|
1199 |
$tab_id = 'custom-tab-' . $GLOBALS['tabs_count'] . '-' . md5( $tab["tab"]["title"] );
|
@@ -1203,7 +1256,7 @@ class BoostrapShortcodes {
|
|
1203 |
|
1204 |
$tabs[] = sprintf(
|
1205 |
'<li%s><a href="#%s" data-toggle="tab" >%s</a></li>',
|
1206 |
-
( !empty($class) ) ? ' class="' .
|
1207 |
sanitize_html_class($tab_id),
|
1208 |
$tab["tab"]["title"]
|
1209 |
);
|
@@ -1241,7 +1294,7 @@ class BoostrapShortcodes {
|
|
1241 |
'data' => false,
|
1242 |
'link' => false
|
1243 |
), $atts );
|
1244 |
-
|
1245 |
if( $GLOBALS['tabs_default_active'] && $GLOBALS['tabs_default_count'] == 0 ) {
|
1246 |
$atts['active'] = true;
|
1247 |
}
|
@@ -1261,10 +1314,10 @@ class BoostrapShortcodes {
|
|
1261 |
}
|
1262 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1263 |
|
1264 |
-
return sprintf(
|
1265 |
'<div id="%s" class="%s"%s>%s</div>',
|
1266 |
sanitize_html_class($id),
|
1267 |
-
esc_attr( $class ),
|
1268 |
( $data_props ) ? ' ' . $data_props : '',
|
1269 |
do_shortcode( $content )
|
1270 |
);
|
@@ -1293,17 +1346,17 @@ class BoostrapShortcodes {
|
|
1293 |
"xclass" => false,
|
1294 |
"data" => false
|
1295 |
), $atts );
|
1296 |
-
|
1297 |
$class = 'panel-group';
|
1298 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1299 |
-
|
1300 |
$id = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
|
1301 |
-
|
1302 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1303 |
|
1304 |
-
return sprintf(
|
1305 |
'<div class="%s" id="%s"%s>%s</div>',
|
1306 |
-
esc_attr( $class ),
|
1307 |
esc_attr($id),
|
1308 |
( $data_props ) ? ' ' . $data_props : '',
|
1309 |
do_shortcode( $content )
|
@@ -1321,7 +1374,7 @@ class BoostrapShortcodes {
|
|
1321 |
*
|
1322 |
*-------------------------------------------------------------------------------------*/
|
1323 |
function bs_collapse( $atts, $content = null ) {
|
1324 |
-
|
1325 |
if( isset($GLOBALS['single_collapse_count']) )
|
1326 |
$GLOBALS['single_collapse_count']++;
|
1327 |
else
|
@@ -1338,10 +1391,10 @@ class BoostrapShortcodes {
|
|
1338 |
$panel_class = 'panel';
|
1339 |
$panel_class .= ( $atts['type'] ) ? ' panel-' . $atts['type'] : ' panel-default';
|
1340 |
$panel_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1341 |
-
|
1342 |
$collapse_class = 'panel-collapse';
|
1343 |
$collapse_class .= ( $atts['active'] == 'true' ) ? ' in' : ' collapse';
|
1344 |
-
|
1345 |
$a_class = '';
|
1346 |
$a_class .= ( $atts['active'] == 'true' ) ? '' : 'collapsed';
|
1347 |
|
@@ -1349,8 +1402,8 @@ class BoostrapShortcodes {
|
|
1349 |
$current_collapse = $parent . '-' . $GLOBALS['single_collapse_count'];
|
1350 |
|
1351 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1352 |
-
|
1353 |
-
return sprintf(
|
1354 |
'<div class="%1$s"%2$s>
|
1355 |
<div class="panel-heading">
|
1356 |
<h4 class="panel-title">
|
@@ -1364,15 +1417,15 @@ class BoostrapShortcodes {
|
|
1364 |
esc_attr( $panel_class ),
|
1365 |
( $data_props ) ? ' ' . $data_props : '',
|
1366 |
$a_class,
|
1367 |
-
( $parent ) ? ' data-parent="#' . $parent . '"
|
1368 |
$current_collapse,
|
1369 |
$atts['title'],
|
1370 |
esc_attr( $collapse_class ),
|
1371 |
do_shortcode( $content )
|
1372 |
);
|
1373 |
}
|
1374 |
-
|
1375 |
-
|
1376 |
/*--------------------------------------------------------------------------------------
|
1377 |
*
|
1378 |
* bs_carousel
|
@@ -1381,7 +1434,7 @@ class BoostrapShortcodes {
|
|
1381 |
*
|
1382 |
*-------------------------------------------------------------------------------------*/
|
1383 |
function bs_carousel( $atts, $content = null ) {
|
1384 |
-
|
1385 |
if( isset($GLOBALS['carousel_count']) )
|
1386 |
$GLOBALS['carousel_count']++;
|
1387 |
else
|
@@ -1399,15 +1452,15 @@ class BoostrapShortcodes {
|
|
1399 |
|
1400 |
$div_class = 'carousel slide';
|
1401 |
$div_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1402 |
-
|
1403 |
$inner_class = 'carousel-inner';
|
1404 |
-
|
1405 |
$id = 'custom-carousel-'. $GLOBALS['carousel_count'];
|
1406 |
-
|
1407 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1408 |
|
1409 |
$atts_map = bs_attribute_map( $content );
|
1410 |
-
|
1411 |
// Extract the slide titles for use in the carousel widget.
|
1412 |
if ( $atts_map ) {
|
1413 |
$indicators = array();
|
@@ -1415,7 +1468,7 @@ class BoostrapShortcodes {
|
|
1415 |
foreach( $atts_map as $check ) {
|
1416 |
if( !empty($check["carousel-item"]["active"]) ) {
|
1417 |
$GLOBALS['carousel_default_active'] = false;
|
1418 |
-
}
|
1419 |
}
|
1420 |
$i = 0;
|
1421 |
foreach( $atts_map as $slide ) {
|
@@ -1461,16 +1514,16 @@ class BoostrapShortcodes {
|
|
1461 |
"xclass" => false,
|
1462 |
"data" => false
|
1463 |
), $atts );
|
1464 |
-
|
1465 |
if( $GLOBALS['carousel_default_active'] && $GLOBALS['carousel_default_count'] == 0 ) {
|
1466 |
$atts['active'] = true;
|
1467 |
}
|
1468 |
$GLOBALS['carousel_default_count']++;
|
1469 |
-
|
1470 |
$class = 'item';
|
1471 |
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
1472 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1473 |
-
|
1474 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1475 |
|
1476 |
//$content = preg_replace('/class=".*?"/', '', $content);
|
@@ -1479,9 +1532,9 @@ class BoostrapShortcodes {
|
|
1479 |
$content = preg_replace('/alignleft/', '', $content);
|
1480 |
$content = preg_replace('/aligncenter/', '', $content);
|
1481 |
|
1482 |
-
return sprintf(
|
1483 |
'<div class="%s"%s>%s%s</div>',
|
1484 |
-
esc_attr( $class ),
|
1485 |
( $data_props ) ? ' ' . $data_props : '',
|
1486 |
do_shortcode( $content ),
|
1487 |
( $atts['caption'] ) ? '<div class="carousel-caption">' . esc_html( $atts['caption'] ) . '</div>' : ''
|
@@ -1507,9 +1560,9 @@ function bs_tooltip( $atts, $content = null ) {
|
|
1507 |
'html' => 'false',
|
1508 |
'data' => ''
|
1509 |
), $atts );
|
1510 |
-
|
1511 |
$class = 'bs-tooltip';
|
1512 |
-
|
1513 |
$atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
|
1514 |
$atts['data'] .= ( $atts['placement'] ) ? $this->check_for_data($atts['data']) . 'placement,' . $atts['placement'] : '';
|
1515 |
$atts['data'] .= ( $atts['html'] ) ? $this->check_for_data($atts['data']) . 'html,' .$atts['html'] : '';
|
@@ -1519,7 +1572,7 @@ function bs_tooltip( $atts, $content = null ) {
|
|
1519 |
$content = do_shortcode($content);
|
1520 |
$return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
|
1521 |
return $return;
|
1522 |
-
|
1523 |
}
|
1524 |
|
1525 |
/*--------------------------------------------------------------------------------------
|
@@ -1539,9 +1592,9 @@ function bs_popover( $atts, $content = null ) {
|
|
1539 |
'html' => 'false',
|
1540 |
'data' => ''
|
1541 |
), $atts );
|
1542 |
-
|
1543 |
$class = 'bs-popover';
|
1544 |
-
|
1545 |
$atts['data'] .= $this->check_for_data($atts['data']) . 'toggle,popover';
|
1546 |
$atts['data'] .= $this->check_for_data($atts['data']) . 'content,' . str_replace(',', ',', $atts['text']);
|
1547 |
$atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
|
@@ -1553,7 +1606,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1553 |
$content = do_shortcode($content);
|
1554 |
$return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
|
1555 |
return html_entity_decode($return);
|
1556 |
-
|
1557 |
}
|
1558 |
|
1559 |
|
@@ -1565,7 +1618,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1565 |
* @since 1.0
|
1566 |
*
|
1567 |
*-------------------------------------------------------------------------------------*/
|
1568 |
-
|
1569 |
function bs_media( $atts, $content = null ) {
|
1570 |
|
1571 |
$atts = shortcode_atts( array(
|
@@ -1573,14 +1626,14 @@ function bs_popover( $atts, $content = null ) {
|
|
1573 |
"data" => false
|
1574 |
), $atts );
|
1575 |
|
1576 |
-
$class = 'media';
|
1577 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass']: '';
|
1578 |
|
1579 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1580 |
|
1581 |
-
return sprintf(
|
1582 |
'<div class="%s"%s>%s</div>',
|
1583 |
-
esc_attr( $class ),
|
1584 |
( $data_props ) ? ' ' . $data_props : '',
|
1585 |
do_shortcode( $content )
|
1586 |
);
|
@@ -1594,16 +1647,16 @@ function bs_popover( $atts, $content = null ) {
|
|
1594 |
"xclass" => false,
|
1595 |
"data" => false
|
1596 |
), $atts );
|
1597 |
-
|
1598 |
$class = "media-object img-responsive";
|
1599 |
$class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
|
1600 |
-
|
1601 |
$media_class ='';
|
1602 |
$media_class = ($atts['media']) ? 'media-' . $atts['media'] : '';
|
1603 |
-
$media_class = ($atts['pull']) ? 'pull-' . $atts['pull'] : $media_class;
|
1604 |
-
|
1605 |
$return = '';
|
1606 |
-
|
1607 |
$tag = array('figure', 'div', 'img', 'i', 'span');
|
1608 |
$content = do_shortcode(preg_replace('/(<br>)+$/', '', $content));
|
1609 |
$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
|
@@ -1619,15 +1672,15 @@ function bs_popover( $atts, $content = null ) {
|
|
1619 |
"data" => false
|
1620 |
), $atts );
|
1621 |
|
1622 |
-
$div_class = 'media-body';
|
1623 |
$div_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1624 |
|
1625 |
-
$h4_class = 'media-heading';
|
1626 |
$h4_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1627 |
|
1628 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1629 |
-
|
1630 |
-
return sprintf(
|
1631 |
'<div class="%s"%s><h4 class="%s">%s</h4>%s</div>',
|
1632 |
esc_attr( $div_class ),
|
1633 |
( $data_props ) ? ' ' . $data_props : '',
|
@@ -1650,15 +1703,15 @@ function bs_popover( $atts, $content = null ) {
|
|
1650 |
"xclass" => false,
|
1651 |
"data" => false
|
1652 |
), $atts );
|
1653 |
-
|
1654 |
$class = 'jumbotron';
|
1655 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1656 |
-
|
1657 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1658 |
-
|
1659 |
-
return sprintf(
|
1660 |
'<div class="%s"%s>%s%s</div>',
|
1661 |
-
esc_attr( $class ),
|
1662 |
( $data_props ) ? ' ' . $data_props : '',
|
1663 |
( $atts['title'] ) ? '<h1>' . esc_html( $atts['title'] ) . '</h1>' : '',
|
1664 |
do_shortcode( $content )
|
@@ -1672,27 +1725,27 @@ function bs_popover( $atts, $content = null ) {
|
|
1672 |
*
|
1673 |
*-------------------------------------------------------------------------------------*/
|
1674 |
function bs_page_header( $atts, $content = null ) {
|
1675 |
-
|
1676 |
$atts = shortcode_atts( array(
|
1677 |
"xclass" => false,
|
1678 |
"data" => false
|
1679 |
), $atts );
|
1680 |
|
1681 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1682 |
-
|
1683 |
$class = "page-header";
|
1684 |
$class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
|
1685 |
-
|
1686 |
$return = '';
|
1687 |
$title = '';
|
1688 |
$tag = 'div';
|
1689 |
$content = $this->strip_paragraph($content);
|
1690 |
$content = $this->nest_dom_element('h1', 'div', $content);
|
1691 |
-
$return .= $this->get_dom_element($tag, $content, $class, '', $atts['data']);
|
1692 |
return $return;
|
1693 |
|
1694 |
-
}
|
1695 |
-
|
1696 |
/*--------------------------------------------------------------------------------------
|
1697 |
*
|
1698 |
* bs_lead
|
@@ -1700,20 +1753,20 @@ function bs_popover( $atts, $content = null ) {
|
|
1700 |
*
|
1701 |
*-------------------------------------------------------------------------------------*/
|
1702 |
function bs_lead( $atts, $content = null ) {
|
1703 |
-
|
1704 |
$atts = shortcode_atts( array(
|
1705 |
"xclass" => false,
|
1706 |
"data" => false
|
1707 |
), $atts );
|
1708 |
|
1709 |
-
$class = 'lead';
|
1710 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1711 |
-
|
1712 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1713 |
-
|
1714 |
-
return sprintf(
|
1715 |
'<p class="%s"%s>%s</p>',
|
1716 |
-
esc_attr( $class ),
|
1717 |
( $data_props ) ? ' ' . $data_props : '',
|
1718 |
do_shortcode( $content )
|
1719 |
);
|
@@ -1736,12 +1789,12 @@ function bs_popover( $atts, $content = null ) {
|
|
1736 |
$class = '';
|
1737 |
$class .= ( $atts['type'] ) ? 'text-' . $atts['type'] : 'text-muted';
|
1738 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1739 |
-
|
1740 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1741 |
-
|
1742 |
-
return sprintf(
|
1743 |
'<span class="%s"%s>%s</span>',
|
1744 |
-
esc_attr( $class ),
|
1745 |
( $data_props ) ? ' ' . $data_props : '',
|
1746 |
do_shortcode( $content )
|
1747 |
);
|
@@ -1754,7 +1807,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1754 |
*
|
1755 |
*-------------------------------------------------------------------------------------*/
|
1756 |
function bs_img( $atts, $content = null ) {
|
1757 |
-
|
1758 |
$atts = shortcode_atts( array(
|
1759 |
"type" => false,
|
1760 |
"responsive" => false,
|
@@ -1772,9 +1825,9 @@ function bs_popover( $atts, $content = null ) {
|
|
1772 |
$content = do_shortcode($content);
|
1773 |
$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
|
1774 |
return $return;
|
1775 |
-
|
1776 |
}
|
1777 |
-
|
1778 |
/*--------------------------------------------------------------------------------------
|
1779 |
*
|
1780 |
* bs_embed_responsive
|
@@ -1782,7 +1835,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1782 |
*
|
1783 |
*-------------------------------------------------------------------------------------*/
|
1784 |
function bs_embed_responsive( $atts, $content = null ) {
|
1785 |
-
|
1786 |
$atts = shortcode_atts( array(
|
1787 |
"ratio" => false,
|
1788 |
"xclass" => false,
|
@@ -1792,7 +1845,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1792 |
$class = 'embed-responsive ';
|
1793 |
$class .= ( $atts['ratio'] ) ? ' embed-responsive-' . $atts['ratio'] . ' ' : '';
|
1794 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1795 |
-
|
1796 |
$embed_class = 'embed-responsive-item';
|
1797 |
|
1798 |
$tag = array('iframe', 'embed', 'video', 'object');
|
@@ -1801,13 +1854,13 @@ function bs_popover( $atts, $content = null ) {
|
|
1801 |
|
1802 |
return sprintf(
|
1803 |
'<div class="%s"%s>%s</div>',
|
1804 |
-
esc_attr( $class ),
|
1805 |
( $data_props ) ? ' ' . $data_props : '',
|
1806 |
$this->scrape_dom_element($tag, $content, $embed_class, '', '')
|
1807 |
);
|
1808 |
-
|
1809 |
}
|
1810 |
-
|
1811 |
/*--------------------------------------------------------------------------------------
|
1812 |
*
|
1813 |
* bs_thumbnail
|
@@ -1815,13 +1868,13 @@ function bs_popover( $atts, $content = null ) {
|
|
1815 |
*
|
1816 |
*-------------------------------------------------------------------------------------*/
|
1817 |
function bs_thumbnail( $atts, $content = null ) {
|
1818 |
-
|
1819 |
$atts = shortcode_atts( array(
|
1820 |
"xclass" => false,
|
1821 |
"has_content" => false,
|
1822 |
"data" => false
|
1823 |
), $atts );
|
1824 |
-
|
1825 |
$class = "thumbnail";
|
1826 |
$class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
|
1827 |
|
@@ -1835,9 +1888,9 @@ function bs_popover( $atts, $content = null ) {
|
|
1835 |
$content = do_shortcode($content);
|
1836 |
$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
|
1837 |
return $return;
|
1838 |
-
|
1839 |
}
|
1840 |
-
|
1841 |
/*--------------------------------------------------------------------------------------
|
1842 |
*
|
1843 |
* bs_responsive
|
@@ -1845,7 +1898,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1845 |
*
|
1846 |
*-------------------------------------------------------------------------------------*/
|
1847 |
function bs_responsive( $atts, $content = null ) {
|
1848 |
-
|
1849 |
$atts = shortcode_atts( array(
|
1850 |
"visible" => false,
|
1851 |
"hidden" => false,
|
@@ -1855,7 +1908,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1855 |
"xclass" => false,
|
1856 |
"data" => false
|
1857 |
), $atts );
|
1858 |
-
|
1859 |
$class = '';
|
1860 |
if( $atts['visible'] ) {
|
1861 |
$visible = explode( ' ', $atts['visible'] );
|
@@ -1888,12 +1941,12 @@ function bs_popover( $atts, $content = null ) {
|
|
1888 |
endforeach;
|
1889 |
}
|
1890 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1891 |
-
|
1892 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1893 |
|
1894 |
-
return sprintf(
|
1895 |
'<span class="%s"%s>%s</span>',
|
1896 |
-
esc_attr( $class ),
|
1897 |
( $data_props ) ? ' ' . $data_props : '',
|
1898 |
do_shortcode( $content )
|
1899 |
);
|
@@ -1908,7 +1961,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1908 |
*
|
1909 |
*-------------------------------------------------------------------------------------*/
|
1910 |
function bs_modal( $atts, $content = null ) {
|
1911 |
-
|
1912 |
if( isset($GLOBALS['modal_count']) )
|
1913 |
$GLOBALS['modal_count']++;
|
1914 |
else
|
@@ -1922,18 +1975,18 @@ function bs_popover( $atts, $content = null ) {
|
|
1922 |
"data" => false
|
1923 |
), $atts );
|
1924 |
|
1925 |
-
$a_class = '';
|
1926 |
$a_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1927 |
-
|
1928 |
$div_class = 'modal fade';
|
1929 |
$div_class .= ( $atts['size'] ) ? ' bs-modal-' . $atts['size'] : '';
|
1930 |
-
|
1931 |
$div_size = ( $atts['size'] ) ? ' modal-' . $atts['size'] : '';
|
1932 |
-
|
1933 |
$id = 'custom-modal-' . $GLOBALS['modal_count'];
|
1934 |
-
|
1935 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1936 |
-
|
1937 |
$modal_output = sprintf(
|
1938 |
'<div class="%1$s" id="%2$s" tabindex="-1" role="dialog" aria-hidden="true">
|
1939 |
<div class="modal-dialog %3$s">
|
@@ -1955,12 +2008,12 @@ function bs_popover( $atts, $content = null ) {
|
|
1955 |
( $atts['title'] ) ? '<h4 class="modal-title">' . $atts['title'] . '</h4>' : '',
|
1956 |
do_shortcode( $content )
|
1957 |
);
|
1958 |
-
|
1959 |
add_action('wp_footer', function() use ($modal_output) {
|
1960 |
echo $modal_output;
|
1961 |
}, 100,0);
|
1962 |
-
|
1963 |
-
return sprintf(
|
1964 |
'<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>',
|
1965 |
esc_attr( $id ),
|
1966 |
esc_attr( $a_class ),
|
@@ -1985,18 +2038,18 @@ function bs_popover( $atts, $content = null ) {
|
|
1985 |
), $atts );
|
1986 |
|
1987 |
$class = 'modal-footer';
|
1988 |
-
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1989 |
|
1990 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1991 |
|
1992 |
return sprintf(
|
1993 |
'</div><div class="%s"%s>%s',
|
1994 |
-
esc_attr( $class ),
|
1995 |
( $data_props ) ? ' ' . $data_props : '',
|
1996 |
do_shortcode( $content )
|
1997 |
);
|
1998 |
}
|
1999 |
-
|
2000 |
/*--------------------------------------------------------------------------------------
|
2001 |
*
|
2002 |
* Parse data-attributes for shortcodes
|
@@ -2014,34 +2067,34 @@ function bs_popover( $atts, $content = null ) {
|
|
2014 |
$data_props .= sprintf( 'data-%s="%s" ', esc_html( $d[0] ), esc_attr( trim( $d[1] ) ) );
|
2015 |
}
|
2016 |
}
|
2017 |
-
else {
|
2018 |
$data_props = false;
|
2019 |
}
|
2020 |
return $data_props;
|
2021 |
}
|
2022 |
-
|
2023 |
/*--------------------------------------------------------------------------------------
|
2024 |
*
|
2025 |
* get DOMDocument element and apply shortcode parameters to it. Create the element if it doesn't exist
|
2026 |
*
|
2027 |
*-------------------------------------------------------------------------------------*/
|
2028 |
function get_dom_element( $tag, $content, $class, $title = '', $data = null ) {
|
2029 |
-
|
2030 |
//clean up content
|
2031 |
$content = trim(trim($content), chr(0xC2).chr(0xA0));
|
2032 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2033 |
-
|
2034 |
$dom = new DOMDocument;
|
2035 |
$dom->loadXML(utf8_encode($content));
|
2036 |
-
|
2037 |
libxml_clear_errors();
|
2038 |
libxml_use_internal_errors($previous_value);
|
2039 |
-
|
2040 |
if(!$dom->documentElement) {
|
2041 |
$element = $dom->createElement($tag, utf8_encode($content));
|
2042 |
$dom->appendChild($element);
|
2043 |
}
|
2044 |
-
|
2045 |
$dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( utf8_encode($class) ));
|
2046 |
if( $title ) {
|
2047 |
$dom->documentElement->setAttribute('title', $title );
|
@@ -2064,10 +2117,10 @@ function bs_popover( $atts, $content = null ) {
|
|
2064 |
function scrape_dom_element( $tag, $content, $class, $title = '', $data = null ) {
|
2065 |
|
2066 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2067 |
-
|
2068 |
$dom = new DOMDocument;
|
2069 |
$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
|
2070 |
-
|
2071 |
libxml_clear_errors();
|
2072 |
libxml_use_internal_errors($previous_value);
|
2073 |
foreach ($tag as $find) {
|
@@ -2085,7 +2138,7 @@ function bs_popover( $atts, $content = null ) {
|
|
2085 |
if( $data ) {
|
2086 |
$data = explode( '|', $data );
|
2087 |
foreach( $data as $d ):
|
2088 |
-
$d = explode(',',$d);
|
2089 |
$outputdom->documentElement->setAttribute('data-'.$d[0],trim($d[1]));
|
2090 |
endforeach;
|
2091 |
}
|
@@ -2095,7 +2148,7 @@ function bs_popover( $atts, $content = null ) {
|
|
2095 |
}
|
2096 |
}
|
2097 |
}
|
2098 |
-
|
2099 |
/*--------------------------------------------------------------------------------------
|
2100 |
*
|
2101 |
* Find if content contains a particular tag, if not, create it, either way wrap it in a wrapper tag
|
@@ -2106,25 +2159,25 @@ function bs_popover( $atts, $content = null ) {
|
|
2106 |
function nest_dom_element($find, $append, $content) {
|
2107 |
|
2108 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2109 |
-
|
2110 |
$dom = new DOMDocument;
|
2111 |
$dom->loadXML(utf8_encode($content));
|
2112 |
-
|
2113 |
libxml_clear_errors();
|
2114 |
libxml_use_internal_errors($previous_value);
|
2115 |
-
|
2116 |
//Does $content include the tag we're looking for?
|
2117 |
-
$hasFind = $dom->getElementsByTagName($find);
|
2118 |
|
2119 |
//If not, add it and wrap it all in our append tag
|
2120 |
if( $hasFind->length == 0 ) {
|
2121 |
$wrapper = $dom->createElement($append);
|
2122 |
$dom->appendChild($wrapper);
|
2123 |
-
|
2124 |
$tag = $dom->createElement($find, $content);
|
2125 |
$wrapper->appendChild($tag);
|
2126 |
}
|
2127 |
-
|
2128 |
//If so, just wrap everything in our append tag
|
2129 |
else {
|
2130 |
$new_root = $dom->createElement($append);
|
@@ -2133,7 +2186,7 @@ function bs_popover( $atts, $content = null ) {
|
|
2133 |
}
|
2134 |
return $dom->saveXML($dom->documentElement);
|
2135 |
}
|
2136 |
-
|
2137 |
/*--------------------------------------------------------------------------------------
|
2138 |
*
|
2139 |
* Add dividers to data attributes content if needed
|
@@ -2144,7 +2197,7 @@ function bs_popover( $atts, $content = null ) {
|
|
2144 |
return "|";
|
2145 |
}
|
2146 |
}
|
2147 |
-
|
2148 |
/*--------------------------------------------------------------------------------------
|
2149 |
*
|
2150 |
* If the user puts a return between the shortcode and its contents, sometimes we want to strip the resulting P tags out
|
@@ -2159,4 +2212,3 @@ function bs_popover( $atts, $content = null ) {
|
|
2159 |
}
|
2160 |
|
2161 |
new BoostrapShortcodes();
|
2162 |
-
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Bootstrap 3 Shortcodes
|
4 |
+
Plugin URI: https://github.com/MWDelaney/bootstrap-shortcodes
|
5 |
+
Description: The plugin adds a shortcodes for all Bootstrap 3 elements.
|
6 |
+
Version: 3.3.9
|
7 |
+
Author: Michael W. Delaney, Filip Stefansson, and Simon Yeldon
|
8 |
+
Author URI:
|
9 |
+
License: MIT
|
10 |
*/
|
11 |
|
12 |
+
/* ============================================================= */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
// ======================================================================== //
|
15 |
+
// Include necessary functions and files
|
16 |
+
// ======================================================================== //
|
|
|
17 |
|
18 |
+
require_once( dirname( __FILE__ ) . '/includes/defaults.php' );
|
19 |
+
require_once( dirname( __FILE__ ) . '/includes/functions.php' );
|
20 |
+
require_once( dirname( __FILE__ ) . '/includes/actions-filters.php' );
|
21 |
|
22 |
+
// ======================================================================== //
|
|
|
|
|
23 |
|
24 |
// Begin Shortcodes
|
25 |
class BoostrapShortcodes {
|
26 |
|
27 |
+
// ======================================================================== //
|
28 |
+
// Initialize shortcodes and conditionally include opt-in Bootstrap scripts
|
29 |
+
// ======================================================================== //
|
30 |
+
|
31 |
+
function __construct() {
|
32 |
+
|
33 |
+
//Initialize shortcodes
|
34 |
+
add_action( 'init', array( $this, 'add_shortcodes' ) );
|
35 |
+
|
36 |
+
//Conditionally include tooltip functionality (see function for conditionals)
|
37 |
+
add_action( 'the_post', array( $this, 'bootstrap_shortcodes_tooltip_script' ), 9999 );
|
38 |
+
|
39 |
+
//Conditionally include popupver functionality (see function for conditionals)
|
40 |
+
add_action( 'the_post', array( $this, 'bootstrap_shortcodes_popover_script' ), 9999 );
|
41 |
+
}
|
42 |
+
|
43 |
+
// ======================================================================== //
|
44 |
|
45 |
+
|
46 |
+
|
47 |
+
// ======================================================================== //
|
48 |
+
// Conditionally include tooltip initialization script.
|
49 |
+
// See details for why this is necessary here: http://getbootstrap.com/javascript/#callout-tooltip-opt-in
|
50 |
+
//
|
51 |
+
// Only includes script if content contains [tooltip] shortcode
|
52 |
+
// ======================================================================== //
|
53 |
+
|
54 |
+
function bootstrap_shortcodes_tooltip_script() {
|
55 |
+
global $post;
|
56 |
+
if( has_shortcode( $post->post_content, 'tooltip')){
|
57 |
+
// Bootstrap tooltip js
|
58 |
+
wp_enqueue_script( 'bootstrap-shortcodes-tooltip', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-tooltip.js', array( 'jquery' ), false, true );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
// ======================================================================== //
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
// ======================================================================== //
|
67 |
+
// Conditionally include popover initialization script.
|
68 |
+
// See details for why this is necessary here: http://getbootstrap.com/javascript/#callout-popover-opt-in
|
69 |
+
//
|
70 |
+
// Only includes script if content contains [popover] shortcode
|
71 |
+
// ======================================================================== //
|
72 |
+
|
73 |
+
function bootstrap_shortcodes_popover_script() {
|
74 |
+
global $post;
|
75 |
+
if( has_shortcode( $post->post_content, 'popover')){
|
76 |
+
// Bootstrap popover js
|
77 |
+
wp_enqueue_script( 'bootstrap-shortcodes-popover', BS_SHORTCODES_URL . 'js/bootstrap-shortcodes-popover.js', array( 'jquery' ), false, true );
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
// ======================================================================== //
|
82 |
|
83 |
/*--------------------------------------------------------------------------------------
|
84 |
*
|
91 |
function add_shortcodes() {
|
92 |
|
93 |
$shortcodes = array(
|
94 |
+
'alert',
|
95 |
+
'badge',
|
96 |
+
'breadcrumb',
|
97 |
+
'breadcrumb-item',
|
98 |
+
'button',
|
99 |
+
'button-group',
|
100 |
+
'button-toolbar',
|
101 |
+
'caret',
|
102 |
+
'carousel',
|
103 |
+
'carousel-item',
|
104 |
+
'code',
|
105 |
+
'collapse',
|
106 |
+
'collapsibles',
|
107 |
+
'column',
|
108 |
+
'container',
|
109 |
+
'container-fluid',
|
110 |
+
'divider',
|
111 |
+
'dropdown',
|
112 |
+
'dropdown-header',
|
113 |
+
'dropdown-item',
|
114 |
+
'emphasis',
|
115 |
+
'icon',
|
116 |
+
'img',
|
117 |
+
'embed-responsive',
|
118 |
+
'jumbotron',
|
119 |
+
'label',
|
120 |
+
'lead',
|
121 |
+
'list-group',
|
122 |
+
'list-group-item',
|
123 |
+
'list-group-item-heading',
|
124 |
+
'list-group-item-text',
|
125 |
+
'media',
|
126 |
+
'media-body',
|
127 |
+
'media-object',
|
128 |
+
'modal',
|
129 |
'modal-footer',
|
130 |
+
'nav',
|
131 |
+
'nav-item',
|
132 |
+
'page-header',
|
133 |
+
'panel',
|
134 |
+
'popover',
|
135 |
+
'progress',
|
136 |
+
'progress-bar',
|
137 |
+
'responsive',
|
138 |
+
'row',
|
139 |
+
'span',
|
140 |
+
'tab',
|
141 |
+
'table',
|
142 |
+
'table-wrap',
|
143 |
+
'tabs',
|
144 |
+
'thumbnail',
|
145 |
+
'tooltip',
|
146 |
+
'well',
|
147 |
);
|
148 |
|
149 |
foreach ( $shortcodes as $shortcode ) {
|
150 |
|
151 |
$function = 'bs_' . str_replace( '-', '_', $shortcode );
|
152 |
add_shortcode( $shortcode, array( $this, $function ) );
|
153 |
+
|
154 |
}
|
155 |
}
|
156 |
|
186 |
$class .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
|
187 |
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
188 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
189 |
+
|
190 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
191 |
|
192 |
+
return sprintf(
|
193 |
'<a href="%s" class="%s"%s%s%s>%s</a>',
|
194 |
esc_url( $atts['link'] ),
|
195 |
+
esc_attr( trim($class) ),
|
196 |
( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
|
197 |
( $atts['title'] ) ? sprintf( ' title="%s"', esc_attr( $atts['title'] ) ) : '',
|
198 |
( $data_props ) ? ' ' . $data_props : '',
|
209 |
*
|
210 |
*-------------------------------------------------------------------------------------*/
|
211 |
function bs_button_group( $atts, $content = null ) {
|
212 |
+
|
213 |
$atts = shortcode_atts( array(
|
214 |
"size" => false,
|
215 |
"vertical" => false,
|
218 |
"xclass" => false,
|
219 |
"data" => false
|
220 |
), $atts );
|
221 |
+
|
222 |
$class = 'btn-group';
|
223 |
$class .= ( $atts['size'] ) ? ' btn-group-' . $atts['size'] : '';
|
224 |
$class .= ( $atts['vertical'] == 'true' ) ? ' btn-group-vertical' : '';
|
225 |
$class .= ( $atts['justified'] == 'true' ) ? ' btn-group-justified' : '';
|
226 |
$class .= ( $atts['dropup'] == 'true' ) ? ' dropup' : '';
|
227 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
228 |
+
|
229 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
230 |
+
|
231 |
+
return sprintf(
|
232 |
'<div class="%s"%s>%s</div>',
|
233 |
+
esc_attr( trim($class) ),
|
234 |
( $data_props ) ? ' ' . $data_props : '',
|
235 |
do_shortcode( $content )
|
236 |
);
|
243 |
*
|
244 |
*-------------------------------------------------------------------------------------*/
|
245 |
function bs_button_toolbar( $atts, $content = null ) {
|
246 |
+
|
247 |
$atts = shortcode_atts( array(
|
248 |
"xclass" => false,
|
249 |
"data" => false
|
250 |
), $atts );
|
251 |
|
252 |
+
$class = 'btn-toolbar';
|
253 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
254 |
+
|
255 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
256 |
+
|
257 |
+
return sprintf(
|
258 |
'<div class="%s"%s>%s</div>',
|
259 |
+
esc_attr( trim($class) ),
|
260 |
( $data_props ) ? ' ' . $data_props : '',
|
261 |
do_shortcode( $content )
|
262 |
);
|
263 |
+
}
|
264 |
+
|
265 |
/*--------------------------------------------------------------------------------------
|
266 |
*
|
267 |
* bs_caret
|
277 |
"data" => false
|
278 |
), $atts );
|
279 |
|
280 |
+
$class = 'caret';
|
281 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
282 |
+
|
283 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
284 |
+
|
285 |
+
return sprintf(
|
286 |
'<span class="%s"%s>%s</span>',
|
287 |
+
esc_attr( trim($class) ),
|
288 |
( $data_props ) ? ' ' . $data_props : '',
|
289 |
do_shortcode( $content )
|
290 |
);
|
291 |
+
}
|
292 |
|
293 |
/*--------------------------------------------------------------------------------------
|
294 |
*
|
297 |
* @author Robin Wouters
|
298 |
* @since 3.0.3.3
|
299 |
*
|
300 |
+
*-------------------------------------------------------------------------------------*/
|
301 |
function bs_container( $atts, $content = null ) {
|
302 |
|
303 |
$atts = shortcode_atts( array(
|
306 |
"data" => false
|
307 |
), $atts );
|
308 |
|
309 |
+
$class = ( $atts['fluid'] == 'true' ) ? 'container-fluid' : 'container';
|
310 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
311 |
|
312 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
313 |
+
|
314 |
+
return sprintf(
|
315 |
'<div class="%s"%s>%s</div>',
|
316 |
+
esc_attr( trim($class) ),
|
317 |
( $data_props ) ? ' ' . $data_props : '',
|
318 |
do_shortcode( $content )
|
319 |
);
|
320 |
+
}
|
321 |
+
|
322 |
+
|
323 |
+
/*--------------------------------------------------------------------------------------
|
324 |
+
*
|
325 |
+
* bs_container_fluid
|
326 |
+
*
|
327 |
+
* @author Robin Wouters
|
328 |
+
* @since 3.0.3.3
|
329 |
+
*
|
330 |
+
*-------------------------------------------------------------------------------------*/
|
331 |
+
function bs_container_fluid( $atts, $content = null ) {
|
332 |
+
|
333 |
+
$atts = shortcode_atts( array(
|
334 |
+
"xclass" => false,
|
335 |
+
"data" => false
|
336 |
+
), $atts );
|
337 |
+
|
338 |
+
$class = 'container-fluid';
|
339 |
+
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
340 |
+
|
341 |
+
$data_props = $this->parse_data_attributes( $atts['data'] );
|
342 |
+
|
343 |
+
return sprintf(
|
344 |
+
'<div class="%s"%s>%s</div>',
|
345 |
+
esc_attr( trim($class) ),
|
346 |
+
( $data_props ) ? ' ' . $data_props : '',
|
347 |
+
do_shortcode( $content )
|
348 |
+
);
|
349 |
+
}
|
350 |
+
|
351 |
/*--------------------------------------------------------------------------------------
|
352 |
*
|
353 |
* bs_dropdown
|
362 |
"data" => false
|
363 |
), $atts );
|
364 |
|
365 |
+
$class = 'dropdown-menu';
|
366 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
367 |
+
|
368 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
369 |
+
|
370 |
+
return sprintf(
|
371 |
'<ul role="menu" class="%s"%s>%s</ul>',
|
372 |
+
esc_attr( trim($class) ),
|
373 |
( $data_props ) ? ' ' . $data_props : '',
|
374 |
do_shortcode( $content )
|
375 |
);
|
376 |
}
|
377 |
+
|
378 |
/*--------------------------------------------------------------------------------------
|
379 |
*
|
380 |
* bs_dropdown_item
|
391 |
"data" => false
|
392 |
), $atts );
|
393 |
|
394 |
+
$li_class = '';
|
395 |
$li_class .= ( $atts['disabled'] == 'true' ) ? ' disabled' : '';
|
396 |
|
397 |
+
$a_class = '';
|
398 |
$a_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
399 |
|
400 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
401 |
|
402 |
+
return sprintf(
|
403 |
'<li role="presentation" class="%s"><a role="menuitem" href="%s" class="%s"%s>%s</a></li>',
|
404 |
esc_attr( $li_class ),
|
405 |
esc_url( $atts['link'] ),
|
408 |
do_shortcode( $content )
|
409 |
);
|
410 |
}
|
411 |
+
|
412 |
/*--------------------------------------------------------------------------------------
|
413 |
*
|
414 |
* bs_dropdown_divider
|
417 |
*
|
418 |
*-------------------------------------------------------------------------------------*/
|
419 |
function bs_divider( $atts, $content = null ) {
|
420 |
+
|
421 |
$atts = shortcode_atts( array(
|
422 |
"xclass" => false,
|
423 |
"data" => false
|
424 |
), $atts );
|
425 |
|
426 |
+
$class = 'divider';
|
427 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
428 |
|
429 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
430 |
+
|
431 |
+
return sprintf(
|
432 |
'<li class="%s"%s>%s</li>',
|
433 |
+
esc_attr( trim($class) ),
|
434 |
( $data_props ) ? ' ' . $data_props : '',
|
435 |
do_shortcode( $content )
|
436 |
);
|
437 |
}
|
438 |
+
|
439 |
/*--------------------------------------------------------------------------------------
|
440 |
*
|
441 |
* bs_dropdown_header
|
444 |
*
|
445 |
*-------------------------------------------------------------------------------------*/
|
446 |
function bs_dropdown_header( $atts, $content = null ) {
|
447 |
+
|
448 |
$atts = shortcode_atts( array(
|
449 |
"xclass" => false,
|
450 |
"data" => false
|
451 |
), $atts );
|
452 |
|
453 |
+
$class = 'dropdown-header';
|
454 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
455 |
|
456 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
457 |
+
|
458 |
+
return sprintf(
|
459 |
'<li class="%s"%s>%s</li>',
|
460 |
+
esc_attr( trim($class) ),
|
461 |
( $data_props ) ? ' ' . $data_props : '',
|
462 |
do_shortcode( $content )
|
463 |
);
|
464 |
}
|
465 |
+
|
466 |
/*--------------------------------------------------------------------------------------
|
467 |
*
|
468 |
* bs_nav
|
478 |
"xclass" => false,
|
479 |
"data" => false
|
480 |
), $atts );
|
481 |
+
|
482 |
$class = 'nav';
|
483 |
$class .= ( $atts['type'] ) ? ' nav-' . $atts['type'] : ' nav-tabs';
|
484 |
$class .= ( $atts['stacked'] == 'true' ) ? ' nav-stacked' : '';
|
485 |
$class .= ( $atts['justified'] == 'true' ) ? ' nav-justified' : '';
|
486 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
487 |
+
|
488 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
489 |
+
|
490 |
+
return sprintf(
|
491 |
'<ul class="%s"%s>%s</ul>',
|
492 |
+
esc_attr( trim($class) ),
|
493 |
( $data_props ) ? ' ' . $data_props : '',
|
494 |
do_shortcode( $content )
|
495 |
);
|
496 |
}
|
497 |
+
|
498 |
/*--------------------------------------------------------------------------------------
|
499 |
*
|
500 |
* bs_nav_item
|
540 |
);
|
541 |
|
542 |
}
|
543 |
+
|
544 |
/*--------------------------------------------------------------------------------------
|
545 |
*
|
546 |
* bs_alert
|
557 |
"xclass" => false,
|
558 |
"data" => false
|
559 |
), $atts );
|
560 |
+
|
561 |
$class = 'alert';
|
562 |
$class .= ( $atts['type'] ) ? ' alert-' . $atts['type'] : ' alert-success';
|
563 |
$class .= ( $atts['dismissable'] == 'true' ) ? ' alert-dismissable' : '';
|
564 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
565 |
+
|
566 |
$dismissable = ( $atts['dismissable'] ) ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' : '';
|
567 |
+
|
568 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
569 |
+
|
570 |
+
return sprintf(
|
571 |
'<div class="%s"%s>%s%s</div>',
|
572 |
+
esc_attr( trim($class) ),
|
573 |
( $data_props ) ? ' ' . $data_props : '',
|
574 |
$dismissable,
|
575 |
do_shortcode( $content )
|
590 |
"xclass" => false,
|
591 |
"data" => false
|
592 |
), $atts );
|
593 |
+
|
594 |
$class = 'progress';
|
595 |
$class .= ( $atts['striped'] == 'true' ) ? ' progress-striped' : '';
|
596 |
$class .= ( $atts['animated'] == 'true' ) ? ' active' : '';
|
597 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
598 |
+
|
599 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
600 |
+
|
601 |
+
return sprintf(
|
602 |
'<div class="%s"%s>%s</div>',
|
603 |
+
esc_attr( trim($class) ),
|
604 |
( $data_props ) ? ' ' . $data_props : '',
|
605 |
do_shortcode( $content )
|
606 |
);
|
621 |
"xclass" => false,
|
622 |
"data" => false
|
623 |
), $atts );
|
624 |
+
|
625 |
$class = 'progress-bar';
|
626 |
$class .= ( $atts['type'] ) ? ' progress-bar-' . $atts['type'] : '';
|
627 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
628 |
+
|
629 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
630 |
+
|
631 |
+
return sprintf(
|
632 |
'<div class="%s" role="progressbar" %s%s>%s</div>',
|
633 |
+
esc_attr( trim($class) ),
|
634 |
( $atts['percent'] ) ? ' aria-value="' . (int) $atts['percent'] . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . (int) $atts['percent'] . '%;"' : '',
|
635 |
( $data_props ) ? ' ' . $data_props : '',
|
636 |
( $atts['percent'] ) ? sprintf('<span%s>%s</span>', ( !$atts['label'] ) ? ' class="sr-only"' : '', (int) $atts['percent'] . '% Complete') : ''
|
660 |
|
661 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
662 |
|
663 |
+
return sprintf(
|
664 |
'<%1$s class="%2$s"%3$s>%4$s</%1$s>',
|
665 |
( $atts['inline'] ) ? 'code' : 'pre',
|
666 |
+
esc_attr( trim($class) ),
|
667 |
( $data_props ) ? ' ' . $data_props : '',
|
668 |
do_shortcode( $content )
|
669 |
);
|
684 |
"data" => false
|
685 |
), $atts );
|
686 |
|
687 |
+
$class = 'row';
|
688 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
689 |
+
|
690 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
691 |
+
|
692 |
+
return sprintf(
|
693 |
'<div class="%s"%s>%s</div>',
|
694 |
+
esc_attr( trim($class) ),
|
695 |
( $data_props ) ? ' ' . $data_props : '',
|
696 |
do_shortcode( $content )
|
697 |
);
|
746 |
$class .= ( $atts['push_sm'] || $atts['push_sm'] === "0" ) ? ' col-sm-push-' . $atts['push_sm'] : '';
|
747 |
$class .= ( $atts['push_xs'] || $atts['push_xs'] === "0" ) ? ' col-xs-push-' . $atts['push_xs'] : '';
|
748 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
749 |
+
|
750 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
751 |
+
|
752 |
+
return sprintf(
|
753 |
'<div class="%s"%s>%s</div>',
|
754 |
+
esc_attr( trim($class) ),
|
755 |
( $data_props ) ? ' ' . $data_props : '',
|
756 |
do_shortcode( $content )
|
757 |
);
|
772 |
"data" => false
|
773 |
), $atts );
|
774 |
|
775 |
+
$class = 'list-group';
|
776 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
777 |
+
|
778 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
779 |
+
|
780 |
+
return sprintf(
|
781 |
'<%1$s class="%2$s"%3$s>%4$s</%1$s>',
|
782 |
( $atts['linked'] == 'true' ) ? 'div' : 'ul',
|
783 |
+
esc_attr( trim($class) ),
|
784 |
( $data_props ) ? ' ' . $data_props : '',
|
785 |
do_shortcode( $content )
|
786 |
);
|
787 |
+
}
|
788 |
|
789 |
/*--------------------------------------------------------------------------------------
|
790 |
*
|
808 |
$class .= ( $atts['type'] ) ? ' list-group-item-' . $atts['type'] : '';
|
809 |
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
810 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
811 |
+
|
812 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
813 |
+
|
814 |
+
return sprintf(
|
815 |
'<%1$s %2$s %3$s class="%4$s"%5$s>%6$s</%1$s>',
|
816 |
( $atts['link'] ) ? 'a' : 'li',
|
817 |
( $atts['link'] ) ? 'href="' . esc_url( $atts['link'] ) . '"' : '',
|
818 |
( $atts['target'] ) ? sprintf( ' target="%s"', esc_attr( $atts['target'] ) ) : '',
|
819 |
+
esc_attr( trim($class) ),
|
820 |
( $data_props ) ? ' ' . $data_props : '',
|
821 |
do_shortcode( $content )
|
822 |
);
|
823 |
}
|
824 |
+
|
825 |
/*--------------------------------------------------------------------------------------
|
826 |
*
|
827 |
* bs_list_group_item_heading
|
835 |
"data" => false
|
836 |
), $atts );
|
837 |
|
838 |
+
$class = 'list-group-item-heading';
|
839 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
840 |
+
|
841 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
842 |
+
|
843 |
+
return sprintf(
|
844 |
'<h4 class="%s"%s>%s</h4>',
|
845 |
+
esc_attr( trim($class) ),
|
846 |
( $data_props ) ? ' ' . $data_props : '',
|
847 |
do_shortcode( $content )
|
848 |
);
|
849 |
}
|
850 |
+
|
851 |
/*--------------------------------------------------------------------------------------
|
852 |
*
|
853 |
* bs_list_group_item_text
|
861 |
"data" => false
|
862 |
), $atts );
|
863 |
|
864 |
+
$class = 'list-group-item-text';
|
865 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
866 |
+
|
867 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
868 |
+
|
869 |
+
return sprintf(
|
870 |
'<p class="%s"%s>%s</p>',
|
871 |
+
esc_attr( trim($class) ),
|
872 |
( $data_props ) ? ' ' . $data_props : '',
|
873 |
do_shortcode( $content )
|
874 |
);
|
887 |
"data" => false
|
888 |
), $atts );
|
889 |
|
890 |
+
$class = 'breadcrumb';
|
891 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
892 |
+
|
893 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
894 |
+
|
895 |
+
return sprintf(
|
896 |
'<ol class="%s"%s>%s</ol>',
|
897 |
+
esc_attr( trim($class) ),
|
898 |
( $data_props ) ? ' ' . $data_props : '',
|
899 |
do_shortcode( $content )
|
900 |
);
|
901 |
+
}
|
902 |
|
903 |
/*--------------------------------------------------------------------------------------
|
904 |
*
|
915 |
"data" => false
|
916 |
), $atts );
|
917 |
|
918 |
+
$class = '';
|
919 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
920 |
|
921 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
922 |
|
923 |
+
return sprintf(
|
924 |
'<li><a href="%s" class="%s"%s>%s</a></li>',
|
925 |
esc_url( $atts['link'] ),
|
926 |
+
esc_attr( trim($class) ),
|
927 |
( $data_props ) ? ' ' . $data_props : '',
|
928 |
do_shortcode( $content )
|
929 |
);
|
944 |
"xclass" => false,
|
945 |
"data" => false
|
946 |
), $atts );
|
947 |
+
|
948 |
$class = 'label';
|
949 |
$class .= ( $atts['type'] ) ? ' label-' . $atts['type'] : ' label-default';
|
950 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
951 |
+
|
952 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
953 |
|
954 |
+
return sprintf(
|
955 |
'<span class="%s"%s>%s</span>',
|
956 |
+
esc_attr( trim($class) ),
|
957 |
( $data_props ) ? ' ' . $data_props : '',
|
958 |
do_shortcode( $content )
|
959 |
);
|
974 |
"xclass" => false,
|
975 |
"data" => false
|
976 |
), $atts );
|
977 |
+
|
978 |
$class = 'badge';
|
979 |
$class .= ( $atts['right'] == 'true' ) ? ' pull-right' : '';
|
980 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
981 |
+
|
982 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
983 |
+
|
984 |
+
return sprintf(
|
985 |
'<span class="%s"%s>%s</span>',
|
986 |
+
esc_attr( trim($class) ),
|
987 |
( $data_props ) ? ' ' . $data_props : '',
|
988 |
do_shortcode( $content )
|
989 |
);
|
1004 |
"xclass" => false,
|
1005 |
"data" => false
|
1006 |
), $atts );
|
1007 |
+
|
1008 |
$class = 'glyphicon';
|
1009 |
$class .= ( $atts['type'] ) ? ' glyphicon-' . $atts['type'] : '';
|
1010 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1011 |
+
|
1012 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1013 |
+
|
1014 |
+
return sprintf(
|
1015 |
'<span class="%s"%s>%s</span>',
|
1016 |
+
esc_attr( trim($class) ),
|
1017 |
( $data_props ) ? ' ' . $data_props : '',
|
1018 |
do_shortcode( $content )
|
1019 |
);
|
1088 |
$class .= ( $atts['hover'] == 'true' ) ? ' table-hover' : '';
|
1089 |
$class .= ( $atts['condensed'] == 'true' ) ? ' table-condensed' : '';
|
1090 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1091 |
+
|
1092 |
$return = '';
|
1093 |
+
|
1094 |
$tag = array('table');
|
1095 |
$content = do_shortcode($content);
|
1096 |
|
1098 |
$return = ( $atts['responsive'] ) ? '<div class="table-responsive">' . $return . '</div>' : $return;
|
1099 |
return $return;
|
1100 |
}
|
1101 |
+
|
1102 |
+
|
1103 |
/*--------------------------------------------------------------------------------------
|
1104 |
*
|
1105 |
* bs_well
|
1118 |
"xclass" => false,
|
1119 |
"data" => false
|
1120 |
), $atts );
|
1121 |
+
|
1122 |
$class = 'well';
|
1123 |
$class .= ( $atts['size'] ) ? ' well-' . $atts['size'] : '';
|
1124 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1125 |
+
|
1126 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1127 |
+
|
1128 |
+
return sprintf(
|
1129 |
'<div class="%s"%s>%s</div>',
|
1130 |
+
esc_attr( trim($class) ),
|
1131 |
( $data_props ) ? ' ' . $data_props : '',
|
1132 |
do_shortcode( $content )
|
1133 |
);
|
1151 |
"xclass" => false,
|
1152 |
"data" => false
|
1153 |
), $atts );
|
1154 |
+
|
1155 |
$class = 'panel';
|
1156 |
$class .= ( $atts['type'] ) ? ' panel-' . $atts['type'] : ' panel-default';
|
1157 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1160 |
$atts['heading'] = $atts['title'];
|
1161 |
$atts['title'] = true;
|
1162 |
}
|
1163 |
+
|
1164 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1165 |
|
1166 |
$footer = ( $atts['footer'] ) ? '<div class="panel-footer">' . $atts['footer'] . '</div>' : '';
|
1167 |
|
1168 |
if ( $atts['heading'] ) {
|
1169 |
+
$heading = sprintf(
|
1170 |
+
'<div class="panel-heading">%s%s%s</div>',
|
1171 |
( $atts['title'] ) ? '<h3 class="panel-title">' : '',
|
1172 |
esc_html( $atts['heading'] ),
|
1173 |
( $atts['title'] ) ? '</h3>' : ''
|
1179 |
|
1180 |
return sprintf(
|
1181 |
'<div class="%s"%s>%s<div class="panel-body">%s</div>%s</div>',
|
1182 |
+
esc_attr( trim($class) ),
|
1183 |
( $data_props ) ? ' ' . $data_props : '',
|
1184 |
$heading,
|
1185 |
do_shortcode( $content ),
|
1213 |
"data" => false,
|
1214 |
"name" => false,
|
1215 |
), $atts );
|
1216 |
+
|
1217 |
$ul_class = 'nav';
|
1218 |
$ul_class .= ( $atts['type'] ) ? ' nav-' . $atts['type'] : ' nav-tabs';
|
1219 |
$ul_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1220 |
+
|
1221 |
$div_class = 'tab-content';
|
1222 |
|
1223 |
// If user defines name of group, use that for ID for tab history purposes
|
1229 |
|
1230 |
|
1231 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1232 |
+
|
1233 |
$atts_map = bs_attribute_map( $content );
|
1234 |
+
|
1235 |
// Extract the tab titles for use in the tab widget.
|
1236 |
if ( $atts_map ) {
|
1237 |
$tabs = array();
|
1243 |
}
|
1244 |
$i = 0;
|
1245 |
foreach( $atts_map as $tab ) {
|
1246 |
+
|
1247 |
$class ='';
|
1248 |
$class .= ( !empty($tab["tab"]["active"]) || ($GLOBALS['tabs_default_active'] && $i == 0) ) ? 'active' : '';
|
1249 |
+
$class .= ( !empty($tab["tab"]["xclass"]) ) ? ' ' . sanitize_html_class($tab["tab"]["xclass"]) : '';
|
1250 |
|
1251 |
if(!isset($tab["tab"]["link"])) {
|
1252 |
$tab_id = 'custom-tab-' . $GLOBALS['tabs_count'] . '-' . md5( $tab["tab"]["title"] );
|
1256 |
|
1257 |
$tabs[] = sprintf(
|
1258 |
'<li%s><a href="#%s" data-toggle="tab" >%s</a></li>',
|
1259 |
+
( !empty($class) ) ? ' class="' . $class . '"' : '',
|
1260 |
sanitize_html_class($tab_id),
|
1261 |
$tab["tab"]["title"]
|
1262 |
);
|
1294 |
'data' => false,
|
1295 |
'link' => false
|
1296 |
), $atts );
|
1297 |
+
|
1298 |
if( $GLOBALS['tabs_default_active'] && $GLOBALS['tabs_default_count'] == 0 ) {
|
1299 |
$atts['active'] = true;
|
1300 |
}
|
1314 |
}
|
1315 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1316 |
|
1317 |
+
return sprintf(
|
1318 |
'<div id="%s" class="%s"%s>%s</div>',
|
1319 |
sanitize_html_class($id),
|
1320 |
+
esc_attr( trim($class) ),
|
1321 |
( $data_props ) ? ' ' . $data_props : '',
|
1322 |
do_shortcode( $content )
|
1323 |
);
|
1346 |
"xclass" => false,
|
1347 |
"data" => false
|
1348 |
), $atts );
|
1349 |
+
|
1350 |
$class = 'panel-group';
|
1351 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1352 |
+
|
1353 |
$id = 'custom-collapse-'. $GLOBALS['collapsibles_count'];
|
1354 |
+
|
1355 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1356 |
|
1357 |
+
return sprintf(
|
1358 |
'<div class="%s" id="%s"%s>%s</div>',
|
1359 |
+
esc_attr( trim($class) ),
|
1360 |
esc_attr($id),
|
1361 |
( $data_props ) ? ' ' . $data_props : '',
|
1362 |
do_shortcode( $content )
|
1374 |
*
|
1375 |
*-------------------------------------------------------------------------------------*/
|
1376 |
function bs_collapse( $atts, $content = null ) {
|
1377 |
+
|
1378 |
if( isset($GLOBALS['single_collapse_count']) )
|
1379 |
$GLOBALS['single_collapse_count']++;
|
1380 |
else
|
1391 |
$panel_class = 'panel';
|
1392 |
$panel_class .= ( $atts['type'] ) ? ' panel-' . $atts['type'] : ' panel-default';
|
1393 |
$panel_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1394 |
+
|
1395 |
$collapse_class = 'panel-collapse';
|
1396 |
$collapse_class .= ( $atts['active'] == 'true' ) ? ' in' : ' collapse';
|
1397 |
+
|
1398 |
$a_class = '';
|
1399 |
$a_class .= ( $atts['active'] == 'true' ) ? '' : 'collapsed';
|
1400 |
|
1402 |
$current_collapse = $parent . '-' . $GLOBALS['single_collapse_count'];
|
1403 |
|
1404 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1405 |
+
|
1406 |
+
return sprintf(
|
1407 |
'<div class="%1$s"%2$s>
|
1408 |
<div class="panel-heading">
|
1409 |
<h4 class="panel-title">
|
1417 |
esc_attr( $panel_class ),
|
1418 |
( $data_props ) ? ' ' . $data_props : '',
|
1419 |
$a_class,
|
1420 |
+
( $parent ) ? ' data-parent="#' . $parent . '"' : '',
|
1421 |
$current_collapse,
|
1422 |
$atts['title'],
|
1423 |
esc_attr( $collapse_class ),
|
1424 |
do_shortcode( $content )
|
1425 |
);
|
1426 |
}
|
1427 |
+
|
1428 |
+
|
1429 |
/*--------------------------------------------------------------------------------------
|
1430 |
*
|
1431 |
* bs_carousel
|
1434 |
*
|
1435 |
*-------------------------------------------------------------------------------------*/
|
1436 |
function bs_carousel( $atts, $content = null ) {
|
1437 |
+
|
1438 |
if( isset($GLOBALS['carousel_count']) )
|
1439 |
$GLOBALS['carousel_count']++;
|
1440 |
else
|
1452 |
|
1453 |
$div_class = 'carousel slide';
|
1454 |
$div_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1455 |
+
|
1456 |
$inner_class = 'carousel-inner';
|
1457 |
+
|
1458 |
$id = 'custom-carousel-'. $GLOBALS['carousel_count'];
|
1459 |
+
|
1460 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1461 |
|
1462 |
$atts_map = bs_attribute_map( $content );
|
1463 |
+
|
1464 |
// Extract the slide titles for use in the carousel widget.
|
1465 |
if ( $atts_map ) {
|
1466 |
$indicators = array();
|
1468 |
foreach( $atts_map as $check ) {
|
1469 |
if( !empty($check["carousel-item"]["active"]) ) {
|
1470 |
$GLOBALS['carousel_default_active'] = false;
|
1471 |
+
}
|
1472 |
}
|
1473 |
$i = 0;
|
1474 |
foreach( $atts_map as $slide ) {
|
1514 |
"xclass" => false,
|
1515 |
"data" => false
|
1516 |
), $atts );
|
1517 |
+
|
1518 |
if( $GLOBALS['carousel_default_active'] && $GLOBALS['carousel_default_count'] == 0 ) {
|
1519 |
$atts['active'] = true;
|
1520 |
}
|
1521 |
$GLOBALS['carousel_default_count']++;
|
1522 |
+
|
1523 |
$class = 'item';
|
1524 |
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
1525 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1526 |
+
|
1527 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1528 |
|
1529 |
//$content = preg_replace('/class=".*?"/', '', $content);
|
1532 |
$content = preg_replace('/alignleft/', '', $content);
|
1533 |
$content = preg_replace('/aligncenter/', '', $content);
|
1534 |
|
1535 |
+
return sprintf(
|
1536 |
'<div class="%s"%s>%s%s</div>',
|
1537 |
+
esc_attr( trim($class) ),
|
1538 |
( $data_props ) ? ' ' . $data_props : '',
|
1539 |
do_shortcode( $content ),
|
1540 |
( $atts['caption'] ) ? '<div class="carousel-caption">' . esc_html( $atts['caption'] ) . '</div>' : ''
|
1560 |
'html' => 'false',
|
1561 |
'data' => ''
|
1562 |
), $atts );
|
1563 |
+
|
1564 |
$class = 'bs-tooltip';
|
1565 |
+
|
1566 |
$atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
|
1567 |
$atts['data'] .= ( $atts['placement'] ) ? $this->check_for_data($atts['data']) . 'placement,' . $atts['placement'] : '';
|
1568 |
$atts['data'] .= ( $atts['html'] ) ? $this->check_for_data($atts['data']) . 'html,' .$atts['html'] : '';
|
1572 |
$content = do_shortcode($content);
|
1573 |
$return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
|
1574 |
return $return;
|
1575 |
+
|
1576 |
}
|
1577 |
|
1578 |
/*--------------------------------------------------------------------------------------
|
1592 |
'html' => 'false',
|
1593 |
'data' => ''
|
1594 |
), $atts );
|
1595 |
+
|
1596 |
$class = 'bs-popover';
|
1597 |
+
|
1598 |
$atts['data'] .= $this->check_for_data($atts['data']) . 'toggle,popover';
|
1599 |
$atts['data'] .= $this->check_for_data($atts['data']) . 'content,' . str_replace(',', ',', $atts['text']);
|
1600 |
$atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
|
1606 |
$content = do_shortcode($content);
|
1607 |
$return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
|
1608 |
return html_entity_decode($return);
|
1609 |
+
|
1610 |
}
|
1611 |
|
1612 |
|
1618 |
* @since 1.0
|
1619 |
*
|
1620 |
*-------------------------------------------------------------------------------------*/
|
1621 |
+
|
1622 |
function bs_media( $atts, $content = null ) {
|
1623 |
|
1624 |
$atts = shortcode_atts( array(
|
1626 |
"data" => false
|
1627 |
), $atts );
|
1628 |
|
1629 |
+
$class = 'media';
|
1630 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass']: '';
|
1631 |
|
1632 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1633 |
|
1634 |
+
return sprintf(
|
1635 |
'<div class="%s"%s>%s</div>',
|
1636 |
+
esc_attr( trim($class) ),
|
1637 |
( $data_props ) ? ' ' . $data_props : '',
|
1638 |
do_shortcode( $content )
|
1639 |
);
|
1647 |
"xclass" => false,
|
1648 |
"data" => false
|
1649 |
), $atts );
|
1650 |
+
|
1651 |
$class = "media-object img-responsive";
|
1652 |
$class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
|
1653 |
+
|
1654 |
$media_class ='';
|
1655 |
$media_class = ($atts['media']) ? 'media-' . $atts['media'] : '';
|
1656 |
+
$media_class = ($atts['pull']) ? 'pull-' . $atts['pull'] : $media_class;
|
1657 |
+
|
1658 |
$return = '';
|
1659 |
+
|
1660 |
$tag = array('figure', 'div', 'img', 'i', 'span');
|
1661 |
$content = do_shortcode(preg_replace('/(<br>)+$/', '', $content));
|
1662 |
$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
|
1672 |
"data" => false
|
1673 |
), $atts );
|
1674 |
|
1675 |
+
$div_class = 'media-body';
|
1676 |
$div_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1677 |
|
1678 |
+
$h4_class = 'media-heading';
|
1679 |
$h4_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1680 |
|
1681 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1682 |
+
|
1683 |
+
return sprintf(
|
1684 |
'<div class="%s"%s><h4 class="%s">%s</h4>%s</div>',
|
1685 |
esc_attr( $div_class ),
|
1686 |
( $data_props ) ? ' ' . $data_props : '',
|
1703 |
"xclass" => false,
|
1704 |
"data" => false
|
1705 |
), $atts );
|
1706 |
+
|
1707 |
$class = 'jumbotron';
|
1708 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1709 |
+
|
1710 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1711 |
+
|
1712 |
+
return sprintf(
|
1713 |
'<div class="%s"%s>%s%s</div>',
|
1714 |
+
esc_attr( trim($class) ),
|
1715 |
( $data_props ) ? ' ' . $data_props : '',
|
1716 |
( $atts['title'] ) ? '<h1>' . esc_html( $atts['title'] ) . '</h1>' : '',
|
1717 |
do_shortcode( $content )
|
1725 |
*
|
1726 |
*-------------------------------------------------------------------------------------*/
|
1727 |
function bs_page_header( $atts, $content = null ) {
|
1728 |
+
|
1729 |
$atts = shortcode_atts( array(
|
1730 |
"xclass" => false,
|
1731 |
"data" => false
|
1732 |
), $atts );
|
1733 |
|
1734 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1735 |
+
|
1736 |
$class = "page-header";
|
1737 |
$class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
|
1738 |
+
|
1739 |
$return = '';
|
1740 |
$title = '';
|
1741 |
$tag = 'div';
|
1742 |
$content = $this->strip_paragraph($content);
|
1743 |
$content = $this->nest_dom_element('h1', 'div', $content);
|
1744 |
+
$return .= $this->get_dom_element($tag, $content, $class, '', $atts['data']);
|
1745 |
return $return;
|
1746 |
|
1747 |
+
}
|
1748 |
+
|
1749 |
/*--------------------------------------------------------------------------------------
|
1750 |
*
|
1751 |
* bs_lead
|
1753 |
*
|
1754 |
*-------------------------------------------------------------------------------------*/
|
1755 |
function bs_lead( $atts, $content = null ) {
|
1756 |
+
|
1757 |
$atts = shortcode_atts( array(
|
1758 |
"xclass" => false,
|
1759 |
"data" => false
|
1760 |
), $atts );
|
1761 |
|
1762 |
+
$class = 'lead';
|
1763 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1764 |
+
|
1765 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1766 |
+
|
1767 |
+
return sprintf(
|
1768 |
'<p class="%s"%s>%s</p>',
|
1769 |
+
esc_attr( trim($class) ),
|
1770 |
( $data_props ) ? ' ' . $data_props : '',
|
1771 |
do_shortcode( $content )
|
1772 |
);
|
1789 |
$class = '';
|
1790 |
$class .= ( $atts['type'] ) ? 'text-' . $atts['type'] : 'text-muted';
|
1791 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1792 |
+
|
1793 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1794 |
+
|
1795 |
+
return sprintf(
|
1796 |
'<span class="%s"%s>%s</span>',
|
1797 |
+
esc_attr( trim($class) ),
|
1798 |
( $data_props ) ? ' ' . $data_props : '',
|
1799 |
do_shortcode( $content )
|
1800 |
);
|
1807 |
*
|
1808 |
*-------------------------------------------------------------------------------------*/
|
1809 |
function bs_img( $atts, $content = null ) {
|
1810 |
+
|
1811 |
$atts = shortcode_atts( array(
|
1812 |
"type" => false,
|
1813 |
"responsive" => false,
|
1825 |
$content = do_shortcode($content);
|
1826 |
$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
|
1827 |
return $return;
|
1828 |
+
|
1829 |
}
|
1830 |
+
|
1831 |
/*--------------------------------------------------------------------------------------
|
1832 |
*
|
1833 |
* bs_embed_responsive
|
1835 |
*
|
1836 |
*-------------------------------------------------------------------------------------*/
|
1837 |
function bs_embed_responsive( $atts, $content = null ) {
|
1838 |
+
|
1839 |
$atts = shortcode_atts( array(
|
1840 |
"ratio" => false,
|
1841 |
"xclass" => false,
|
1845 |
$class = 'embed-responsive ';
|
1846 |
$class .= ( $atts['ratio'] ) ? ' embed-responsive-' . $atts['ratio'] . ' ' : '';
|
1847 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1848 |
+
|
1849 |
$embed_class = 'embed-responsive-item';
|
1850 |
|
1851 |
$tag = array('iframe', 'embed', 'video', 'object');
|
1854 |
|
1855 |
return sprintf(
|
1856 |
'<div class="%s"%s>%s</div>',
|
1857 |
+
esc_attr( trim($class) ),
|
1858 |
( $data_props ) ? ' ' . $data_props : '',
|
1859 |
$this->scrape_dom_element($tag, $content, $embed_class, '', '')
|
1860 |
);
|
1861 |
+
|
1862 |
}
|
1863 |
+
|
1864 |
/*--------------------------------------------------------------------------------------
|
1865 |
*
|
1866 |
* bs_thumbnail
|
1868 |
*
|
1869 |
*-------------------------------------------------------------------------------------*/
|
1870 |
function bs_thumbnail( $atts, $content = null ) {
|
1871 |
+
|
1872 |
$atts = shortcode_atts( array(
|
1873 |
"xclass" => false,
|
1874 |
"has_content" => false,
|
1875 |
"data" => false
|
1876 |
), $atts );
|
1877 |
+
|
1878 |
$class = "thumbnail";
|
1879 |
$class .= ($atts['xclass']) ? ' ' . $atts['xclass'] : '';
|
1880 |
|
1888 |
$content = do_shortcode($content);
|
1889 |
$return .= $this->scrape_dom_element($tag, $content, $class, '', $atts['data']);
|
1890 |
return $return;
|
1891 |
+
|
1892 |
}
|
1893 |
+
|
1894 |
/*--------------------------------------------------------------------------------------
|
1895 |
*
|
1896 |
* bs_responsive
|
1898 |
*
|
1899 |
*-------------------------------------------------------------------------------------*/
|
1900 |
function bs_responsive( $atts, $content = null ) {
|
1901 |
+
|
1902 |
$atts = shortcode_atts( array(
|
1903 |
"visible" => false,
|
1904 |
"hidden" => false,
|
1908 |
"xclass" => false,
|
1909 |
"data" => false
|
1910 |
), $atts );
|
1911 |
+
|
1912 |
$class = '';
|
1913 |
if( $atts['visible'] ) {
|
1914 |
$visible = explode( ' ', $atts['visible'] );
|
1941 |
endforeach;
|
1942 |
}
|
1943 |
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1944 |
+
|
1945 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1946 |
|
1947 |
+
return sprintf(
|
1948 |
'<span class="%s"%s>%s</span>',
|
1949 |
+
esc_attr( trim($class) ),
|
1950 |
( $data_props ) ? ' ' . $data_props : '',
|
1951 |
do_shortcode( $content )
|
1952 |
);
|
1961 |
*
|
1962 |
*-------------------------------------------------------------------------------------*/
|
1963 |
function bs_modal( $atts, $content = null ) {
|
1964 |
+
|
1965 |
if( isset($GLOBALS['modal_count']) )
|
1966 |
$GLOBALS['modal_count']++;
|
1967 |
else
|
1975 |
"data" => false
|
1976 |
), $atts );
|
1977 |
|
1978 |
+
$a_class = '';
|
1979 |
$a_class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1980 |
+
|
1981 |
$div_class = 'modal fade';
|
1982 |
$div_class .= ( $atts['size'] ) ? ' bs-modal-' . $atts['size'] : '';
|
1983 |
+
|
1984 |
$div_size = ( $atts['size'] ) ? ' modal-' . $atts['size'] : '';
|
1985 |
+
|
1986 |
$id = 'custom-modal-' . $GLOBALS['modal_count'];
|
1987 |
+
|
1988 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1989 |
+
|
1990 |
$modal_output = sprintf(
|
1991 |
'<div class="%1$s" id="%2$s" tabindex="-1" role="dialog" aria-hidden="true">
|
1992 |
<div class="modal-dialog %3$s">
|
2008 |
( $atts['title'] ) ? '<h4 class="modal-title">' . $atts['title'] . '</h4>' : '',
|
2009 |
do_shortcode( $content )
|
2010 |
);
|
2011 |
+
|
2012 |
add_action('wp_footer', function() use ($modal_output) {
|
2013 |
echo $modal_output;
|
2014 |
}, 100,0);
|
2015 |
+
|
2016 |
+
return sprintf(
|
2017 |
'<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>',
|
2018 |
esc_attr( $id ),
|
2019 |
esc_attr( $a_class ),
|
2038 |
), $atts );
|
2039 |
|
2040 |
$class = 'modal-footer';
|
2041 |
+
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
2042 |
|
2043 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
2044 |
|
2045 |
return sprintf(
|
2046 |
'</div><div class="%s"%s>%s',
|
2047 |
+
esc_attr( trim($class) ),
|
2048 |
( $data_props ) ? ' ' . $data_props : '',
|
2049 |
do_shortcode( $content )
|
2050 |
);
|
2051 |
}
|
2052 |
+
|
2053 |
/*--------------------------------------------------------------------------------------
|
2054 |
*
|
2055 |
* Parse data-attributes for shortcodes
|
2067 |
$data_props .= sprintf( 'data-%s="%s" ', esc_html( $d[0] ), esc_attr( trim( $d[1] ) ) );
|
2068 |
}
|
2069 |
}
|
2070 |
+
else {
|
2071 |
$data_props = false;
|
2072 |
}
|
2073 |
return $data_props;
|
2074 |
}
|
2075 |
+
|
2076 |
/*--------------------------------------------------------------------------------------
|
2077 |
*
|
2078 |
* get DOMDocument element and apply shortcode parameters to it. Create the element if it doesn't exist
|
2079 |
*
|
2080 |
*-------------------------------------------------------------------------------------*/
|
2081 |
function get_dom_element( $tag, $content, $class, $title = '', $data = null ) {
|
2082 |
+
|
2083 |
//clean up content
|
2084 |
$content = trim(trim($content), chr(0xC2).chr(0xA0));
|
2085 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2086 |
+
|
2087 |
$dom = new DOMDocument;
|
2088 |
$dom->loadXML(utf8_encode($content));
|
2089 |
+
|
2090 |
libxml_clear_errors();
|
2091 |
libxml_use_internal_errors($previous_value);
|
2092 |
+
|
2093 |
if(!$dom->documentElement) {
|
2094 |
$element = $dom->createElement($tag, utf8_encode($content));
|
2095 |
$dom->appendChild($element);
|
2096 |
}
|
2097 |
+
|
2098 |
$dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( utf8_encode($class) ));
|
2099 |
if( $title ) {
|
2100 |
$dom->documentElement->setAttribute('title', $title );
|
2117 |
function scrape_dom_element( $tag, $content, $class, $title = '', $data = null ) {
|
2118 |
|
2119 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2120 |
+
|
2121 |
$dom = new DOMDocument;
|
2122 |
$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
|
2123 |
+
|
2124 |
libxml_clear_errors();
|
2125 |
libxml_use_internal_errors($previous_value);
|
2126 |
foreach ($tag as $find) {
|
2138 |
if( $data ) {
|
2139 |
$data = explode( '|', $data );
|
2140 |
foreach( $data as $d ):
|
2141 |
+
$d = explode(',',$d);
|
2142 |
$outputdom->documentElement->setAttribute('data-'.$d[0],trim($d[1]));
|
2143 |
endforeach;
|
2144 |
}
|
2148 |
}
|
2149 |
}
|
2150 |
}
|
2151 |
+
|
2152 |
/*--------------------------------------------------------------------------------------
|
2153 |
*
|
2154 |
* Find if content contains a particular tag, if not, create it, either way wrap it in a wrapper tag
|
2159 |
function nest_dom_element($find, $append, $content) {
|
2160 |
|
2161 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2162 |
+
|
2163 |
$dom = new DOMDocument;
|
2164 |
$dom->loadXML(utf8_encode($content));
|
2165 |
+
|
2166 |
libxml_clear_errors();
|
2167 |
libxml_use_internal_errors($previous_value);
|
2168 |
+
|
2169 |
//Does $content include the tag we're looking for?
|
2170 |
+
$hasFind = $dom->getElementsByTagName($find);
|
2171 |
|
2172 |
//If not, add it and wrap it all in our append tag
|
2173 |
if( $hasFind->length == 0 ) {
|
2174 |
$wrapper = $dom->createElement($append);
|
2175 |
$dom->appendChild($wrapper);
|
2176 |
+
|
2177 |
$tag = $dom->createElement($find, $content);
|
2178 |
$wrapper->appendChild($tag);
|
2179 |
}
|
2180 |
+
|
2181 |
//If so, just wrap everything in our append tag
|
2182 |
else {
|
2183 |
$new_root = $dom->createElement($append);
|
2186 |
}
|
2187 |
return $dom->saveXML($dom->documentElement);
|
2188 |
}
|
2189 |
+
|
2190 |
/*--------------------------------------------------------------------------------------
|
2191 |
*
|
2192 |
* Add dividers to data attributes content if needed
|
2197 |
return "|";
|
2198 |
}
|
2199 |
}
|
2200 |
+
|
2201 |
/*--------------------------------------------------------------------------------------
|
2202 |
*
|
2203 |
* If the user puts a return between the shortcode and its contents, sometimes we want to strip the resulting P tags out
|
2212 |
}
|
2213 |
|
2214 |
new BoostrapShortcodes();
|
|
composer.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
{
|
2 |
-
"name": "
|
3 |
"description": "WordPress shortcodes for easier use of Bootstrap elements in your content.",
|
4 |
"keywords": [
|
5 |
"bootstrap",
|
@@ -7,7 +7,7 @@
|
|
7 |
"wordpress",
|
8 |
"plugin"
|
9 |
],
|
10 |
-
"homepage": "https://github.com/
|
11 |
"license": "GPL2",
|
12 |
"authors": [
|
13 |
{
|
1 |
{
|
2 |
+
"name": "mwdelaney/bootstrap-3-shortcodes",
|
3 |
"description": "WordPress shortcodes for easier use of Bootstrap elements in your content.",
|
4 |
"keywords": [
|
5 |
"bootstrap",
|
7 |
"wordpress",
|
8 |
"plugin"
|
9 |
],
|
10 |
+
"homepage": "https://github.com/mwdelaney/bootstrap-3-shortcodes",
|
11 |
"license": "GPL2",
|
12 |
"authors": [
|
13 |
{
|
includes/actions-filters.php
CHANGED
@@ -1,16 +1,68 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
wp_enqueue_style( 'bootstrap-shortcodes-help-all' );
|
9 |
-
}
|
10 |
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
wp_register_style( 'bs-font', plugins_url( 'bootstrap-3-shortcodes/includes/help/bs-font.css' ) );
|
15 |
wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
|
16 |
wp_register_style( 'bootstrap-modal', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-modal.css' ) );
|
@@ -19,19 +71,17 @@ function bootstrap_shortcodes_help_styles() {
|
|
19 |
wp_enqueue_style( 'bootstrap-modal' );
|
20 |
wp_enqueue_style( 'bs-font' );
|
21 |
wp_enqueue_script( 'bootstrap' );
|
22 |
-
|
23 |
//Visual Composer causes problems
|
24 |
$handle = 'vc_bootstrap_js';
|
25 |
$list = 'enqueued';
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
add_filter('the_content', 'bs_fix_shortcodes');
|
32 |
|
33 |
-
//
|
34 |
-
function add_bootstrap_button() {
|
35 |
//the id of the container I want to show in the popup
|
36 |
$popup_id = 'bootstrap-shortcodes-help';
|
37 |
|
@@ -47,40 +97,63 @@ function add_bootstrap_button() {
|
|
47 |
esc_attr( 'button add_media bootstrap-shortcodes-button')
|
48 |
//sprintf( '<img src="%s" style="height: 20px; position: relative; top: -2px;">', esc_url( $img ) )
|
49 |
);
|
50 |
-
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
//
|
54 |
-
//add a button to the content editor, next to the media button
|
55 |
-
//this button will show a popup that contains inline content
|
56 |
-
if(in_array(basename($_SERVER['PHP_SELF']), array('post.php', 'page.php', 'page-new.php', 'post-new.php', 'widgets.php', 'admin-ajax.php'))) {
|
57 |
-
add_action('media_buttons', 'add_bootstrap_button', 11);
|
58 |
-
add_action( 'media_buttons', 'bootstrap_shortcodes_help_styles' );
|
59 |
-
}
|
60 |
-
function boostrap_shortcodes_help() {
|
61 |
-
include( BS_SHORTCODES_DIR . 'bootstrap-shortcodes-help.php');
|
62 |
-
}
|
63 |
-
add_action( 'admin_footer', 'boostrap_shortcodes_help' );
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
// Add the Bootstrap Shortcodes button to Distraction Free Writing mode
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
add_action ('wp_fullscreen_buttons', 'bs_fullscreenbuttons');
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
|
3 |
+
// ======================================================================== //
|
4 |
+
// PHP Version notice if version < 5.3
|
5 |
+
// ======================================================================== //
|
6 |
|
7 |
+
function php_version_notice() {
|
8 |
+
$class = 'notice notice-error';
|
9 |
+
$message = __( '<strong>Bootstrap 3 Shortcodes for WordPress</strong> requires PHP version 5.3 or later. You are running PHP version ' . PHP_VERSION . '. Please upgrade to a supported version of PHP.', 'sample-text-domain' );
|
10 |
|
11 |
+
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message );
|
12 |
+
}
|
|
|
|
|
13 |
|
14 |
+
//Only run this if the PHP version is less than 5.3
|
15 |
+
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
16 |
+
add_action( 'admin_notices', 'php_version_notice' );
|
17 |
+
}
|
18 |
|
19 |
+
// ======================================================================== //
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
// ======================================================================== //
|
24 |
+
// Enqueue help button styles
|
25 |
+
// ======================================================================== //
|
26 |
+
|
27 |
+
function bootstrap_shortcodes_styles_all() {
|
28 |
+
wp_register_style( 'bootstrap-shortcodes-help-all', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help-all.css' ) );
|
29 |
+
wp_enqueue_style( 'bootstrap-shortcodes-help-all' );
|
30 |
+
}
|
31 |
+
|
32 |
+
add_action( 'admin_enqueue_scripts', 'bootstrap_shortcodes_styles_all' );
|
33 |
+
|
34 |
+
// ======================================================================== //
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
// ======================================================================== //
|
39 |
+
// Function and filter to remove extra line breaks around shortcodes
|
40 |
+
// ======================================================================== //
|
41 |
+
|
42 |
+
function bs_fix_shortcodes($content){
|
43 |
+
$array = array (
|
44 |
+
'<p>[' => '[',
|
45 |
+
']</p>' => ']',
|
46 |
+
']<br />' => ']',
|
47 |
+
']<br>' => ']'
|
48 |
+
);
|
49 |
+
|
50 |
+
$content = strtr($content, $array);
|
51 |
+
return $content;
|
52 |
+
}
|
53 |
+
|
54 |
+
add_filter('the_content', 'bs_fix_shortcodes');
|
55 |
+
|
56 |
+
// ======================================================================== //
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
// ======================================================================== //
|
61 |
+
// Button creation and styles for the documentation popup button
|
62 |
+
// ======================================================================== //
|
63 |
+
|
64 |
+
//Function to register and enqueue the documentation stylesheets
|
65 |
+
function bootstrap_shortcodes_help_styles() {
|
66 |
wp_register_style( 'bs-font', plugins_url( 'bootstrap-3-shortcodes/includes/help/bs-font.css' ) );
|
67 |
wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
|
68 |
wp_register_style( 'bootstrap-modal', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-modal.css' ) );
|
71 |
wp_enqueue_style( 'bootstrap-modal' );
|
72 |
wp_enqueue_style( 'bs-font' );
|
73 |
wp_enqueue_script( 'bootstrap' );
|
74 |
+
|
75 |
//Visual Composer causes problems
|
76 |
$handle = 'vc_bootstrap_js';
|
77 |
$list = 'enqueued';
|
78 |
+
if (wp_script_is( $handle, $list )) {
|
79 |
+
wp_dequeue_script( $handle );
|
80 |
+
}
|
81 |
+
}
|
|
|
|
|
82 |
|
83 |
+
//Function create the documentation popup button
|
84 |
+
function add_bootstrap_button() {
|
85 |
//the id of the container I want to show in the popup
|
86 |
$popup_id = 'bootstrap-shortcodes-help';
|
87 |
|
97 |
esc_attr( 'button add_media bootstrap-shortcodes-button')
|
98 |
//sprintf( '<img src="%s" style="height: 20px; position: relative; top: -2px;">', esc_url( $img ) )
|
99 |
);
|
100 |
+
}
|
101 |
|
102 |
+
//add the button to the content editor, next to the media button on any admin page in the array below
|
103 |
+
if(in_array(basename($_SERVER['PHP_SELF']), array('post.php', 'page.php', 'page-new.php', 'post-new.php', 'widgets.php', 'admin-ajax.php'))) {
|
104 |
+
add_action('media_buttons', 'add_bootstrap_button', 11);
|
105 |
+
add_action( 'media_buttons', 'bootstrap_shortcodes_help_styles' );
|
106 |
+
}
|
107 |
|
108 |
+
// ======================================================================== //
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
+
|
111 |
+
|
112 |
+
// ======================================================================== //
|
113 |
+
// Include the help popup content in the footer
|
114 |
+
// ======================================================================== //
|
115 |
+
|
116 |
+
function boostrap_shortcodes_help() {
|
117 |
+
include( BS_SHORTCODES_DIR . 'bootstrap-shortcodes-help.php');
|
118 |
+
}
|
119 |
+
|
120 |
+
add_action( 'admin_footer', 'boostrap_shortcodes_help' );
|
121 |
+
|
122 |
+
// ======================================================================== //
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
// ======================================================================== //
|
127 |
// Add the Bootstrap Shortcodes button to Distraction Free Writing mode
|
128 |
+
// ======================================================================== //
|
129 |
+
|
130 |
+
function bs_fullscreenbuttons($buttons) {
|
131 |
+
$buttons[] = 'separator';
|
132 |
+
$buttons['bootstrap-shortcodes'] = array(
|
133 |
+
'title' => __('Boostrap 3 Shortcodes Help'),
|
134 |
+
'onclick' => "jQuery('#bootstrap-shortcodes-help').modal('show');",
|
135 |
+
'both' => false
|
136 |
+
);
|
137 |
+
return $buttons;
|
138 |
+
}
|
139 |
+
|
140 |
+
add_action ('wp_fullscreen_buttons', 'bs_fullscreenbuttons');
|
141 |
+
|
142 |
+
// ======================================================================== //
|
143 |
+
|
144 |
+
|
145 |
+
|
146 |
+
// ======================================================================== //
|
147 |
+
// Gravity Forms is bossy.
|
148 |
+
// Register this script with Gravity Forms (if present) so it isn't stripped out
|
149 |
+
// ======================================================================== //
|
150 |
+
|
151 |
+
function bs_register_script($scripts){
|
152 |
+
$scripts[] = "bootstrap-shortcodes-help-all";
|
153 |
+
return $scripts;
|
154 |
+
}
|
155 |
+
|
156 |
+
add_filter("gform_noconflict_styles", "bs_register_script");
|
157 |
+
|
158 |
+
// ======================================================================== //
|
159 |
+
|
includes/bootstrap-shortcodes-help.php
CHANGED
@@ -1,74 +1,148 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
$html = file_get_contents(dirname(__FILE__) . '/help/README.html');
|
3 |
-
?>
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
jQuery(document).ready(function() {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
});
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
});
|
27 |
</script>
|
28 |
|
29 |
<script type="text/javascript">
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
</script>
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<div id="bootstrap-shortcodes-help" class="modal fade">
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
<h4>Bootstrap Shortcodes Help</h4>
|
44 |
<ul class="nav nav-tabs">
|
45 |
<li class="active"><a href="#bs-shortcode-reference" data-toggle="tab">Shortcode Reference</a></li>
|
46 |
<li><a href="#bs-requirements" data-toggle="tab">System Requirements</a></li>
|
47 |
</ul>
|
48 |
-
</div>
|
49 |
-
<div class="modal-body ativa-scroll">
|
50 |
-
<div>
|
51 |
-
|
52 |
-
<div id="bs-top" class="tab-content">
|
53 |
-
|
54 |
-
<?php
|
55 |
-
# Put HTML content in the document
|
56 |
-
$html = preg_replace('/(<a href="http:[^"]+")>/is','\\1 target="_blank">',$html);
|
57 |
-
$html = str_replace('<table>', '<table class="table table-striped">', $html);
|
58 |
-
$html = str_replace('<ul>', '<div class="list-group">', $html);
|
59 |
-
$html = str_replace('</ul>', '</div>', $html);
|
60 |
-
$html = str_replace('<li><a ', '<a class="list-group-item" ', $html);
|
61 |
-
$html = str_replace('</li>', '', $html);
|
62 |
-
$html = str_replace('href="#', 'href="#bs-', $html);
|
63 |
-
$html = str_replace('<hr>', '<hr><a class="btn btn-link btn-default pull-right" href="#bs-top"><i class="text-muted glyphicon glyphicon-arrow-up"></i></a>', $html);
|
64 |
-
$html = str_replace('<h3 id="', '<h3 id="bs-', $html);
|
65 |
-
$html = str_replace('</pre>', '</pre><p><button data-dismiss="modal" class="btn btn-primary btn-sm insert-code">Insert Example <i class="glyphicon glyphicon-share-alt"></i></button></p>', $html);
|
66 |
-
echo $html;
|
67 |
-
?>
|
68 |
</div>
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
</div><!-- /.modal -->
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
|
3 |
+
// ======================================================================== //
|
4 |
+
// Get the contents of the help document, save them in a variable
|
5 |
+
// ======================================================================== //
|
6 |
+
|
7 |
$html = file_get_contents(dirname(__FILE__) . '/help/README.html');
|
|
|
8 |
|
9 |
+
// ======================================================================== //
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
// ======================================================================== //
|
14 |
+
// Include some jQuery to edit the help document
|
15 |
+
// ======================================================================== //
|
16 |
+
?>
|
17 |
+
<script type="text/javascript">
|
18 |
jQuery(document).ready(function() {
|
19 |
+
|
20 |
+
// ======================================================================== //
|
21 |
+
// Send example shortcodes to the TinyMCE editor when an "Insert Example"
|
22 |
+
// button is clicked.
|
23 |
+
// ======================================================================== //
|
24 |
+
|
25 |
+
jQuery(".insert-code").click(function() {
|
26 |
+
var example = jQuery( this ).parent().prev().find("code").text();
|
27 |
+
var lines = example.split('\n');
|
28 |
+
var paras = '';
|
29 |
+
jQuery.each(lines, function(i, line) {
|
30 |
+
if (line) {
|
31 |
+
paras += line + '<br>';
|
32 |
+
}
|
33 |
+
});
|
34 |
+
var win = window.dialogArguments || opener || parent || top;
|
35 |
+
win.send_to_editor(paras);
|
36 |
});
|
37 |
+
|
38 |
+
// ======================================================================== //
|
39 |
+
|
40 |
|
41 |
+
|
42 |
+
// ======================================================================== //
|
43 |
+
// Create tabs from the help documentation content, splitting on the H2s
|
44 |
+
// ======================================================================== //
|
45 |
+
|
46 |
+
jQuery('#bootstrap-shortcodes-help h2').each(function(){
|
47 |
+
var id = jQuery(this).attr("id");
|
48 |
+
jQuery(this).removeAttr("id").nextUntil("h2").andSelf().wrapAll('<div class="tab-pane" id="bs-' + id + '" />');
|
49 |
+
});
|
50 |
+
//Make the documentation tab active
|
51 |
+
jQuery('#bs-shortcode-reference').addClass('active');
|
52 |
+
|
53 |
+
//Hide header info from the readme, not relevent to documentation.
|
54 |
+
jQuery("#bootstrap-shortcodes-help #bootstrap-3-shortcodes-for-wordpress").nextUntil("#bootstrap-shortcodes-help #bs-requirements").hide();
|
55 |
+
|
56 |
+
// ======================================================================== //
|
57 |
|
58 |
});
|
59 |
</script>
|
60 |
|
61 |
<script type="text/javascript">
|
62 |
+
|
63 |
+
// ======================================================================== //
|
64 |
+
// Make the documentation popup modal scrollable
|
65 |
+
// Originally from: http://stackoverflow.com/questions/9899676/twitter-bootstrap-scrollable-modal
|
66 |
+
// ======================================================================== //
|
67 |
+
|
68 |
+
jQuery(document).ready(bsajustamodal);
|
69 |
+
jQuery(window).resize(bsajustamodal);
|
70 |
+
function bsajustamodal() {
|
71 |
+
var altura = jQuery(window).height() - 155; //value corresponding to the modal heading + footer
|
72 |
+
jQuery(".ativa-scroll").css({"height":altura,"overflow-y":"auto"});
|
73 |
+
}
|
74 |
+
|
75 |
+
// ======================================================================== //
|
76 |
+
|
77 |
</script>
|
78 |
|
79 |
+
<?php
|
80 |
+
// ======================================================================== //
|
81 |
+
?>
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
<?php
|
86 |
+
// ======================================================================== //
|
87 |
+
// Create the documentation popup modal
|
88 |
+
// ======================================================================== //
|
89 |
+
?>
|
90 |
+
|
91 |
<div id="bootstrap-shortcodes-help" class="modal fade">
|
92 |
+
<div class="modal-dialog modal-lg">
|
93 |
+
<div class="modal-content">
|
94 |
+
<div class="modal-header">
|
95 |
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
96 |
<h4>Bootstrap Shortcodes Help</h4>
|
97 |
<ul class="nav nav-tabs">
|
98 |
<li class="active"><a href="#bs-shortcode-reference" data-toggle="tab">Shortcode Reference</a></li>
|
99 |
<li><a href="#bs-requirements" data-toggle="tab">System Requirements</a></li>
|
100 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
</div>
|
102 |
+
|
103 |
+
<div class="modal-body ativa-scroll">
|
104 |
+
<div>
|
105 |
+
<div id="bs-top" class="tab-content">
|
106 |
+
|
107 |
+
<?php
|
108 |
+
// ======================================================================== //
|
109 |
+
// Put HTML content in the page so we can pop it up in a modal
|
110 |
+
// But first edit the HTML to make it more useful as popup documentation
|
111 |
+
// * Alter links to open in new tabs
|
112 |
+
// * Add Bootstrap styling to tables
|
113 |
+
// * Add Bootstrap styling to lists (and replace ULs with DIVs, and LIs with As)
|
114 |
+
// * Edit anchors to be on-page jumps
|
115 |
+
// * Add back-to-top buttons after sections
|
116 |
+
// * Add IDs to h3 tags for the above on-page jumps
|
117 |
+
// * Add "Insert Example" buttons after code examples
|
118 |
+
// ======================================================================== //
|
119 |
+
|
120 |
+
$html = preg_replace('/(<a href="http:[^"]+")>/is','\\1 target="_blank">',$html);
|
121 |
+
$html = str_replace('<table>', '<table class="table table-striped">', $html);
|
122 |
+
$html = str_replace('<ul>', '<div class="list-group">', $html);
|
123 |
+
$html = str_replace('</ul>', '</div>', $html);
|
124 |
+
$html = str_replace('<li><a ', '<a class="list-group-item" ', $html);
|
125 |
+
$html = str_replace('</li>', '', $html);
|
126 |
+
$html = str_replace('href="#', 'href="#bs-', $html);
|
127 |
+
$html = str_replace('<hr>', '<hr><a class="btn btn-link btn-default pull-right" href="#bs-top"><i class="text-muted glyphicon glyphicon-arrow-up"></i></a>', $html);
|
128 |
+
$html = str_replace('<h3 id="', '<h3 id="bs-', $html);
|
129 |
+
$html = str_replace('</pre>', '</pre><p><button data-dismiss="modal" class="btn btn-primary btn-sm insert-code">Insert Example <i class="glyphicon glyphicon-share-alt"></i></button></p>', $html);
|
130 |
+
|
131 |
+
//Insert the HTML now that we're done editing it
|
132 |
+
echo $html;
|
133 |
+
|
134 |
+
// ======================================================================== //
|
135 |
|
136 |
+
?>
|
137 |
+
|
138 |
+
</div><!-- /.tab-content -->
|
139 |
+
</div><!-- /div -->
|
140 |
+
</div><!-- /.modal-body -->
|
141 |
+
|
142 |
+
</div><!-- /.modal-content -->
|
143 |
+
</div><!-- /.modal-dialog -->
|
144 |
</div><!-- /.modal -->
|
145 |
+
|
146 |
+
<?php
|
147 |
+
// ======================================================================== //
|
148 |
+
?>
|
includes/defaults.php
CHANGED
@@ -1,13 +1,20 @@
|
|
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 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
// ======================================================================== //
|
4 |
+
// Define some constants for easy reference later
|
5 |
+
// ======================================================================== //
|
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 |
+
}
|
14 |
+
|
15 |
+
// ======================================================================== //
|
16 |
+
|
17 |
// Windows-proof constants: replace backward by forward slashes - thanks to: https://github.com/peterbouwmeester
|
18 |
//$fslashed_dir = trailingslashit(str_replace('\\','/', dirname(__FILE__)));
|
19 |
//$fslashed_abs = trailingslashit(str_replace('\\','/', ABSPATH));
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.php
CHANGED
@@ -1,36 +1,42 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
'
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
//
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$
|
28 |
-
$
|
29 |
-
|
30 |
-
|
31 |
-
$
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
+
// ======================================================================== //
|
4 |
+
// Clean Up DomDocument (deprecated)
|
5 |
+
// ======================================================================== //
|
6 |
+
|
7 |
+
function bs_cleanup_domdocument($content) {
|
8 |
+
$content = preg_replace('#(( ){0,}<br( {0,})(/{0,1})>){1,}$#i', '', $content);
|
9 |
+
return $content;
|
10 |
+
}
|
11 |
+
|
12 |
+
// ======================================================================== //
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
// ======================================================================== //
|
17 |
+
// Create attributes map so we can get the attributes of a wrapped shortcode
|
18 |
+
//
|
19 |
+
// Used by:
|
20 |
+
// bs_tabs()
|
21 |
+
// bs_carousel()
|
22 |
+
//
|
23 |
+
// ======================================================================== //
|
24 |
+
|
25 |
+
function bs_attribute_map($str, $att = null) {
|
26 |
+
$res = array();
|
27 |
+
$return = array();
|
28 |
+
$reg = get_shortcode_regex();
|
29 |
+
preg_match_all('~'.$reg.'~',$str, $matches);
|
30 |
+
foreach($matches[2] as $key => $name) {
|
31 |
+
$parsed = shortcode_parse_atts($matches[3][$key]);
|
32 |
+
$parsed = is_array($parsed) ? $parsed : array();
|
33 |
+
|
34 |
+
$res[$name] = $parsed;
|
35 |
+
$return[] = $res;
|
36 |
+
}
|
37 |
+
return $return;
|
38 |
+
}
|
39 |
+
|
40 |
+
// ======================================================================== //
|
41 |
|
42 |
?>
|
includes/help/README.html
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
-
<h1 id="bootstrap-shortcodes-for-wordpress">Bootstrap Shortcodes for WordPress</h1>
|
|
|
2 |
<p>WordPress plugin that provides shortcodes for easier use of the Bootstrap styles and components in your content.</p>
|
|
|
3 |
<h2 id="requirements">Requirements</h2>
|
|
|
4 |
<p>This plugin won't do anything if you don't have WordPress theme built with the <a href="http://getbootstrap.com/">Bootstrap</a> framework. <strong>This plugin does not include the Bootstrap framework</strong>.</p>
|
5 |
-
<p>The plugin is tested to work with <code>Bootstrap 3</code> and <code>WordPress 4</code>.</p>
|
6 |
-
<p>This plugin contains a <code>composer.json</code> file for those of you who manage your PHP dependencies with <a href="https://getcomposer.org">Composer</a>.</p>
|
7 |
<h2 id="shortcode-reference">Shortcode Reference</h2>
|
8 |
<h3 id="css">CSS</h3>
|
9 |
<ul>
|
@@ -56,7 +58,7 @@
|
|
56 |
...
|
57 |
[/column]
|
58 |
[/row]
|
59 |
-
</code></pre><p>The container component is also supported in case your theme doesn't
|
60 |
<pre><code>[container]
|
61 |
[row]
|
62 |
[column md="6"]
|
@@ -67,6 +69,20 @@
|
|
67 |
[/column]
|
68 |
[/row]
|
69 |
[/container]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
</code></pre><h4 id="-container-parameters">[container] parameters</h4>
|
71 |
<table>
|
72 |
<thead>
|
@@ -102,6 +118,34 @@
|
|
102 |
</tr>
|
103 |
</tbody>
|
104 |
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
<h4 id="-row-parameters">[row] parameters</h4>
|
106 |
<table>
|
107 |
<thead>
|
1 |
+
<h1 id="bootstrap-3-shortcodes-for-wordpress">Bootstrap 3 Shortcodes for WordPress</h1>
|
2 |
+
<p><img src="https://img.shields.io/wordpress/plugin/r/bootstrap-3-shortcodes.svg" alt="WordPress Rating"> <img src="https://img.shields.io/wordpress/plugin/dt/bootstrap-3-shortcodes.svg" alt="WordPress Downloads"></p>
|
3 |
<p>WordPress plugin that provides shortcodes for easier use of the Bootstrap styles and components in your content.</p>
|
4 |
+
<p><strong>Bootstrap 3 Shortcodes for WordPress</strong> 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!</p>
|
5 |
<h2 id="requirements">Requirements</h2>
|
6 |
+
<p><img src="https://img.shields.io/wordpress/v/bootstrap-3-shortcodes.svg" alt="Tested in WordPress"> <img src="https://img.shields.io/badge/PHP-5.3%2B-blue.svg" alt="PHP 5.3+"> <img src="https://img.shields.io/badge/Bootstrap-3.3.x-6f5499.svg" alt="Bootstrap"></p>
|
7 |
<p>This plugin won't do anything if you don't have WordPress theme built with the <a href="http://getbootstrap.com/">Bootstrap</a> framework. <strong>This plugin does not include the Bootstrap framework</strong>.</p>
|
8 |
+
<p>The plugin is tested to work with <code>Bootstrap 3</code> and <code>WordPress 4.5</code> and <strong>requires PHP 5.3 or later</strong>.</p>
|
|
|
9 |
<h2 id="shortcode-reference">Shortcode Reference</h2>
|
10 |
<h3 id="css">CSS</h3>
|
11 |
<ul>
|
58 |
...
|
59 |
[/column]
|
60 |
[/row]
|
61 |
+
</code></pre><p>The container component is also supported in case your theme doesn't include a container.</p>
|
62 |
<pre><code>[container]
|
63 |
[row]
|
64 |
[column md="6"]
|
69 |
[/column]
|
70 |
[/row]
|
71 |
[/container]
|
72 |
+
|
73 |
+
The container-fluid component is supported as a discrete shortcode for cases where you want to wrap a container.
|
74 |
+
[container-fluid]
|
75 |
+
[container]
|
76 |
+
[row]
|
77 |
+
[column md="6"]
|
78 |
+
...
|
79 |
+
[/column]
|
80 |
+
[column md="6"]
|
81 |
+
...
|
82 |
+
[/column]
|
83 |
+
[/row]
|
84 |
+
[/container]
|
85 |
+
[/container-fluid]
|
86 |
</code></pre><h4 id="-container-parameters">[container] parameters</h4>
|
87 |
<table>
|
88 |
<thead>
|
118 |
</tr>
|
119 |
</tbody>
|
120 |
</table>
|
121 |
+
<h4 id="-container-fluid-parameters">[container-fluid] parameters</h4>
|
122 |
+
<table>
|
123 |
+
<thead>
|
124 |
+
<tr>
|
125 |
+
<th>Parameter</th>
|
126 |
+
<th>Description</th>
|
127 |
+
<th>Required</th>
|
128 |
+
<th>Values</th>
|
129 |
+
<th>Default</th>
|
130 |
+
</tr>
|
131 |
+
</thead>
|
132 |
+
<tbody>
|
133 |
+
<tr>
|
134 |
+
<td>xclass</td>
|
135 |
+
<td>Any extra classes you want to add</td>
|
136 |
+
<td>optional</td>
|
137 |
+
<td>any text</td>
|
138 |
+
<td>none</td>
|
139 |
+
</tr>
|
140 |
+
<tr>
|
141 |
+
<td>data</td>
|
142 |
+
<td>Data attribute and value pairs separated by a comma. Pairs separated by pipe (see example at <a href="#button-dropdowns">Button Dropdowns</a>).</td>
|
143 |
+
<td>optional</td>
|
144 |
+
<td>any text</td>
|
145 |
+
<td>none</td>
|
146 |
+
</tr>
|
147 |
+
</tbody>
|
148 |
+
</table>
|
149 |
<h4 id="-row-parameters">[row] parameters</h4>
|
150 |
<table>
|
151 |
<thead>
|
includes/help/css/bootstrap-shortcodes-help.css
CHANGED
@@ -21,8 +21,7 @@
|
|
21 |
}
|
22 |
/* END Fix for WPEngine's stylesheets */
|
23 |
|
24 |
-
#bootstrap-shortcodes-help h1
|
25 |
-
#bootstrap-shortcodes-help h1+p {
|
26 |
display: none;
|
27 |
}
|
28 |
#bootstrap-shortcodes-help .nav-tabs {
|
21 |
}
|
22 |
/* END Fix for WPEngine's stylesheets */
|
23 |
|
24 |
+
#bootstrap-shortcodes-help h1{
|
|
|
25 |
display: none;
|
26 |
}
|
27 |
#bootstrap-shortcodes-help .nav-tabs {
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Bootstrap Shortcodes for WordPress ===
|
2 |
-
Contributors: filipstefansson, nodley
|
3 |
Tags: bootstrap, shortcode, shortcodes, responsive, grid
|
4 |
Requires at least: 3.8
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 3.3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -16,13 +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 |
For questions, support, or to contribute to this plugin, check out [our GitHub project](https://github.com/filipstefansson/bootstrap-3-shortcodes)
|
20 |
|
21 |
####Updated for Bootstrap 3.3.x
|
22 |
Tested and working in the latest version of Bootstrap!
|
23 |
|
24 |
-
If you like this plugin, check out our companion plugin for Font Awesome, [Font Awesome Shortcodes](http://www.wordpress.org/plugins/font-awesome-shortcodes/)
|
25 |
-
|
26 |
###Supported Shortcodes
|
27 |
####CSS
|
28 |
* Grid (container, row, columns, fully responsive)
|
@@ -72,10 +72,17 @@ No, we assume you are already working with a WordPress theme that includes the B
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= 3.3.8 =
|
76 |
* Tested to work with WordPress 4.5
|
77 |
* Set a default "active" slide in carousel if none is specified
|
78 |
-
* Add shortcode for responsive embeds
|
79 |
* Correct some non-latin characters displaying incorrectly
|
80 |
* Add filter to hook into tabs for things like tab history (thanks, Jason Maners!)
|
81 |
|
@@ -94,7 +101,7 @@ No, we assume you are already working with a WordPress theme that includes the B
|
|
94 |
|
95 |
= 3.3.4 =
|
96 |
* Restore Bootstrap 3.2 backwards compatibility for [media-object] shortcode, updated documentation to use Bootstrap 3.3 example, but offer 3.2 options.
|
97 |
-
* Add "collapsed" class to non-active [collapse] elements (thanks, Artem!)
|
98 |
|
99 |
= 3.3 =
|
100 |
* Tested to work with Bootstrap 3.3!
|
1 |
=== Bootstrap Shortcodes for WordPress ===
|
2 |
+
Contributors: FoolsRun, filipstefansson, nodley
|
3 |
Tags: bootstrap, shortcode, shortcodes, responsive, grid
|
4 |
Requires at least: 3.8
|
5 |
+
Tested up to: 4.6
|
6 |
+
Stable tag: 3.3.9
|
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 |
+
**Requires PHP 5.3 or newer**
|
20 |
+
|
21 |
For questions, support, or to contribute to this plugin, check out [our GitHub project](https://github.com/filipstefansson/bootstrap-3-shortcodes)
|
22 |
|
23 |
####Updated for Bootstrap 3.3.x
|
24 |
Tested and working in the latest version of Bootstrap!
|
25 |
|
|
|
|
|
26 |
###Supported Shortcodes
|
27 |
####CSS
|
28 |
* Grid (container, row, columns, fully responsive)
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 3.3.9 =
|
76 |
+
* Tested to work with WordPress 4.6
|
77 |
+
* Fixed bug in [collapse] (thanks who all who reported it)
|
78 |
+
* Note PHP 5.3 or greater requirement in documentation
|
79 |
+
* Update documentation for clarity
|
80 |
+
* Fix issue with xclass in active tabs (thanks who all who reported it!)
|
81 |
+
|
82 |
= 3.3.8 =
|
83 |
* Tested to work with WordPress 4.5
|
84 |
* Set a default "active" slide in carousel if none is specified
|
85 |
+
* Add shortcode for responsive embeds
|
86 |
* Correct some non-latin characters displaying incorrectly
|
87 |
* Add filter to hook into tabs for things like tab history (thanks, Jason Maners!)
|
88 |
|
101 |
|
102 |
= 3.3.4 =
|
103 |
* Restore Bootstrap 3.2 backwards compatibility for [media-object] shortcode, updated documentation to use Bootstrap 3.3 example, but offer 3.2 options.
|
104 |
+
* Add "collapsed" class to non-active [collapse] elements (thanks, Artem!)
|
105 |
|
106 |
= 3.3 =
|
107 |
* Tested to work with Bootstrap 3.3!
|