Calculated Fields Form - Version 1.1.126

Version Description

  • Modifies the equation parser.
  • Implements the CSVTOJSON operation in the file handling operations module. Allows to convert a client-side CSV file into a JSON object for use in equations.
  • Implements integration with Advanced Custom Fields as a data source in DS fields (Distributed with Developers and Platinum versions of the plugin).
  • Reimplements the CFF - DropBox add-on to support the new DropBox integration requirements (Platinum version).
Download this release

Release Info

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

Code changes from version 1.1.125 to 1.1.126

README.txt CHANGED
@@ -4,7 +4,7 @@ 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.125
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.125 =
969
 
970
  * Fixes a minor issue in the Slider, Checkbox, and number controls with spinner buttons.
@@ -1011,11 +1018,4 @@ A: Please, follow the steps below:
1011
 
1012
  * Modifies the SUM operation.
1013
  * Implements the SIGMA operation.
1014
- * Implements the CURRENTLATLNG operation in the Distance operations module (Developer and Platinum plugin versions).
1015
-
1016
- = 1.1.116 =
1017
-
1018
- * Modifies the calculated fields to reduce the number of endless loops.
1019
- * Modifies the Google Places add-on to fix a conflict with the Yoast sitemap (Platinum plugin version).
1020
- * Fixes a notice in the WebMerge add-on (Platinum plugin version).
1021
- * Minor modifications in the interface of other add-ons (Platinum plugin version).
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.126
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.126 =
969
+
970
+ * Modifies the equation parser.
971
+ * Implements the CSVTOJSON operation in the file handling operations module. Allows to convert a client-side CSV file into a JSON object for use in equations.
972
+ * Implements integration with Advanced Custom Fields as a data source in DS fields (Distributed with Developers and Platinum versions of the plugin).
973
+ * Reimplements the CFF - DropBox add-on to support the new DropBox integration requirements (Platinum version).
974
+
975
  = 1.1.125 =
976
 
977
  * Fixes a minor issue in the Slider, Checkbox, and number controls with spinner buttons.
1018
 
1019
  * Modifies the SUM operation.
1020
  * Implements the SIGMA operation.
1021
+ * Implements the CURRENTLATLNG operation in the Distance operations module (Developer and Platinum plugin versions).
 
 
 
 
 
 
 
changelog.txt CHANGED
@@ -1,5 +1,12 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
3
  = 1.1.125 =
4
 
5
  * Fixes a minor issue in the Slider, Checkbox, and number controls with spinner buttons.
1
  == Changelog ==
2
 
3
+ = 1.1.126 =
4
+
5
+ * Modifies the equation parser.
6
+ * Implements the CSVTOJSON operation in the file handling operations module. Allows to convert a client-side CSV file into a JSON object for use in equations.
7
+ * Implements integration with Advanced Custom Fields as a data source in DS fields (Distributed with Developers and Platinum versions of the plugin).
8
+ * Reimplements the CFF - DropBox add-on to support the new DropBox integration requirements (Platinum version).
9
+
10
  = 1.1.125 =
11
 
12
  * Fixes a minor issue in the Slider, Checkbox, and number controls with spinner buttons.
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.125
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.125' );
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.126
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.126' );
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 ) );
inc/cpcff_session.inc.php CHANGED
@@ -167,7 +167,7 @@ if ( ! class_exists( 'CP_SESSION' ) ) {
167
  // Special methods for registering and recovering the forms submissions
168
  public static function register_event( $eventid, $formid ) {
169
  $cp_cff_form_data = self::get_var( 'cp_cff_form_data' );
170
- if ( empty( $cp_cff_form_data ) ) {
171
  $cp_cff_form_data = array();
172
  }
173
 
167
  // Special methods for registering and recovering the forms submissions
168
  public static function register_event( $eventid, $formid ) {
169
  $cp_cff_form_data = self::get_var( 'cp_cff_form_data' );
170
+ if ( empty( $cp_cff_form_data ) || ! is_array( $cp_cff_form_data ) ) {
171
  $cp_cff_form_data = array();
172
  }
173
 
js/fbuilder-pro-public.jquery.js CHANGED
@@ -1,4 +1,4 @@
1
- $.fbuilder['version'] = '1.1.125';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
1
+ $.fbuilder['version'] = '1.1.126';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
js/fields-public/fbuilder.fcalculated.js CHANGED
@@ -377,6 +377,10 @@
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
  {
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
+
381
+ while(match = /(pdfpagesnumber|imgdimension|viewfile|csvtojson)\s*\(\s*fieldname\d+_\d+(\|n)\b/i.exec(equation)) {
382
+ equation = equation.replace(match[2], match[0].replace('|n', ''));
383
+ }
384
  equation = equation.replace(/fieldname\d+_\d+\|n\b/g, '');
385
  while (match = regexp.exec(equation))
386
  {
js/modules/09_file/admin/module_admin.js CHANGED
@@ -23,6 +23,11 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'file' ] = {
23
  "code" : "VIEWFILE(",
24
  "tip" : "<p>Displays the files into a tag. Pass the &quot;Upload File&quot; field name or the numeric component of the field name and the tag id where display the files. <br><br> Ex. <strong>VIEWFILE(fieldname123|n, &quot;tag-id&quot;);</strong> or <strong>VIEWFILE(123, &quot;tag-id&quot;);</strong><br><br>If the Upload File field accepts multiple files, the operation will include multiple viewers.</p>"
25
  },
 
 
 
 
 
26
 
27
  ]
28
  }
23
  "code" : "VIEWFILE(",
24
  "tip" : "<p>Displays the files into a tag. Pass the &quot;Upload File&quot; field name or the numeric component of the field name and the tag id where display the files. <br><br> Ex. <strong>VIEWFILE(fieldname123|n, &quot;tag-id&quot;);</strong> or <strong>VIEWFILE(123, &quot;tag-id&quot;);</strong><br><br>If the Upload File field accepts multiple files, the operation will include multiple viewers.</p>"
25
  },
26
+ {
27
+ "value" : "CSVTOJSON",
28
+ "code" : "CSVTOJSON(",
29
+ "tip" : "<p>Takes the client CSV file and converts it into a JSON object you can use with the equations and DS fields.</p><p>CSVTOJSON(field name, arguments(optional))</p><p>Pass the &quot;Upload File&quot; field name or the numeric component of the field name and the arguments object with CSV attributes like, headline (the CSV file includes headline or not), delimiter (the columns delimiter symbol, uses comma by default), quote (the quote symblo to enclose text columns, uses double-quote by default). </p><p>Ex. <strong>CSVTOJSON(fieldname123|n);</strong><br><br><strong> CSVTOJSON(123);</strong><br><br><strong>CSVTOJSON(fieldname123|n,{headline:1,delimiter:&quot;,&quot;});</strong></p>"
30
+ },
31
 
32
  ]
33
  }
