Skip to content

Commit

Permalink
= 2.1.3 (2022-04-18) =
Browse files Browse the repository at this point in the history
* check for user_cap 'wpcf7_edit_contact_forms' instead of 'wpcf7_edit_contact_form' in several places. Thanks, [@PayBox](https://wordpress.org/support/topic/some-notices-appearing-fix-suggested/)!
* PRO multistep: make "Next step" and "Previous step" buttons translatable by third party plugins like wpml and loco translate.
* PRO multistep: show spinner while validating a step.
* PRO Fix additional disable_on_hide bug with multistep [GH issue 87-4](#87)
* Replace all occurences of text domain 'contact-form-7' with 'cf7-conditional-fields'
  • Loading branch information
pwkip committed Apr 18, 2022
1 parent 4e7496a commit 5b3cb5c
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 50 deletions.
1 change: 1 addition & 0 deletions Wpcf7cfMailParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function hide_hidden_mail_fields_regex_callback ( $matches ) {
$name_suffix = implode('__',$name_parts);

$content = $matches[2];

if ( in_array( $name, $this->hidden_groups ) ) {

// The tag name represents a hidden group, so replace everything from [tagname] to [/tagname] with nothing
Expand Down
5 changes: 3 additions & 2 deletions admin-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
box-shadow: none;
height: 22px;
line-height: 22px;
min-height: 22px;
box-sizing: content-box; }
#wpcf7cf-conditional-panel #wpcf7cf-entries .label {
background-color: transparent;
Expand Down Expand Up @@ -116,7 +117,7 @@
height: 22px;
position: absolute;
line-height: 22px;
right: 50px;
right: 53px;
top: 0; }
#wpcf7cf-conditional-panel .wpcf7cf-and-rule {
margin-bottom: 4px;
Expand All @@ -137,7 +138,7 @@
box-sizing: border-box;
display: flex; }
#wpcf7cf-conditional-panel .entry .wpcf7cf-if {
width: 188px; }
width: 189px; }
#wpcf7cf-conditional-panel .then-field-select {
width: 130px; }
#wpcf7cf-conditional-panel .entry .wpcf7cf-and-rules {
Expand Down
5 changes: 3 additions & 2 deletions admin-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
box-shadow: none;
height: 22px;
line-height: 22px;
min-height: 22px;
box-sizing: content-box;
}

Expand Down Expand Up @@ -147,7 +148,7 @@
height: 22px;
position: absolute;
line-height: 22px;
right: 50px;
right: 53px;
top: 0;
}

Expand Down Expand Up @@ -184,7 +185,7 @@
}

.entry .wpcf7cf-if {
width: 188px;
width: 189px;
}

