Calculated Fields Form - Version 1.0.318

Version Description

  • Modifies the Advanced Equations module.
  • Improves the performance of DS fields (Developer and Platinum versions of the plugin).
  • Modifies the WooCommerce add-on to include the form in the products' pages, even if the products' prices were left in blank in the WooCommerce settings (Developer and Platinum versions of the plugin).
  • Modifies the RedSys add-on to prevent the payments fail if the "Product name" attribute was left in blank in the form's settings (Platinum version of the plugin).
Download this release

Release Info

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

Code changes from version 1.0.306 to 1.0.318

Files changed (33) hide show
  1. README.txt +49 -33
  2. captcha/captcha.php +35 -14
  3. changelog.txt +68 -0
  4. cp_calculatedfieldsf_free.php +2 -2
  5. css/style.css +1 -1
  6. inc/cpcff_amp.inc.php +9 -2
  7. inc/cpcff_main.inc.php +4 -1
  8. inc/cpcff_page_builders.inc.php +46 -2
  9. js/fbuilder-pro-admin.jquery.js +1 -1
  10. js/fbuilder-pro-public.jquery.js +6 -2
  11. js/fields-admin/fbuilder.fcalculated.js +7 -5
  12. js/fields-public/02_fbuilder.fnumber.js +1 -1
  13. js/fields-public/02_fbuilder.fslider.js +6 -9
  14. js/fields-public/04_fbuilder.fdate.js +34 -27
  15. js/fields-public/09_fbuilder.ffile.js +6 -14
  16. js/fields-public/fbuilder.fcalculated.js +8 -2
  17. js/modules/06_connector/public/01_connector.js +1 -1
  18. pagebuilders/beaverbuilder/{cff.inc.php → cff/cff.inc.php} +3 -3
  19. pagebuilders/beaverbuilder/cff/{beaver.pb.php → cff/cff.php} +4 -2
  20. pagebuilders/beaverbuilder/cff/{includes → cff/includes}/frontend.php +3 -3
  21. pagebuilders/beaverbuilder/cff/cff/js/settings.js +13 -0
  22. pagebuilders/beaverbuilder/cffvar/cffvar.inc.php +38 -0
  23. pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php +20 -0
  24. pagebuilders/beaverbuilder/cffvar/cffvar/css/cffvar.css +1 -0
  25. pagebuilders/beaverbuilder/cffvar/cffvar/includes/frontend.php +17 -0
  26. pagebuilders/elementor/elementor.pb.php +4 -4
  27. pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php +4 -4
  28. pagebuilders/siteorigin/siteorigin-cpcff/siteorigin-cpcff.php +1 -1
  29. pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php +2 -2
  30. pagebuilders/visualcomposer/CFFForm/CFFForm/public/cff-preview.png +0 -0
  31. pagebuilders/visualcomposer/CFFForm/CFFForm/public/cff-thumbnail.png +0 -0
  32. pagebuilders/visualcomposer/CFFForm/manifest.json +19 -0
  33. pagebuilders/visualcomposer/CFFForm/public/dist/element.bundle.js +83 -0
README.txt CHANGED
@@ -55,6 +55,7 @@ The "Calculated Fields Form" plugin allows the specific integration with the fol
55
  * Elementor.
56
  * Page Builder by SiteOrigin.
57
  * Beaver Builder.
 
58
  * For other editors, the shortcodes should be inserted using other controls of general purpose, like the controls for inserting HTML or shortcodes.
59
 
60
  = Latest Features Added =
@@ -904,63 +905,78 @@ This way the special characters should show correctly.
904
  4. Inserting the form using Elementor
905
  5. Inserting the form using Page Builder by SiteOrigin
906
  6. Inserting the form using Beaver Builder
907
- 7. Sample calculated form
908
- 8. Calculated field settings
909
- 9. Advanced equations editor
910
- 10. Calculator Form builder
911
- 11. Editing general fields
912
- 12. Available designs
913
- 13. Add-ons section
914
- 14. WooCommerce add-on
915
- 15. SalesForce add-on
916
- 16. WebHook add-on, and its integration with Zapier
 
917
 
918
  == Changelog ==
919
 
920
- = 1.0.306 =
921
 
922
- * Modifies the autocomplete module to include the requirements of latest versions of browsers.
923
- * Modifies the slider control to circumvent some errors caused by invalid values entered by the form creator.
924
- * Includes the Chart.js operations module to integrate ChartJS in the form (Developer and Platinum versions of the plugin)
 
925
 
926
- = 1.0.305 =
927
 
928
- * Includes the 'Connecting with thirds' module, with the cffProxy operation that allows the use of third party functions in the equations.
 
929
 
930
- = 1.0.304 =
931
 
932
- * Fixes an issue in the module that associates fields.
 
 
 
 
 
 
933
 
934
- = 1.0.303 =
935
 
936
- * Includes a specific module to allow the integration with Beaver Builder.
 
937
 
938
- = 1.0.302 =
939
 
940
- * Fixes an issue where the error message overlap the acceptance control when the validation rule fails in the submit action.
 
941
 
942
- = 1.0.301 =
943
 
944
- * Modifies the revisions module. The current update increases the number of revisions per form to 20, where the older are removed from the database. Furthermore, it is possible to generate the revisions even pressing the preview button.
 
 
945
 
946
- = 1.0.300 =
947
 
948
- * Improves the code that creates the relationship between the fields' attributes and other fields in the form, furthermore, fixes some issues between this relationships and the dependencies.
949
 
950
- = 1.0.299 =
951
 
952
- * Modifies the Number and Currency controls allowing enter the name of other fields as the MAX and MIN attributes to define a relationship between the fields.
 
 
953
 
954
- = 1.0.298 =
955
 
956
- * Fixes an issue applying the stringify to the JSON object of form's structure.
957
 
958
- = 1.0.297 =
959
 
960
- * Includes the integration with an advanced equations editor.
961
 
962
  == Upgrade Notice ==
963
 
964
- = 1.0.306 =
965
 
966
  Important note: If you are using the Professional version don't update via the WP dashboard but using your personal update link. Contact us if you need further information: http://cff.dwbooster.com/contact-us
55
  * Elementor.
56
  * Page Builder by SiteOrigin.
57
  * Beaver Builder.
58
+ * Visual Composer.
59
  * For other editors, the shortcodes should be inserted using other controls of general purpose, like the controls for inserting HTML or shortcodes.
60
 
61
  = Latest Features Added =
905
  4. Inserting the form using Elementor
906
  5. Inserting the form using Page Builder by SiteOrigin
907
  6. Inserting the form using Beaver Builder
908
+ 7. Inserting the form using Visual Composer
909
+ 8. Sample calculated form
910
+ 9. Calculated field settings
911
+ 10. Advanced equations editor
912
+ 11. Calculator Form builder
913
+ 12. Editing general fields
914
+ 13. Available designs
915
+ 14. Add-ons section
916
+ 15. WooCommerce add-on
917
+ 16. SalesForce add-on
918
+ 17. WebHook add-on, and its integration with Zapier
919
 
920
  == Changelog ==
921
 
922
+ = 1.0.318 =
923
 
924
+ * Modifies the Advanced Equations module.
925
+ * Improves the performance of DS fields (Developer and Platinum versions of the plugin).
926
+ * Modifies the WooCommerce add-on to include the form in the products' pages, even if the products' prices were left in blank in the WooCommerce settings (Developer and Platinum versions of the plugin).
927
+ * Modifies the RedSys add-on to prevent the payments fail if the "Product name" attribute was left in blank in the form's settings (Platinum version of the plugin).
928
 
929
+ = 1.0.317 =
930
 
931
+ * Modifies the Upload File field.
932
+ * Modifies the Users Permissions add-on to prevent the files uploaded previously being lost when the uses edit their submissions.
933
 
934
+ = 1.0.316 =
935
 
936
+ * Fixes a conflict with other plugins that use the forms builder.
937
+ * Fixes an issue between the module that pre-fills the form's fields and the dependencies.
938
+ * Includes the "callback" attribute in the fields tags, allowing to apply escape functions before the tags' replacement (Professional, Developer and Platinum versions of the plugin).
939
+ * Implements the "STRAIGHT" mode in the "DISTANCE" operation to determine the straight line distance between addresses (Developer and Platinum versions of the plugin).
940
+ * Implements the attribute: events_per_page into the [CP_CALCULATED_FIELDS_RESULT_LIST] shortcode to allow paginate the submissions lists (Professional, Developer and Platinum versions of the plugin).
941
+ * Implements the attribute: events_per_page into the [CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST] shortcode of the Users Permissions add-on for controlling the number of items per page (Developer and Platinum versions of the plugin).
942
+ * Allows to insert the [CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST] shortcode with the format: [CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST] content [/CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST]. In this way the content takes precedence over the "Summary" attribute in the form's settings (Developer and Platinum versions of the plugin).
943
 
944
+ = 1.0.315 =
945
 
946
+ * Fixes some minor issues.
947
+ * Implements a specific element to insert the forms using Visual Composer.
948
 
949
+ = 1.0.314 =
950
 
951
+ * Fixes an issue with the tooltips in multi-pages forms.
952
+ * Fixes an issue assigning the default values in the Date/Time fields, specifically populating the time component.
953
 
954
+ = 1.0.313 =
955
 
956
+ * Improves the integration with the different pages builders: Gutenberg, SiteOrigin, Beaver Page Builder, Elementor.
957
+ * Includes a new module in the Beaver Page Builder for generating the javascript variables.
958
+ * Fixes an issue in the PrintFriendly add-on when there are multiple notification emails (Platinum version of the plugin).
959
 
960
+ = 1.0.312 =
961
 
962
+ * Modifies the module that generates the Captcha.
963
 
964
+ = 1.0.311 =
965
 
966
+ * Improves the generated form reducing its code.
967
+ * Fixes an common issue caused by the users that enter comma signs as separator of class names in the 'Add Custom Coding Keywords' attributes of fields settings.
968
+ * Fixes an issue in the signature add-on. It was hiding the signature when the submission is being edited by the 'Users Permissions' add-on.
969
 
970
+ = 1.0.310 =
971
 
972
+ * Fixes a conflict between the Forms Preview module and some popular themes.
973
 
974
+ = 1.0.309 =
975
 
976
+ * Modifies the number and slider controls to allow entering the blank character as the thousands separator.
977
 
978
  == Upgrade Notice ==
979
 
980
+ = 1.0.318 =
981
 
