Calculated Fields Form - Version 1.1.123

Version Description

  • Implements two new operations CFFCOUNTIF and CFFFILTER.
  • Fixes a minor issue in the advanced equations editor.
  • Prevents involuntary endless loop using operands with |n modifier.
  • Prevents third-party plugins affecting the redirection to the thank you page (Professional, Developer and Platinum distributions).
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Calculated Fields Form
Version 1.1.123
Comparing to
See all releases

Code changes from version 1.1.122 to 1.1.123

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: codepeople
3
  Donate link: http://cff.dwbooster.com
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
- Tested up to: 6.0
7
- Stable tag: 1.1.122
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -965,6 +965,13 @@ A: Please, follow the steps below:
965
 
966
  == Changelog ==
967
 
 
 
 
 
 
 
 
968
  = 1.1.122 =
969
 
970
  * Loads the font files locally instead of Google Fonts.
@@ -1012,9 +1019,4 @@ A: Please, follow the steps below:
1012
 
1013
  = 1.1.114 =
1014
 
1015
- * Fixes a parser error when opening the public form right after importing it from the forms library.
1016
-
1017
- = 1.1.113 =
1018
-
1019
- * Modifies the setChoices method in radio buttons, checkbox, and dropdown fields.
1020
- * Modifies the GOTOPAGE operation.
3
  Donate link: http://cff.dwbooster.com
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
+ Tested up to: 6.1
7
+ Stable tag: 1.1.123
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
965
 
966
  == Changelog ==
967
 
968
+ = 1.1.123 =
969
+
970
+ * Implements two new operations CFFCOUNTIF and CFFFILTER.
971
+ * Fixes a minor issue in the advanced equations editor.
972
+ * Prevents involuntary endless loop using operands with |n modifier.
973
+ * Prevents third-party plugins affecting the redirection to the thank you page (Professional, Developer and Platinum distributions).
974
+
975
  = 1.1.122 =
976
 
977
  * Loads the font files locally instead of Google Fonts.
1019
 
1020
  = 1.1.114 =
1021
 
1022
+ * Fixes a parser error when opening the public form right after importing it from the forms library.
 
 
 
 
 
changelog.txt CHANGED
@@ -1,5 +1,12 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
3
  = 1.1.122 =
4
 
5
  * Loads the font files locally instead of Google Fonts.
1
  == Changelog ==
2
 
3
+ = 1.1.123 =
4
+
5
+ * Implements two new operations CFFCOUNTIF and CFFFILTER.
6
+ * Fixes a minor issue in the advanced equations editor.
7
+ * Prevents involuntary endless loop using operands with |n modifier.
8
+ * Prevents third-party plugins affecting the redirection to the thank you page (Professional, Developer and Platinum distributions).
9
+
10
  = 1.1.122 =
11
 
12
  * Loads the font files locally instead of Google Fonts.
cp_calculatedfieldsf_free.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
- Version: 1.1.122
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
@@ -15,7 +15,7 @@ if ( ! defined( 'WP_DEBUG' ) || true != WP_DEBUG ) {
15
  }
16
 
17
  // Defining main constants