.then-field-select {
Expand Down
5 changes: 1 addition & 4 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function wpcf7cf_admin_enqueue_scripts( $hook_suffix ) {
add_filter('wpcf7_editor_panels', 'add_conditional_panel');

function add_conditional_panel($panels) {
if ( current_user_can( 'wpcf7_edit_contact_form' ) ) {
if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) {
$panels['wpcf7cf-conditional-panel'] = array(
'title' => __( 'Conditional fields', 'cf7-conditional-fields' ),
'callback' => 'wpcf7cf_editor_panel_conditional'
Expand Down Expand Up @@ -113,9 +113,6 @@ function wpcf7cf_editor_panel_conditional($form) {
print_entries_html($form);
?>
<div id="wpcf7cf-entries">
<?php
//print_entries_html($form, $wpcf7cf_entries);
?>
</div>

<span id="wpcf7cf-add-button" title="<?php _e( 'add new rule', 'cf7-conditional-fields' ); ?>"><?php _e( '+ add new conditional rule', 'cf7-conditional-fields'); ?></span>
Expand Down
6 changes: 3 additions & 3 deletions cf7cf.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ function wpcf7cf_form_hidden_fields($hidden_fields) {
unset($options['settings']['license_key']); // don't show license key in the source code duh.

return array_merge($hidden_fields, array(
'_wpcf7cf_hidden_group_fields' => '',
'_wpcf7cf_hidden_groups' => '',
'_wpcf7cf_visible_groups' => '',
'_wpcf7cf_hidden_group_fields' => '[]',
'_wpcf7cf_hidden_groups' => '[]',
'_wpcf7cf_visible_groups' => '[]',
'_wpcf7cf_repeaters' => '[]',
'_wpcf7cf_steps' => '{}',
'_wpcf7cf_options' => ''.json_encode($options),
Expand Down
2 changes: 1 addition & 1 deletion contact-form-7-conditional-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: http://bdwm.be/
* Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
* Author: Jules Colle
* Version: 2.1.2
* Version: 2.1.3
* Author URI: http://bdwm.be/
* Text Domain: cf7-conditional-fields
* License: GPL v2 or later
Expand Down
2 changes: 1 addition & 1 deletion init.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '2.1.2' );
if (!defined('WPCF7CF_VERSION')) define( 'WPCF7CF_VERSION', '2.1.3' );
if (!defined('WPCF7CF_CF7_MIN_VERSION')) define( 'WPCF7CF_CF7_MIN_VERSION', '5.4' );
if (!defined('WPCF7CF_CF7_MAX_VERSION')) define( 'WPCF7CF_CF7_MAX_VERSION', '5.5.6' );
if (!defined('WPCF7CF_REQUIRED_WP_VERSION')) define( 'WPCF7CF_REQUIRED_WP_VERSION', '4.1' );
Expand Down
18 changes: 10 additions & 8 deletions js/scripts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/scripts.js.map

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions js/scripts_es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ Wpcf7cfForm.prototype.updateEventListeners = function() {
var form = e.data;
clearTimeout(wpcf7cf_timeout);
wpcf7cf_timeout = setTimeout(function() {
window.wpcf7cf.updateMultistepState(form.multistep);
form.displayFields();
}, wpcf7cf_change_time_ms);
});
Expand Down Expand Up @@ -886,8 +887,10 @@ function Wpcf7cfMultistep($multistep, form) {
multistep.$btn_next.on('click.wpcf7cf_step', async function() {

multistep.$btn_next.addClass('disabled').attr('disabled', true);

multistep.form.$form.addClass('submitting');
var result = await multistep.validateStep(multistep.currentStep);
multistep.form.$form.removeClass('submitting');

if (result === 'success') {
multistep.moveToStep(multistep.currentStep+1);
}
Expand Down Expand Up @@ -1201,8 +1204,6 @@ window.wpcf7cf = {

const val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];

const parentGroup = 'parent-group';

const suffix = nameWithoutBrackets.replace(originalNameWithoutBrackets, '');

if (!simplified_dom[name]) {
Expand Down Expand Up @@ -1256,12 +1257,14 @@ window.wpcf7cf = {

// replace next button with submit button on last step.
// TODO: make this depend on a setting
var $submit_button = multistep.form.$form.find('input[type="submit"]').eq(0);
var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);
var $submit_button = multistep.form.$form.find('input[type="submit"]:last').eq(0);
var $ajax_loader = multistep.form.$form.find('.wpcf7-spinner').eq(0);

$submit_button.detach().prependTo(multistep.$btn_next.parent());
$ajax_loader.detach().prependTo(multistep.$btn_next.parent());

if (multistep.currentStep == multistep.numSteps) {
multistep.$btn_next.hide();
$ajax_loader.detach().appendTo(multistep.$btn_next.parent());
$submit_button.detach().appendTo(multistep.$btn_next.parent());
$submit_button.show();
} else {
$submit_button.hide();
Expand Down
2 changes: 1 addition & 1 deletion jsdoc-out/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="wpcf7c
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Wed Feb 23 2022 11:10:35 GMT+0100 (Midden-Europese standaardtijd)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon Apr 18 2022 23:26:26 GMT+0200 (Midden-Europese zomertijd)
</footer>

<script> prettyPrint(); </script>
Expand Down
19 changes: 11 additions & 8 deletions jsdoc-out/scripts_es6.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ <h1 class="page-title">Source: scripts_es6.js</h1>
var form = e.data;
clearTimeout(wpcf7cf_timeout);
wpcf7cf_timeout = setTimeout(function() {
window.wpcf7cf.updateMultistepState(form.multistep);
form.displayFields();
}, wpcf7cf_change_time_ms);
});
Expand Down Expand Up @@ -914,8 +915,10 @@ <h1 class="page-title">Source: scripts_es6.js</h1>
multistep.$btn_next.on('click.wpcf7cf_step', async function() {

multistep.$btn_next.addClass('disabled').attr('disabled', true);

multistep.form.$form.addClass('submitting');
var result = await multistep.validateStep(multistep.currentStep);
multistep.form.$form.removeClass('submitting');

if (result === 'success') {
multistep.moveToStep(multistep.currentStep+1);
}
Expand Down Expand Up @@ -1229,8 +1232,6 @@ <h1 class="page-title">Source: scripts_es6.js</h1>

const val = type === 'step' ? [currentNode.dataset.id.substring(5)] : [];

const parentGroup = 'parent-group';

const suffix = nameWithoutBrackets.replace(originalNameWithoutBrackets, '');

if (!simplified_dom[name]) {
Expand Down Expand Up @@ -1284,12 +1285,14 @@ <h1 class="page-title">Source: scripts_es6.js</h1>

// replace next button with submit button on last step.
// TODO: make this depend on a setting
var $submit_button = multistep.form.$form.find('input[type="submit"]').eq(0);
var $ajax_loader = multistep.form.$form.find('.ajax-loader').eq(0);
var $submit_button = multistep.form.$form.find('input[type="submit"]:last').eq(0);
var $ajax_loader = multistep.form.$form.find('.wpcf7-spinner').eq(0);

$submit_button.detach().prependTo(multistep.$btn_next.parent());
$ajax_loader.detach().prependTo(multistep.$btn_next.parent());

if (multistep.currentStep == multistep.numSteps) {
multistep.$btn_next.hide();
$ajax_loader.detach().appendTo(multistep.$btn_next.parent());
$submit_button.detach().appendTo(multistep.$btn_next.parent());
$submit_button.show();
} else {
$submit_button.hide();
Expand Down Expand Up @@ -1584,7 +1587,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="wpcf7c
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Wed Feb 23 2022 11:10:35 GMT+0100 (Midden-Europese standaardtijd)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon Apr 18 2022 23:26:26 GMT+0200 (Midden-Europese zomertijd)
</footer>

<script> prettyPrint(); </script>
Expand Down
18 changes: 9 additions & 9 deletions jsdoc-out/wpcf7cf.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2>wpcf7cf</h2>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1051">line 1051</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1054">line 1054</a>
</li></ul></dd>


Expand Down Expand Up @@ -236,7 +236,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1501">line 1501</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1504">line 1504</a>
</li></ul></dd>


Expand Down Expand Up @@ -399,7 +399,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1512">line 1512</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1515">line 1515</a>
</li></ul></dd>


Expand Down Expand Up @@ -562,7 +562,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1433">line 1433</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1436">line 1436</a>
</li></ul></dd>


Expand Down Expand Up @@ -748,7 +748,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1453">line 1453</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1456">line 1456</a>
</li></ul></dd>


Expand Down Expand Up @@ -934,7 +934,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1477">line 1477</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1480">line 1480</a>
</li></ul></dd>


Expand Down Expand Up @@ -1120,7 +1120,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1465">line 1465</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1468">line 1468</a>
</li></ul></dd>


Expand Down Expand Up @@ -1307,7 +1307,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1490">line 1490</a>
<a href="scripts_es6.js.html">scripts_es6.js</a>, <a href="scripts_es6.js.html#line1493">line 1493</a>
</li></ul></dd>


Expand Down Expand Up @@ -1359,7 +1359,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="wpcf7c
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Wed Feb 23 2022 11:10:36 GMT+0100 (Midden-Europese standaardtijd)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon Apr 18 2022 23:26:26 GMT+0200 (Midden-Europese zomertijd)
</footer>

<script> prettyPrint(); </script>
Expand Down
11 changes: 9 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Author: Jules Colle
Website: http://bdwm.be
Tags: wordpress, contact form 7, forms, conditional fields
Requires at least: 5.0
Tested up to: 5.9
Stable tag: 2.1.2
Tested up to: 5.9.3
Stable tag: 2.1.3
Requires PHP: 7.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -123,6 +123,13 @@ Make sure to also update CF7 to the latest version! (Version 2.0 is only compati

== Changelog ==

= 2.1.3 (2022-04-18) =
* check for user_cap 'wpcf7_edit_contact_forms' instead of 'wpcf7_edit_contact_form' in several places. Thanks, [@paybox](https://wordpress.org/support/topic/some-notices-appearing-fix-suggested/)!
* PRO multistep: make "Next step" and "Previous step" buttons translatable by third party plugins like wpml and loco translate.
* PRO multistep: show spinner while validating a step.
* PRO Fix additional disable_on_hide bug with multistep [GH issue 87-4](https://github.com/pwkip/contact-form-7-conditional-fields/issues/87)
* Replace all occurences of text domain 'contact-form-7' with 'cf7-conditional-fields'

= 2.1.2 (2022-02-23) =
* Fully tested with Contact Form 7 version 5.5.6

Expand Down
2 changes: 1 addition & 1 deletion wpcf7cf-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function wpcf7cf_input_select($slug, $args) {
add_action('admin_init', 'wpcf7cf_admin_init');
function wpcf7cf_admin_init(){

if(isset($_POST['reset']) && current_user_can( 'wpcf7_edit_contact_form' ) ) {
if(isset($_POST['reset']) && current_user_can( 'wpcf7_edit_contact_forms' ) ) {
wpcf7cf_reset_options();
}

Expand Down

0 comments on commit 5b3cb5c

Please sign in to comment.