982
  Important note: If you are using the Professional version don't update via the WP dashboard but using your personal update link. Contact us if you need further information: http://cff.dwbooster.com/contact-us
captcha/captcha.php CHANGED
@@ -3,7 +3,7 @@
3
  PHP Captcha by Codepeople.net
4
  http://www.codepeople.net
5
  */
6
-
7
  if(!defined('WP_DEBUG') || true != WP_DEBUG)
8
  {
9
  error_reporting(E_ERROR|E_PARSE);
@@ -11,6 +11,15 @@ if(!defined('WP_DEBUG') || true != WP_DEBUG)
11
 
12
  ob_clean();
13
 
 
 
 
 
 
 
 
 
 
14
  if( !class_exists( 'CP_SESSION' ) && session_id() == '' ) session_start();
15
 
16
  if (!isset($_GET["ps"])) $_GET["ps"] = '';
@@ -54,14 +63,14 @@ if ($_GET["bcolor"] == '') $_GET["bcolor"] = "FFFFFF";
54
  if ($_GET["border"] == '') $_GET["border"] = "000000";
55
 
56
  //configuration
57
- $imgX = $_GET["width"];
58
- $imgY = $_GET["height"];
59
-
60
- $letter_count = $_GET["letter_count"];
61
- $min_size = $_GET["min_size"];
62
- $max_size = $_GET["max_size"];
63
- $noise = $_GET["noise"];
64
- $noiselength = $_GET["noiselength"];
65
  $bcolor = cpcff_decodeColor($_GET["bcolor"]);
66
  $border = cpcff_decodeColor($_GET["border"]);
67
 
@@ -70,7 +79,6 @@ $random_noise_color= true;
70
  $tcolor = cpcff_decodeColor("666666");
71
  $random_text_color= true;
72
 
73
-
74
  header("Cache-Control: no-store, no-cache, must-revalidate");
75
  header("Pragma: no-cache");
76
 
@@ -103,8 +111,8 @@ for ($i = 0; $i < $letter_count; $i++) {
103
  $str .= chr(mt_rand(97, 122))." ";
104
  }
105
 
106
- if( class_exists( 'CP_SESSION' ) ) CP_SESSION::set_var('rand_code'.$_GET["ps"], str_replace(" ", "", $str));
107
- else $_SESSION['rand_code'.$_GET["ps"] ] = str_replace(" ", "", $str);
108
 
109
  $image = imagecreatetruecolor($imgX, $imgY);
110
  $backgr_col = imagecolorallocate($image, $bcolor["r"],$bcolor["g"],$bcolor["b"]);
@@ -134,8 +142,21 @@ for ($i=0;$i<$noise;$i++)
134
  imageline ( $image, $x1, $y1, mt_rand($x1-$noiselength,$x1+$noiselength), mt_rand($y1-$noiselength,$y1+$noiselength), $color);
135
  }
136
 
137
- $font = dirname( __FILE__ ) . "/font-1.ttf"; // font
138
- if ($_GET["font"]) $font = dirname( __FILE__ ) . "/".$_GET["font"];
 
 
 
 
 
 
 
 
 
 
 
 
 
139
 
140
  // Removed @2x, the patch fixes an issue caused by other plugin that includes the @2x in the name of font files.
141
  $font = str_replace( array("\\", "@2x"), array("/", ""), $font );
3
  PHP Captcha by Codepeople.net
4
  http://www.codepeople.net
5
  */
6
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
7
  if(!defined('WP_DEBUG') || true != WP_DEBUG)
8
  {
9
  error_reporting(E_ERROR|E_PARSE);
11
 
12
  ob_clean();
13
 
14
+ if(!function_exists('cff_captcha_sanitize_key'))
15
+ {
16
+ function cff_captcha_sanitize_key( $key ) {
17
+ $key = strtolower( $key );
18
+ $key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
19
+ return $key;
20
+ }
21
+ }
22
+
23
  if( !class_exists( 'CP_SESSION' ) && session_id() == '' ) session_start();
24
 
25
  if (!isset($_GET["ps"])) $_GET["ps"] = '';
63
  if ($_GET["border"] == '') $_GET["border"] = "000000";
64
 
65
  //configuration
66
+ $imgX = ( isset($_GET["width"]) && is_numeric( $_GET["width"] ) )? $_GET["width"] : "180" ;
67
+ $imgY = ( isset($_GET["height"]) && is_numeric( $_GET["height"] ) )? $_GET["height"] : "60" ;
68
+
69
+ $letter_count = ( isset($_GET["letter_count"]) && is_numeric( $_GET["letter_count"] ) )? $_GET["letter_count"] : "5";
70
+ $min_size = ( isset($_GET["min_size"]) && is_numeric( $_GET["min_size"] ) )? $_GET["min_size"] : "35";
71
+ $max_size = ( isset($_GET["max_size"]) && is_numeric( $_GET["max_size"] ) )? $_GET["max_size"] : "45";
72
+ $noise = ( isset($_GET["noise"]) && is_numeric( $_GET["noise"] ) )? $_GET["noise"] : "200";
73
+ $noiselength = ( isset($_GET["noiselength"]) && is_numeric( $_GET["noiselength"] ) )? $_GET["noiselength"] : "5";
74
  $bcolor = cpcff_decodeColor($_GET["bcolor"]);
75
  $border = cpcff_decodeColor($_GET["border"]);
76
 
79
  $tcolor = cpcff_decodeColor("666666");
80
  $random_text_color= true;
81
 
 
82
  header("Cache-Control: no-store, no-cache, must-revalidate");
83
  header("Pragma: no-cache");
84
 
111
  $str .= chr(mt_rand(97, 122))." ";
112
  }
113
 
114
+ if( class_exists( 'CP_SESSION' ) ) CP_SESSION::set_var('rand_code'.cff_captcha_sanitize_key($_GET["ps"]), str_replace(" ", "", $str));
115
+ else $_SESSION['rand_code'.cff_captcha_sanitize_key($_GET["ps"]) ] = str_replace(" ", "", $str);
116
 
117
  $image = imagecreatetruecolor($imgX, $imgY);
118
  $backgr_col = imagecolorallocate($image, $bcolor["r"],$bcolor["g"],$bcolor["b"]);
142
  imageline ( $image, $x1, $y1, mt_rand($x1-$noiselength,$x1+$noiselength), mt_rand($y1-$noiselength,$y1+$noiselength), $color);
143
  }
144
 
145
+ switch (@$_GET["font"]) {
146
+ case "font-2.ttf":
147
+ $selected_font = "font-2.ttf";
148
+ break;
149
+ case "font-3.ttf":
150
+ $selected_font = "font-3.ttf";
151
+ break;
152
+ case "font-4.ttf":
153
+ $selected_font = "font-4.ttf";
154
+ break;
155
+ default:
156
+ $selected_font = "font-1.ttf";
157
+ }
158
+
159
+ $font = dirname( __FILE__ ) . "/" . $selected_font; // font
160
 
161
  // Removed @2x, the patch fixes an issue caused by other plugin that includes the @2x in the name of font files.
162
  $font = str_replace( array("\\", "@2x"), array("/", ""), $font );
changelog.txt CHANGED
@@ -1,5 +1,73 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.306 =
4
 
5
  * Modifies the autocomplete module to include the requirements of latest versions of browsers.
1
  == Changelog ==
2
 
3
+ = 1.0.318 =
4
+
5
+ * Modifies the Advanced Equations module.
6
+ * Improves the performance of DS fields (Developer and Platinum versions of the plugin).
7
+ * Modifies the WooCommerce add-on to include the form in the products' pages, even if the products' prices were left in blank in the WooCommerce settings (Developer and Platinum versions of the plugin).
8
+ * Modifies the RedSys add-on to prevent the payments fail if the "Product name" attribute was left in blank in the form's settings (Platinum version of the plugin).
9
+
10
+ = 1.0.317 =
11
+
12
+ * Modifies the Upload File field.
13
+ * Modifies the Users Permissions add-on to prevent the files uploaded previously being lost when the uses edit their submissions.
14
+
15
+ = 1.0.316 =
16
+
17
+ * Fixes a conflict with other plugins that use the forms builder.
18
+ * Fixes an issue between the module that pre-fills the form's fields and the dependencies.
19
+ * Includes the "callback" attribute in the fields tags, allowing to apply escape functions before the tags' replacement (Professional, Developer and Platinum versions of the plugin).
20
+ * Implements the "STRAIGHT" mode in the "DISTANCE" operation to determine the straight line distance between addresses (Developer and Platinum versions of the plugin).
21
+ * Implements the attribute: events_per_page into the [CP_CALCULATED_FIELDS_RESULT_LIST] shortcode to allow paginate the submissions lists (Professional, Developer and Platinum versions of the plugin).
22
+ * Implements the attribute: events_per_page into the [CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST] shortcode of the Users Permissions add-on for controlling the number of items per page (Developer and Platinum versions of the plugin).
23
+ * Allows to insert the [CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST] shortcode with the format: [CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST] content [/CP_CALCULATED_FIELDS_USER_SUBMISSIONS_LIST]. In this way the content takes precedence over the "Summary" attribute in the form's settings (Developer and Platinum versions of the plugin).
24
+
25
+ = 1.0.315 =
26
+
27
+ * Fixes some minor issues.
28
+ * Implements a specific element to insert the forms using Visual Composer.
29
+
30
+ = 1.0.314 =
31
+
32
+ * Fixes an issue with the tooltips in multi-pages forms.
33
+ * Fixes an issue assigning the default values in the Date/Time fields, specifically populating the time component.
34
+
35
+ = 1.0.313 =
36
+
37
+ * Improves the integration with the different pages builders: Gutenberg, SiteOrigin, Beaver Page Builder, Elementor.
38
+ * Includes a new module in the Beaver Page Builder for generating the javascript variables.
39
+ * Fixes an issue in the PrintFriendly add-on when there are multiple notification emails (Platinum version of the plugin).
40
+
41
+ = 1.0.312 =
42
+
43
+ * Modifies the module that generates the Captcha.
44
+
45
+ = 1.0.311 =
46
+
47
+ * Improves the generated form reducing its code.
48
+ * Fixes an common issue caused by the users that enter comma signs as separator of class names in the 'Add Custom Coding Keywords' attributes of fields settings.
49
+ * Fixes an issue in the signature add-on. It was hiding the signature when the submission is being edited by the 'Users Permissions' add-on.
50
+
51
+ = 1.0.310 =
52
+
53
+ * Fixes a conflict between the Forms Preview module and some popular themes.
54
+
55
+ = 1.0.309 =
56
+
57
+ * Modifies the number and slider controls to allow entering the blank character as the thousands separator.
58
+
59
+ = 1.0.308 =
60
+
61
+ * Fixes an issue in the validation rules of Date/Time fields when the date component is disabled.
62
+ * Allows to preserves the 12 hours format in the summary fields (and in the notification emails and the thank you pages in the commercial versions of the plugin).
63
+ * Modifies the integration with the Gutenberg editor.
64
+ * Fixes an issue in the Date/Time operations module (Developer and Platinum versions of the plugin).
65
+
66
+ = 1.0.307 =
67
+
68
+ * Modifies the cffProxy operation for accepting not only camel-case convention, but lower can uppercase too: cffproxy and CFFPROXY.
69
+ * Modifies the MailChimp add-on to allow assigning tags the new members (Platinum version of the plugin).
70
+
71
  = 1.0.306 =
