Bootstrap for Contact Form 7 - Version 1.4.0

Version Description

  • Enhanced: all form settings except submit_size, submit_type and required_html can now be overridden on a per-field basis by providing the setting name and its intended value as a shortcode attribute
  • Enhanced: a new value 'none' is now supported for the layout form setting which will prevent any wrapper from rendering; it is recommended to only use this for advanced field layouts
  • Enhanced: a new attribute label_class can now be added to shortcodes for additional label classes
  • Enhanced: input_before and input_after now support HTML by putting something like `{input_before}Content before{/input_before} into the content of a field shortcode (make sure to use curly braces); this method is now recommended and takes precedence over the old way
  • Fixed: the label of the free_text option in radio buttons / checkboxes is now displayed correctly
Download this release

Release Info

Developer flixos90
Plugin Icon 128x128 Bootstrap for Contact Form 7
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.1 to 1.4.0

README.md CHANGED
@@ -11,3 +11,5 @@ Contributions and Bugs
11
  ----------------------
12
 
13
  If you have ideas on how to improve the plugin or if you discover a bug, I would appreciate if you shared them with me, right here on Github. In either case, please open a new issue [here](https://github.com/felixarntz/bootstrap-for-contact-form-7/issues/new)!
 
 
11
  ----------------------
12
 
13
  If you have ideas on how to improve the plugin or if you discover a bug, I would appreciate if you shared them with me, right here on Github. In either case, please open a new issue [here](https://github.com/felixarntz/bootstrap-for-contact-form-7/issues/new)!
14
+
15
+ You can also contribute to the plugin by translating it. Simply visit [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/bootstrap-for-contact-form-7) to get started.
assets/dist/js/scripts.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Bootstrap for Contact Form 7 (https://wordpress.org/plugins/bootstrap-for-contact-form-7/)
3
+ * By Felix Arntz (https://leaves-and-love.net)
4
+ * Licensed under GNU General Public License v3 (http://www.gnu.org/licenses/gpl-3.0.html)
5
+ */
6
+ +function ( $ ) {
7
+ 'use strict';
8
+
9
+ // add Bootstrap Alert classes to response output
10
+ $( function() {
11
+ $( 'div.wpcf7' ).on( 'invalid.wpcf7', function() {
12
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-warning' );
13
+ });
14
+ $( 'div.wpcf7' ).on( 'spam.wpcf7', function() {
15
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-warning' );
16
+ });
17
+ $( 'div.wpcf7' ).on( 'mailsent.wpcf7', function() {
18
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-success' );
19
+ });
20
+ $( 'div.wpcf7' ).on( 'mailfailed.wpcf7', function() {
21
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-danger' );
22
+ });
23
+
24
+ $( 'div.wpcf7' ).on( 'click', 'div.wpcf7-response-output .close', function( e ) {
25
+ $( this ).parent().hide();
26
+ e.preventDefault();
27
+ });
28
+ });
29
+
30
+ // WPCF7 Function Override: Adjusted for Bootstrap Help Block Output and Status Class
31
+ $.fn.wpcf7NotValidTip = function( message ) {
32
+ return this.each( function() {
33
+ var $into = $( this );
34
+ $into.addClass( 'has-error' );
35
+
36
+ if ( ! $into.parents( '.wpcf7-form' ).hasClass( 'form-inline' ) ) {
37
+ $into.find( 'span.wpcf7-not-valid-tip' ).remove();
38
+ if ( $into.parents( '.wpcf7-form' ).hasClass( 'form-horizontal' ) ) {
39
+ $into.children( 'div' ).append( '<span class="help-block wpcf7-not-valid-tip">' + message + '</span>' );
40
+ } else {
41
+ $into.append( '<span class="help-block wpcf7-not-valid-tip">' + message + '</span>' );
42
+ }
43
+ $into.slideDown( 'fast' );
44
+
45
+ if ( $into.is( '.use-floating-validation-tip *' ) ) {
46
+ $( '.wpcf7-not-valid-tip', $into ).mouseover( function() {
47
+ $( this ).wpcf7FadeOut();
48
+ });
49
+
50
+ $( ':input', $into ).focus( function() {
51
+ $( '.wpcf7-not-valid-tip', $into ).not( ':hidden' ).wpcf7FadeOut();
52
+ });
53
+ }
54
+ }
55
+ });
56
+ };
57
+
58
+ // WPCF7 Function Override: Different DOM Element is required
59
+ $.fn.wpcf7RefillQuiz = function( quiz ) {
60
+ return this.each( function() {
61
+ var form = $( this );
62
+
63
+ $.each( quiz, function( i, n ) {
64
+ form.find( ':input[name="' + i + '"]' ).clearFields();
65
+ form.find( ':input[name="' + i + '"]' ).siblings( 'p.wpcf7-quiz-label' ).text( n[0] );
66
+ form.find( 'input:hidden[name="_wpcf7_quiz_answer_' + i + '"]' ).attr( 'value', n[1] );
67
+ });
68
+ });
69
+ };
70
+
71
+ // WPCF7 Function Override: Adjusted for Bootstrap Alert classes and Status Class
72
+ $.fn.wpcf7ClearResponseOutput = function() {
73
+ return this.each(function() {
74
+ var $close = $( this ).find( 'div.wpcf7-response-output .close' );
75
+ $( this ).find( 'div.wpcf7-response-output' ).hide().empty().removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked alert-warning alert-success alert-danger' ).removeAttr( 'role' );
76
+ if ( 0 < $close.length ) {
77
+ $( this ).find( 'div.wpcf7-response-output' ).append( $close );
78
+ }
79
+ $( this ).find( 'div.form-group' ).removeClass( 'has-error' );
80
+ $( this ).find( 'span.wpcf7-not-valid-tip' ).remove();
81
+ $( this ).find( 'img.ajax-loader' ).css({ visibility: 'hidden' });
82
+ });
83
+ };
84
+
85
+ }(jQuery);
assets/dist/js/scripts.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ /*!
2
+ * Bootstrap for Contact Form 7 (https://wordpress.org/plugins/bootstrap-for-contact-form-7/)
3
+ * By Felix Arntz (https://leaves-and-love.net)
4
+ * Licensed under GNU General Public License v3 (http://www.gnu.org/licenses/gpl-3.0.html)
5
+ */
6
+ +function(i){"use strict";i(function(){i("div.wpcf7").on("invalid.wpcf7",function(){i(this).find("div.wpcf7-response-output").addClass("alert-warning")}),i("div.wpcf7").on("spam.wpcf7",function(){i(this).find("div.wpcf7-response-output").addClass("alert-warning")}),i("div.wpcf7").on("mailsent.wpcf7",function(){i(this).find("div.wpcf7-response-output").addClass("alert-success")}),i("div.wpcf7").on("mailfailed.wpcf7",function(){i(this).find("div.wpcf7-response-output").addClass("alert-danger")}),i("div.wpcf7").on("click","div.wpcf7-response-output .close",function(n){i(this).parent().hide(),n.preventDefault()})}),i.fn.wpcf7NotValidTip=function(n){return this.each(function(){var t=i(this);t.addClass("has-error"),t.parents(".wpcf7-form").hasClass("form-inline")||(t.find("span.wpcf7-not-valid-tip").remove(),t.parents(".wpcf7-form").hasClass("form-horizontal")?t.children("div").append('<span class="help-block wpcf7-not-valid-tip">'+n+"</span>"):t.append('<span class="help-block wpcf7-not-valid-tip">'+n+"</span>"),t.slideDown("fast"),t.is(".use-floating-validation-tip *")&&(i(".wpcf7-not-valid-tip",t).mouseover(function(){i(this).wpcf7FadeOut()}),i(":input",t).focus(function(){i(".wpcf7-not-valid-tip",t).not(":hidden").wpcf7FadeOut()})))})},i.fn.wpcf7RefillQuiz=function(n){return this.each(function(){var t=i(this);i.each(n,function(i,n){t.find(':input[name="'+i+'"]').clearFields(),t.find(':input[name="'+i+'"]').siblings("p.wpcf7-quiz-label").text(n[0]),t.find('input:hidden[name="_wpcf7_quiz_answer_'+i+'"]').attr("value",n[1])})})},i.fn.wpcf7ClearResponseOutput=function(){return this.each(function(){var n=i(this).find("div.wpcf7-response-output .close");i(this).find("div.wpcf7-response-output").hide().empty().removeClass("wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked alert-warning alert-success alert-danger").removeAttr("role"),0<n.length&&i(this).find("div.wpcf7-response-output").append(n),i(this).find("div.form-group").removeClass("has-error"),i(this).find("span.wpcf7-not-valid-tip").remove(),i(this).find("img.ajax-loader").css({visibility:"hidden"})})}}(jQuery);
assets/scripts.js CHANGED
File without changes
assets/src/js/.jshintrc ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "asi" : true,
3
+ "browser" : true,
4
+ "eqeqeq" : false,
5
+ "eqnull" : true,
6
+ "es3" : true,
7
+ "expr" : true,
8
+ "jquery" : true,
9
+ "latedef" : true,
10
+ "laxbreak" : true,
11
+ "nonbsp" : true,
12
+ "predef" : [
13
+ "console",
14
+ "jQuery",
15
+ "wp",
16
+ "ajaxurl"
17
+ ],
18
+ "strict" : true,
19
+ "undef" : true,
20
+ "unused" : true
21
+ }
assets/src/js/scripts.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ +function ( $ ) {
2
+ 'use strict';
3
+
4
+ // add Bootstrap Alert classes to response output
5
+ $( function() {
6
+ $( 'div.wpcf7' ).on( 'invalid.wpcf7', function() {
7
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-warning' );
8
+ });
9
+ $( 'div.wpcf7' ).on( 'spam.wpcf7', function() {
10
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-warning' );
11
+ });
12
+ $( 'div.wpcf7' ).on( 'mailsent.wpcf7', function() {
13
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-success' );
14
+ });
15
+ $( 'div.wpcf7' ).on( 'mailfailed.wpcf7', function() {
16
+ $( this ).find( 'div.wpcf7-response-output' ).addClass( 'alert-danger' );
17
+ });
18
+
19
+ $( 'div.wpcf7' ).on( 'click', 'div.wpcf7-response-output .close', function( e ) {
20
+ $( this ).parent().hide();
21
+ e.preventDefault();
22
+ });
23
+ });
24
+
25
+ // WPCF7 Function Override: Adjusted for Bootstrap Help Block Output and Status Class
26
+ $.fn.wpcf7NotValidTip = function( message ) {
27
+ return this.each( function() {
28
+ var $into = $( this );
29
+ $into.addClass( 'has-error' );
30
+
31
+ if ( ! $into.parents( '.wpcf7-form' ).hasClass( 'form-inline' ) ) {
32
+ $into.find( 'span.wpcf7-not-valid-tip' ).remove();
33
+ if ( $into.parents( '.wpcf7-form' ).hasClass( 'form-horizontal' ) ) {
34
+ $into.children( 'div' ).append( '<span class="help-block wpcf7-not-valid-tip">' + message + '</span>' );
35
+ } else {
36
+ $into.append( '<span class="help-block wpcf7-not-valid-tip">' + message + '</span>' );
37
+ }
38
+ $into.slideDown( 'fast' );
39
+
40
+ if ( $into.is( '.use-floating-validation-tip *' ) ) {
41
+ $( '.wpcf7-not-valid-tip', $into ).mouseover( function() {
42
+ $( this ).wpcf7FadeOut();
43
+ });
44
+
45
+ $( ':input', $into ).focus( function() {
46
+ $( '.wpcf7-not-valid-tip', $into ).not( ':hidden' ).wpcf7FadeOut();
47
+ });
48
+ }
49
+ }
50
+ });
51
+ };
52
+
53
+ // WPCF7 Function Override: Different DOM Element is required
54
+ $.fn.wpcf7RefillQuiz = function( quiz ) {
55
+ return this.each( function() {
56
+ var form = $( this );
57
+
58
+ $.each( quiz, function( i, n ) {
59
+ form.find( ':input[name="' + i + '"]' ).clearFields();
60
+ form.find( ':input[name="' + i + '"]' ).siblings( 'p.wpcf7-quiz-label' ).text( n[0] );
61
+ form.find( 'input:hidden[name="_wpcf7_quiz_answer_' + i + '"]' ).attr( 'value', n[1] );
62
+ });
63
+ });
64
+ };
65
+
66
+ // WPCF7 Function Override: Adjusted for Bootstrap Alert classes and Status Class
67
+ $.fn.wpcf7ClearResponseOutput = function() {
68
+ return this.each(function() {
69
+ var $close = $( this ).find( 'div.wpcf7-response-output .close' );
70
+ $( this ).find( 'div.wpcf7-response-output' ).hide().empty().removeClass( 'wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked alert-warning alert-success alert-danger' ).removeAttr( 'role' );
71
+ if ( 0 < $close.length ) {
72
+ $( this ).find( 'div.wpcf7-response-output' ).append( $close );
73
+ }
74
+ $( this ).find( 'div.form-group' ).removeClass( 'has-error' );
75
+ $( this ).find( 'span.wpcf7-not-valid-tip' ).remove();
76
+ $( this ).find( 'img.ajax-loader' ).css({ visibility: 'hidden' });
77
+ });
78
+ };
79
+
80
+ }(jQuery);
bootstrap-for-contact-form-7.php CHANGED
@@ -1,20 +1,22 @@
1
  <?php
2
  /*
3
  Plugin Name: Bootstrap for Contact Form 7
4
- Plugin URI: http://wordpress.org/plugins/bootstrap-for-contact-form-7/
5
  Description: This plugin modifies the output of the popular Contact Form 7 plugin to be styled in compliance with themes using the Bootstrap CSS framework.
6
- Version: 1.3.1
7
- Author: Felix Arntz
8
- Author URI: http://leaves-and-love.net
9
- License: GNU General Public License v3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: bootstrap-for-contact-form-7
12
- Tags: wordpress, plugin, contact form 7, wpcf7, bootstrap, bootstrap 3, bootstrap framework, addon, contact form 7 addon, contact form, cf7bs, css
13
  */
14
  /**
 
 
15
  * @package CF7BS
16
- * @version 1.3.1
17
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
18
  */
19
 
20
  if ( ! defined( 'WPCF7_AUTOP' ) ) {
@@ -22,7 +24,7 @@ if ( ! defined( 'WPCF7_AUTOP' ) ) {
22
  }
23
 
24
  function cf7bs_maybe_init() {
25
- define( 'CF7BS_VERSION', '1.3.1' );
26
  define( 'CF7BS_MAINFILE', __FILE__ );
27
  define( 'CF7BS_PATH', untrailingslashit( plugin_dir_path( CF7BS_MAINFILE ) ) );
28
  define( 'CF7BS_URL', untrailingslashit( plugin_dir_url( CF7BS_MAINFILE ) ) );
@@ -68,9 +70,22 @@ add_action( 'plugins_loaded', 'cf7bs_maybe_init', 50 );
68
  $current_form_id = 0;
69
  $current_form_properties = array();
70
 
71
- function cf7bs_get_form_property( $property, $form_id = 0 ) {
72
  global $current_form_id, $current_form_properties;
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  $current_form = $original_form = null;
75
 
76
  if ( ! $form_id ) {
@@ -118,20 +133,26 @@ function cf7bs_get_form_property( $property, $form_id = 0 ) {
118
  return false;
119
  }
120
 
121
- function cf7bs_get_default_form_properties() {
122
  $properties = array(
123
- 'layout' => 'default', // 'default', 'inline', 'horizontal'
124
  'size' => 'default', // 'default', 'small', 'large'
125
  'group_layout' => 'default', // 'default', 'inline', 'buttons'
126
  'group_type' => 'default', // 'default', 'primary', 'success', 'info', 'warning', 'danger' (only if group_layout=buttons)
127
- 'submit_size' => '', // 'default', 'small', 'large' or leave empty to use value of 'size'
128
- 'submit_type' => 'primary', // 'default', 'primary', 'success', 'info', 'warning', 'danger'
129
- 'required_html' => '<span class="required">*</span>',
130
  'grid_columns' => 12,
131
  'label_width' => 3, // integer between 1 and 'grid_columns' minus 1
132
  'breakpoint' => 'sm', // xs, sm, md, lg
133
  );
134
- return apply_filters( 'cf7bs_default_form_properties', $properties );
 
 
 
 
 
 
 
 
 
135
  }
136
 
137
  function cf7bs_apply_field_args_filter( $field_args, $tag_type, $tag_name = '', $form_id = 0 ) {
1
  <?php
2
  /*
3
  Plugin Name: Bootstrap for Contact Form 7
4
+ Plugin URI: https://wordpress.org/plugins/bootstrap-for-contact-form-7/
5
  Description: This plugin modifies the output of the popular Contact Form 7 plugin to be styled in compliance with themes using the Bootstrap CSS framework.
6
+ Version: 1.4.0
7
+ Author: Felix Arntz
8
+ Author URI: https://leaves-and-love.net
9
+ License: GNU General Public License v3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Text Domain: bootstrap-for-contact-form-7
12
+ Tags: contact form 7, wpcf7, bootstrap, bootstrap 3, bootstrap framework, addon, contact form 7 addon, contact form, cf7bs
13
  */
14
  /**
15
+ * Plugin initialization file
16
+ *
17
  * @package CF7BS
 
18
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
19
+ * @since 1.0.0
20
  */
21
 
22
  if ( ! defined( 'WPCF7_AUTOP' ) ) {
24
  }
25
 
26
  function cf7bs_maybe_init() {
27
+ define( 'CF7BS_VERSION', '1.4.0' );
28
  define( 'CF7BS_MAINFILE', __FILE__ );
29
  define( 'CF7BS_PATH', untrailingslashit( plugin_dir_path( CF7BS_MAINFILE ) ) );
30
  define( 'CF7BS_URL', untrailingslashit( plugin_dir_url( CF7BS_MAINFILE ) ) );
70
  $current_form_id = 0;
71
  $current_form_properties = array();
72
 
73
+ function cf7bs_get_form_property( $property, $form_id = 0, $field_tag = null ) {
74
  global $current_form_id, $current_form_properties;
75
 
76
+ // Allow overriding some form properties by individual fields.
77
+ if ( $field_tag ) {
78
+ if ( in_array( $property, array_keys( cf7bs_get_default_form_properties( true ) ) ) ) {
79
+ $ret = $field_tag->get_option( $property, '[-0-9a-zA-Z_]+', true );
80
+ if ( $ret ) {
81
+ // special case: skip the `$size` property if it is numeric (default CF7 way)
82
+ if ( 'size' != $property || ! is_numeric( $ret ) ) {
83
+ return $ret;
84
+ }
85
+ }
86
+ }
87
+ }
88
+
89
  $current_form = $original_form = null;
90
 
91
  if ( ! $form_id ) {
133
  return false;
134
  }
135
 
136
+ function cf7bs_get_default_form_properties( $only_overrideables = false ) {
137
  $properties = array(
138
+ 'layout' => 'default', // 'default', 'inline', 'horizontal', 'none'
139
  'size' => 'default', // 'default', 'small', 'large'
140
  'group_layout' => 'default', // 'default', 'inline', 'buttons'
141
  'group_type' => 'default', // 'default', 'primary', 'success', 'info', 'warning', 'danger' (only if group_layout=buttons)
 
 
 
142
  'grid_columns' => 12,
143
  'label_width' => 3, // integer between 1 and 'grid_columns' minus 1
144
  'breakpoint' => 'sm', // xs, sm, md, lg
145
  );
146
+
147
+ if ( ! $only_overrideables ) {
148
+ $properties = array_merge( $properties, array(
149
+ 'submit_size' => '', // 'default', 'small', 'large' or leave empty to use value of 'size'
150
+ 'submit_type' => 'primary', // 'default', 'primary', 'success', 'info', 'warning', 'danger'
151
+ 'required_html' => '<span class="required">*</span>',
152
+ ) );
153
+ }
154
+
155
+ return apply_filters( 'cf7bs_default_form_properties', $properties, $only_overrideables );
156
  }
157
 
158
  function cf7bs_apply_field_args_filter( $field_args, $tag_type, $tag_name = '', $form_id = 0 ) {
changelog.txt CHANGED
@@ -1,5 +1,12 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
3
  = 1.3.1 =
4
  * Enhanced: alerts can now be made dismissible by defining the constant `CF7BS_ALERT_DISMISSIBLE`
5
  * Fixed: properly add `for` attributes to labels for checkbox and radio groups for accessibility
1
  == Changelog ==
2
 
3
+ = 1.4.0 =
4
+ * Enhanced: all form settings except `submit_size`, `submit_type` and `required_html` can now be overridden on a per-field basis by providing the setting name and its intended value as a shortcode attribute
5
+ * Enhanced: a new value 'none' is now supported for the `layout` form setting which will prevent any wrapper from rendering; it is recommended to only use this for advanced field layouts
6
+ * Enhanced: a new attribute `label_class` can now be added to shortcodes for additional label classes
7
+ * Enhanced: `input_before` and `input_after` now support HTML by putting something like `{input_before}<span>Content before</span>{/input_before} into the content of a field shortcode (make sure to use curly braces); this method is now recommended and takes precedence over the old way
8
+ * Fixed: the label of the `free_text` option in radio buttons / checkboxes is now displayed correctly
9
+
10
  = 1.3.1 =