js/modules/09_file/public/01_file.js CHANGED
@@ -183,6 +183,100 @@
183
  }
184
  }
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  root.CF_FILE = lib;
187
 
188
  })(this);
183
  }
184
  }
185
 
186
+ // CSVTOJSON(fieldname, args, form) the ards, and form parameter are optional
187
+ lib.CSVTOJSON = lib.csvtojson = function(fieldname, args, form){
188
+ function parseLine(line) {
189
+ var flag = false, parts = [], cell = '';
190
+ for(var i = 0, h = line.length; i < h; i++){
191
+ if(line[i] == args['quote']) {
192
+ if(!flag && (i==0 || line[i-1] != '\\')) flag = true;
193
+ else if(flag && line[i-1] != '\\') flag = false;
194
+ } else if(line[i] == args['delimiter'] && !flag){
195
+ parts.push(cell);
196
+ cell = '';
197
+ continue;
198
+ }
199
+ cell += line[i];
200
+ }
201
+ parts.push(cell);
202
+ return parts;
203
+ };
204
+
205
+ var field = _getField(fieldname, form),
206
+ counter = 0,
207
+ result = null,
208
+ files;
209
+
210
+ if(field)
211
+ {
212
+ if(field.multiple) result = [];
213
+
214
+ if(typeof args == 'undefined' || args === null) args = {};
215
+ if(!('headline' in args)) args['headline'] = false;
216
+ if(!('delimiter' in args)) args['delimiter'] = ',';
217
+ if(!('quote' in args)) args['quote'] = '"';
218
+
219
+ files = field.val(true);
220
+ counter = files.length;
221
+ if(counter)
222
+ {
223
+ index = 'CSVTOJSON:'+field.val();
224
+ if(index in lib.records)
225
+ {
226
+ result = lib.records[index];
227
+ /*delete lib.records[index];*/
228
+ }
229
+ else
230
+ {
231
+ for(var i in files)
232
+ {
233
+ if(typeof files[i] == 'object' && files[i].type.match(/csv.*/i))
234
+ {
235
+ var reader = new FileReader();
236
+ reader.onloadend = (function(eq, index, multiple){
237
+ return function(evt){
238
+ var reader = evt.target;
239
+ try{
240
+ var csv = reader.result,
241
+ json = [],
242
+ lines = csv.split(/[\r\n]+/),
243
+ line,
244
+ headers,
245
+ obj;
246
+ for( var i = 0, h = lines.length; i < h; i++) {
247
+ if(!lines[i].length) continue;
248
+ if(args['headline'] && typeof headers == 'undefined') {
249
+ headers = parseLine(lines[i]);
250
+ } else {
251
+ obj = {};
252
+ line = parseLine(lines[i]);
253
+ for (var j = 0, k = line.length; j < k; j++) {
254
+ obj[ (typeof headers != 'undefined') ? headers[j] : j ] = line[j];
255
+ }
256
+ json.push(JSON.parse(JSON.stringify(obj)));
257
+ }
258
+ }
259
+
260
+ if(multiple) result.push(json);
261
+ else result = json;
262
+ } catch (err) {}
263
+ counter--;
264
+ if(counter == 0)
265
+ {
266
+ lib.records[index] = result;
267
+ eval_equation(eq);
268
+ }
269
+ };
270
+ })($.fbuilder['currentEq'], index, field.multiple)
271
+ reader.readAsBinaryString(files[i]);
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+ return result;
278
+ };
279
+
280
  root.CF_FILE = lib;
281
 
282
  })(this);
languages/calculated-fields-form-en_US.mo CHANGED
Binary file
languages/calculated-fields-form-en_US.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: \n"
4
- "POT-Creation-Date: 2022-09-12 12:19+0200\n"
5
- "PO-Revision-Date: 2022-09-12 12:19+0200\n"
6
  "Last-Translator: CodePeople\n"
7
  "Language-Team: \n"
8
  "Language: en_US\n"
@@ -10,7 +10,7 @@ msgstr ""
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
- "X-Generator: Poedit 3.1.1\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
16
  "X-Poedit-SearchPath-0: .\n"
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: \n"
4
+ "POT-Creation-Date: 2022-11-09 16:17+0100\n"
5
+ "PO-Revision-Date: 2022-11-09 16:17+0100\n"
6
  "Last-Translator: CodePeople\n"
7
  "Language-Team: \n"
8
  "Language: en_US\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
13
+ "X-Generator: Poedit 3.2\n"
14
  "X-Poedit-Basepath: ..\n"
15
  "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
16
  "X-Poedit-SearchPath-0: .\n"