18
- define( 'CP_CALCULATEDFIELDSF_VERSION', '1.1.122' );
19
  define( 'CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
20
  define( 'CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
21
  define( 'CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
+ Version: 1.1.123
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
15
  }
16
 
17
  // Defining main constants
18
+ define( 'CP_CALCULATEDFIELDSF_VERSION', '1.1.123' );
19
  define( 'CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
20
  define( 'CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
21
  define( 'CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
js/fbuilder-pro-public.jquery.js CHANGED
@@ -1,4 +1,4 @@
1
- $.fbuilder['version'] = '1.1.122';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
1
+ $.fbuilder['version'] = '1.1.123';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
js/fields-admin/fbuilder.fcalculated.js CHANGED
@@ -34,7 +34,8 @@
34
  {
35
  delete(this['eq_factored']);
36
  delete(this['items']);
37
- cff_form_fields_list = {}; /* Global variable to allows the integration with the Advanced Editor */
 
38
  },
39
  display:function()
40
  {
34
  {
35
  delete(this['eq_factored']);
36
  delete(this['items']);
37
+ /* Global variable to allows the integration with the Advanced Editor */
38
+ if(typeof cff_form_fields_list == 'undefined') cff_form_fields_list = {};
39
  },
40
  display:function()
41
  {
js/fields-public/fbuilder.fcalculated.js CHANGED
@@ -377,6 +377,7 @@
377
  /* conf attribute only for compatibility */
378
  equationObj = {'result':fieldObj.name, 'resultField':fieldObj, 'equation':equation, 'conf':fieldObj.configuration(), 'dep':dependencies, 'identifier':form_identifier};
379
  form.equations.splice(i, 0, equationObj);
 
380
  while (match = regexp.exec(equation))
381
  {
382
  field = $.fbuilder['forms'][form_identifier].getItem(match[1]+form_identifier);
377
  /* conf attribute only for compatibility */
378
  equationObj = {'result':fieldObj.name, 'resultField':fieldObj, 'equation':equation, 'conf':fieldObj.configuration(), 'dep':dependencies, 'identifier':form_identifier};
379
  form.equations.splice(i, 0, equationObj);
380
+ equation = equation.replace(/fieldname\d+_\d+\|n\b/g, '');
381
  while (match = regexp.exec(equation))
382
  {
383
  field = $.fbuilder['forms'][form_identifier].getItem(match[1]+form_identifier);
js/modules/01_mathematical_logical/admin/module_admin.js CHANGED
@@ -72,7 +72,9 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
72
  { "value" : "AND", "code" : "AND(", "tip" : "Checks whether all arguments are true, and return true if all values are true. <strong>AND(logical1,logical2,...)</strong>" },
73
  { "value" : "OR", "code" : "OR(", "tip" : "Checks whether any of arguments are true. Returns false only if all arguments are false. <strong>OR(logical1,logical2,...)</strong>" },
74
  { "value" : "NOT", "code" : "NOT(", "tip" : "Changes false to true, or true to false. <strong>NOT(logical)</strong>" },
75
- { "value" : "IN", "code" : "IN(", "tip" : "Checks whether the term is included in the second argument, the second argument may be a string or strings array. <strong>IN(term, string/array)</strong>" }
 
 
76
  ]
77
  },
78
 
72
  { "value" : "AND", "code" : "AND(", "tip" : "Checks whether all arguments are true, and return true if all values are true. <strong>AND(logical1,logical2,...)</strong>" },
73
  { "value" : "OR", "code" : "OR(", "tip" : "Checks whether any of arguments are true. Returns false only if all arguments are false. <strong>OR(logical1,logical2,...)</strong>" },
74
  { "value" : "NOT", "code" : "NOT(", "tip" : "Changes false to true, or true to false. <strong>NOT(logical)</strong>" },
75
+ { "value" : "IN", "code" : "IN(", "tip" : "Checks whether the term is included in the second argument, the second argument may be a string or strings array. <strong>IN(term, string/array)</strong>" },
76
+ { "value" : "CFFCOUNTIF", "code" : "CFFCOUNTIF(", "tip" : "<p>Counts the elements of the array that are equal to the term. <strong>CFFCOUNTIF(array, term)</strong></p><p>Ex. <strong>CFFCOUNTIF([5,10,5,7], 5)</strong><br>returns <strong>2</strong></p><p>The term can be a callback function that returns a boolean.</p><p>Ex. CFFCOUNTIF([5,10,5,7], <strong>function(x){ return x == 5;}</strong>)</p>" },
77
+ { "value" : "CFFFILTER", "code" : "CFFFILTER(", "tip" : "<p>Returns the subset of elements in the array that satisfies the callback. The callback function receives a parameter and returns a boolean. <strong>CFFFILTER(array, callback)</strong></p><p>Ex. <strong>CFFFILTER([5,10,5,7], function(x){ return 5 < x;})</strong><br>returns <strong>[10,7]</strong></p>" }
78
  ]
79
  },
80
 
js/modules/01_mathematical_logical/public/01_logical.js CHANGED
@@ -65,7 +65,59 @@
65
  return false;
66
  };
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  root.CF_LOGICAL = lib;
70
 
71
- })(this);
65
  return false;
66
  };
67
 
68
+ if(window.CFFCOUNTIF == undefined){
69
+ window['CFFCOUNTIF'] = window['cffcountif'] = function(){
70
+ var r = 0, l = arguments.length, t, callback;
71
+ if(l) {
72
+ if(typeof arguments[l-1] == 'function') {
73
+ callback = arguments[l-1];
74
+ } else {
75
+ callback = (function(last_item){
76
+ return function(x){
77
+ return x == last_item;
78
+ };
79
+ })(arguments[l-1]);
80
+ }
81
+ l -= 1;
82
+
83
+ for(var i=0; i < l; i++)
84
+ {
85
+ if(Array.isArray(arguments[i]))
86
+ r += CFFCOUNTIF.apply(this,arguments[i].concat(callback));
87
+ else if(jQuery.isPlainObject(arguments[i]))
88
+ r += CFFCOUNTIF.apply(this,Object.values(arguments[i]).concat(callback));
89
+ else
90
+ r += callback(arguments[i]) ? 1 : 0;
91
+ }
92
+ }
93
+ return r;
94
+ };
95
+ }
96
+
97
+ if(window.CFFFILTER == undefined){
98
+ window['CFFFILTER'] = window['cfffilter'] = function(){
99
+ var r = [], l = arguments.length, t, callback = function(){return true;};
100
+ if(l) {
101
+
102
+ if(typeof arguments[l-1] == 'function') {
103
+ callback = arguments[l-1];
104
+ l -= 1;
105
+ }
106
+
107
+ for(var i=0; i < l; i++)
108
+ {
109
+ if(Array.isArray(arguments[i]))
110
+ r = r.concat(CFFFILTER.apply(this,arguments[i].concat(callback)));
111
+ else if(jQuery.isPlainObject(arguments[i]))
112
+ r = r.concat(CFFFILTER.apply(this,Object.values(arguments[i]).concat(callback)));
113
+ else if(callback(arguments[i]))
114
+ r.push(arguments[i]);
115
+ }
116
+ }
117
+ return r;
118
+ };
119
+ }
120
 
121
  root.CF_LOGICAL = lib;
122
 
123
+ })(this);