11
  * Enhanced: alerts can now be made dismissible by defining the constant `CF7BS_ALERT_DISMISSIBLE`
12
  * Fixed: properly add `for` attributes to labels for checkbox and radio groups for accessibility
classes/CF7BS_Alert.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  class CF7BS_Alert extends CF7BS_Component {
1
  <?php
2
  /**
3
+ * CF7BS_Alert class
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  class CF7BS_Alert extends CF7BS_Component {
classes/CF7BS_Button.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  class CF7BS_Button extends CF7BS_Component {
@@ -16,6 +18,10 @@ class CF7BS_Button extends CF7BS_Component {
16
 
17
  $type = $this->validate_type( $type );
18
 
 
 
 
 
19
  if ( ! empty( $class ) ) {
20
  $class .= ' ';
21
  }
@@ -52,30 +58,36 @@ class CF7BS_Button extends CF7BS_Component {
52
  }
53
  $output .= '<label' . $for . ' class="' . esc_attr( $class ) . '"><input' . $id . $name . ' type="radio" value="' . esc_attr( $value ) . '"' . $append . '>' . $title . '</label>';
54
  } else {
55
- $wrapper_class = array();
 
56
 
57
- if ( $align && 'inline' != $form_layout ) {
58
- $wrapper_class[] = 'text-' . $align;
59
- }
60
 
61
- if ( 'horizontal' == $form_layout ) {
62
- $wrapper_class[] = $this->get_column_class( $form_label_width, $form_breakpoint, $grid_columns );
63
- }
64
 
65
- $wrapper_class = implode( ' ', $wrapper_class );
66
 
67
- if ( ! empty( $wrapper_class ) ) {
68
- $wrapper_class = ' class="' . $wrapper_class . '"';
69
- }
70
 
71
- if ( is_int( $tabindex ) ) {
72
- $tabindex = ' tabindex="' . $tabindex . '"';
73
- } else {
74
- $tabindex = '';
 
 
75
  }
76
- $output .= '<div class="form-group"><div' . $wrapper_class . '>';
77
  $output .= '<input class="' . esc_attr( $class ) . '"' . $id . $name . ' type="submit" value="' . esc_attr( $title ) . '"' . $tabindex . '>';
78
- $output .= '</div></div>';
 
 
 
79
  }
80
  }
81
 
@@ -117,7 +129,7 @@ class CF7BS_Button extends CF7BS_Component {
117
  'tabindex' => false,
118
  'align' => false,
119
  'grid_columns' => 12,
120
- 'form_layout' => 'default', // default, inline, horizontal
121
  'form_label_width' => 2,
122
  'form_breakpoint' => 'sm',
123
  );
1
  <?php
2
  /**
3
+ * CF7BS_Button class
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  class CF7BS_Button extends CF7BS_Component {
18
 
19
  $type = $this->validate_type( $type );
20
 
21
+ if ( is_numeric($tabindex) ) {
22
+ $tabindex = intval($tabindex);
23
+ }
24
+
25
  if ( ! empty( $class ) ) {
26
  $class .= ' ';
27
  }
58
  }
59
  $output .= '<label' . $for . ' class="' . esc_attr( $class ) . '"><input' . $id . $name . ' type="radio" value="' . esc_attr( $value ) . '"' . $append . '>' . $title . '</label>';
60
  } else {
61
+ if ( 'none' != $form_layout ) {
62
+ $wrapper_class = array();
63
 
64
+ if ( $align && 'inline' != $form_layout ) {
65
+ $wrapper_class[] = 'text-' . $align;
66
+ }
67
 
68
+ if ( 'horizontal' == $form_layout ) {
69
+ $wrapper_class[] = $this->get_column_class( $form_label_width, $form_breakpoint, $grid_columns );
70
+ }
71
 
72
+ $wrapper_class = implode( ' ', $wrapper_class );
73
 
74
+ if ( ! empty( $wrapper_class ) ) {
75
+ $wrapper_class = ' class="' . $wrapper_class . '"';
76
+ }
77
 
78
+ if ( is_int( $tabindex ) ) {
79
+ $tabindex = ' tabindex="' . $tabindex . '"';
80
+ } else {
81
+ $tabindex = '';
82
+ }
83
+ $output .= '<div class="form-group"><div' . $wrapper_class . '>';
84
  }
85
+
86
  $output .= '<input class="' . esc_attr( $class ) . '"' . $id . $name . ' type="submit" value="' . esc_attr( $title ) . '"' . $tabindex . '>';
87
+
88
+ if ( 'none' != $form_layout ) {
89
+ $output .= '</div></div>';
90
+ }
91
  }
92
  }
93
 
129
  'tabindex' => false,
130
  'align' => false,
131
  'grid_columns' => 12,
132
+ 'form_layout' => 'default', // default, inline, horizontal, none
133
  'form_label_width' => 2,
134
  'form_breakpoint' => 'sm',
135
  );
classes/CF7BS_Button_Group.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  class CF7BS_Button_Group extends CF7BS_Component {
1
  <?php
2
  /**
3
+ * CF7BS_Button_Group class
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  class CF7BS_Button_Group extends CF7BS_Component {
classes/CF7BS_Component.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  abstract class CF7BS_Component {
1
  <?php
2
  /**
3
+ * CF7BS_Component class
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  abstract class CF7BS_Component {
classes/CF7BS_Form_Field.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  class CF7BS_Form_Field extends CF7BS_Component {
@@ -18,11 +20,19 @@ class CF7BS_Form_Field extends CF7BS_Component {
18
 
19
  $value = $this->validate_value( $value, $type, $options );
20
 
 
 
 
 
21
  if ( 'hidden' != $type ) {
22
- $label_class = 'control-label';
 
 
 
23
  $input_div_class = '';
24
  $input_class = $class;
25
  if ( 'horizontal' == $form_layout ) {
 
26
  $classes = $this->get_column_width_classes( $form_label_width, $form_breakpoint, $grid_columns );
27
  $label_class .= ' ' . $classes['label'];
28
  $input_div_class = $classes['input'];
@@ -30,6 +40,7 @@ class CF7BS_Form_Field extends CF7BS_Component {
30
  $input_div_class .= ' ' . $this->get_column_offset_class( $form_label_width, $form_breakpoint, $grid_columns );
31
  }
32
  } elseif( 'inline' == $form_layout ) {
 
33
  if ( empty( $placeholder ) ) {
34
  $placeholder = $label;
35
  }
@@ -109,25 +120,27 @@ class CF7BS_Form_Field extends CF7BS_Component {
109
  $append .= ' disabled';
110
  }
111
 
112
- if ( 'horizontal' == $form_layout ) {
113
- $output .= '<div class="form-group' . $wrapper_class . $status . '">';
114
- if ( ! empty( $label ) ) {
115
- $output .= '<label class="' . esc_attr( $label_class ) . '"' . ( ! empty( $id ) ? ' for="' . esc_attr( $id ) . '"' : '' ) . '>' . esc_html( $label ) . $label_required . '</label>';
116
- }
117
- $output .= '<div class="' . esc_attr( $input_div_class ) . '">';
118
- } elseif( 'inline' == $form_layout ) {
119
- $output .= '<div class="form-group' . $wrapper_class . $status . '">';
120
- if ( ! empty( $label ) ) {
121
- $output .= '<label class="sr-only"' . ( ! empty( $id ) ? ' for="' . esc_attr( $id ) . '"' : '' ) . '>' . esc_html( $label ) . $label_required . '</label>';
122
- }
123
- } else {
124
- $output .= '<div class="form-group' . $wrapper_class . $status . '">';
125
- if ( ! empty( $label ) ) {
126
- $rc_group_style = '';
127
- if ( in_array( $type, array( 'radio', 'checkbox' ) ) ) {
128
- $rc_group_style = ' style="display:block;"';
 
 
 
129
  }
130
- $output .= '<label' . ( ! empty( $id ) ? ' for="' . esc_attr( $id ) . '"' : '' ) . $rc_group_style . '>' . esc_html( $label ) . $label_required . '</label>';
131
  }
132
  }
133
  }
@@ -369,7 +382,7 @@ class CF7BS_Form_Field extends CF7BS_Component {
369
  break;
370
  }
371
 
372
- if ( 'hidden' != $type ) {
373
  if ( ! empty( $help_text ) && 'inline' != $form_layout ) {
374
  $output .= '<span class="help-block">' . $help_text . '</span>';
375
  }
@@ -414,7 +427,7 @@ class CF7BS_Form_Field extends CF7BS_Component {
414
  'help_text' => '',
415
  'size' => 'default', // default, large, small, mini
416
  'grid_columns' => 12,
417
- 'form_layout' => 'default', // default, inline, horizontal
418
  'form_label_width' => 2,
419
  'form_breakpoint' => 'sm',
420
  'mode' => 'default', // default, required, static, disabled
@@ -426,6 +439,7 @@ class CF7BS_Form_Field extends CF7BS_Component {
426
  'group_layout' => 'default', // default, inline, buttons
427
  'group_type' => 'default', // only if group_layout==buttons
428
  'wrapper_class' => '',
 
429
  'input_before' => '',
430
  'input_after' => '',
431
  'input_before_class' => 'input-group-addon',
1
  <?php
2
  /**
3
+ * CF7BS_Form_Field class
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  class CF7BS_Form_Field extends CF7BS_Component {
20
 
21
  $value = $this->validate_value( $value, $type, $options );
22
 
23
+ if ( is_numeric($tabindex) ) {
24
+ $tabindex = intval($tabindex);
25
+ }
26
+
27
  if ( 'hidden' != $type ) {
28
+ if ( ! empty( $label_class ) ) {
29
+ $label_class .= ' ';
30
+ }
31
+
32
  $input_div_class = '';
33
  $input_class = $class;
34
  if ( 'horizontal' == $form_layout ) {
35
+ $label_class .= ' control-label';
36
  $classes = $this->get_column_width_classes( $form_label_width, $form_breakpoint, $grid_columns );
37
  $label_class .= ' ' . $classes['label'];
38
  $input_div_class = $classes['input'];
40
  $input_div_class .= ' ' . $this->get_column_offset_class( $form_label_width, $form_breakpoint, $grid_columns );
41
  }
42
  } elseif( 'inline' == $form_layout ) {
43
+ $label_class .= ' sr-only';
44
  if ( empty( $placeholder ) ) {
45
  $placeholder = $label;
46
  }
120
  $append .= ' disabled';
121
  }
122
 
123
+ if ( 'none' != $form_layout ) {
124
+ if ( 'horizontal' == $form_layout ) {
125
+ $output .= '<div class="form-group' . $wrapper_class . $status . '">';
126
+ if ( ! empty( $label ) ) {
127
+ $output .= '<label class="' . esc_attr( $label_class ) . '"' . ( ! empty( $id ) ? ' for="' . esc_attr( $id ) . '"' : '' ) . '>' . esc_html( $label ) . $label_required . '</label>';
128
+ }
129
+ $output .= '<div class="' . esc_attr( $input_div_class ) . '">';
130
+ } elseif( 'inline' == $form_layout ) {
131
+ $output .= '<div class="form-group' . $wrapper_class . $status . '">';
132
+ if ( ! empty( $label ) ) {
133
+ $output .= '<label class="' . esc_attr( $label_class ) . '"' . ( ! empty( $id ) ? ' for="' . esc_attr( $id ) . '"' : '' ) . '>' . esc_html( $label ) . $label_required . '</label>';
134
+ }
135
+ } else {
136
+ $output .= '<div class="form-group' . $wrapper_class . $status . '">';
137
+ if ( ! empty( $label ) ) {
138
+ $rc_group_style = '';
139
+ if ( in_array( $type, array( 'radio', 'checkbox' ) ) ) {
140
+ $rc_group_style = ' style="display:block;"';
141
+ }
142
+ $output .= '<label class="' . esc_attr( $label_class ) . '"' . ( ! empty( $id ) ? ' for="' . esc_attr( $id ) . '"' : '' ) . $rc_group_style . '>' . esc_html( $label ) . $label_required . '</label>';
143
  }
 
144
  }
145
  }
146
  }
382
  break;
383
  }
384
 
385
+ if ( 'hidden' != $type && 'none' != $form_layout ) {
386
  if ( ! empty( $help_text ) && 'inline' != $form_layout ) {
387
  $output .= '<span class="help-block">' . $help_text . '</span>';
388
  }
427
  'help_text' => '',
428
  'size' => 'default', // default, large, small, mini
429
  'grid_columns' => 12,
430
+ 'form_layout' => 'default', // default, inline, horizontal, none
431
  'form_label_width' => 2,
432
  'form_breakpoint' => 'sm',
433
  'mode' => 'default', // default, required, static, disabled
439
  'group_layout' => 'default', // default, inline, buttons
440
  'group_type' => 'default', // only if group_layout==buttons
441
  'wrapper_class' => '',
442
+ 'label_class' => '',
443
  'input_before' => '',
444
  'input_after' => '',
445
  'input_before_class' => 'input-group-addon',
modifications.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  function cf7bs_selected( $selected, $current = true, $echo = true ) {
@@ -82,7 +84,10 @@ function cf7bs_enqueue_scripts() {
82
  if ( 'header' === WPCF7_LOAD_JS ) {
83
  $in_footer = false;
84
  }
85
- wp_enqueue_script( 'contact-form-7-bootstrap', CF7BS_URL . '/assets/scripts.min.js', array( 'jquery', 'jquery-form', 'contact-form-7' ), CF7BS_VERSION, $in_footer );
 
 
 
86
  }
87
  add_action( 'wpcf7_enqueue_scripts', 'cf7bs_enqueue_scripts' );
88
 
1
  <?php
2
  /**
3
+ * Utility functions
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  function cf7bs_selected( $selected, $current = true, $echo = true ) {
84
  if ( 'header' === WPCF7_LOAD_JS ) {
85
  $in_footer = false;
86
  }
87
+
88
+ $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
89
+
90
+ wp_enqueue_script( 'contact-form-7-bootstrap', CF7BS_URL . '/assets/dist/js/scripts' . $min . '.js', array( 'jquery', 'jquery-form', 'contact-form-7' ), CF7BS_VERSION, $in_footer );
91
  }
92
  add_action( 'wpcf7_enqueue_scripts', 'cf7bs_enqueue_scripts' );
93
 
modules/acceptance.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_acceptance' );
@@ -42,16 +44,17 @@ function cf7bs_acceptance_shortcode_handler( $tag ) {
42
  '1' => $tag->content,
43
  ),
44
  'help_text' => $validation_error,
45
- 'size' => cf7bs_get_form_property( 'size' ),
46
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
47
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
48
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
49
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
50
- 'group_layout' => cf7bs_get_form_property( 'group_layout' ),
51
  'mode' => $mode,
52
  'status' => $status,
53
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
54
  'wrapper_class' => $tag->name,
 
55
  ), $tag->basetype, $tag->name ) );
56
 
57
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * Acceptance module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_acceptance' );
44
  '1' => $tag->content,
45
  ),
46
  'help_text' => $validation_error,
47
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
48
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
49
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
50
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
51
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
52
+ 'group_layout' => cf7bs_get_form_property( 'group_layout', 0, $tag ),
53
  'mode' => $mode,
54
  'status' => $status,
55
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
56
  'wrapper_class' => $tag->name,
57
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
58
  ), $tag->basetype, $tag->name ) );
59
 
60
  $html = $field->display( false );
modules/checkbox.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_checkbox' );
@@ -104,12 +106,12 @@ function cf7bs_checkbox_shortcode_handler( $tag ) {
104
  $posted = wpcf7_is_posted();
105
 
106
  $count = 0;
 
107
 
108
  foreach ( (array) $tag->values as $key => $value ) {
109
- if ( $free_text && $count == count( $tag->values ) - 1 ) {
110
- $options[ $value ] = '<input type="text" name="' . sprintf( '_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name ) . '" class="wpcf7-free-text">';
111
- } else {
112
- $options[ $value ] = isset( $labels[ $key ] ) ? $labels[ $key ] : $value;
113
  }
114
 
115
  if ( $posted && ! empty( $post ) ) {
@@ -156,17 +158,18 @@ function cf7bs_checkbox_shortcode_handler( $tag ) {
156
  'label' => $label,
157
  'options' => $options,
158
  'help_text' => $validation_error,
159
- 'size' => cf7bs_get_form_property( 'size' ),
160
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
161
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
162
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
163
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
164
- 'group_layout' => cf7bs_get_form_property( 'group_layout' ),
165
- 'group_type' => cf7bs_get_form_property( 'group_type' ),
166
  'mode' => $mode,
167
  'status' => $status,
168
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
169
  'wrapper_class' => $tag->get_class_option( $class . ' ' . $tag->name ),
 
170
  ), $tag->basetype, $tag->name ) );
171
 
172
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * Checkbox module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_checkbox' );
106
  $posted = wpcf7_is_posted();
107
 
108
  $count = 0;
109
+ $replace_index = count( (array) $tag->values ) - 1;
110
 
111
  foreach ( (array) $tag->values as $key => $value ) {
112
+ $options[ $value ] = isset( $labels[ $key ] ) ? $labels[ $key ] : $value;
113
+ if ( $free_text && $count == $replace_index ) {
114
+ $options[ $value ] .= ' <input type="text" name="' . sprintf( '_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name ) . '" class="wpcf7-free-text">';
 
115
  }
116
 
117
  if ( $posted && ! empty( $post ) ) {
158
  'label' => $label,
159
  'options' => $options,
160
  'help_text' => $validation_error,
161
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
162
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
163
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
164
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
165
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
166
+ 'group_layout' => cf7bs_get_form_property( 'group_layout', 0, $tag ),
167
+ 'group_type' => cf7bs_get_form_property( 'group_type', 0, $tag ),
168
  'mode' => $mode,
169
  'status' => $status,
170
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
171
  'wrapper_class' => $tag->get_class_option( $class . ' ' . $tag->name ),
172
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
173
  ), $tag->basetype, $tag->name ) );
174
 
175
  $html = $field->display( false );
modules/count.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_count' );
@@ -23,10 +25,10 @@ function cf7bs_count_shortcode_handler( $tag ) {
23
  'name' => wpcf7_count_shortcode_handler( $tag ),
24
  'type' => 'custom',
25
  'label' => $tag_obj->content,
26
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
27
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
28
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
29
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
30
  'tabindex' => false,
31
  'wrapper_class' => '',
32
  ), $tag_obj->basetype, $tag_obj->name ) );
1
  <?php
2
  /**
3
+ * Count module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.2.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_count' );
25
  'name' => wpcf7_count_shortcode_handler( $tag ),
26
  'type' => 'custom',
27
  'label' => $tag_obj->content,
28
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag_obj ),
29
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag_obj ),
30
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag_obj ),
31
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag_obj ),
32
  'tabindex' => false,
33
  'wrapper_class' => '',
34
  ), $tag_obj->basetype, $tag_obj->name ) );
modules/date.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_date' );
@@ -52,6 +54,15 @@ function cf7bs_date_shortcode_handler( $tag ) {
52
  $value = stripslashes_deep( rawurldecode( $_GET[ $tag->name ] ) );
53
  }
54
 
 
 
 
 
 
 
 
 
 
55
  $field = new CF7BS_Form_Field( cf7bs_apply_field_args_filter( array(
56
  'name' => $tag->name,
57
  'id' => $tag->get_option( 'id', 'id', true ),
@@ -61,21 +72,22 @@ function cf7bs_date_shortcode_handler( $tag ) {
61
  'placeholder' => $placeholder,
62
  'label' => $tag->content,
63
  'options' => array(
64
- 'min' => $tag->get_option( 'min', 'date', true ),
65
- 'max' => $tag->get_option( 'max', 'date', true ),
66
  'step' => $tag->get_option( 'step', 'int', true ),
67
  ),
68
  'help_text' => $validation_error,
69
- 'size' => cf7bs_get_form_property( 'size' ),
70
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
71
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
72
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
73
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
74
  'mode' => $mode,
75
  'status' => $status,
76
  'readonly' => $tag->has_option( 'readonly' ) ? true : false,
77
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
78
  'wrapper_class' => $tag->name,
 
79
  ), $tag->basetype, $tag->name ) );
80
 
81
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * Date module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_date' );
54
  $value = stripslashes_deep( rawurldecode( $_GET[ $tag->name ] ) );
55
  }
56
 
57
+ if ( is_callable( array( $tag, 'get_date_option' ) ) ) {
58
+ $min = $tag->get_date_option( 'min' );
59
+ $max = $tag->get_date_option( 'max' );
60
+ } else {
61
+ $min = $tag->get_option( 'min', 'date', true );
62
+ $max = $tag->get_option( 'max', 'date', true );
63
+ }
64
+ $step = $tag->get_option( 'step', 'int', true );
65
+
66
  $field = new CF7BS_Form_Field( cf7bs_apply_field_args_filter( array(
67
  'name' => $tag->name,
68
  'id' => $tag->get_option( 'id', 'id', true ),
72
  'placeholder' => $placeholder,
73
  'label' => $tag->content,
74
  'options' => array(
75
+ 'min' => $min,
76
+ 'max' => $max,
77
  'step' => $tag->get_option( 'step', 'int', true ),
78
  ),
79
  'help_text' => $validation_error,
80
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
81
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
82
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
83
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
84
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
85
  'mode' => $mode,
86
  'status' => $status,
87
  'readonly' => $tag->has_option( 'readonly' ) ? true : false,
88
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
89
  'wrapper_class' => $tag->name,
90
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
91
  ), $tag->basetype, $tag->name ) );
92
 
93
  $html = $field->display( false );
modules/file.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_file' );
@@ -59,15 +61,16 @@ function cf7bs_file_shortcode_handler( $tag ) {
59
  'value' => '1',
60
  'label' => $tag->content,
61
  'help_text' => $validation_error,
62
- 'size' => cf7bs_get_form_property( 'size' ),
63
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
64
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
65
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
66
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
67
  'mode' => $mode,
68
  'status' => $status,
69
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
70
  'wrapper_class' => $tag->name,
 
71
  ), $tag->basetype, $tag->name ) );
72
 
73
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * File module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_file' );
61
  'value' => '1',
62
  'label' => $tag->content,
63
  'help_text' => $validation_error,
64
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
65
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
66
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
67
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
68
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
69
  'mode' => $mode,
70
  'status' => $status,
71
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
72
  'wrapper_class' => $tag->name,
73
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
74
  ), $tag->basetype, $tag->name ) );
75
 
76
  $html = $field->display( false );
modules/number.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_number' );
@@ -68,16 +70,17 @@ function cf7bs_number_shortcode_handler( $tag ) {
68
  'step' => $tag->get_option( 'step', 'int', true ),
69
  ),
70
  'help_text' => $validation_error,
71
- 'size' => cf7bs_get_form_property( 'size' ),
72
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
73
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
74
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
75
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
76
  'mode' => $mode,
77
  'status' => $status,
78
  'readonly' => $tag->has_option( 'readonly' ) ? true : false,
79
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
80
  'wrapper_class' => $tag->name,
 
81
  ), $tag->basetype, $tag->name ) );
82
 
83
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * Number module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_number' );
70
  'step' => $tag->get_option( 'step', 'int', true ),
71
  ),
72
  'help_text' => $validation_error,
73
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
74
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
75
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
76
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
77
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
78
  'mode' => $mode,
79
  'status' => $status,
80
  'readonly' => $tag->has_option( 'readonly' ) ? true : false,
81
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
82
  'wrapper_class' => $tag->name,
83
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
84
  ), $tag->basetype, $tag->name ) );
85
 
86
  $html = $field->display( false );
modules/quiz.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_quiz' );
@@ -53,15 +55,16 @@ function cf7bs_quiz_shortcode_handler( $tag ) {
53
  'placeholder' => '',
54
  'label' => $tag->content,
55
  'help_text' => $validation_error,
56
- 'size' => cf7bs_get_form_property( 'size' ),
57
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
58
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
59
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
60
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
61
  'status' => $status,
62
  'maxlength' => $tag->get_maxlength_option(),
63
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
64
  'wrapper_class' => $tag->name,
 
65
  ), $tag->basetype, $tag->name ) );
66
 
67
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * Quiz module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_quiz' );
55
  'placeholder' => '',
56
  'label' => $tag->content,
57
  'help_text' => $validation_error,
58
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
59
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
60
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
61
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
62
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
63
  'status' => $status,
64
  'maxlength' => $tag->get_maxlength_option(),
65
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
66
  'wrapper_class' => $tag->name,
67
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
68
  ), $tag->basetype, $tag->name ) );
69
 
70
  $html = $field->display( false );
modules/really-simple-captcha.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_captcha' );
@@ -32,7 +34,7 @@ function cf7bs_captcha_shortcode_handler( $tag ) {
32
  if ( $image_sizes_array = preg_grep( '%^size:[smlSML]$%', $tag['options'] ) ) {
33
  $tag['options'] = array_values( array_diff_key( $tag['options'], $image_sizes_array ) );
34
  }
35
- $size = cf7bs_get_form_property( 'size' );
36
  $image_size = 'large' == $size ? 'l' : ( 'small' == $size ? 's' : 'm' );
37
  $tag['options'][] = 'size:' . $image_size;
38
 
@@ -41,10 +43,10 @@ function cf7bs_captcha_shortcode_handler( $tag ) {
41
  'type' => 'custom',
42
  'label' => $tag_obj->content,
43
  'help_text' => $validation_error,
44
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
45
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
46
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
47
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
48
  'tabindex' => false,
49
  'wrapper_class' => '',
50
  ), $tag_obj->basetype, $tag_obj->name ) );
@@ -98,15 +100,16 @@ function cf7bs_captcha_shortcode_handler( $tag ) {
98
  'placeholder' => $placeholder,
99
  'label' => $tag_obj->content,
100
  'help_text' => $validation_error,
101
- 'size' => cf7bs_get_form_property( 'size' ),
102
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
103
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
104
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
105
  'mode' => $mode,
106
  'status' => $status,
107
  'maxlength' => $tag_obj->get_maxlength_option(),
108
  'tabindex' => $tag_obj->get_option( 'tabindex', 'int', true ),
109
  'wrapper_class' => $tag_obj->name,
 
110
  'input_before' => $input_before,
111
  'input_after' => $input_after,
112
  'input_before_class'=> 'input-group-addon input-group-has-image',
1
  <?php
2
  /**
3
+ * Really Simple CAPTCHA module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_captcha' );
34
  if ( $image_sizes_array = preg_grep( '%^size:[smlSML]$%', $tag['options'] ) ) {
35
  $tag['options'] = array_values( array_diff_key( $tag['options'], $image_sizes_array ) );
36
  }
37
+ $size = cf7bs_get_form_property( 'size', 0, $tag_obj );
38
  $image_size = 'large' == $size ? 'l' : ( 'small' == $size ? 's' : 'm' );
39
  $tag['options'][] = 'size:' . $image_size;
40
 
43
  'type' => 'custom',
44
  'label' => $tag_obj->content,
45
  'help_text' => $validation_error,
46
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag_obj ),
47
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag_obj ),
48
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag_obj ),
49
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag_obj ),
50
  'tabindex' => false,
51
  'wrapper_class' => '',
52
  ), $tag_obj->basetype, $tag_obj->name ) );
100
  'placeholder' => $placeholder,
101
  'label' => $tag_obj->content,
102
  'help_text' => $validation_error,
103
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag_obj ),
104
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag_obj ),
105
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag_obj ),
106
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag_obj ),
107
  'mode' => $mode,
108
  'status' => $status,
109
  'maxlength' => $tag_obj->get_maxlength_option(),
110
  'tabindex' => $tag_obj->get_option( 'tabindex', 'int', true ),
111
  'wrapper_class' => $tag_obj->name,
112
+ 'label_class' => $tag_obj->get_option( 'label_class', 'class', true ),
113
  'input_before' => $input_before,
114
  'input_after' => $input_after,
115
  'input_before_class'=> 'input-group-addon input-group-has-image',
modules/recaptcha.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  if ( function_exists( 'wpcf7_recaptcha_add_shortcode_recaptcha' ) ) {
@@ -24,10 +26,10 @@ if ( function_exists( 'wpcf7_recaptcha_add_shortcode_recaptcha' ) ) {
24
  'name' => wpcf7_recaptcha_shortcode_handler( $tag ),
25
  'type' => 'custom',
26
  'label' => $tag_obj->content,
27
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
28
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
29
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
30
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
31
  'tabindex' => false,
32
  'wrapper_class' => '',
33
  ), $tag_obj->basetype ) );
1
  <?php
2
  /**
3
+ * reCAPTCHA module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.3.0
8
  */
9
 
10
  if ( function_exists( 'wpcf7_recaptcha_add_shortcode_recaptcha' ) ) {
26
  'name' => wpcf7_recaptcha_shortcode_handler( $tag ),
27
  'type' => 'custom',
28
  'label' => $tag_obj->content,
29
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag_obj ),
30
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag_obj ),
31
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag_obj ),
32
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag_obj ),
33
  'tabindex' => false,