72
 
73
  * Modifies the autocomplete module to include the requirements of latest versions of browsers.
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.0.306
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
@@ -16,7 +16,7 @@ if(!defined('WP_DEBUG') || true != WP_DEBUG)
16
  }
17
 
18
  // Defining main constants
19
- define('CP_CALCULATEDFIELDSF_VERSION', '1.0.306' );
20
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
21
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
22
  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.0.318
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
16
  }
17
 
18
  // Defining main constants
19
+ define('CP_CALCULATEDFIELDSF_VERSION', '1.0.318' );
20
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
21
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
22
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
css/style.css CHANGED
@@ -199,7 +199,7 @@ a.helpfbuilder{font-size:80%;text-decoration:underline;color:#00f;cursor:pointer
199
  .cff-light-modal{display: none; position: fixed; background: transparent; top: 0; bottom: 0; left: 0; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; right: 0; z-index: 99999; transition: background 1s; font-size: 16px; visibility: hidden;}
200
  .cff-light-modal-content{background: transparent; width: 90%; height:90%; position: relative; max-height: 90%; line-height: 1.4; display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column;}
201
  .cff-light-modal-body{padding: 0; overflow: hidden; height: 100%;}
202
- .cff-light-modal-close-icon{text-decoration: none; color: #fff; padding: 0; font-size: 24px; line-height: 24px; position: absolute; top: 5px; right: 5px; cursor: pointer;}
203
  .cff-light-modal:target{background: rgba(0, 0, 0, 0.5); display: -ms-flexbox; display: flex; visibility: visible;}
204
  @keyframes cff-basic{0%{opacity: 0;}100%{opacity: 1;}}
205
  .cff-light-modal iframe{width:100%;height:100%;border-radius: .2em; overflow:hidden;}
199
  .cff-light-modal{display: none; position: fixed; background: transparent; top: 0; bottom: 0; left: 0; -ms-flex-align: center; align-items: center; -ms-flex-pack: center; justify-content: center; right: 0; z-index: 99999; transition: background 1s; font-size: 16px; visibility: hidden;}
200
  .cff-light-modal-content{background: transparent; width: 90%; height:90%; position: relative; max-height: 90%; line-height: 1.4; display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column;}
201
  .cff-light-modal-body{padding: 0; overflow: hidden; height: 100%;}
202
+ .cff-light-modal-close-icon{text-decoration: none; color: #fff; padding: 0; font-size: 18px; line-height: 24px; position: absolute; top: 5px; right: 5px; cursor: pointer;}
203
  .cff-light-modal:target{background: rgba(0, 0, 0, 0.5); display: -ms-flexbox; display: flex; visibility: visible;}
204
  @keyframes cff-basic{0%{opacity: 0;}100%{opacity: 1;}}
205
  .cff-light-modal iframe{width:100%;height:100%;border-radius: .2em; overflow:hidden;}
inc/cpcff_amp.inc.php CHANGED
@@ -99,7 +99,10 @@ if(!class_exists('CPCFF_AMP'))
99
  ob_start();
100
  if(!empty($wp_styles)) $wp_styles->do_items();
101
  if(!empty($wp_scripts)) $wp_scripts->do_items();
102
- wp_footer();
 
 
 
103
  $message .= ob_get_contents();
104
  ob_end_clean();
105
 
@@ -223,7 +226,11 @@ if(!class_exists('CPCFF_AMP'))
223
  if( $param == 'cff-form')
224
  $attrs['id'] = @intval($value);
225
  elseif(preg_match('/^cff\-form\-attr\-/i', $param))
226
- $attrs[preg_replace('/^cff\-form\-attr\-/i', '', $param)] = $value;
 
 
 
 
227
  }
228
  }
229
  return $attrs;
99
  ob_start();
100
  if(!empty($wp_styles)) $wp_styles->do_items();
101
  if(!empty($wp_scripts)) $wp_scripts->do_items();
102
+ if(class_exists('Error'))
103
+ {
104
+ try{ wp_footer(); } catch(Error $err) {}
105
+ }
106
  $message .= ob_get_contents();
107
  ob_end_clean();
108
 
226
  if( $param == 'cff-form')
227
  $attrs['id'] = @intval($value);
228
  elseif(preg_match('/^cff\-form\-attr\-/i', $param))
229
+ {
230
+ $param = preg_replace('/^cff\-form\-attr\-/i', '', $param);
231
+ $param = sanitize_text_field($param);
232
+ $attrs[$param] = sanitize_text_field($value);
233
+ }
234
  }
235
  }
236
  return $attrs;
inc/cpcff_main.inc.php CHANGED
@@ -385,7 +385,10 @@ if(!class_exists('CPCFF_MAIN'))
385
  ob_start();
386
  if(!empty($wp_styles)) $wp_styles->do_items();
387
  if(!empty($wp_scripts)) $wp_scripts->do_items();
388
- wp_footer();
 
 
 
389
  $message .= ob_get_contents();
390
  ob_end_clean();
391
  $page_title = (!empty($atts['page_title'])) ? $atts['page_title'] : '';
385
  ob_start();
386
  if(!empty($wp_styles)) $wp_styles->do_items();
387
  if(!empty($wp_scripts)) $wp_scripts->do_items();
388
+ if(class_exists('Error'))
389
+ {
390
+ try{ wp_footer(); } catch(Error $err) {}
391
+ }
392
  $message .= ob_get_contents();
393
  ob_end_clean();
394
  $page_title = (!empty($atts['page_title'])) ? $atts['page_title'] : '';
inc/cpcff_page_builders.inc.php CHANGED
@@ -8,6 +8,8 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
8
  class CPCFF_PAGE_BUILDERS
9
  {
10
  private static $_instance;
 
 
11
  private function __construct(){}
12
  private static function instance()
13
  {
@@ -28,6 +30,7 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
28
 
29
  // Gutenberg editor
30
  add_action( 'enqueue_block_editor_assets', array($instance,'gutenberg_editor' ) );
 
31
 
32
  // Elementor
33
  add_action( 'elementor/widgets/widgets_registered', array($instance, 'elementor_editor') );
@@ -36,8 +39,10 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
36
  // Beaver builder
37
  if(class_exists('FLBuilder'))
38
  {
39
- include_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cff.inc.php';
 
40
  }
 
41
  } // End init
42
 
43
  public function after_setup_theme()
@@ -47,6 +52,9 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
47
  // SiteOrigin
48
  add_filter('siteorigin_widgets_widget_folders', array($instance, 'siteorigin_widgets_collection'));
49
  add_filter('siteorigin_panels_widget_dialog_tabs', array($instance, 'siteorigin_panels_widget_dialog_tabs'));
 
 
 
50
  } // End after_setup_theme
51
 
52
  /**************************** GUTENBERG ****************************/
@@ -81,6 +89,27 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
81
  wp_localize_script('cp_calculatedfieldsf_gutenberg_editor', 'cpcff_gutenberg_editor_config', $config);
82
  } // End gutenberg_editor
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  /**************************** ELEMENTOR ****************************/
85
 
86
  public function elementor_editor_category()
@@ -95,7 +124,7 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
95
  require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/elementor/elementor.pb.php';
96
  } // End elementor_editor
97
 
98
- /**************************** ELEMENTOR ****************************/
99
 
100
  public function siteorigin_widgets_collection($folders)
101
  {
@@ -115,5 +144,20 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
115
  return $tabs;
116
  } // End siteorigin_panels_widget_dialog_tabs
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  } // End CPCFF_PAGE_BUILDERS
119
  }
8
  class CPCFF_PAGE_BUILDERS
9
  {
10
  private static $_instance;
11
+ private $wptexturize_flag = false;
12
+
13
  private function __construct(){}
14
  private static function instance()
15
  {
30
 
31
  // Gutenberg editor
32
  add_action( 'enqueue_block_editor_assets', array($instance,'gutenberg_editor' ) );
33
+ add_filter( 'render_block', array($instance, 'gutenberg_dissable_wptexturize'), 10, 2 );
34
 
35
  // Elementor
36
  add_action( 'elementor/widgets/widgets_registered', array($instance, 'elementor_editor') );
39
  // Beaver builder
40
  if(class_exists('FLBuilder'))
41
  {
42
+ include_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cff/cff.inc.php';
43
+ include_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cffvar/cffvar.inc.php';
44
  }
45
+
46
  } // End init
47
 
48
  public function after_setup_theme()
52
  // SiteOrigin
53
  add_filter('siteorigin_widgets_widget_folders', array($instance, 'siteorigin_widgets_collection'));
54
  add_filter('siteorigin_panels_widget_dialog_tabs', array($instance, 'siteorigin_panels_widget_dialog_tabs'));
55
+
56
+ // Visual Composer
57
+ add_action('vcv:api', array($instance, 'visualcomposer_editor'));
58
  } // End after_setup_theme
59
 
60
  /**************************** GUTENBERG ****************************/
89
  wp_localize_script('cp_calculatedfieldsf_gutenberg_editor', 'cpcff_gutenberg_editor_config', $config);
90
  } // End gutenberg_editor
91
 
