Version Description
- Allow for xclass property on individual [tab]s
- Prevent Bootstrap help popup button from appearing on unintended pages
- Allow for commas in [popover] content
- Further correction for conflicts with Visual Composer
- Allow special characters in [page-header]
Download this release
Release Info
Developer | FoolsRun |
Plugin | Bootstrap Shortcodes for WordPress |
Version | 3.3.6 |
Comparing to | |
See all releases |
Code changes from version 3.3.5 to 3.3.6
- README.md +1 -0
- bootstrap-shortcodes.php +25 -15
- includes/actions-filters.php +11 -11
- includes/help/README.html +7 -0
- readme.txt +9 -2
README.md
CHANGED
@@ -171,6 +171,7 @@ bordered | Set "bordered" table style (see Bootstrap documentation) | optional |
|
|
171 |
striped | Set "striped" table style (see Bootstrap documentation) | optional | true, false | false
|
172 |
hover | Set "hover" table style (see Bootstrap documentation) | optional | true, false | false
|
173 |
condensed | Set "condensed" table style (see Bootstrap documentation) | optional | true, false | false
|
|
|
174 |
xclass | Any extra classes you want to add | optional | any text | none
|
175 |
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
|
176 |
|
171 |
striped | Set "striped" table style (see Bootstrap documentation) | optional | true, false | false
|
172 |
hover | Set "hover" table style (see Bootstrap documentation) | optional | true, false | false
|
173 |
condensed | Set "condensed" table style (see Bootstrap documentation) | optional | true, false | false
|
174 |
+
responsive | Wrap the table in a div with the class "table-respsonve" (see Bootstrap documentation) | optional | true, false | false
|
175 |
xclass | Any extra classes you want to add | optional | any text | none
|
176 |
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
|
177 |
|
bootstrap-shortcodes.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Bootstrap 3 Shortcodes
|
4 |
Plugin URI: http://wp-snippets.com/freebies/bootstrap-shortcodes or https://github.com/filipstefansson/bootstrap-shortcodes
|
5 |
Description: The plugin adds a shortcodes for all Bootstrap elements.
|
6 |
-
Version: 3.3.
|
7 |
Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
|
8 |
Author URI:
|
9 |
License: GPL2
|
@@ -1180,9 +1180,14 @@ class BoostrapShortcodes {
|
|
1180 |
}
|
1181 |
$i = 0;
|
1182 |
foreach( $atts_map as $tab ) {
|
|
|
|
|
|
|
|
|
|
|
1183 |
$tabs[] = sprintf(
|
1184 |
'<li%s><a href="#%s" data-toggle="tab">%s</a></li>',
|
1185 |
-
( !empty($
|
1186 |
'custom-tab-' . $GLOBALS['tabs_count'] . '-' . md5($tab["tab"]["title"]),
|
1187 |
$tab["tab"]["title"]
|
1188 |
);
|
@@ -1224,9 +1229,11 @@ class BoostrapShortcodes {
|
|
1224 |
$GLOBALS['tabs_default_count']++;
|
1225 |
|
1226 |
$class = 'tab-pane';
|
1227 |
-
$class .= ( $atts['fade'] == 'true' )
|
1228 |
-
$class .= ( $atts['active'] == 'true' )
|
1229 |
$class .= ( $atts['active'] == 'true' && $atts['fade'] == 'true' ) ? ' in' : '';
|
|
|
|
|
1230 |
|
1231 |
$id = 'custom-tab-'. $GLOBALS['tabs_count'] . '-'. md5( $atts['title'] );
|
1232 |
|
@@ -1505,7 +1512,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1505 |
$class = 'bs-popover';
|
1506 |
|
1507 |
$atts['data'] .= $this->check_for_data($atts['data']) . 'toggle,popover';
|
1508 |
-
$atts['data'] .= $this->check_for_data($atts['data']) . 'content,' . $atts['text'];
|
1509 |
$atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
|
1510 |
$atts['data'] .= ( $atts['placement'] ) ? $this->check_for_data($atts['data']) . 'placement,' . $atts['placement'] : '';
|
1511 |
$atts['data'] .= ( $atts['html'] ) ? $this->check_for_data($atts['data']) . 'html,' . $atts['html'] : '';
|
@@ -1514,7 +1521,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1514 |
$tag = 'span';
|
1515 |
$content = do_shortcode($content);
|
1516 |
$return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
|
1517 |
-
return $return;
|
1518 |
|
1519 |
}
|
1520 |
|
@@ -1851,6 +1858,8 @@ function bs_popover( $atts, $content = null ) {
|
|
1851 |
$div_class = 'modal fade';
|
1852 |
$div_class .= ( $atts['size'] ) ? ' bs-modal-' . $atts['size'] : '';
|
1853 |
|
|
|
|
|
1854 |
$id = 'custom-modal-' . md5( $atts['title'] );
|
1855 |
|
1856 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
@@ -1858,14 +1867,14 @@ function bs_popover( $atts, $content = null ) {
|
|
1858 |
return sprintf(
|
1859 |
'<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>
|
1860 |
<div class="%5$s" id="%1$s" tabindex="-1" role="dialog" aria-hidden="true">
|
1861 |
-
<div class="modal-dialog">
|
1862 |
<div class="modal-content">
|
1863 |
<div class="modal-header">
|
1864 |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
1865 |
-
%
|
1866 |
</div>
|
1867 |
<div class="modal-body">
|
1868 |
-
%
|
1869 |
</div>
|
1870 |
</div> <!-- /.modal-content -->
|
1871 |
</div> <!-- /.modal-dialog -->
|
@@ -1876,6 +1885,7 @@ function bs_popover( $atts, $content = null ) {
|
|
1876 |
( $data_props ) ? ' ' . $data_props : '',
|
1877 |
esc_html( $atts['text'] ),
|
1878 |
esc_attr( $div_class ),
|
|
|
1879 |
( $atts['title'] ) ? '<h4 class="modal-title">' . $atts['title'] . '</h4>' : '',
|
1880 |
do_shortcode( $content )
|
1881 |
);
|
@@ -1944,25 +1954,25 @@ function bs_popover( $atts, $content = null ) {
|
|
1944 |
$previous_value = libxml_use_internal_errors(TRUE);
|
1945 |
|
1946 |
$dom = new DOMDocument;
|
1947 |
-
$dom->loadXML($content);
|
1948 |
|
1949 |
libxml_clear_errors();
|
1950 |
libxml_use_internal_errors($previous_value);
|
1951 |
|
1952 |
if(!$dom->documentElement) {
|
1953 |
-
$element = $dom->createElement($tag, $content);
|
1954 |
$dom->appendChild($element);
|
1955 |
}
|
1956 |
|
1957 |
-
$dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( $class ));
|
1958 |
if( $title ) {
|
1959 |
-
$dom->documentElement->setAttribute('title', $title );
|
1960 |
}
|
1961 |
if( $data ) {
|
1962 |
$data = explode( '|', $data );
|
1963 |
foreach( $data as $d ):
|
1964 |
$d = explode(',',$d);
|
1965 |
-
$dom->documentElement->setAttribute('data-'
|
1966 |
endforeach;
|
1967 |
}
|
1968 |
return $dom->saveXML($dom->documentElement);
|
@@ -2020,7 +2030,7 @@ function bs_popover( $atts, $content = null ) {
|
|
2020 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2021 |
|
2022 |
$dom = new DOMDocument;
|
2023 |
-
$dom->loadXML($content);
|
2024 |
|
2025 |
libxml_clear_errors();
|
2026 |
libxml_use_internal_errors($previous_value);
|
3 |
Plugin Name: Bootstrap 3 Shortcodes
|
4 |
Plugin URI: http://wp-snippets.com/freebies/bootstrap-shortcodes or https://github.com/filipstefansson/bootstrap-shortcodes
|
5 |
Description: The plugin adds a shortcodes for all Bootstrap elements.
|
6 |
+
Version: 3.3.6
|
7 |
Author: Filip Stefansson, Simon Yeldon, and Michael W. Delaney
|
8 |
Author URI:
|
9 |
License: GPL2
|
1180 |
}
|
1181 |
$i = 0;
|
1182 |
foreach( $atts_map as $tab ) {
|
1183 |
+
|
1184 |
+
$class ='';
|
1185 |
+
$class .= ( !empty($tab["tab"]["active"]) || ($GLOBALS['tabs_default_active'] && $i == 0) ) ? 'active' : '';
|
1186 |
+
$class .= ( !empty($tab["tab"]["xclass"]) ) ? ' ' . $tab["tab"]["xclass"] : '';
|
1187 |
+
|
1188 |
$tabs[] = sprintf(
|
1189 |
'<li%s><a href="#%s" data-toggle="tab">%s</a></li>',
|
1190 |
+
( !empty($class) ) ? ' class="' . $class . '"' : '',
|
1191 |
'custom-tab-' . $GLOBALS['tabs_count'] . '-' . md5($tab["tab"]["title"]),
|
1192 |
$tab["tab"]["title"]
|
1193 |
);
|
1229 |
$GLOBALS['tabs_default_count']++;
|
1230 |
|
1231 |
$class = 'tab-pane';
|
1232 |
+
$class .= ( $atts['fade'] == 'true' ) ? ' fade' : '';
|
1233 |
+
$class .= ( $atts['active'] == 'true' ) ? ' active' : '';
|
1234 |
$class .= ( $atts['active'] == 'true' && $atts['fade'] == 'true' ) ? ' in' : '';
|
1235 |
+
$class .= ( $atts['xclass'] ) ? ' ' . $atts['xclass'] : '';
|
1236 |
+
|
1237 |
|
1238 |
$id = 'custom-tab-'. $GLOBALS['tabs_count'] . '-'. md5( $atts['title'] );
|
1239 |
|
1512 |
$class = 'bs-popover';
|
1513 |
|
1514 |
$atts['data'] .= $this->check_for_data($atts['data']) . 'toggle,popover';
|
1515 |
+
$atts['data'] .= $this->check_for_data($atts['data']) . 'content,' . str_replace(',', ',', $atts['text']);
|
1516 |
$atts['data'] .= ( $atts['animation'] ) ? $this->check_for_data($atts['data']) . 'animation,' . $atts['animation'] : '';
|
1517 |
$atts['data'] .= ( $atts['placement'] ) ? $this->check_for_data($atts['data']) . 'placement,' . $atts['placement'] : '';
|
1518 |
$atts['data'] .= ( $atts['html'] ) ? $this->check_for_data($atts['data']) . 'html,' . $atts['html'] : '';
|
1521 |
$tag = 'span';
|
1522 |
$content = do_shortcode($content);
|
1523 |
$return .= $this->get_dom_element($tag, $content, $class, $atts['title'], $atts['data']);
|
1524 |
+
return html_entity_decode($return);
|
1525 |
|
1526 |
}
|
1527 |
|
1858 |
$div_class = 'modal fade';
|
1859 |
$div_class .= ( $atts['size'] ) ? ' bs-modal-' . $atts['size'] : '';
|
1860 |
|
1861 |
+
$div_size = ( $atts['size'] ) ? ' modal-' . $atts['size'] : '';
|
1862 |
+
|
1863 |
$id = 'custom-modal-' . md5( $atts['title'] );
|
1864 |
|
1865 |
$data_props = $this->parse_data_attributes( $atts['data'] );
|
1867 |
return sprintf(
|
1868 |
'<a data-toggle="modal" href="#%1$s" class="%2$s"%3$s>%4$s</a>
|
1869 |
<div class="%5$s" id="%1$s" tabindex="-1" role="dialog" aria-hidden="true">
|
1870 |
+
<div class="modal-dialog %6$s">
|
1871 |
<div class="modal-content">
|
1872 |
<div class="modal-header">
|
1873 |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
1874 |
+
%7$s
|
1875 |
</div>
|
1876 |
<div class="modal-body">
|
1877 |
+
%8$s
|
1878 |
</div>
|
1879 |
</div> <!-- /.modal-content -->
|
1880 |
</div> <!-- /.modal-dialog -->
|
1885 |
( $data_props ) ? ' ' . $data_props : '',
|
1886 |
esc_html( $atts['text'] ),
|
1887 |
esc_attr( $div_class ),
|
1888 |
+
esc_attr( $div_size ),
|
1889 |
( $atts['title'] ) ? '<h4 class="modal-title">' . $atts['title'] . '</h4>' : '',
|
1890 |
do_shortcode( $content )
|
1891 |
);
|
1954 |
$previous_value = libxml_use_internal_errors(TRUE);
|
1955 |
|
1956 |
$dom = new DOMDocument;
|
1957 |
+
$dom->loadXML(utf8_encode($content));
|
1958 |
|
1959 |
libxml_clear_errors();
|
1960 |
libxml_use_internal_errors($previous_value);
|
1961 |
|
1962 |
if(!$dom->documentElement) {
|
1963 |
+
$element = $dom->createElement($tag, utf8_encode($content));
|
1964 |
$dom->appendChild($element);
|
1965 |
}
|
1966 |
|
1967 |
+
$dom->documentElement->setAttribute('class', $dom->documentElement->getAttribute('class') . ' ' . esc_attr( utf8_encode($class) ));
|
1968 |
if( $title ) {
|
1969 |
+
$dom->documentElement->setAttribute('title', utf8_encode($title) );
|
1970 |
}
|
1971 |
if( $data ) {
|
1972 |
$data = explode( '|', $data );
|
1973 |
foreach( $data as $d ):
|
1974 |
$d = explode(',',$d);
|
1975 |
+
$dom->documentElement->setAttribute('data-'.utf8_encode($d[0]),trim(utf8_encode($d[1])));
|
1976 |
endforeach;
|
1977 |
}
|
1978 |
return $dom->saveXML($dom->documentElement);
|
2030 |
$previous_value = libxml_use_internal_errors(TRUE);
|
2031 |
|
2032 |
$dom = new DOMDocument;
|
2033 |
+
$dom->loadXML(utf8_encode($content));
|
2034 |
|
2035 |
libxml_clear_errors();
|
2036 |
libxml_use_internal_errors($previous_value);
|
includes/actions-filters.php
CHANGED
@@ -10,10 +10,7 @@ function bootstrap_shortcodes_styles_all() {
|
|
10 |
|
11 |
add_action( 'admin_enqueue_scripts', 'bootstrap_shortcodes_styles_all' );
|
12 |
|
13 |
-
|
14 |
function bootstrap_shortcodes_help_styles() {
|
15 |
-
$screen = get_current_screen();
|
16 |
-
if($screen != null && $screen->parent_base != "gf_edit_forms") {
|
17 |
wp_register_style( 'bs-font', plugins_url( 'bootstrap-3-shortcodes/includes/help/bs-font.css' ) );
|
18 |
wp_register_style( 'bootstrap-shortcodes-help', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-shortcodes-help.css' ) );
|
19 |
wp_register_style( 'bootstrap-modal', plugins_url( 'bootstrap-3-shortcodes/includes/help/css/bootstrap-modal.css' ) );
|
@@ -22,17 +19,19 @@ function bootstrap_shortcodes_help_styles() {
|
|
22 |
wp_enqueue_style( 'bootstrap-modal' );
|
23 |
wp_enqueue_style( 'bs-font' );
|
24 |
wp_enqueue_script( 'bootstrap' );
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
-
add_action( 'media_buttons', 'bootstrap_shortcodes_help_styles' );
|
29 |
|
30 |
add_filter('the_content', 'bs_fix_shortcodes');
|
31 |
|
32 |
//action to add a custom button to the content editor
|
33 |
function add_bootstrap_button() {
|
34 |
-
$screen = get_current_screen();
|
35 |
-
if($screen != null && $screen->parent_base != "gf_edit_forms") {
|
36 |
//the id of the container I want to show in the popup
|
37 |
$popup_id = 'bootstrap-shortcodes-help';
|
38 |
|
@@ -48,15 +47,16 @@ function add_bootstrap_button() {
|
|
48 |
esc_attr( 'button add_media bootstrap-shortcodes-button')
|
49 |
//sprintf( '<img src="%s" style="height: 20px; position: relative; top: -2px;">', esc_url( $img ) )
|
50 |
);
|
51 |
-
}
|
52 |
}
|
53 |
|
54 |
|
55 |
// Create a Media Button for the help file
|
56 |
//add a button to the content editor, next to the media button
|
57 |
//this button will show a popup that contains inline content
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
function boostrap_shortcodes_help() {
|
61 |
include('bootstrap-shortcodes-help.php');
|
62 |
}
|
10 |
|
11 |
add_action( 'admin_enqueue_scripts', 'bootstrap_shortcodes_styles_all' );
|
12 |
|
|
|
13 |
function bootstrap_shortcodes_help_styles() {
|
|
|
|
|
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 |
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 |
+
if (wp_script_is( $handle, $list )) {
|
27 |
+
wp_dequeue_script( $handle );
|
28 |
+
}
|
29 |
}
|
|
|
30 |
|
31 |
add_filter('the_content', 'bs_fix_shortcodes');
|
32 |
|
33 |
//action to add a custom button to the content editor
|
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 |
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 |
// Create a Media Button for the help file
|
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'))) {
|
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('bootstrap-shortcodes-help.php');
|
62 |
}
|
includes/help/README.html
CHANGED
@@ -435,6 +435,13 @@
|
|
435 |
<td>false</td>
|
436 |
</tr>
|
437 |
<tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
<td>xclass</td>
|
439 |
<td>Any extra classes you want to add</td>
|
440 |
<td>optional</td>
|
435 |
<td>false</td>
|
436 |
</tr>
|
437 |
<tr>
|
438 |
+
<td>responsive</td>
|
439 |
+
<td>Wrap the table in a div with the class "table-responsive" (see Bootstrap documentation)</td>
|
440 |
+
<td>optional</td>
|
441 |
+
<td>true, false</td>
|
442 |
+
<td>false</td>
|
443 |
+
</tr>
|
444 |
+
<tr>
|
445 |
<td>xclass</td>
|
446 |
<td>Any extra classes you want to add</td>
|
447 |
<td>optional</td>
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: filipstefansson, nodley, FoolsRun
|
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 |
|
@@ -71,6 +71,13 @@ No, we assume you are already working with a WordPress theme that includes the B
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 3.3.5 =
|
75 |
* Tested to work in WordPress 4.1!
|
76 |
* Allow non-English characters in [table-wrap], [media-object], [img], [thumbnail], [modal], [tab], and [collapse]
|
2 |
Contributors: filipstefansson, nodley, FoolsRun
|
3 |
Tags: bootstrap, shortcode, shortcodes, responsive, grid
|
4 |
Requires at least: 3.8
|
5 |
+
Tested up to: 4.2.2
|
6 |
+
Stable tag: 3.3.6
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 3.3.6 =
|
75 |
+
* Allow for xclass property on individual [tab]s
|
76 |
+
* Prevent Bootstrap help popup button from appearing on unintended pages
|
77 |
+
* Allow for commas in [popover] content
|
78 |
+
* Further correction for conflicts with Visual Composer
|
79 |
+
* Allow special characters in [page-header]
|
80 |
+
|
81 |
= 3.3.5 =
|
82 |
* Tested to work in WordPress 4.1!
|
83 |
* Allow non-English characters in [table-wrap], [media-object], [img], [thumbnail], [modal], [tab], and [collapse]
|