34
  'wrapper_class' => '',
35
  ), $tag_obj->basetype ) );
modules/select.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_select' );
@@ -130,15 +132,16 @@ function cf7bs_select_shortcode_handler( $tag ) {
130
  'label' => $tag->content,
131
  'options' => $options,
132
  'help_text' => $validation_error,
133
- 'size' => cf7bs_get_form_property( 'size' ),
134
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
135
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
136
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
137
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
138
  'mode' => $mode,
139
  'status' => $status,
140
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
141
  'wrapper_class' => $tag->name,
 
142
  ), $tag->basetype, $tag->name ) );
143
 
144
  $html = $field->display( false );
1
  <?php
2
  /**
3
+ * Select module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_select' );
132
  'label' => $tag->content,
133
  'options' => $options,
134
  'help_text' => $validation_error,
135
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag ),
136
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
137
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
138
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
139
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
140
  'mode' => $mode,
141
  'status' => $status,
142
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
143
  'wrapper_class' => $tag->name,
144
+ 'label_class' => $tag->get_option( 'label_class', 'class', true ),
145
  ), $tag->basetype, $tag->name ) );
146
 
147
  $html = $field->display( false );
modules/submit.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit' );
@@ -22,9 +24,9 @@ function cf7bs_submit_shortcode_handler( $tag ) {
22
  $value = __( 'Send', 'contact-form-7' );
23
  }
24
 
25
- $size = cf7bs_get_form_property( 'submit_size' );
26
  if ( ! $size ) {
27
- $size = cf7bs_get_form_property( 'size' );
28
  }
29
 
30
  $button = new CF7BS_Button( array(
@@ -32,14 +34,14 @@ function cf7bs_submit_shortcode_handler( $tag ) {
32
  'id' => $tag->get_option( 'id', 'id', true ),
33
  'class' => $tag->get_class_option( $class ),
34
  'title' => $value,
35
- 'type' => cf7bs_get_form_property( 'submit_type' ),
36
  'size' => $size,
37
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
38
  'align' => $tag->get_option( 'align', '[A-Za-z]+', true ),
39
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
40
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
41
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
42
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
43
  ) );
44
 
45
  $html = $button->display( false );
1
  <?php
2
  /**
3
+ * Submit module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_submit' );
24
  $value = __( 'Send', 'contact-form-7' );
25
  }
26
 
27
+ $size = cf7bs_get_form_property( 'submit_size', 0, $tag );
28
  if ( ! $size ) {
29
+ $size = cf7bs_get_form_property( 'size', 0, $tag );
30
  }
31
 
32
  $button = new CF7BS_Button( array(
34
  'id' => $tag->get_option( 'id', 'id', true ),
35
  'class' => $tag->get_class_option( $class ),
36
  'title' => $value,
37
+ 'type' => cf7bs_get_form_property( 'submit_type', 0, $tag ),
38
  'size' => $size,
39
  'tabindex' => $tag->get_option( 'tabindex', 'int', true ),
40
  'align' => $tag->get_option( 'align', '[A-Za-z]+', true ),
41
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag ),
42
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag ),
43
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag ),
44
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag ),
45
  ) );
46
 
47
  $html = $button->display( false );
modules/text.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_text' );
@@ -78,6 +80,24 @@ function cf7bs_text_shortcode_handler( $tag ) {
78
  $input_after = '';
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  if ( $tag_obj->has_option( 'include_count' ) ) {
82
  $count_mode = 'input_after';
83
  $count_down = false;
@@ -115,13 +135,13 @@ function cf7bs_text_shortcode_handler( $tag ) {
115
  'type' => wpcf7_support_html5() ? $tag_obj->basetype : 'text',
116
  'value' => $value,
117
  'placeholder' => $placeholder,
118
- 'label' => $tag_obj->content,
119
  'help_text' => $validation_error,
120
- 'size' => cf7bs_get_form_property( 'size' ),
121
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
122
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
123
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
124
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
125
  'mode' => $mode,
126
  'status' => $status,
127
  'readonly' => $tag_obj->has_option( 'readonly' ) ? true : false,
@@ -129,6 +149,7 @@ function cf7bs_text_shortcode_handler( $tag ) {
129
  'maxlength' => $tag_obj->get_maxlength_option(),
130
  'tabindex' => $tag_obj->get_option( 'tabindex', 'int', true ),
131
  'wrapper_class' => $tag_obj->name,
 
132
  'input_before' => $input_before,
133
  'input_after' => $input_after,
134
  ), $tag_obj->basetype, $tag_obj->name ) );
1
  <?php
2
  /**
3
+ * Text module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_text' );
80
  $input_after = '';
81
  }
82
 
83
+ $content = $tag_obj->content;
84
+
85
+ $matches = array();
86
+ if ( preg_match( '/\{input_before\}(.*)\{\/input_before\}/imU', $content, $matches ) ) {
87
+ if ( ! empty( $matches[1] ) ) {
88
+ $input_before = $matches[1];
89
+ }
90
+ $content = str_replace( $matches[0], '', $content );
91
+ }
92
+
93
+ $matches = array();
94
+ if ( preg_match( '/\{input_after\}(.*)\{\/input_after\}/imU', $content, $matches ) ) {
95
+ if ( ! empty( $matches[1] ) ) {
96
+ $input_after = $matches[1];
97
+ }
98
+ $content = str_replace( $matches[0], '', $content );
99
+ }
100
+
101
  if ( $tag_obj->has_option( 'include_count' ) ) {
102
  $count_mode = 'input_after';
103
  $count_down = false;
135
  'type' => wpcf7_support_html5() ? $tag_obj->basetype : 'text',
136
  'value' => $value,
137
  'placeholder' => $placeholder,
138
+ 'label' => $content,
139
  'help_text' => $validation_error,
140
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag_obj ),
141
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag_obj ),
142
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag_obj ),
143
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag_obj ),
144
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag_obj ),
145
  'mode' => $mode,
146
  'status' => $status,
147
  'readonly' => $tag_obj->has_option( 'readonly' ) ? true : false,
149
  'maxlength' => $tag_obj->get_maxlength_option(),
150
  'tabindex' => $tag_obj->get_option( 'tabindex', 'int', true ),
151
  'wrapper_class' => $tag_obj->name,
152
+ 'label_class' => $tag_obj->get_option( 'label_class', 'class', true ),
153
  'input_before' => $input_before,
154
  'input_after' => $input_after,
155
  ), $tag_obj->basetype, $tag_obj->name ) );
modules/textarea.php CHANGED
@@ -1,8 +1,10 @@
1
  <?php
2
  /**
 
 
3
  * @package CF7BS
4
- * @version 1.3.1
5
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
 
6
  */