92
+ public function gutenberg_dissable_wptexturize($block_content, $block)
93
+ {
94
+ if (
95
+ 'cpcff/form-summary-shortcode' === $block['blockName'] ||
96
+ 'cpcff/form-summary-list-shortcode' === $block['blockName']
97
+ )
98
+ {
99
+ if(has_filter( 'the_content', 'wptexturize' ))
100
+ {
101
+ $this->wptexturize_flag = true;
102
+ remove_filter('the_content', 'wptexturize');
103
+ }
104
+ }
105
+ elseif($this->wptexturize_flag && !has_filter( 'the_content', 'wptexturize' ))
106
+ {
107
+ add_filter( 'the_content', 'wpautop' );
108
+ }
109
+
110
+ return $block_content;
111
+ } // End gutenberg_dissable_wptexturize
112
+
113
  /**************************** ELEMENTOR ****************************/
114
 
115
  public function elementor_editor_category()
124
  require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/elementor/elementor.pb.php';
125
  } // End elementor_editor
126
 
127
+ /**************************** SITEORIGIN ****************************/
128
 
129
  public function siteorigin_widgets_collection($folders)
130
  {
144
  return $tabs;
145
  } // End siteorigin_panels_widget_dialog_tabs
146
 
147
+ /**************************** VISUAL COMPOSER ****************************/
148
+
149
+ public function visualcomposer_editor($api)
150
+ {
151
+ $elementsToRegister = [ 'CFFForm', ];
152
+ $pluginBaseUrl = rtrim(plugins_url('/pagebuilders/visualcomposer/', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH), '\\/');
153
+ $elementsApi = $api->elements;
154
+ foreach ($elementsToRegister as $tag)
155
+ {
156
+ $manifestPath = CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/visualcomposer/' . $tag . '/manifest.json';
157
+ $elementBaseUrl = $pluginBaseUrl . '/' . $tag;
158
+ $elementsApi->add($manifestPath, $elementBaseUrl);
159
+ }
160
+ } // End visualcomposer_editor
161
+
162
  } // End CPCFF_PAGE_BUILDERS
163
  }
js/fbuilder-pro-admin.jquery.js CHANGED
@@ -942,7 +942,7 @@
942
 
943
  $("#sCsslayout").bind("keyup", {obj: this}, function(e)
944
  {
945
- e.data.obj.csslayout = $(this).val();
946
  $.fbuilder.reloadItems( {'field': e.data.obj} );
947
  });
948
 
942
 
943
  $("#sCsslayout").bind("keyup", {obj: this}, function(e)
944
  {
945
+ e.data.obj.csslayout = $(this).val().replace(/\,/g, ' ').replace(/\s+/g, ' ');
946
  $.fbuilder.reloadItems( {'field': e.data.obj} );
947
  });
948
 
js/fbuilder-pro-public.jquery.js CHANGED
@@ -417,7 +417,7 @@
417
  },
418
  setVal:function( v )
419
  {
420
- $( "[id='" + this.name + "']" ).val( v );
421
  }
422
  });
423
 
@@ -517,7 +517,11 @@
517
  _viewportHeight = $(window).height(),
518
  _scrollTop = formObj.offset().top;
519
 
520
- if( ffocusable.length && !ffocusable.first().hasClass('hasDatepicker'))
 
 
 
 
521
  {
522
  ffocusable[0].focus();
523
  }
417
  },
418
  setVal:function( v )
419
  {
420
+ $( "[id='" + this.name + "']" ).val( v ).change();
421
  }
422
  });
423
 
517
  _viewportHeight = $(window).height(),
518
  _scrollTop = formObj.offset().top;
519
 
520
+ if(
521
+ ffocusable.length &&
522
+ !ffocusable.first().hasClass('hasDatepicker') &&
523
+ ffocusable.first().closest('[uh]').length == 0 /* FIXES AUTO-OPEN TOOLTIPS */
524
+ )
525
  {
526
  ffocusable[0].focus();
527
  }
js/fields-admin/fbuilder.fcalculated.js CHANGED
@@ -25,7 +25,9 @@
25
  hidefield:false,
26
  init:function()
27
  {
28
- if( typeof this[ 'eq_factored' ] != 'undefined' ) this[ 'eq_factored' ] = "";
 
 
29
  },
30
  display:function()
31
  {
@@ -51,13 +53,14 @@
51
  }
52
  });
53
  $(document).on('click', '.cff-light-modal-close-icon', function(){$('[id="cff-advanced-equation-editor"]').remove();});
 
54
  $("#sAdvancedEditor").bind("click", {obj: this}, function(e)
55
  {
56
  $(window).unbind('message');
57
  $(window).bind('message', function(event){$('#sEq').val(event.originalEvent.data).change();});
58
  var advEditor = '<div class="cff-light-modal" id="cff-advanced-equation-editor" role="dialog" aria-hidden="false">'+
59
  '<div class="cff-light-modal-content">'+
60
- '<a href="#" class="cff-light-modal-close-icon" aria-label="close" title="Close">&times;</a>'+
61
  '<div class="cff-light-modal-body">'+
62
  '<iframe width="560" height="315" frameborder="0" allowfullscreen scrolling="no"></iframe>'+
63
  '</div>'+
@@ -70,7 +73,7 @@
70
  function(){
71
  var args = {};
72
  args.code = e.data.obj.eq;
73
- if('items' in e.data.obj) args.fields = e.data.obj.items;
74
  if( $.fbuilder[ 'modules' ] )
75
  {
76
  args.operations = {};
@@ -352,7 +355,6 @@
352
  var items = this.fBuild.getItems(),
353
  invalidFields = { 'fSectionBreak':1, 'fPageBreak':1, 'fsummary':1, 'ffieldset':1, 'fdiv':1, 'fMedia':1, 'fButton':1, 'fhtml':1, 'ffile':1 };
354
 
355
- me.items = {}
356
  for( var i in items )
357
  {
358
  var item = items[ i ];
@@ -361,7 +363,7 @@
361
  var fName = item[ 'name' ],
362
  fTitle = item[ 'title' ];
363
 
364
- me.items[fName] = {label:fTitle, type:item.ftype};
365
 
366
  fName = fName.replace( /'/g, "\'" ).replace( /"/g, '\"' );
367
  out += '<option value="' + fName + '">'+item[ 'name' ] + ( ( item[ 'title' ] && !/^\s*$/.test( item[ 'title' ] ) ) ? '('+item[ 'title' ] + ')' : '' ) + '</option>';
25
  hidefield:false,
26
  init:function()
27
  {
28
+ delete(this['eq_factored']);
29
+ delete(this['items']);
30
+ cff_form_fields_list = {}; /* Global variable to allows the integration with the Advanced Editor */
31
  },
32
  display:function()
33
  {
53
  }
54
  });
55
  $(document).on('click', '.cff-light-modal-close-icon', function(){$('[id="cff-advanced-equation-editor"]').remove();});
56
+ $(document).on('keyup', function(e){if(e.key === 'Escape') $('.cff-light-modal-close-icon').click();});
57
  $("#sAdvancedEditor").bind("click", {obj: this}, function(e)
58
  {
59
  $(window).unbind('message');
60
  $(window).bind('message', function(event){$('#sEq').val(event.originalEvent.data).change();});
61
  var advEditor = '<div class="cff-light-modal" id="cff-advanced-equation-editor" role="dialog" aria-hidden="false">'+
62
  '<div class="cff-light-modal-content">'+
63
+ '<a href="#" class="cff-light-modal-close-icon" aria-label="close" title="Close">Save & Close</a>'+
64
  '<div class="cff-light-modal-body">'+
65
  '<iframe width="560" height="315" frameborder="0" allowfullscreen scrolling="no"></iframe>'+
66
  '</div>'+
73
  function(){
74
  var args = {};
75
  args.code = e.data.obj.eq;
76
+ args.fields = cff_form_fields_list;
77
  if( $.fbuilder[ 'modules' ] )
78
  {
79
  args.operations = {};
355
  var items = this.fBuild.getItems(),
356
  invalidFields = { 'fSectionBreak':1, 'fPageBreak':1, 'fsummary':1, 'ffieldset':1, 'fdiv':1, 'fMedia':1, 'fButton':1, 'fhtml':1, 'ffile':1 };
357
 
 
358
  for( var i in items )
359
  {
360
  var item = items[ i ];
363
  var fName = item[ 'name' ],
364
  fTitle = item[ 'title' ];
365
 
366
+ cff_form_fields_list[fName] = {label:fTitle, type:item.ftype};
367
 
368
  fName = fName.replace( /'/g, "\'" ).replace( /"/g, '\"' );
369
  out += '<option value="' + fName + '">'+item[ 'name' ] + ( ( item[ 'title' ] && !/^\s*$/.test( item[ 'title' ] ) ) ? '('+item[ 'title' ] + ')' : '' ) + '</option>';
js/fields-public/02_fbuilder.fnumber.js CHANGED
@@ -69,7 +69,7 @@
69
  },
70
  show:function()
71
  {
72
- var _type = ( this.dformat == 'digits' || ( /^\s*$/.test( this.thousandSeparator ) && /^\s*\.\s*$/.test( this.decimalSymbol ) ) ) ? 'number' : 'text';
73
 
74
  return '<div class="fields '+this.csslayout+' '+this.name+' cff-number-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+( ( !/^\s*$/.test( this.min) ) ? 'min="'+$.fbuilder.parseVal( this._getAttr('min'), this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+( ( !/^\s*$/.test(this.max) ) ? ' max="'+$.fbuilder.parseVal( this._getAttr('max'), this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+' class="field '+this.dformat+' '+this.size+((this.required)?" required":"")+'" type="'+_type+'" value="'+$.fbuilder.htmlEncode((this.formatDynamically) ? this.getFormattedValue(this.predefined) : this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
75
  },
69
  },
70
  show:function()
71
  {
72
+ var _type = ( this.dformat == 'digits' || ( /^$/.test( this.thousandSeparator ) && /^\s*(\.\s*)?$/.test( this.decimalSymbol ) ) ) ? 'number' : 'text';
73
 
74
  return '<div class="fields '+this.csslayout+' '+this.name+' cff-number-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input id="'+this.name+'" name="'+this.name+'" '+( ( !/^\s*$/.test( this.min) ) ? 'min="'+$.fbuilder.parseVal( this._getAttr('min'), this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+( ( !/^\s*$/.test(this.max) ) ? ' max="'+$.fbuilder.parseVal( this._getAttr('max'), this.thousandSeparator, this.decimalSymbol )+'" ' : '' )+' class="field '+this.dformat+' '+this.size+((this.required)?" required":"")+'" type="'+_type+'" value="'+$.fbuilder.htmlEncode((this.formatDynamically) ? this.getFormattedValue(this.predefined) : this.predefined)+'" '+((this.readonly)?'readonly':'')+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
75
  },
js/fields-public/02_fbuilder.fslider.js CHANGED
@@ -29,17 +29,15 @@
29
  counter = 0,
30
  str = '';
31
 
32
- if( !/^\s*$/.test( this.thousandSeparator ) )
33
  {
34
- for( var i = parts[0].length-1; i >= 0; i--)
35
- {
36
- counter++;
37
- str = parts[0][i] + str;
38
- if( counter%3 == 0 && i != 0 ) str = this.thousandSeparator + str;
39
 
40
- }
41
- parts[0] = str;
42
  }
 
 
43
  if( typeof parts[ 1 ] != 'undefined' && parts[ 1 ].length == 1 )
44
  {
45
  parts[ 1 ] += '0';
@@ -92,7 +90,6 @@
92
  this._setHndl('step');
93
 
94
  this.centSeparator = ( /^\s*$/.test( this.centSeparator )) ? '.' : $.trim( this.centSeparator );
95
- this.thousandSeparator = $.trim( this.thousandSeparator );
96
  },
97
  show:function()
98
  {
29
  counter = 0,
30
  str = '';
31
 
32
+ for( var i = parts[0].length-1; i >= 0; i--)
33
  {
34
+ counter++;
35
+ str = parts[0][i] + str;
36
+ if( counter%3 == 0 && i != 0 ) str = this.thousandSeparator + str;
 
 
37
 
 
 
38
  }
39
+ parts[0] = str;
40
+
41
  if( typeof parts[ 1 ] != 'undefined' && parts[ 1 ].length == 1 )
42
  {
43
  parts[ 1 ] += '0';
90
  this._setHndl('step');
91
 
92
  this.centSeparator = ( /^\s*$/.test( this.centSeparator )) ? '.' : $.trim( this.centSeparator );
 
93
  },
94
  show:function()
95
  {
js/fields-public/04_fbuilder.fdate.js CHANGED
@@ -199,16 +199,9 @@
199
  str = $( '#'+me.name+'_date' ).val();
200
  if( me.showTimepicker )
201
  {
202
- var h = $( '#'+me.name+'_hours' ).val()*1;
203
- str += ' ';
204
- if( me.tformat == 12 )
205
- {
206
- h = (h==12) ? 0 : h;
207
- if( $( '#'+me.name+'_ampm' ).val() == 'pm' ) str += ( h + 12 );
208
- else str += h;
209
- }
210
- else str += h;
211
  str += ':'+$( '#'+me.name+'_minutes' ).val();
 
212
  }
213
  $( '#'+me.name ).val( str ).change();
214
  },
@@ -261,28 +254,31 @@
261
 
262
  if( me.showTimepicker )
263
  {
264
- var parts, time = {}, tmp = 0;
265
- if( ( parts = /(\d{1,2}):(\d{1,2})/g.exec( me.defaultTime ) ) != null )
266
  {
267
- time[ 'hour' ] = parts[ 1 ];
268
  time[ 'minute' ] = parts[ 2 ];
269
  }
270
  else
271
  {
272
  var d = new Date();
273
- time[ 'hour' ] = Math.min(Math.max(d.getHours(), me.minHour), me.maxHour);
274
  time[ 'minute' ] = d.getMinutes();
275
- if(time[ 'hour' ] == me.minHour) time[ 'minute' ] = Math.max(time['minute'],me.minMinute);
276
- if(time[ 'hour' ] == me.maxHour) time[ 'minute' ] = Math.min(time['minute'],me.maxMinute);
277
  }
278
 
 
 
 
 
279
  _setValue(
280
  me.name+'_hours',
281
  ( me.tformat == 12 ) ? ( ( time[ 'hour' ] > 12 ) ? time[ 'hour' ] - 12 : ( ( time[ 'hour' ] == 0 ) ? 12 : time[ 'hour' ] ) ) : time[ 'hour' ],
282
  ( me.tformat == 12 ) ? 12 : me.maxHour
283
  );
284
 
285
- _setValue( me.name+'_minutes', time[ 'minute' ], me.maxMinute );
 
286
  $( '#'+me.name+'_ampm'+' [value="' + ( ( time[ 'hour' ] < 12 ) ? 'am' : 'pm' ) + '"]' ).prop( 'selected', true );
287
  }
288
  },
@@ -294,7 +290,7 @@
294
  format_label = [],
295
  date_tag_type = 'text',
296
  disabled = '',
297
- date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required)?' required': '');
298
 
299
  if( me.predefinedClick ) attr = 'placeholder';
300
  if( me.showDatepicker ) format_label.push(me.dformat);
@@ -366,7 +362,7 @@
366
  rt = '(\\d{1,2})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{4})';
367
 
368
  v = $.trim(e.val());
369
- var re = new RegExp( rt+'(\\s(\\d{1,2})[:\\.](\\d{1,2}))?' ),
370
  d = re.exec( v ),
371
  h = 0,
372
  m = 0,
@@ -374,9 +370,14 @@
374
 
375
  if( d )
376
  {
377
- if( typeof d[ 5 ] != 'undefined' ) h = d[ 5 ];
378
- if( typeof d[ 6 ] != 'undefined' ) m = d[ 6 ];
379
-
 
 
 
 
 
380
  switch( dformat )
381
  {
382
  case 'yyyy/dd/mm':
@@ -392,7 +393,6 @@
392
  date = new Date( d[ 3 ], ( d[ 1 ] * 1 - 1 ), d[ 2 ], h, m, 0, 0 );
393
  break;
394
  }
395
-
396
  if( me.showTimepicker ) return date.valueOf() / 86400000;
397
  else return Math.ceil( date.valueOf() / 86400000 );
398
  }
@@ -406,12 +406,19 @@
406
  v = $.trim(v)
407
  .replace( /\s+/g, ' ' )
408
  .split( ' ' );
409
- this.defaultDate = v[ 0 ];
410
- this.set_DefaultDate();
411
- if( v.length == 2 )
 
 
 
412
  {
413
- this.defaultTime = v[ 1 ];
414
- this.set_DefaultTime();
 
 
 
 
415
  }
416
  this.set_dateTime();
417
  }
199
  str = $( '#'+me.name+'_date' ).val();
200
  if( me.showTimepicker )
201
  {
202
+ str += ' '+$( '#'+me.name+'_hours' ).val();
 
 
 
 
 
 
 
 
203
  str += ':'+$( '#'+me.name+'_minutes' ).val();
204
+ if( $( '#'+me.name+'_ampm' ).length ) str += $( '#'+me.name+'_ampm' ).val();
205
  }
206
  $( '#'+me.name ).val( str ).change();
207
  },
254
 
255
  if( me.showTimepicker )
256
  {
257
+ var parts, time = {}, tmp = 0, max_minutes = 59;
258
+ if( ( parts = /(\d{1,2}):(\d{1,2})\s*([ap]m)?/gi.exec( me.defaultTime ) ) != null )
259
  {
260
+ time[ 'hour' ] = parts[ 1 ]*1+((parts.length == 4 && /pm/i.test(parts[3]) && parts[1] != 12) ? 12 : 0);
261
  time[ 'minute' ] = parts[ 2 ];
262
  }
263
  else
264
  {
265
  var d = new Date();
266
+ time[ 'hour' ] = d.getHours();
267
  time[ 'minute' ] = d.getMinutes();
 
 
268
  }
269
 
270
+ time[ 'hour' ] = Math.min(Math.max(time[ 'hour' ], me.minHour), me.maxHour);
271
+ if(time[ 'hour' ] <= me.minHour) time[ 'minute' ] = Math.max(time['minute'],me.minMinute);
272
+ if(me.maxHour <= time[ 'hour' ]) time[ 'minute' ] = Math.min(time['minute'],me.maxMinute);
273
+
274
  _setValue(
275
  me.name+'_hours',
276
  ( me.tformat == 12 ) ? ( ( time[ 'hour' ] > 12 ) ? time[ 'hour' ] - 12 : ( ( time[ 'hour' ] == 0 ) ? 12 : time[ 'hour' ] ) ) : time[ 'hour' ],
277
  ( me.tformat == 12 ) ? 12 : me.maxHour
278
  );
279
 
280
+ _setValue( me.name+'_minutes', time[ 'minute' ], (time[ 'hour' ] == me.maxHour) ? me.maxMinute : 59);
281
+
282
  $( '#'+me.name+'_ampm'+' [value="' + ( ( time[ 'hour' ] < 12 ) ? 'am' : 'pm' ) + '"]' ).prop( 'selected', true );
283
  }
284
  },
290
  format_label = [],
291
  date_tag_type = 'text',
292
  disabled = '',
293
+ date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required && me.showDatepicker)?' required': '');
294
 
295
  if( me.predefinedClick ) attr = 'placeholder';
296
  if( me.showDatepicker ) format_label.push(me.dformat);
362
  rt = '(\\d{1,2})[\\/\\-\\.](\\d{1,2})[\\/\\-\\.](\\d{4})';
363
 
364
  v = $.trim(e.val());
365
+ var re = new RegExp( rt+'(\\s(\\d{1,2})[:\\.](\\d{1,2})\s*([amp]{2})?)?' ),
366
  d = re.exec( v ),
367
  h = 0,
368
  m = 0,
370
 
371
  if( d )
372
  {
373
+ if( typeof d[ 5 ] != 'undefined' ) h = d[ 5 ]*1;
374
+ if( typeof d[ 6 ] != 'undefined' ) m = d[ 6 ]*1;
375
+ if( typeof d[ 7 ] != 'undefined' )
376
+ {
377
+ var am = d[ 7 ].toLowerCase();
378
+ if(am == 'pm' && h < 12 ) h += 12;
379
+ if(am == 'am' && h == 12) h -= 12;
380
+ }
381
  switch( dformat )
382
  {
383
  case 'yyyy/dd/mm':
393
  date = new Date( d[ 3 ], ( d[ 1 ] * 1 - 1 ), d[ 2 ], h, m, 0, 0 );
394
  break;
395
  }
 
396
  if( me.showTimepicker ) return date.valueOf() / 86400000;
397
  else return Math.ceil( date.valueOf() / 86400000 );
398
  }
406
  v = $.trim(v)
407
  .replace( /\s+/g, ' ' )
408
  .split( ' ' );
409
+ if(this.showDatepicker)
410
+ {
411
+ this.defaultDate = v[ 0 ];
412
+ this.set_DefaultDate();
413
+ }
414
+ if(this.showTimepicker)
415
  {
416
+ var t = (v.length == 2) ? v[1] : ((!this.showDatepicker) ? v[0] : false);
417
+ if(t !== false)
418
+ {
419
+ this.defaultTime = t;
420
+ this.set_DefaultTime();
421
+ }
422
  }
423
  this.set_dateTime();
424
  }
js/fields-public/09_fbuilder.ffile.js CHANGED
@@ -13,16 +13,19 @@
13
  preview: false,
14
  thumb_width: '80px',
15
  thumb_height: '',
 
16
  init: function(){
17
  this.thumb_width = $.trim(this.thumb_width);
18
  this.thumb_height = $.trim(this.thumb_height);
 
 
19
  },
20
  show:function()
21
  {
22
  this.accept = $.fbuilder.htmlEncode($.trim(this.accept));
23
  this.upload_size = $.fbuilder.htmlEncode($.trim(this.upload_size));
24
 
25
- return '<div class="fields '+this.csslayout+' '+this.name+' cff-file-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="file" id="'+this.name+'" name="'+this.name+'[]"'+((this.accept.length) ? ' accept="'+this.accept+'"' : '')+((this.upload_size.length) ? ' upload_size="'+this.upload_size+'"' : '')+' class="field '+this.size+((this.required)?" required":"")+'" '+( ( this.multiple ) ? 'multiple' : '' )+' /><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
26
  },
27
  after_show:function()
28
  {
@@ -56,6 +59,7 @@
56
  $( '#'+me.name ).change( function(){
57
  var h = this.files.length, n = 0;
58
  $( this ).siblings( 'span.files-list' ).remove();
 
59
  if(1 <= h)
60
  {
61
  var filesContainer = $('<span class="files-list"></span>');
@@ -83,16 +87,4 @@
83
  });
84
  }
85
  }
86
- );
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
13
  preview: false,
14
  thumb_width: '80px',
15
  thumb_height: '',
16
+ _patch: false, // Used only if the submission is being updated to preserves the previous values
17
  init: function(){
18
  this.thumb_width = $.trim(this.thumb_width);
19
  this.thumb_height = $.trim(this.thumb_height);
20
+ var form_identifier = this.form_identifier.replace(/[^\d]/g, '');
21
+ this._patch = ('cpcff_default' in window && form_identifier in cpcff_default) ? true : false;
22
  },
23
  show:function()
24
  {
25
  this.accept = $.fbuilder.htmlEncode($.trim(this.accept));
26
  this.upload_size = $.fbuilder.htmlEncode($.trim(this.upload_size));
27
 
28
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-file-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+''+((this.required)?"<span class='r'>*</span>":"")+'</label><div class="dfield"><input type="file" id="'+this.name+'" name="'+this.name+'[]"'+((this.accept.length) ? ' accept="'+this.accept+'"' : '')+((this.upload_size.length) ? ' upload_size="'+this.upload_size+'"' : '')+' class="field '+this.size+((this.required)?" required":"")+'" '+( ( this.multiple ) ? 'multiple' : '' )+' />'+((this._patch) ? '<input type="hidden" id="'+this.name+'_patch" name="'+this.name+'_patch" value="1" />' : '' )+'<span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
29
  },
30
  after_show:function()
31
  {
59
  $( '#'+me.name ).change( function(){
60
  var h = this.files.length, n = 0;
61
  $( this ).siblings( 'span.files-list' ).remove();
62
+ $('[id="'+me.name+'_patch"]').remove();
63
  if(1 <= h)
64
  {
65
  var filesContainer = $('<span class="files-list"></span>');
87
  });
88
  }
89
  }
90
+ );
 
 
 
 
 
 
 
 
 
 
 
 
js/fields-public/fbuilder.fcalculated.js CHANGED
@@ -580,8 +580,14 @@
580
  $(document).bind( 'showHideDepEvent', function( evt, form_identifier )
581
  {
582
  // If evalequations = 0 the equations shouldn't be evaluated dynamically
583
- var fId = '#'+form_identifier, evalequations = $( fId ).attr( 'data-evalequations' );
584
- if( typeof evalequations == 'undefined' || evalequations*1 == 1 ) obj.defaultCalc( fId );
 
 
 
 
 
 
585
  });