7
 
8
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_textarea' );
@@ -74,6 +76,24 @@ function cf7bs_textarea_shortcode_handler( $tag ) {
74
  $input_after = '';
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  if ( $tag_obj->has_option( 'include_count' ) ) {
78
  $count_mode = 'input_after';
79
  $count_down = false;
@@ -111,13 +131,13 @@ function cf7bs_textarea_shortcode_handler( $tag ) {
111
  'type' => 'textarea',
112
  'value' => $value,
113
  'placeholder' => $placeholder,
114
- 'label' => $tag_obj->content,
115
  'help_text' => $validation_error,
116
- 'size' => cf7bs_get_form_property( 'size' ),
117
- 'grid_columns' => cf7bs_get_form_property( 'grid_columns' ),
118
- 'form_layout' => cf7bs_get_form_property( 'layout' ),
119
- 'form_label_width' => cf7bs_get_form_property( 'label_width' ),
120
- 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint' ),
121
  'mode' => $mode,
122
  'status' => $status,
123
  'readonly' => $tag_obj->has_option( 'readonly' ) ? true : false,
@@ -125,6 +145,7 @@ function cf7bs_textarea_shortcode_handler( $tag ) {
125
  'maxlength' => $tag_obj->get_maxlength_option(),
126
  'tabindex' => $tag_obj->get_option( 'tabindex', 'int', true ),
127
  'wrapper_class' => $tag_obj->name,
 
128
  'rows' => $rows,
129
  'input_before' => $input_before,
130
  'input_after' => $input_after,
1
  <?php
2
  /**
3
+ * Textarea module
4
+ *
5
  * @package CF7BS
 
6
  * @author Felix Arntz <felix-arntz@leaves-and-love.net>
7
+ * @since 1.0.0
8
  */
9
 
10
  remove_action( 'wpcf7_init', 'wpcf7_add_shortcode_textarea' );
76
  $input_after = '';
77
  }
78
 
79
+ $content = $tag_obj->content;
80
+
81
+ $matches = array();
82
+ if ( preg_match( '/\{input_before\}(.*)\{\/input_before\}/imU', $content, $matches ) ) {
83
+ if ( ! empty( $matches[1] ) ) {
84
+ $input_before = $matches[1];
85
+ }
86
+ $content = str_replace( $matches[0], '', $content );
87
+ }
88
+
89
+ $matches = array();
90
+ if ( preg_match( '/\{input_after\}(.*)\{\/input_after\}/imU', $content, $matches ) ) {
91
+ if ( ! empty( $matches[1] ) ) {
92
+ $input_after = $matches[1];
93
+ }
94
+ $content = str_replace( $matches[0], '', $content );
95
+ }
96
+
97
  if ( $tag_obj->has_option( 'include_count' ) ) {
98
  $count_mode = 'input_after';
99
  $count_down = false;
131
  'type' => 'textarea',
132
  'value' => $value,
133
  'placeholder' => $placeholder,
134
+ 'label' => $content,
135
  'help_text' => $validation_error,
136
+ 'size' => cf7bs_get_form_property( 'size', 0, $tag_obj ),
137
+ 'grid_columns' => cf7bs_get_form_property( 'grid_columns', 0, $tag_obj ),
138
+ 'form_layout' => cf7bs_get_form_property( 'layout', 0, $tag_obj ),
139
+ 'form_label_width' => cf7bs_get_form_property( 'label_width', 0, $tag_obj ),
140
+ 'form_breakpoint' => cf7bs_get_form_property( 'breakpoint', 0, $tag_obj ),
141
  'mode' => $mode,
142
  'status' => $status,
143
  'readonly' => $tag_obj->has_option( 'readonly' ) ? true : false,
145
  'maxlength' => $tag_obj->get_maxlength_option(),
146
  'tabindex' => $tag_obj->get_option( 'tabindex', 'int', true ),
147
  'wrapper_class' => $tag_obj->name,
148
+ 'label_class' => $tag_obj->get_option( 'label_class', 'class', true ),
149
  'rows' => $rows,
150
  'input_before' => $input_before,
151
  'input_after' => $input_after,
readme.txt CHANGED
@@ -2,17 +2,17 @@
2
 
3
  Plugin Name: Bootstrap for Contact Form 7
4
  Plugin URI: https://wordpress.org/plugins/bootstrap-for-contact-form-7/
5
- Author URI: http://leaves-and-love.net
6
  Author: Felix Arntz
7
- Donate link: http://leaves-and-love.net/wordpress-plugins/
8
  Contributors: flixos90
9
- Requires at least: 3.6
10
- Tested up to: 4.4.2
11
- Stable tag: 1.3.1
12
- Version: 1.3.1
13
- License: GPL v3
 
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
- Tags: wordpress, plugin, contact form 7, wpcf7, bootstrap, bootstrap 3, bootstrap framework, addon, contact form 7 addon, contact form, cf7bs, css
16
 
17
  This plugin modifies the output of the popular Contact Form 7 plugin to be styled in compliance with themes using the Bootstrap CSS framework.
18
 
@@ -101,6 +101,8 @@ I preferably take support requests as [issues on Github](https://github.com/feli
101
 
102
  If you're a developer and you have some ideas to improve the plugin or to solve a bug, feel free to raise an issue or submit a pull request in the [Github repository for the plugin](https://github.com/felixarntz/bootstrap-for-contact-form-7).
103
 
 
 
104
  == Screenshots ==
105
 
106
  1. A general form by the Contact Form 7 plugin as rendered with Bootstrap for Contact Form 7
@@ -109,6 +111,13 @@ If you're a developer and you have some ideas to improve the plugin or to solve
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
112
  = 1.3.1 =
113
  * Enhanced: alerts can now be made dismissible by defining the constant `CF7BS_ALERT_DISMISSIBLE`
114
  * Fixed: properly add `for` attributes to labels for checkbox and radio groups for accessibility
@@ -192,7 +201,7 @@ You can adjust several form properties (properties that affect an entire form, n
192
  * `label_width` - adjusts the form's label width (applies only to horizontal layout); valid values: any integer between 1 and the value of `grid_columns` minus 1; default value: 3
193
  * `breakpoint` - adjusts the responsive breakpoint (applies only to horizontal layout); valid values: 'xs', 'sm', 'md', 'lg'; default value: 'sm'
194
 
195
- There are three methods to adjust the above properties: The easiest one is to use the "Additional Settings" tab when editing a form in Contact Form 7 and insert any property and its desired value there, one per line. For example:
196
 
197
  layout:horizontal
198
  size:large
@@ -210,17 +219,22 @@ Alternatively you can use the filter `cf7bs_form_{{FORM_ID}}_properties` where `
210
 
211
  The third way does something slightly different from the other two since it does not change a specific form's properties, but the default properties for all forms. To do that, you should use the filter `cf7bs_default_form_properties` which works exactly like the other filter mentioned above.
212
 
 
 
 
 
 
 
 
213
  Note that the custom form filter takes precedence over the properties defined in the admin, while the default filter is just used as fallback.
214
 
215
  = Input Groups =
216
 
217
- All textual input fields support the input group feature that Bootstrap provides. To use it, add an option `input_before` and/or `input_after` to any text / email / url / tel input. Example:
218
-
219
- [text twitter-username input_before:@]Your Twitter Handle[/text]
220
 
221
- Note that the `input_before` and `input_after` options can also be added to textareas. In this case, the content will be displayed directly above or below the textarea respectively. To display content that contains one or more spaces, just enter it as the option value, replacing all spaces by three dashes. Example:
222
 
223
- [textarea* your-text input_before:Please---enter---something]Your Text[/textarea*]
224
 
225
  = Submit Button Alignment =
226
 
2
 
3
  Plugin Name: Bootstrap for Contact Form 7
4
  Plugin URI: https://wordpress.org/plugins/bootstrap-for-contact-form-7/
 
5
  Author: Felix Arntz
6
+ Author URI: https://leaves-and-love.net
7
  Contributors: flixos90
8
+ Donate link: https://leaves-and-love.net/wordpress-plugins/
9
+ Requires at least: 3.6
10
+ Tested up to: 4.6
11
+ Stable tag: 1.4.0
12
+ Version: 1.4.0
13
+ License: GNU General Public License v3
14
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
15
+ Tags: contact form 7, wpcf7, bootstrap, bootstrap 3, bootstrap framework, addon, contact form 7 addon, contact form, cf7bs
16
 
17
  This plugin modifies the output of the popular Contact Form 7 plugin to be styled in compliance with themes using the Bootstrap CSS framework.
18
 
101
 
102
  If you're a developer and you have some ideas to improve the plugin or to solve a bug, feel free to raise an issue or submit a pull request in the [Github repository for the plugin](https://github.com/felixarntz/bootstrap-for-contact-form-7).
103
 
104
+ You can also contribute to the plugin by translating it. Simply visit [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/bootstrap-for-contact-form-7) to get started.
105
+
106
  == Screenshots ==
107
 
108
  1. A general form by the Contact Form 7 plugin as rendered with Bootstrap for Contact Form 7
111
 
112
  == Changelog ==
113
 
114
+ = 1.4.0 =
115
+ * Enhanced: all form settings except `submit_size`, `submit_type` and `required_html` can now be overridden on a per-field basis by providing the setting name and its intended value as a shortcode attribute
116
+ * Enhanced: a new value 'none' is now supported for the `layout` form setting which will prevent any wrapper from rendering; it is recommended to only use this for advanced field layouts
117
+ * Enhanced: a new attribute `label_class` can now be added to shortcodes for additional label classes
118
+ * Enhanced: `input_before` and `input_after` now support HTML by putting something like `{input_before}<span>Content before</span>{/input_before} into the content of a field shortcode (make sure to use curly braces); this method is now recommended and takes precedence over the old way
119
+ * Fixed: the label of the `free_text` option in radio buttons / checkboxes is now displayed correctly
120
+
121
  = 1.3.1 =
122
  * Enhanced: alerts can now be made dismissible by defining the constant `CF7BS_ALERT_DISMISSIBLE`
123
  * Fixed: properly add `for` attributes to labels for checkbox and radio groups for accessibility
201
  * `label_width` - adjusts the form's label width (applies only to horizontal layout); valid values: any integer between 1 and the value of `grid_columns` minus 1; default value: 3
202
  * `breakpoint` - adjusts the responsive breakpoint (applies only to horizontal layout); valid values: 'xs', 'sm', 'md', 'lg'; default value: 'sm'
203
 
204
+ There are four methods to adjust the above properties: The easiest one is to use the "Additional Settings" tab when editing a form in Contact Form 7 and insert any property and its desired value there, one per line. For example:
205
 
206
  layout:horizontal
207
  size:large
219
 
220
  The third way does something slightly different from the other two since it does not change a specific form's properties, but the default properties for all forms. To do that, you should use the filter `cf7bs_default_form_properties` which works exactly like the other filter mentioned above.
221
 
222
+ The fourth method is different from the others as it allows to override the form settings on a per-field basis. You can add any of the setting names plus its intended value as a shortcode attribute for any field to make this field behave differently from the form's setting. This can be especially helpful if you need to create advanced form layouts like when you need multiple fields on the same line. For example, you could do the following to display two fields in one row, even though the form's `layout` is set to 'default':
223
+
224
+ <div class="form-group row">
225
+ <div class="col-md-6"><label for="user-first-name">First Name</label>[text user_first_name id:user-first-name layout:none][/text]</div>
226
+ <div class="col-md-6"><label for="user-last-name">Last Name</label>[text user_last_name id:user-last-name layout:none][/text]</div>
227
+ </div>
228
+
229
  Note that the custom form filter takes precedence over the properties defined in the admin, while the default filter is just used as fallback.
230
 
231
  = Input Groups =
232
 
233
+ All textual input fields support the input group feature that Bootstrap provides. To use it, add a shortcode-like construct (almost, but it has to use curly braces instead) into the content of any text / email / url / tel input shortcode. Example:
 
 
234
 
235
+ [text twitter-username]{input_before}@{/input_before}Your Twitter Handle[/text]
236
 
237
+ Note that the `input_before` and `input_after` can also be added to textareas. In this case, the content will be displayed directly above or below the textarea respectively.
238
 
239
  = Submit Button Alignment =
240