586
  return obj; // Return the public object
587
  }
580
  $(document).bind( 'showHideDepEvent', function( evt, form_identifier )
581
  {
582
  // If evalequations = 0 the equations shouldn't be evaluated dynamically
583
+ var f, evalequations;
584
+ if(form_identifier) f = $('#'+form_identifier);
585
+ else f = $('[id*="cp_calculatedfieldsf_pform_"]:eq(0)');
586
+ if(f.length)
587
+ {
588
+ evalequations = f.data( 'evalequations' );
589
+ if( typeof evalequations == 'undefined' || evalequations*1 == 1 ) obj.defaultCalc( '#'+f.attr('id') );
590
+ }
591
  });
592
  return obj; // Return the public object
593
  }
js/modules/06_connector/public/01_connector.js CHANGED
@@ -17,7 +17,7 @@
17
  lib.cff_connector_version = '0.1';
18
 
19
  // cffProxy( function ) The function should accept a callback
20
- lib.cffProxy = function(){
21
  if(typeof fbuilderjQuery == 'undefined' || !arguments.length || typeof arguments[0] != 'function') return;
22
 
23
  var $ = fbuilderjQuery,
17
  lib.cff_connector_version = '0.1';
18
 
19
  // cffProxy( function ) The function should accept a callback
20
+ lib.cffProxy = lib.cffproxy = lib.CFFPROXY = function(){
21
  if(typeof fbuilderjQuery == 'undefined' || !arguments.length || typeof arguments[0] != 'function') return;
22
 
23
  var $ = fbuilderjQuery,
pagebuilders/beaverbuilder/{cff.inc.php → cff/cff.inc.php} RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
- require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cff/beaver.pb.php';
3
 
4
  // Get the forms list
5
  global $wpdb;
@@ -26,7 +26,7 @@ FLBuilder::register_module(
26
  'type' => 'select',
27
  'label' => __('Select form', 'calculated-fields-form'),
28
  'options' => $options,
29
- 'default' => $default
30
  ),
31
  'class_name' => array(
32
  'type' => 'text',
@@ -41,4 +41,4 @@ FLBuilder::register_module(
41
  )
42
  )
43
  )
44
- );
1
  <?php
2
+ require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cff/cff/cff.php';
3
 
4
  // Get the forms list
5
  global $wpdb;
26
  'type' => 'select',
27
  'label' => __('Select form', 'calculated-fields-form'),
28
  'options' => $options,
29
+ 'default' => $default,
30
  ),
31
  'class_name' => array(
32
  'type' => 'text',
41
  )
42
  )
43
  )
44
+ );
pagebuilders/beaverbuilder/cff/{beaver.pb.php → cff/cff.php} RENAMED
@@ -12,7 +12,9 @@ class CFFBeaver extends FLBuilderModule {
12
  'category' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
13
  'dir' => $modules_dir,
14
  'url' => $modules_url,
15
- 'partial_refresh' => true,
16
  ));
 
 
17
  }
18
- }
12
  'category' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
13
  'dir' => $modules_dir,
14
  'url' => $modules_url,
15
+ 'partial_refresh' => true
16
  ));
17
+
18
+ $this->add_js('cff-beaver-form', $this->url . 'js/settings.js', array('jquery'));
19
  }
20
+ }
pagebuilders/beaverbuilder/cff/{includes → cff/includes}/frontend.php RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
- $form = $settings->form_id;
3
  if(!empty($form))
4
  {
5
  $output = '[CP_CALCULATED_FIELDS id="'.$form.'"';
6
 
7
- $class_name = $settings->class_name;
8
  if(!empty($class_name)) $output .= ' class="'.esc_attr($class_name).'"';
9
 
10
- $attributes = $settings->attributes;
11
  if(!empty($attributes)) $output .= ' '.$attributes;
12
 
13
  $output .= ']';
1
  <?php
2
+ $form = @intval($settings->form_id);
3
  if(!empty($form))
4
  {
5
  $output = '[CP_CALCULATED_FIELDS id="'.$form.'"';
6
 
7
+ $class_name = sanitize_text_field($settings->class_name);
8
  if(!empty($class_name)) $output .= ' class="'.esc_attr($class_name).'"';
9
 
10
+ $attributes = sanitize_text_field($settings->attributes);
11
  if(!empty($attributes)) $output .= ' '.$attributes;
12
 
13
  $output .= ']';
pagebuilders/beaverbuilder/cff/cff/js/settings.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($){
2
+ function cffCallback(evt)
3
+ {
4
+ if('fbuilderjQuery' in window)
5
+ {
6
+ delete fbuilderjQuery.fbuilderGeneratorFlag;
7
+ fbuilderjQuery.fbuilderjQueryGenerator();
8
+ }
9
+ };
10
+ $( '.fl-builder-content' ).on( 'fl-builder.preview-rendered', cffCallback );
11
+ $( '.fl-builder-content' ).on( 'fl-builder.layout-rendered', cffCallback );
12
+
13
+ })(jQuery)
pagebuilders/beaverbuilder/cffvar/cffvar.inc.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php';
3
+
4
+ FLBuilder::register_module(
5
+ 'CFFVarBeaver',
6
+ array(
7
+ 'cff-var-tab' => array(
8
+ 'title' => __('Generate variable', 'calculated-fields-form'),
9
+ 'sections' => array(
10
+ 'cff-var-section' => array(
11
+ 'title' => __('Variable attributes', 'calculated-fields-form'),
12
+ 'fields' => array(
13
+ 'var_name' => array(
14
+ 'type' => 'text',
15
+ 'label' => __('Enter the variable name', 'calculated-fields-form'),
16
+ 'required' => true,
17
+ ),
18
+ 'default_value' => array(
19
+ 'type' => 'text',
20
+ 'label' => __('Enter the default value', 'calculated-fields-form')
21
+ ),
22
+ 'from' => array(
23
+ 'type' => 'select',
24
+ 'label' => __('Generate variable from', 'calculated-fields-form'),
25
+ 'options' => array(
26
+ 'directly' => __('Directly', 'calculated-fields-form'),
27
+ 'get' => __('GET parameters', 'calculated-fields-form'),
28
+ 'post' => __('POST parameters', 'calculated-fields-form'),
29
+ 'session' => __('SESSION variables', 'calculated-fields-form'),
30
+ 'cookies' => __('COOKIES variables', 'calculated-fields-form'),
31
+ )
32
+ ),
33
+ )
34
+ )
35
+ )
36
+ )
37
+ )
38
+ );
pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class CFFVarBeaver extends FLBuilderModule {
3
+ public function __construct()
4
+ {
5
+ $modules_dir = dirname(__FILE__).'/';
6
+ $modules_url = plugins_url( '/', __FILE__ ).'/';
7
+
8
+ parent::__construct(array(
9
+ 'name' => __( 'Create variable', 'calculated-fields-form' ),
10
+ 'description' => __( 'Create javascript variable', 'fl-builder' ),
11
+ 'group' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
12
+ 'category' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
13
+ 'dir' => $modules_dir,
14
+ 'url' => $modules_url,
15
+ 'partial_refresh' => true,
16
+ ));
17
+
18
+ $this->add_css('cff-var', $this->url . 'css/cffvar.css');
19
+ }
20
+ }
pagebuilders/beaverbuilder/cffvar/cffvar/css/cffvar.css ADDED
@@ -0,0 +1 @@
 
1
+ .fl-builder-edit .fl-module.fl-module-cffvar{border:1px dashed #DDD;}
pagebuilders/beaverbuilder/cffvar/cffvar/includes/frontend.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $var_name = sanitize_text_field($settings->var_name);
3
+ $default_value = sanitize_text_field($settings->default_value);
4
+ $from = sanitize_text_field($settings->from);
5
+
6
+ if(!empty($var_name))
7
+ {
8
+ $output = '[CP_CALCULATED_FIELDS_VAR name="'.esc_attr($var_name).'"';
9
+
10
+ if(!empty($from) && $from !== 'directly')
11
+ $output .= ' from="'.esc_attr($from).'" default_value="'.esc_attr($default_value).'"';
12
+ elseif($from === 'directly')
13
+ $output .= ' value="'.esc_attr($default_value).'"';
14
+
15
+ $output .= ']';
16
+ echo $output;
17
+ }
pagebuilders/elementor/elementor.pb.php CHANGED
@@ -81,9 +81,9 @@ class Elementor_CFF_Widget extends Widget_Base
81
  private function _get_shortcode()
82
  {
83
  $settings = $this->get_settings_for_display();
84
- $attrs = trim($settings['attrs']);
85
  if(!empty($attrs)) $attrs = ' '.$attrs;
86
- return '[CP_CALCULATED_FIELDS id="'.$settings['form'].'"'.$attrs.']';
87
  } // End _get_shortcode
88
 
89
  protected function render()
@@ -105,8 +105,8 @@ class Elementor_CFF_Widget extends Widget_Base
105
  {
106
  if(is_numeric($i)) continue;
107
  if($i == 'id') $url .= '&cff-form';
108
- else $url .= '&'.urlencode($i);
109
- $url .= '='.urlencode($v);
110
  }
111
 
112
  ?>
81
  private function _get_shortcode()
82
  {
83
  $settings = $this->get_settings_for_display();
84
+ $attrs = sanitize_text_field($settings['attrs']);
85
  if(!empty($attrs)) $attrs = ' '.$attrs;
86
+ return '[CP_CALCULATED_FIELDS id="'.@intval($settings['form']).'"'.$attrs.']';
87
  } // End _get_shortcode
88
 
89
  protected function render()
105
  {
106
  if(is_numeric($i)) continue;
107
  if($i == 'id') $url .= '&cff-form';
108
+ else $url .= '&'.urlencode(sanitize_text_field($i));
109
+ $url .= '='.urlencode(sanitize_text_field($v));
110
  }
111
 
112
  ?>
pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- $name = trim($instance['name']);
3
- $from = trim($instance['from']);
4
- $default_value = trim($instance['default_value']);
5
- $value = trim($instance['value']);
6
  $shortcode = '';
7
  if(!empty($name))
8
  {
1
  <?php
2
+ $name = sanitize_text_field($instance['name']);
3
+ $from = sanitize_text_field($instance['from']);
4
+ $default_value = sanitize_text_field($instance['default_value']);
5
+ $value = sanitize_text_field($instance['value']);
6
  $shortcode = '';
7
  if(!empty($name))
8
  {
pagebuilders/siteorigin/siteorigin-cpcff/siteorigin-cpcff.php CHANGED
@@ -16,7 +16,7 @@ class SiteOrigin_CFF_Shortcode extends SiteOrigin_Widget
16
  foreach($forms as $form)
17
  {
18
  if(empty($default)) $default = $form->id;
19
- $options[$form->id] = '('.$form->id.') '.$form->form_name;
20
  }
21
 
22
  parent::__construct(
16
  foreach($forms as $form)
17
  {
18
  if(empty($default)) $default = $form->id;
19
+ $options[$form->id] = esc_html('('.$form->id.') '.$form->form_name);
20
  }
21
 
22
  parent::__construct(
pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  $form = trim($instance['form']);
3
- $class_name = trim($instance['class_name']);
4
- $attrs = trim($instance['attrs']);
5
  $shortcode = '';
6
  if(@intval($form))
7
  {
1
  <?php
2
  $form = trim($instance['form']);
3
+ $class_name = sanitize_text_field($instance['class_name']);
4
+ $attrs = sanitize_text_field($instance['attrs']);
5
  $shortcode = '';
6
  if(@intval($form))
7
  {
pagebuilders/visualcomposer/CFFForm/CFFForm/public/cff-preview.png ADDED
Binary file
pagebuilders/visualcomposer/CFFForm/CFFForm/public/cff-thumbnail.png ADDED
Binary file
pagebuilders/visualcomposer/CFFForm/manifest.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "elements": {
3
+ "CFFForm": {
4
+ "settings": {
5
+ "name": "Calculated Fields Form",
6
+ "metaThumbnailUrl": "[publicPath]/cff-thumbnail.png",
7
+ "metaPreviewUrl": "[publicPath]/cff-preview.png",
8
+ "metaDescription": "Add a calculated fields form."
9
+ }
10
+ }
11
+ },
12
+ "categories": {
13
+ "Misc": {
14
+ "elements": [
15
+ "CFFForm"
16
+ ]
17
+ }
18
+ }
19
+ }
pagebuilders/visualcomposer/CFFForm/public/dist/element.bundle.js ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (window["vcvWebpackJsonp4x"] = window["vcvWebpackJsonp4x"] || []).push([["element"],{
2
+
3
+ /***/ "./CFFForm/component.js":
4
+ /*!******************************!*\
5
+ !*** ./CFFForm/component.js ***!
6
+ \******************************/
7
+ /*! no static exports found */
8
+ /***/ (function(module, exports, __webpack_require__) {
9
+
10
+ "use strict";
11
+ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _extends2 = __webpack_require__(/*! babel-runtime/helpers/extends */ \"./node_modules/babel-runtime/helpers/extends.js\");\n\nvar _extends3 = _interopRequireDefault(_extends2);\n\nvar _getPrototypeOf = __webpack_require__(/*! babel-runtime/core-js/object/get-prototype-of */ \"./node_modules/babel-runtime/core-js/object/get-prototype-of.js\");\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _classCallCheck2 = __webpack_require__(/*! babel-runtime/helpers/classCallCheck */ \"./node_modules/babel-runtime/helpers/classCallCheck.js\");\n\nvar _classCallCheck3 = _interopRequireDefault(_classCallCheck2);\n\nvar _createClass2 = __webpack_require__(/*! babel-runtime/helpers/createClass */ \"./node_modules/babel-runtime/helpers/createClass.js\");\n\nvar _createClass3 = _interopRequireDefault(_createClass2);\n\nvar _possibleConstructorReturn2 = __webpack_require__(/*! babel-runtime/helpers/possibleConstructorReturn */ \"./node_modules/babel-runtime/helpers/possibleConstructorReturn.js\");\n\nvar _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);\n\nvar _get2 = __webpack_require__(/*! babel-runtime/helpers/get */ \"./node_modules/babel-runtime/helpers/get.js\");\n\nvar _get3 = _interopRequireDefault(_get2);\n\nvar _inherits2 = __webpack_require__(/*! babel-runtime/helpers/inherits */ \"./node_modules/babel-runtime/helpers/inherits.js\");\n\nvar _inherits3 = _interopRequireDefault(_inherits2);\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _vcCake = __webpack_require__(/*! vc-cake */ \"./node_modules/vc-cake/index.js\");\n\nvar _vcCake2 = _interopRequireDefault(_vcCake);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar vcvAPI = _vcCake2.default.getService('api');\n\nvar CFFFormElement = function (_vcvAPI$elementCompon) {\n\t(0, _inherits3.default)(CFFFormElement, _vcvAPI$elementCompon);\n\n\tfunction CFFFormElement() {\n\t\t(0, _classCallCheck3.default)(this, CFFFormElement);\n\t\treturn (0, _possibleConstructorReturn3.default)(this, (CFFFormElement.__proto__ || (0, _getPrototypeOf2.default)(CFFFormElement)).apply(this, arguments));\n\t}\n\n\t(0, _createClass3.default)(CFFFormElement, [{\n\t\tkey: 'sanitize',\n\t\tvalue: function sanitize(str, args) {\n\t\t\tif (typeof args == 'undefined') args = {};\n\t\t\tif (!('quotes' in args)) args['quotes'] = false;\n\t\t\tif (!('spaces' in args)) args['spaces'] = false;\n\n\t\t\tstr = str.replace(/[^a-zA-Z0-9\\.\\-_\\s\"']/g, '');\n\t\t\tif (!args.quotes) str = str.replace(/'\"/g, '');\n\t\t\tif (!args.spaces) str = str.replace(/\\s/g, '');\n\n\t\t\treturn str;\n\t\t}\n\t}, {\n\t\tkey: 'getTheShortcode',\n\t\tvalue: function getTheShortcode(atts) {\n\t\t\t// Generates the form's shortcode\n\t\t\tvar _atts$fId = atts.fId,\n\t\t\t fId = _atts$fId === undefined ? \"\" : _atts$fId,\n\t\t\t _atts$clssName = atts.clssName,\n\t\t\t clssName = _atts$clssName === undefined ? \"\" : _atts$clssName,\n\t\t\t _atts$attrs = atts.attrs,\n\t\t\t attrs = _atts$attrs === undefined ? \"\" : _atts$attrs;\n\n\t\t\tif (fId == '') return '';\n\t\t\tvar shortcode = '[CP_CALCULATED_FIELDS id=\"' + this.sanitize(fId) + '\"';\n\t\t\tif (clssName != '') shortcode += ' class=\"' + this.sanitize(clssName, { spaces: true }) + '\"';\n\t\t\tif (attrs != '') shortcode += ' ' + this.sanitize(attrs, { quotes: true, spaces: true });\n\t\t\tshortcode += ']';\n\n\t\t\treturn shortcode;\n\t\t}\n\t}, {\n\t\tkey: 'addFormGeneratorForVSEditor',\n\t\tvalue: function addFormGeneratorForVSEditor(base) {\n\t\t\treturn base != '' ? base + '<script>delete fbuilderjQuery.fbuilderGeneratorFlag; if(\"fbuilderjQuery\" in window && \"fbuilderjQueryGenerator\" in fbuilderjQuery) fbuilderjQuery.fbuilderjQueryGenerator();</script>' : base;\n\t\t}\n\t}, {\n\t\tkey: 'componentDidMount',\n\t\tvalue: function componentDidMount() {\n\n\t\t\tvar shortcode = this.addFormGeneratorForVSEditor(this.getTheShortcode(this.props.atts));\n\t\t\t(0, _get3.default)(CFFFormElement.prototype.__proto__ || (0, _getPrototypeOf2.default)(CFFFormElement.prototype), 'updateShortcodeToHtml', this).call(this, shortcode, this.refs.vcvhelper);\n\t\t\tif (!window.wp || !window.wp.shortcode || !window.VCV_API_WPBAKERY_WPB_MAP) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.multipleShortcodesRegex = window.wp.shortcode.regexp(window.VCV_API_WPBAKERY_WPB_MAP().join('|'));\n\t\t\tthis.localShortcodesRegex = new RegExp(this.multipleShortcodesRegex.source);\n\t\t}\n\t}, {\n\t\tkey: 'componentDidUpdate',\n\t\tvalue: function componentDidUpdate(props) {\n\n\t\t\tvar shortcode = this.addFormGeneratorForVSEditor(this.getTheShortcode(this.props.atts));\n\t\t\tvar shortcodeCmp = this.getTheShortcode(props.atts);\n\t\t\t// update only if shortcode changed\n\t\t\tif (shortcode !== shortcodeCmp) {\n\t\t\t\t(0, _get3.default)(CFFFormElement.prototype.__proto__ || (0, _getPrototypeOf2.default)(CFFFormElement.prototype), 'updateShortcodeToHtml', this).call(this, shortcode, this.refs.vcvhelper);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\tvar _props = this.props,\n\t\t\t id = _props.id,\n\t\t\t atts = _props.atts,\n\t\t\t editor = _props.editor;\n\n\n\t\t\tvar shortcode = this.getTheShortcode(atts);\n\t\t\tvar elementClasses = 'vce-cff-form';\n\t\t\tvar wrapperClasses = 'vce-cff-form-wrapper vce';\n\t\t\tvar customProps = {};\n\n\t\t\tvar doAll = this.applyDO('all');\n\n\t\t\treturn _react2.default.createElement(\n\t\t\t\t'div',\n\t\t\t\t(0, _extends3.default)({ className: elementClasses }, editor, customProps),\n\t\t\t\t_react2.default.createElement(\n\t\t\t\t\t'div',\n\t\t\t\t\t(0, _extends3.default)({ className: wrapperClasses, id: 'el-' + id }, doAll),\n\t\t\t\t\t_react2.default.createElement('style', { className: 'vcvhelper', ref: 'style' }),\n\t\t\t\t\t_react2.default.createElement('div', { className: 'vcvhelper', ref: 'vcvhelper', 'data-vcvs-html': shortcode })\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\treturn CFFFormElement;\n}(vcvAPI.elementComponent);\n\nexports.default = CFFFormElement;\n\n//# sourceURL=webpack:///./CFFForm/component.js?");
12
+
13
+ /***/ }),
14
+
15
+ /***/ "./CFFForm/index.js":
16
+ /*!**************************!*\
17
+ !*** ./CFFForm/index.js ***!
18
+ \**************************/
19
+ /*! no static exports found */
20
+ /***/ (function(module, exports, __webpack_require__) {
21
+
22
+ "use strict";
23
+ eval("\n\nvar _vcCake = __webpack_require__(/*! vc-cake */ \"./node_modules/vc-cake/index.js\");\n\nvar _vcCake2 = _interopRequireDefault(_vcCake);\n\nvar _component = __webpack_require__(/*! ./component */ \"./CFFForm/component.js\");\n\nvar _component2 = _interopRequireDefault(_component);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar vcvAddElement = _vcCake2.default.getService('cook').add;\n\nvcvAddElement(__webpack_require__(/*! ./settings.json */ \"./CFFForm/settings.json\"),\n// Component callback\nfunction (component) {\n component.add(_component2.default);\n}, {\n css: false,\n editorCss: __webpack_require__(/*! raw-loader!./editor.css */ \"./node_modules/raw-loader/index.js!./CFFForm/editor.css\")\n});\n\n//# sourceURL=webpack:///./CFFForm/index.js?");
24
+
25
+ /***/ }),
26
+
27
+ /***/ "./CFFForm/settings.json":
28
+ /*!*******************************!*\
29
+ !*** ./CFFForm/settings.json ***!
30
+ \*******************************/
31
+ /*! exports provided: fId, clssName, attrs, designOptions, editFormTab1, metaEditFormTabs, relatedTo, tag, default */
32
+ /***/ (function(module) {
33
+
34
+ eval("module.exports = {\"fId\":{\"type\":\"number\",\"access\":\"public\",\"options\":{\"label\":\"Enter the form id (Required)\",\"description\":\"Enter the integer number representing the form's id to insert.\"}},\"clssName\":{\"type\":\"string\",\"access\":\"public\",\"options\":{\"label\":\"Class name (Optional)\",\"description\":\"Enter the custom class names to apply the form (separated by space)\"}},\"attrs\":{\"type\":\"string\",\"access\":\"public\",\"options\":{\"label\":\"Additional attributes (Optional)\",\"description\":\"Enter the additional parameters to include in the form's shortcode. Ex. attr_1=\\\"value1\\\" attr_2=\\\"value2\\\"\"}},\"designOptions\":{\"type\":\"designOptions\",\"access\":\"public\",\"value\":{},\"options\":{\"label\":\"Design Options\"}},\"editFormTab1\":{\"type\":\"group\",\"access\":\"protected\",\"value\":[\"fId\",\"clssName\",\"attrs\"],\"options\":{\"label\":\"General\"}},\"metaEditFormTabs\":{\"type\":\"group\",\"access\":\"protected\",\"value\":[\"editFormTab1\",\"designOptions\"]},\"relatedTo\":{\"type\":\"group\",\"access\":\"protected\",\"value\":[\"General\"]},\"tag\":{\"access\":\"protected\",\"type\":\"string\",\"value\":\"CFFForm\"}};\n\n//# sourceURL=webpack:///./CFFForm/settings.json?");
35
+
36
+ /***/ }),
37
+
38
+ /***/ "./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js":
39
+ /*!**********************************************************************************!*\
40
+ !*** ./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js ***!
41
+ \**********************************************************************************/
42
+ /*! no static exports found */
43
+ /***/ (function(module, exports, __webpack_require__) {
44
+
45
+ eval("module.exports = { \"default\": __webpack_require__(/*! core-js/library/fn/object/get-own-property-descriptor */ \"./node_modules/core-js/library/fn/object/get-own-property-descriptor.js\"), __esModule: true };\n\n//# sourceURL=webpack:///./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js?");
46
+
47
+ /***/ }),
48
+
49
+ /***/ "./node_modules/babel-runtime/helpers/get.js":
50
+ /*!***************************************************!*\
51
+ !*** ./node_modules/babel-runtime/helpers/get.js ***!
52
+ \***************************************************/
53
+ /*! no static exports found */
54
+ /***/ (function(module, exports, __webpack_require__) {
55
+
56
+ "use strict";
57
+ eval("\n\nexports.__esModule = true;\n\nvar _getPrototypeOf = __webpack_require__(/*! ../core-js/object/get-prototype-of */ \"./node_modules/babel-runtime/core-js/object/get-prototype-of.js\");\n\nvar _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);\n\nvar _getOwnPropertyDescriptor = __webpack_require__(/*! ../core-js/object/get-own-property-descriptor */ \"./node_modules/babel-runtime/core-js/object/get-own-property-descriptor.js\");\n\nvar _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = (0, _getOwnPropertyDescriptor2.default)(object, property);\n\n if (desc === undefined) {\n var parent = (0, _getPrototypeOf2.default)(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};\n\n//# sourceURL=webpack:///./node_modules/babel-runtime/helpers/get.js?");
58
+
59
+ /***/ }),
60
+
61
+ /***/ "./node_modules/core-js/library/fn/object/get-own-property-descriptor.js":
62
+ /*!*******************************************************************************!*\
63
+ !*** ./node_modules/core-js/library/fn/object/get-own-property-descriptor.js ***!
64
+ \*******************************************************************************/
65
+ /*! no static exports found */
66
+ /***/ (function(module, exports, __webpack_require__) {
67
+
68
+ eval("__webpack_require__(/*! ../../modules/es6.object.get-own-property-descriptor */ \"./node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js\");\nvar $Object = __webpack_require__(/*! ../../modules/_core */ \"./node_modules/core-js/library/modules/_core.js\").Object;\nmodule.exports = function getOwnPropertyDescriptor(it, key) {\n return $Object.getOwnPropertyDescriptor(it, key);\n};\n\n\n//# sourceURL=webpack:///./node_modules/core-js/library/fn/object/get-own-property-descriptor.js?");
69
+
70
+ /***/ }),
71
+
72
+ /***/ "./node_modules/raw-loader/index.js!./CFFForm/editor.css":
73
+ /*!******************************************************!*\
74
+ !*** ./node_modules/raw-loader!./CFFForm/editor.css ***!
75
+ \******************************************************/
76
+ /*! no static exports found */
77
+ /***/ (function(module, exports) {
78
+
79
+ eval("module.exports = \".vce-cff-form {\\n min-height: 1em;\\n}\\n.vce-cff-form .vcvhelper:empty{min-height:1em; background:#DEDEDE;}\\n.vce-cff-form .vcvhelper *{pointer-events: none;}\"\n\n//# sourceURL=webpack:///./CFFForm/editor.css?./node_modules/raw-loader");
80
+
81
+ /***/ })
82
+
83
+ },[['./CFFForm/index.js']]]);