Calculated Fields Form - Version 1.0.290

Version Description

  • Modifies the dependencies (Checkbox, Radio Buttons, DropDown, Container fields, Calculated fields).
  • Modifies the date/time control for defining the aria-labels for screen readers.
  • Fixes an issue that causes the loopback request to the site fails, caused by the sessions management (Professional, Developer and Platinum versions of the plugin).
  • Includes a new attribute in the troubleshoot section for starting the session as soon as possible (in case of conflict with other plugins) (Professional, Developer, and Platinum versions of the plugin).
  • Modifies the PayPal Pro add-on (Platinum version of the plugin).
Download this release

Release Info

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

Code changes from version 1.0.280 to 1.0.290

Files changed (31) hide show
  1. README.txt +60 -42
  2. captcha/captcha.php +3 -1
  3. changelog.txt +60 -0
  4. config/cpcff_config.cfg.php +7 -5
  5. cp_calculatedfieldsf_free.php +2 -6
  6. css/stylepublic.css +1 -1
  7. inc/cpcff_admin_int.inc.php +1 -1
  8. inc/cpcff_auxiliary.inc.php +45 -0
  9. inc/cpcff_main.inc.php +7 -4
  10. inc/cpcff_page_builders.inc.php +54 -7
  11. inc/cpcff_session.inc.php +1 -1
  12. js/fbuilder-pro-public.jquery.js +2 -1
  13. js/fields-admin/04_fbuilder.fdate.js +12 -2
  14. js/fields-public/02_fbuilder.fslider.js +13 -8
  15. js/fields-public/04_fbuilder.fdate.js +162 -121
  16. js/fields-public/06_fbuilder.fcheck.js +1 -0
  17. js/fields-public/07_fbuilder.fradio.js +1 -0
  18. js/fields-public/08_fbuilder.fdropdown.js +1 -0
  19. js/fields-public/28_fbuilder.fcontainer.js +1 -0
  20. js/fields-public/fbuilder.fcalculated.js +2 -0
  21. pagebuilders/elementor/assets/elementor.css +7 -0
  22. pagebuilders/{elementor.pb.php → elementor/elementor.pb.php} +3 -0
  23. pagebuilders/{elementor_category.pb.php → elementor/elementor_category.pb.php} +0 -0
  24. {css → pagebuilders/gutenberg/assets/css}/gutenberg.css +0 -0
  25. js/cp_calculatedfieldsf_gutenberg.js → pagebuilders/gutenberg/assets/js/gutenberg.js +4 -4
  26. pagebuilders/siteorigin/siteorigin-cpcff-variable/assets/banner.svg +1 -0
  27. pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php +67 -0
  28. pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php +15 -0
  29. pagebuilders/siteorigin/siteorigin-cpcff/assets/banner.svg +1 -0
  30. pagebuilders/siteorigin/siteorigin-cpcff/siteorigin-cpcff.php +64 -0
  31. pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php +13 -0
README.txt CHANGED
@@ -3,7 +3,7 @@ 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: 5.0
7
Stable tag: trunk
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -53,6 +53,7 @@ The "Calculated Fields Form" plugin allows the specific integration with the fol
53
* Classic WordPress Editor.
54
* Gutenberg Editor.
55
* Elementor.
56
* For other editors, the shortcodes should be inserted using other controls of general purpose, like the controls for inserting HTML or shortcodes.
57
58
= Latest Features Added =
@@ -124,6 +125,7 @@ The plugin has two additional (commercial) versions: **Premium** and **Developer
124
* Includes the "Autocomplete Places" add-on that allows integrate the input fields with the Photon API to autocomplete the addresses entered by the users.
125
* Includes the "Signature" add-on to convert some form fields in "Signature" fields, allowing the users to sign with the mouse or directly in the touchscreens.
126
* Includes the "iCal" add-on for sending the users an iCal file as part of the confirmation email after the form submission to be imported into most popular calendars like Outlook and Google Calendar.
127
* Includes the "WebMerge" add-on to integrate the forms with the WebMerge Service, and generate PDF and Office documents at runtime with the information collected by the forms.
128
* Includes the "PrintFriendly" add-on to integrate the forms with the PrintFriendly API for generating PDF files after forms submissions, and attach the resulting files to the notification emails.
129
* Includes the "MailChimp" add-on to add new members to the MailChimp Service using the data collected by the form.
@@ -395,6 +397,12 @@ The "iCal" add-on sends the users an iCal file as part of the confirmation email
395
396
[CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#ical-addon "iCal add-on")
397
398
= WebMerge add-on - Only available in the Platinum version of the plugin =
399
400
The "WebMerge" add-on integrates the forms with the WebMerge Service, and generate PDF and Office documents at runtime with the information collected by the forms.
@@ -889,71 +897,81 @@ A: Please, visit the following entry in our technical blog:
889
2. Inserting the form using the Classic Editor
890
3. Inserting the form using the Gutenberg Editor
891
4. Inserting the form using Elementor
892
- 5. Sample calculated form
893
- 6. Calculated field settings
894
- 7. Calculator Form builder
895
- 8. Editing general fields
896
- 9. Available designs
897
- 10. Add-ons section
898
- 11. WooCommerce add-on
899
- 12. SalesForce add-on
900
- 13. WebHook add-on, and its integration with Zapier
901
902
== Changelog ==
903
904
- = 1.0.280 =
905
906
- * Modifies the slider controls allowing to integrate other fields in the form with the attributes: min, max and step, and vary them dynamically at runtime.
907
- * Modifies the predefined template 12 to display the down arrow in the DropDown fields.
908
- * Allows to include the tags of the Section Break controls in the notification emails and thank you pages (Professional, Developer and Platinum verisons of the plugin)
909
910
- = 1.0.279 =
911
912
- * Fixes an issue with the tooltips defined in the radio buttons and checkbox controls.
913
914
- = 1.0.278 =
915
916
- * Modifies the module that generates the forms' previews, and the AMP versions of forms.
917
- * Implements the specific integration with the Elementor pages builder.
918
- * Improves the forms appearance in small screens.
919
920
- = 1.0.277 =
921
922
- * Improves the some of predefined templates.
923
- * Optimizes the form's styles.
924
- * Allows to includes images and html tags in the tooltips.
925
- * Fixes an issue printing the list of messages when includes images (Professional, Developer, and Platinum versions of the plugin)
926
927
- = 1.0.276 =
928
929
- * Implements a new columns system to format the forms easier.
930
931
- = 1.0.275 =
932
933
- * Includes new operations: RADIANS to convert an angle in degrees to radians, DEGREES to convert a number in radians to degrees, ATANH to get the hyperbolic arctangent of a number.
934
- * Includes new controls in the interface of the equations edition: SIN, COS, TAN, ASIN, ACOS, ATAN, ATAN2, ATANH, RADIANS, DEGREES.
935
936
- = 1.0.274 =
937
938
- * Modifies the blocks dimensions.
939
- * Fixes an issue editing the additional attributes.
940
- * Includes the Form ID in the submissions list.
941
942
- = 1.0.273 =
943
944
- * Improves the integration with the Gutenberg editor.
945
946
- = 1.0.272 =
947
948
- * Modifies the nonces to increase the plugin's security.
949
- * Fixes some little issues with the messages list.
950
951
- = 1.0.271 =
952
953
- * Fixes an issue between the Promote Banner and the official distribution of WP5.0
954
955
== Upgrade Notice ==
956
957
- = 1.0.280 =
958
959
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
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: 5.1
7
Stable tag: trunk
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
53
* Classic WordPress Editor.
54
* Gutenberg Editor.
55
* Elementor.
56
+ * Page Builder by SiteOrigin.
57
* For other editors, the shortcodes should be inserted using other controls of general purpose, like the controls for inserting HTML or shortcodes.
58
59
= Latest Features Added =
125
* Includes the "Autocomplete Places" add-on that allows integrate the input fields with the Photon API to autocomplete the addresses entered by the users.
126
* Includes the "Signature" add-on to convert some form fields in "Signature" fields, allowing the users to sign with the mouse or directly in the touchscreens.
127
* Includes the "iCal" add-on for sending the users an iCal file as part of the confirmation email after the form submission to be imported into most popular calendars like Outlook and Google Calendar.
128
+ * Includes the "CSV Generator" add-on that allows to export dynamically the information collected by the form to a CSV file, and send it as attachment in the notification emails.
129
* Includes the "WebMerge" add-on to integrate the forms with the WebMerge Service, and generate PDF and Office documents at runtime with the information collected by the forms.
130
* Includes the "PrintFriendly" add-on to integrate the forms with the PrintFriendly API for generating PDF files after forms submissions, and attach the resulting files to the notification emails.
131
* Includes the "MailChimp" add-on to add new members to the MailChimp Service using the data collected by the form.
397
398
[CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#ical-addon "iCal add-on")
399
400
+ = CSV Generator add-on - Only available in the Platinum version of the plugin =
401
+
402
+ The "CSV Generator" add-on allows to export dynamically the information collected by the form to a CSV file, and send it as attachment in the notification emails.
403
+
404
+ [CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#csv-generator-addon "CSV Generator add-on")
405
+
406
= WebMerge add-on - Only available in the Platinum version of the plugin =
407
408
The "WebMerge" add-on integrates the forms with the WebMerge Service, and generate PDF and Office documents at runtime with the information collected by the forms.
897
2. Inserting the form using the Classic Editor
898
3. Inserting the form using the Gutenberg Editor
899
4. Inserting the form using Elementor
900
+ 5. Inserting the form using Page Builder by SiteOrigin
901
+ 6. Sample calculated form
902
+ 7. Calculated field settings
903
+ 8. Calculator Form builder
904
+ 9. Editing general fields
905
+ 10. Available designs
906
+ 11. Add-ons section
907
+ 12. WooCommerce add-on
908
+ 13. SalesForce add-on
909
+ 14. WebHook add-on, and its integration with Zapier
910
911
== Changelog ==
912
913
+ = 1.0.290 =
914
915
+ * Modifies the dependencies (Checkbox, Radio Buttons, DropDown, Container fields, Calculated fields).
916
+ * Modifies the date/time control for defining the aria-labels for screen readers.
917
+ * Fixes an issue that causes the loopback request to the site fails, caused by the sessions management (Professional, Developer and Platinum versions of the plugin).
918
+ * Includes a new attribute in the troubleshoot section for starting the session as soon as possible (in case of conflict with other plugins) (Professional, Developer, and Platinum versions of the plugin).
919
+ * Modifies the PayPal Pro add-on (Platinum version of the plugin).
920
921
+ = 1.0.289 =
922
923
+ * Improves the Widgets for Page Builder by SiteOrigin.
924
+ * Improves the Widgets for Elementor.
925
+ * Includes a new block for inserting the results list shortcode in the Gutenberg editor (Professional, Developer and Platinum versions of the plugin).
926
+ * Includes a new icon for inserting the results list shortcode in the Classic WordPress editor (Professional, Developer and Platinum versions of the plugin).
927
+ * Modifies the module that generates the default email address used in the "from" attribute (Professional, Developer and Platinum versions of the plugin).
928
+ * Fixes some errors in the CFF - CSV Generator add-on (Platinum version of the plugin).
929
930
+ = 1.0.288 =
931
932
+ * Implements new Widgets to allow the specific integration with the Page Builder by SiteOrigin.
933
+ * Improves the integration with the other pages builders.
934
+ * Modifies the Appearance/Widget, allowing to associate a class name to the form, and pass to it additional attributes (Professional, Developer and Platinum versions of the plugin).
935
+ * Includes minimum changes in the CFF - WooCommerce add-on (Developer and Platinum versions of the plugin).
936
937
+ = 1.0.287 =
938
939
+ * Fixes an issue that causes the loopback request to the site fails.
940
941
+ = 1.0.286 =
942
943
+ * Modifies the blocks for the Gutenberg editor, preparing the plugin for WordPress 5.1
944
945
+ = 1.0.285 =
946
947
+ * Fixes an issue in the date/time controls.
948
949
+ = 1.0.284 =
950
951
+ * Fixes some issues in the slider control.
952
+ * Modifies the Date controls allowing to enter other fields' names as the min and max attributes.
953
+ * Modifies the Captcha generator to fix a conflict with other plugins.
954
+ * Includes some minimal changes in the DS fields (Developer and Platinum versions of the plugin).
955
+ * Includes some minimal changes in the interface of the Users Permissions add-on. Assings class names to the different tags in the list of users submissions (Developer and Platinum versions of the plugin).
956
+ * Modifies the CSV Generator add-on to improve the security in the generated CSV files.
957
958
+ = 1.0.283 =
959
960
+ * Modifies the code that assigns the default values to the slider control.
961
962
+ = 1.0.282 =
963
964
+ * Fixes an issue in the slider controls.
965
966
+ = 1.0.281 =
967
968
+ * Fixes a conflict with older browsers.
969
+ * Modifies the SESSION Management module.
970
+ * Includes a new module for cleaning the expired transients.
971
+ * The Platinum version of the plugin includes the CSV Generator add-on.
972
973
== Upgrade Notice ==
974
975
+ = 1.0.290 =
976
977
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
@@ -136,7 +136,9 @@ for ($i=0;$i<$noise;$i++)
136
137
$font = dirname( __FILE__ ) . "/font-1.ttf"; // font
138
if ($_GET["font"]) $font = dirname( __FILE__ ) . "/".$_GET["font"];
139
- $font = str_replace( "\\", "/", $font );
140
141
$font_size = rand($min_size, $max_size);
142
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 );
142
143
$font_size = rand($min_size, $max_size);
144
changelog.txt CHANGED
@@ -1,5 +1,65 @@
1
== Changelog ==
2
3
= 1.0.280 =
4
5
* Modifies the slider controls allowing to integrate other fields in the form with the attributes: min, max and step, and vary them dynamically at runtime.
1
== Changelog ==
2
3
+ = 1.0.290 =
4
+
5
+ * Modifies the dependencies (Checkbox, Radio Buttons, DropDown, Container fields, Calculated fields).
6
+ * Modifies the date/time control for defining the aria-labels for screen readers.
7
+ * Fixes an issue that causes the loopback request to the site fails, caused by the sessions management (Professional, Developer and Platinum versions of the plugin).
8
+ * Includes a new attribute in the troubleshoot section for starting the session as soon as possible (in case of conflict with other plugins) (Professional, Developer, and Platinum versions of the plugin).
9
+ * Modifies the PayPal Pro add-on (Platinum version of the plugin).
10
+
11
+ = 1.0.289 =
12
+
13
+ * Improves the Widgets for Page Builder by SiteOrigin.
14
+ * Improves the Widgets for Elementor.
15
+ * Includes a new block for inserting the results list shortcode in the Gutenberg editor (Professional, Developer and Platinum versions of the plugin).
16
+ * Includes a new icon for inserting the results list shortcode in the Classic WordPress editor (Professional, Developer and Platinum versions of the plugin).
17
+ * Modifies the module that generates the default email address used in the "from" attribute (Professional, Developer and Platinum versions of the plugin).
18
+ * Fixes some errors in the CFF - CSV Generator add-on (Platinum version of the plugin).
19
+
20
+ = 1.0.288 =
21
+
22
+ * Implements new Widgets to allow the specific integration with the Page Builder by SiteOrigin.
23
+ * Improves the integration with the other pages builders.
24
+ * Modifies the Appearance/Widget, allowing to associate a class name to the form, and pass to it additional attributes (Professional, Developer and Platinum versions of the plugin).
25
+ * Includes minimum changes in the CFF - WooCommerce add-on (Developer and Platinum versions of the plugin).
26
+
27
+ = 1.0.287 =
28
+
29
+ * Fixes an issue that causes the loopback request to the site fails.
30
+
31
+ = 1.0.286 =
32
+
33
+ * Modifies the blocks for the Gutenberg editor, preparing the plugin for WordPress 5.1
34
+
35
+ = 1.0.285 =
36
+
37
+ * Fixes an issue in the date/time controls.
38
+
39
+ = 1.0.284 =
40
+
41
+ * Fixes some issues in the slider control.
42
+ * Modifies the Date controls allowing to enter other fields' names as the min and max attributes.
43
+ * Modifies the Captcha generator to fix a conflict with other plugins.
44
+ * Includes some minimal changes in the DS fields (Developer and Platinum versions of the plugin).
45
+ * Includes some minimal changes in the interface of the Users Permissions add-on. Assings class names to the different tags in the list of users submissions (Developer and Platinum versions of the plugin).
46
+ * Modifies the CSV Generator add-on to improve the security in the generated CSV files.
47
+
48
+ = 1.0.283 =
49
+
50
+ * Modifies the code that assigns the default values to the slider control.
51
+
52
+ = 1.0.282 =
53
+
54
+ * Fixes an issue in the slider controls.
55
+
56
+ = 1.0.281 =
57
+
58
+ * Fixes a conflict with older browsers.
59
+ * Modifies the SESSION Management module.
60
+ * Includes a new module for cleaning the expired transients.
61
+ * The Platinum version of the plugin includes the CSV Generator add-on.
62
+
63
= 1.0.280 =
64
65
* Modifies the slider controls allowing to integrate other fields in the form with the attributes: min, max and step, and vary them dynamically at runtime.
config/cpcff_config.cfg.php CHANGED
@@ -132,11 +132,13 @@ if(!function_exists('cpcff_init_constants'))
132
// User emails
133
if(!defined('CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email'))
134
{
135
- $user_id = get_current_user_id();
136
- define(
137
- 'CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email',
138
- ($user_id)?get_the_author_meta('user_email', get_current_user_id()):''
139
- );
140
}
141
142
if(!defined('CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails'))
132
// User emails
133
if(!defined('CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email'))
134
{
135
+ $user_email = get_the_author_meta('user_email', get_current_user_id());
136
+ $host = $_SERVER['HTTP_HOST'];
137
+ preg_match("/[^\.\/]+(\.[^\.\/]+)?#x2F;", $host, $matches);
138
+ $domain = $matches[0];
139
+ $pos = strpos($user_email, $domain);
140
+ if ($pos === false) define('CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email', 'admin@'.$domain );
141
+ else define('CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email', $user_email );
142
}
143
144
if(!defined('CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails'))
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.280
7
Text Domain: calculated-fields-form
8
Author: CodePeople
9
Author URI: https://cff.dwbooster.com
@@ -15,12 +15,8 @@ if(!defined('WP_DEBUG') || true != WP_DEBUG)
15
error_reporting(E_ERROR|E_PARSE);
16
}
17
18
- require_once 'inc/cpcff_session.inc.php';
19
- // Start Session
20
- if( !defined('DOING_AJAX') && !defined('DOING_CRON')) CP_SESSION::session_start();
21
-
22
// Defining main constants
23
- define('CP_CALCULATEDFIELDSF_VERSION', '1.0.280' );
24
define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
25
define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
26
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.290
7
Text Domain: calculated-fields-form
8
Author: CodePeople
9
Author URI: https://cff.dwbooster.com
15
error_reporting(E_ERROR|E_PARSE);
16
}
17
18
// Defining main constants
19
+ define('CP_CALCULATEDFIELDSF_VERSION', '1.0.290' );
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/stylepublic.css CHANGED
@@ -117,7 +117,7 @@
117
#fbuilder .col-sm-9,
118
#fbuilder .col-sm-10,
119
#fbuilder .col-sm-11{float:left;clear:none;margin-left:0;margin-right:0;}
120
- #fbuilder .col-sm-12{float:none;clear:bothmargin-left:0;margin-right:0;;}
121
122
#fbuilder .col-sm-1 {width: 8.33333333%;}
123
#fbuilder .col-sm-2 {width: 16.66666667%;}
117
#fbuilder .col-sm-9,
118
#fbuilder .col-sm-10,
119
#fbuilder .col-sm-11{float:left;clear:none;margin-left:0;margin-right:0;}
120
+ #fbuilder .col-sm-12{float:none;clear:both;margin-left:0;margin-right:0;}
121
122
#fbuilder .col-sm-1 {width: 8.33333333%;}
123
#fbuilder .col-sm-2 {width: 16.66666667%;}
inc/cpcff_admin_int.inc.php CHANGED
@@ -491,7 +491,7 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
491
<table class="form-table">
492
<tr valign="top">
493
<th scope="row"><?php _e( '"From" email', 'calculated-fields-form' ); ?></th>
494
- <td><input type="text" name="fp_from_email" size="40" value="<?php echo esc_attr($form_obj->get_option('fp_from_email', CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email)); ?>" /></td>
495
</tr>
496
<tr valign="top">
497
<th scope="row"><?php _e( 'Destination emails (comma separated)', 'calculated-fields-form' ); ?></th>
491
<table class="form-table">
492
<tr valign="top">
493
<th scope="row"><?php _e( '"From" email', 'calculated-fields-form' ); ?></th>
494
+ <td><input type="text" name="fp_from_email" size="40" value="<?php echo esc_attr($form_obj->get_option('fp_from_email', CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email)); ?>" /><br><i>Ex: admin@<?php echo str_replace('www.','',$_SERVER["HTTP_HOST"]); ?></i></td>
495
</tr>
496
<tr valign="top">
497
<th scope="row"><?php _e( 'Destination emails (comma separated)', 'calculated-fields-form' ); ?></th>
inc/cpcff_auxiliary.inc.php CHANGED
@@ -122,6 +122,51 @@ if(!class_exists('CPCFF_AUXILIARY'))
122
);
123
} // End clean_json
124
125
/**
126
* Decodes a JSON string.
127
*
122
);
123
} // End clean_json
124
125
+ /**
126
+ * Set the hook for cleanning the expired transients
127
+ *
128
+ * @since 1.0.281
129
+ */
130
+ public static function clean_transients_hook()
131
+ {
132
+ add_action('cpcff_clean_transients', array('CPCFF_AUXILIARY', 'clean_transients'));
133
+ if (!wp_next_scheduled('cpcff_clean_transients'))
134
+ wp_schedule_event(time() + 5, 'daily', 'cpcff_clean_transients');
135
+ } // End clean_transients_hook
136
+
137
+ /**
138
+ * Clean the expired transients
139
+ *
140
+ * @since 1.0.281
141
+ */
142
+ public static function clean_transients()
143
+ {
144
+ global $wpdb;
145
+ $table = $wpdb->options;
146
+
147
+ // get current PHP time, offset by a minute to avoid clashes with other tasks
148
+ $threshold = time() - MINUTE_IN_SECONDS;
149
+
150
+ // delete expired transients, using the paired timeout record to find them
151
+ $sql = "
152
+ delete from t1, t2
153
+ using $table t1
154
+ join $table t2 on t2.option_name = replace(t1.option_name, '_timeout', '')
155
+ where t1.option_name like '\_transient\_timeout\_%'
156
+ and t1.option_value < '$threshold'
157
+ ";
158
+ $wpdb->query($sql);
159
+
160
+ // delete orphaned transient expirations
161
+ $sql = "
162
+ delete from $table
163
+ where option_name like '\_transient\_timeout\_%'
164
+ and option_value < '$threshold'
165
+ ";
166
+
167
+ $wpdb->query($sql);
168
+ } // End clean_transients
169
+
170
/**
171
* Decodes a JSON string.
172
*
inc/cpcff_main.inc.php CHANGED
@@ -112,6 +112,10 @@ if(!class_exists('CPCFF_MAIN'))
112
// Fix different troubleshoots
113
$this->troubleshoots();
114
115
} // End __construct
116
117
/**
@@ -127,7 +131,7 @@ if(!class_exists('CPCFF_MAIN'))
127
self::$_instance = new self();
128
}
129
return self::$_instance;
130
- } // End init
131
132
/**
133
* Loads the primary resources, previous to the plugin's initialization
@@ -154,6 +158,8 @@ if(!class_exists('CPCFF_MAIN'))
154
*/
155
public function init()
156
{
157
if ( $this->_is_admin ) // Initializes the WordPress modules.
158
{
159
if(
@@ -182,9 +188,6 @@ if(!class_exists('CPCFF_MAIN'))
182
$this->_define_shortcodes();
183
}
184
185
- // Integration with Page Builders
186
- require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/inc/cpcff_page_builders.inc.php';
187
- CPCFF_PAGE_BUILDERS::init();
188
} // End init
189
190
/**
112
// Fix different troubleshoots
113
$this->troubleshoots();
114
115
+ // Integration with Page Builders
116
+ require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/inc/cpcff_page_builders.inc.php';
117
+ CPCFF_PAGE_BUILDERS::run();
118
+
119
} // End __construct
120
121
/**
131
self::$_instance = new self();
132
}
133
return self::$_instance;
134
+ } // End instance
135
136
/**
137
* Loads the primary resources, previous to the plugin's initialization
158
*/
159
public function init()
160
{
161
+ CPCFF_AUXILIARY::clean_transients_hook(); // Set the hook for clearing the expired transients
162
+
163
if ( $this->_is_admin ) // Initializes the WordPress modules.
164
{
165
if(
188
$this->_define_shortcodes();
189
}
190
191
} // End init
192
193
/**
inc/cpcff_page_builders.inc.php CHANGED
@@ -7,15 +7,41 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
7
{
8
class CPCFF_PAGE_BUILDERS
9
{
10
private function __construct(){}
11
- public static function init()
12
{
13
- $instance = new self();
14
15
add_action( 'enqueue_block_editor_assets', array($instance,'gutenberg_editor' ) );
16
add_action( 'elementor/widgets/widgets_registered', array($instance, 'elementor_editor') );
17
add_action( 'elementor/elements/categories_registered', array($instance, 'elementor_editor_category') );
18
- }
19
20
/**************************** GUTENBERG ****************************/
21
@@ -26,8 +52,8 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
26
{
27
global $wpdb;
28
29
- wp_enqueue_style('cp_calculatedfieldsf_gutenberg_editor_css', plugins_url('/css/gutenberg.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH));
30
- wp_enqueue_script('cp_calculatedfieldsf_gutenberg_editor', plugins_url('/js/cp_calculatedfieldsf_gutenberg.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH));
31
32
$url = CPCFF_AUXILIARY::site_url();
33
$url .= ((strpos($url, '?') === false) ? '?' : '&').'cff-editor-preview=1&cff-amp-redirected=1&cff-form=';
@@ -53,13 +79,34 @@ if(!class_exists('CPCFF_PAGE_BUILDERS'))
53
54
public function elementor_editor_category()
55
{
56
- require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/elementor_category.pb.php';
57
} // End elementor_editor
58
59
public function elementor_editor()
60
{
61
- require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/elementor.pb.php';
62
} // End elementor_editor
63
64
} // End CPCFF_PAGE_BUILDERS
65
}
7
{
8
class CPCFF_PAGE_BUILDERS
9
{
10
+ private static $_instance;
11
private function __construct(){}
12
+ private static function instance()
13
{
14
+ if(!isset(self::$_instance)) self::$_instance = new self();
15
+ return self::$_instance;
16
+ } // End instance
17
18
+ public static function run()
19
+ {
20
+ $instance = self::instance();
21
+ add_action('init', array($instance, 'init'));
22
+ add_action('after_setup_theme', array($instance, 'after_setup_theme'));
23
+ }
24
+
25
+ public function init()
26
+ {
27
+ $instance = $instance = self::instance();
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') );
34
add_action( 'elementor/elements/categories_registered', array($instance, 'elementor_editor_category') );
35
+ } // End init
36
+
37
+ public function after_setup_theme()
38
+ {
39
+ $instance = $instance = self::instance();
40
+
41
+ // SiteOrigin
42
+ add_filter('siteorigin_widgets_widget_folders', array($instance, 'siteorigin_widgets_collection'));
43
+ add_filter('siteorigin_panels_widget_dialog_tabs', array($instance, 'siteorigin_panels_widget_dialog_tabs'));
44
+ } // End after_setup_theme
45
46
/**************************** GUTENBERG ****************************/
47
52
{
53
global $wpdb;
54
55
+ wp_enqueue_style('cp_calculatedfieldsf_gutenberg_editor_css', plugins_url('/pagebuilders/gutenberg/assets/css/gutenberg.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH));
56
+ wp_enqueue_script('cp_calculatedfieldsf_gutenberg_editor', plugins_url('/pagebuilders/gutenberg/assets/js/gutenberg.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH));
57
58
$url = CPCFF_AUXILIARY::site_url();
59
$url .= ((strpos($url, '?') === false) ? '?' : '&').'cff-editor-preview=1&cff-amp-redirected=1&cff-form=';
79
80
public function elementor_editor_category()
81
{
82
+ require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/elementor/elementor_category.pb.php';
83
} // End elementor_editor
84
85
public function elementor_editor()
86
{
87
+ wp_enqueue_style('cp_calculatedfieldsf_elementor_editor_css', plugins_url('/pagebuilders/elementor/assets/elementor.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH));
88
+ require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/elementor/elementor.pb.php';
89
} // End elementor_editor
90
91
+ /**************************** ELEMENTOR ****************************/
92
+
93
+ public function siteorigin_widgets_collection($folders)
94
+ {
95
+ $folders[] = CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/siteorigin/';
96
+ return $folders;
97
+ } // End siteorigin_widgets_collection
98
+
99
+ public function siteorigin_panels_widget_dialog_tabs($tabs)
100
+ {
101
+ $tabs[] = array(
102
+ 'title' => __('Calculated Fields Form', 'calculated-fields-form'),
103
+ 'filter' => array(
104
+ 'groups' => array('calculated-fields-form')
105
+ )
106
+ );
107
+
108
+ return $tabs;
109
+ } // End siteorigin_panels_widget_dialog_tabs
110
+
111
} // End CPCFF_PAGE_BUILDERS
112
}
inc/cpcff_session.inc.php CHANGED
@@ -44,7 +44,7 @@ if( !class_exists( 'CP_SESSION' ) )
44
else
45
{
46
$this->session_id = $this->_generate_session_id();
47
- $this->expiration = time()+$this->expiration_interval;
48
$this->_set_cookie();
49
}
50
44
else
45
{
46
$this->session_id = $this->_generate_session_id();
47
+ $this->expiration = $this->expiration_interval;
48
$this->_set_cookie();
49
}
50
js/fbuilder-pro-public.jquery.js CHANGED
@@ -568,7 +568,8 @@
568
for( var field_id in form_data )
569
{
570
item = form_obj.getItem( field_id+id );
571
- if( typeof item[ 'setVal' ] != 'undefined' ) item.setVal( form_data[ field_id ] );
572
}
573
574
$.fbuilder.showHideDep(
568
for( var field_id in form_data )
569
{
570
item = form_obj.getItem( field_id+id );
571
+ try{ if( typeof item[ 'setVal' ] != 'undefined' ) item.setVal( form_data[ field_id ] ); }
572
+ catch(err){}
573
}
574
575
$.fbuilder.showHideDep(
js/fields-admin/04_fbuilder.fdate.js CHANGED
@@ -36,6 +36,10 @@
36
showDatepicker: true,
37
showTimepicker: false,
38
39
defaultDate:"",
40
defaultTime:"",
41
working_dates:[true,true,true,true,true,true,true],
@@ -74,6 +78,9 @@
74
}
75
},
76
{s:"#sShowDatepicker",e:"click", l:"showDatepicker", f:function(el){return el.is(':checked');}},
77
{s:"#sMinHour",e:"change keyup", l:"minHour"},
78
{s:"#sMaxHour",e:"change keyup", l:"maxHour"},
79
{s:"#sMinMinute",e:"change keyup", l:"minMinute"},
@@ -106,8 +113,8 @@
106
{
107
var str = "";
108
str += '<div><label>Default date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: Leave empty for current date.\n\nDate: A Fixed date with the same date format indicated in the &quot;Date Format&quot; drop-down field.\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are &quot;y&quot; for years, &quot;m&quot; for months, &quot;w&quot; for weeks, and &quot;d&quot; for days. For example, &quot;+1m +7d&quot; represents one month and seven days from today.">help?</a>]</label><br /><input class="large" name="sDefaultDate" id="sDefaultDate" value="'+$.fbuilder.htmlEncode(this.defaultDate)+'" /></div>';
109
- str += '<div><label>Min date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No min Date.\n\nDate: A Fixed date with the same date format indicated in the &quot;Date Format&quot; drop-down field.\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are &quot;y&quot; for years, &quot;m&quot; for months, &quot;w&quot; for weeks, and &quot;d&quot; for days. For example, &quot;+1m +7d&quot; represents one month and seven days from today.">help?</a>]</label><br /><input class="large" name="sMinDate" id="sMinDate" value="'+$.fbuilder.htmlEncode(this.minDate)+'" /></div>';
110
- str += '<div><label>Max date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No max Date.\n\nDate: A Fixed date with the same date format indicated in the &quot;Date Format&quot; drop-down field.\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are &quot;y&quot; for years, &quot;m&quot; for months, &quot;w&quot; for weeks, and &quot;d&quot; for days. For example, &quot;+1m +7d&quot; represents one month and seven days from today.">help?</a>]</label><br /><input class="large" name="sMaxDate" id="sMaxDate" value="'+$.fbuilder.htmlEncode(this.maxDate)+'" /></div>';
111
str += '<div><label>Invalid Dates [<a class="helpfbuilder" text="To define some dates as invalid, enter the dates with the format: mm/dd/yyyy separated by comma; for example: 12/31/2014,02/20/2014 or by hyphen for intervals; for example: 12/20/2014-12/28/2014 ">help?</a>]</label><br /><input class="large" name="sInvalidDates" id="sInvalidDates" value="'+$.fbuilder.htmlEncode(this.invalidDates)+'" /></div>';
112
str += '<div><input type="checkbox" name="sShowDropdown" id="sShowDropdown" '+((this.showDropdown)?"checked":"")+'/><label>Show Dropdown Year and Month</label><div id="divdropdownRange" style="display:'+((this.showDropdown)?"":"none")+'">Year Range [<a class="helpfbuilder" text="The range of years displayed in the year drop-down: either relative to today\'s year (&quot;-nn:+nn&quot;), absolute (&quot;nnnn:nnnn&quot;), or combinations of these formats (&quot;nnnn:-nn&quot;)">help?</a>]: <input type="text" name="sDropdownRange" id="sDropdownRange" value="'+$.fbuilder.htmlEncode(this.dropdownRange)+'"/></div></div>';
113
str += '<div class="working_dates"><label>Selectable dates </label><br /><input name="sWD0" id="sWD0" value="0" type="checkbox" '+((this.working_dates[0])?"checked":"")+'/>Su<input name="sWD1" id="sWD1" value="1" type="checkbox" '+((this.working_dates[1])?"checked":"")+'/>Mo<input name="sWD2" id="sWD2" value="2" type="checkbox" '+((this.working_dates[2])?"checked":"")+'/>Tu<input name="sWD3" id="sWD3" value="3" type="checkbox" '+((this.working_dates[3])?"checked":"")+'/>We<input name="sWD4" id="sWD4" value="4" type="checkbox" '+((this.working_dates[4])?"checked":"")+'/>Th<input name="sWD5" id="sWD5" value="5" type="checkbox" '+((this.working_dates[5])?"checked":"")+'/>Fr<input name="sWD6" id="sWD6" value="6" type="checkbox" '+((this.working_dates[6])?"checked":"")+'/>Sa</div>';
@@ -125,6 +132,9 @@
125
126
str += '<div><label>Steps for hours</label><br /><input class="large" name="sStepHour" id="sStepHour" value="'+$.fbuilder.htmlEncode(this.stepHour)+'" /></div>';
127
str += '<div><label>Steps for minutes</label><br /><input class="large" name="sStepMinute" id="sStepMinute" value="'+$.fbuilder.htmlEncode(this.stepMinute)+'" /></div>';
128
str += '</div>';
129
str += '<hr></hr>';
130
return str;
36
showDatepicker: true,
37
showTimepicker: false,
38
39
+ ariaHourLabel: 'hours',
40
+ ariaMinuteLabel: 'minutes',
41
+ ariaAMPMLabel: 'am or pm',
42
+
43
defaultDate:"",
44
defaultTime:"",
45
working_dates:[true,true,true,true,true,true,true],
78
}
79
},
80
{s:"#sShowDatepicker",e:"click", l:"showDatepicker", f:function(el){return el.is(':checked');}},
81
+ {s:"#sAriaAMPMLabel",e:"change keyup", l:"ariaAMPMLabel"},
82
+ {s:"#sAriaHourLabel",e:"change keyup", l:"ariaHourLabel"},
83
+ {s:"#sAriaMinuteLabel",e:"change keyup", l:"ariaMinuteLabel"},
84
{s:"#sMinHour",e:"change keyup", l:"minHour"},
85
{s:"#sMaxHour",e:"change keyup", l:"maxHour"},
86
{s:"#sMinMinute",e:"change keyup", l:"minMinute"},
113
{
114
var str = "";
115
str += '<div><label>Default date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: Leave empty for current date.\n\nDate: A Fixed date with the same date format indicated in the &quot;Date Format&quot; drop-down field.\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are &quot;y&quot; for years, &quot;m&quot; for months, &quot;w&quot; for weeks, and &quot;d&quot; for days. For example, &quot;+1m +7d&quot; represents one month and seven days from today.">help?</a>]</label><br /><input class="large" name="sDefaultDate" id="sDefaultDate" value="'+$.fbuilder.htmlEncode(this.defaultDate)+'" /></div>';
116
+ str += '<div><label>Min date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No min Date.\n\nDate: A Fixed date with the same date format indicated in the &quot;Date Format&quot; drop-down field.\n\nField Name: the name of another date field, Ex: fieldname1\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are &quot;y&quot; for years, &quot;m&quot; for months, &quot;w&quot; for weeks, and &quot;d&quot; for days. For example, &quot;+1m +7d&quot; represents one month and seven days from today.">help?</a>]</label><br /><input class="large" name="sMinDate" id="sMinDate" value="'+$.fbuilder.htmlEncode(this.minDate)+'" /></div>';
117
+ str += '<div><label>Max date [<a class="helpfbuilder" text="You can put one of the following type of values into this field:\n\nEmpty: No max Date.\n\nDate: A Fixed date with the same date format indicated in the &quot;Date Format&quot; drop-down field.\n\nField Name: the name of another date field, Ex: fieldname1\n\nNumber: A number of days from today. For example 2 represents two days from today and -1 represents yesterday.\n\nString: A smart text indicating a relative date. Relative dates must contain value (number) and period pairs; valid periods are &quot;y&quot; for years, &quot;m&quot; for months, &quot;w&quot; for weeks, and &quot;d&quot; for days. For example, &quot;+1m +7d&quot; represents one month and seven days from today.">help?</a>]</label><br /><input class="large" name="sMaxDate" id="sMaxDate" value="'+$.fbuilder.htmlEncode(this.maxDate)+'" /></div>';
118
str += '<div><label>Invalid Dates [<a class="helpfbuilder" text="To define some dates as invalid, enter the dates with the format: mm/dd/yyyy separated by comma; for example: 12/31/2014,02/20/2014 or by hyphen for intervals; for example: 12/20/2014-12/28/2014 ">help?</a>]</label><br /><input class="large" name="sInvalidDates" id="sInvalidDates" value="'+$.fbuilder.htmlEncode(this.invalidDates)+'" /></div>';
119
str += '<div><input type="checkbox" name="sShowDropdown" id="sShowDropdown" '+((this.showDropdown)?"checked":"")+'/><label>Show Dropdown Year and Month</label><div id="divdropdownRange" style="display:'+((this.showDropdown)?"":"none")+'">Year Range [<a class="helpfbuilder" text="The range of years displayed in the year drop-down: either relative to today\'s year (&quot;-nn:+nn&quot;), absolute (&quot;nnnn:nnnn&quot;), or combinations of these formats (&quot;nnnn:-nn&quot;)">help?</a>]: <input type="text" name="sDropdownRange" id="sDropdownRange" value="'+$.fbuilder.htmlEncode(this.dropdownRange)+'"/></div></div>';
120
str += '<div class="working_dates"><label>Selectable dates </label><br /><input name="sWD0" id="sWD0" value="0" type="checkbox" '+((this.working_dates[0])?"checked":"")+'/>Su<input name="sWD1" id="sWD1" value="1" type="checkbox" '+((this.working_dates[1])?"checked":"")+'/>Mo<input name="sWD2" id="sWD2" value="2" type="checkbox" '+((this.working_dates[2])?"checked":"")+'/>Tu<input name="sWD3" id="sWD3" value="3" type="checkbox" '+((this.working_dates[3])?"checked":"")+'/>We<input name="sWD4" id="sWD4" value="4" type="checkbox" '+((this.working_dates[4])?"checked":"")+'/>Th<input name="sWD5" id="sWD5" value="5" type="checkbox" '+((this.working_dates[5])?"checked":"")+'/>Fr<input name="sWD6" id="sWD6" value="6" type="checkbox" '+((this.working_dates[6])?"checked":"")+'/>Sa</div>';
132
133
str += '<div><label>Steps for hours</label><br /><input class="large" name="sStepHour" id="sStepHour" value="'+$.fbuilder.htmlEncode(this.stepHour)+'" /></div>';
134
str += '<div><label>Steps for minutes</label><br /><input class="large" name="sStepMinute" id="sStepMinute" value="'+$.fbuilder.htmlEncode(this.stepMinute)+'" /></div>';
135
+ str += '<div><label>Label for hours in screen readers</label><br /><input class="large" name="sAriaHourLabel" id="sAriaHourLabel" value="'+$.fbuilder.htmlEncode(this.ariaHourLabel)+'" /></div>';
136
+ str += '<div><label>Label for minutes in screen readers</label><br /><input class="large" name="sAriaMinuteLabel" id="sAriaMinuteLabel" value="'+$.fbuilder.htmlEncode(this.ariaMinuteLabel)+'" /></div>';
137
+ str += '<div><label>Label for am/pm component in screen readers</label><br /><input class="large" name="sAriaAMPMLabel" id="sAriaAMPMLabel" value="'+$.fbuilder.htmlEncode(this.ariaAMPMLabel)+'" /></div>';
138
str += '</div>';
139
str += '<hr></hr>';
140
return str;
js/fields-public/02_fbuilder.fslider.js CHANGED
@@ -21,17 +21,22 @@
21
caption:"{0}",
22
_getAttr:function(attr)
23
{
24
- if($.isNumeric(this[attr])) return parseFloat(this[attr]);
25
- var f = this.getField(this[attr]);
26
- if(f) return parseFloat(f.val());
27
return 0;
28
},
29
_setHndl:function(attr, one)
30
{
31
- if($.isNumeric(this[attr])) return;
32
- let s = (/^fieldname\d+#x2F;i) ? '[id*="'+this[attr]+this.form_identifier+'"]' : this[attr],
33
i = (one) ? 'one' : 'on';
34
- var me = this;
35
$(document)[i]('change', s, function(){ if(me['set_'+attr]) me['set_'+attr](me._getAttr(attr));});
36
},
37
_setThousandsSeparator : function(v)
@@ -109,7 +114,7 @@
109
},
110
show:function()
111
{
112
- return '<div class="fields '+this.csslayout+' '+this.name+' cff-slider-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+'</label><div class="dfield slider-container"><input id="'+this.name+'" name="'+this.name+'" class="field" type="hidden" value=""/><div id="'+this.name+'_slider" class="slider '+this.size+'"></div><div class="corner-captions '+this.size+'"><span class="left-corner">'+this.minCaption+'</span><span class="right-corner" style="float:right;">'+this.maxCaption+'</span></div><div id="'+this.name+'_caption" class="slider-caption"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
113
},
114
set_min : function(v)
115
{
@@ -172,7 +177,7 @@
172
try{ v = JSON.parse(v); }catch(err){}
173
try{
174
$( '[name="'+this.name+'"]' ).val( v );
175
- $(this.name+'_slider').slider((($.isArray(v)) ? 'values' : 'value'), v);
176
this._setFieldValue();
177
}catch( err ){}
178
}
21
caption:"{0}",
22
_getAttr:function(attr)
23
{
24
+ var me = this, f, v = $.trim(me[attr]);
25
+ if($.isNumeric(v)) return parseFloat(v);
26
+ f = (/^fieldname\d+#x2F;i.test(v)) ? me.getField(v) : false;
27
+ if(f)
28
+ {
29
+ v = f.val();
30
+ if($.isNumeric(v)) return parseFloat(v);
31
+ }
32
return 0;
33
},
34
_setHndl:function(attr, one)
35
{
36
+ var me = this, v = $.trim(me[attr]);
37
+ if($.isNumeric(v)) return;
38
+ var s = (/^fieldname\d+#x2F;i.test(v)) ? '[id*="'+v+me.form_identifier+'"]' : v,
39
i = (one) ? 'one' : 'on';
40
$(document)[i]('change', s, function(){ if(me['set_'+attr]) me['set_'+attr](me._getAttr(attr));});
41
},
42
_setThousandsSeparator : function(v)
114
},
115
show:function()
116
{
117
+ return '<div class="fields '+this.csslayout+' '+this.name+' cff-slider-field" id="field'+this.form_identifier+'-'+this.index+'"><label for="'+this.name+'">'+this.title+'</label><div class="dfield slider-container"><input id="'+this.name+'" name="'+this.name+'" class="field" type="hidden" value="'+$.fbuilder.htmlEncode(this._getAttr('predefined'))+'"/><div id="'+this.name+'_slider" class="slider '+this.size+'"></div><div class="corner-captions '+this.size+'"><span class="left-corner">'+this.minCaption+'</span><span class="right-corner" style="float:right;">'+this.maxCaption+'</span></div><div id="'+this.name+'_caption" class="slider-caption"></div><span class="uh">'+this.userhelp+'</span></div><div class="clearer"></div></div>';
118
},
119
set_min : function(v)
120
{
177
try{ v = JSON.parse(v); }catch(err){}
178
try{
179
$( '[name="'+this.name+'"]' ).val( v );
180
+ $('#'+this.name+'_slider').slider((($.isArray(v)) ? 'values' : 'value'), v);
181
this._setFieldValue();
182
}catch( err ){}
183
}
js/fields-public/04_fbuilder.fdate.js CHANGED
@@ -28,28 +28,103 @@
28
showDatepicker: true,
29
showTimepicker: false,
30
31
defaultDate:"",
32
defaultTime:"",
33
working_dates:[true,true,true,true,true,true,true],
34
- init:function()
35
{
36
- var me = this;
37
- function checkValue( v, min, max )
38
{
39
- v = parseInt( v );
40
- v = ( isNaN( v ) ) ? max : v;
41
- return Math.min(Math.max(v,min),max);
42
}
43
44
- me.minHour = checkValue( me.minHour, 0, 23 );
45
- me.maxHour = checkValue( me.maxHour, 0, 23 );
46
- me.minMinute = checkValue( me.minMinute, 0, 59 );
47
- me.maxMinute = checkValue( me.maxMinute, 0, 59 );
48
- me.stepHour = checkValue( me.stepHour, 1, Math.max( 1, me.maxHour - me.minHour ) );
49
- me.stepMinute = checkValue( me.stepMinute, 1, Math.max( 1, me.maxMinute - me.minMinute ) );
50
- me.dformat = me.dformat.replace(/\//g, me.dseparator);
51
52
me.invalidDates = me.invalidDates.replace( /\s+/g, '' );
53
if( !/^\s*#x2F;.test( me.invalidDates ) )
54
{
55
var dateRegExp = new RegExp( /^\d{1,2}\/\d{1,2}\/\d{4}#x2F; ),
@@ -86,6 +161,18 @@
86
}
87
}
88
}
89
},
90
get_hours:function()
91
{
@@ -98,12 +185,11 @@
98
99
while( ( h = from + me.stepHour * i ) <= to )
100
{
101
-
102
if( h < 10 ) h = '0'+''+h;
103
str += '<option value="' + h + '">' + h + '</option>';
104
i++;
105
}
106
- return '<select id="'+me.name+'_hours" name="'+me.name+'_hours" class="hours-component">' + str + '</select>:';
107
},
108
get_minutes:function()
109
{
@@ -120,18 +206,18 @@
120
str += '<option value="' + m + '">' + m + '</option>';
121
i++;
122
}
123
- return '<select id="'+me.name+'_minutes" name="'+me.name+'_minutes" class="minutes-component">' + str + '</select>';
124
},
125
get_ampm:function()
126
{
127
var str = '';
128
if( this.tformat == 12 )
129
{
130
- return '<select id="'+this.name+'_ampm" class="ampm-component"><option value="am">am</option><option value="pm">pm</option></select>';
131
}
132
return str;
133
},
134
- set_date_time:function()
135
{
136
var me = this,
137
str = $( '#'+me.name+'_date' ).val();
@@ -150,57 +236,52 @@
150
}
151
$( '#'+me.name ).val( str ).change();
152
},
153
- show:function()
154
{
155
- var me = this,
156
- n = me.name,
157
- attr = 'value',
158
- format_label = [],
159
- date_tag_type = 'text',
160
- disabled = '',
161
- date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required)?' required': '');
162
-
163
- if( me.predefinedClick ) attr = 'placeholder';
164
- if( me.showDatepicker ) format_label.push(me.dformat);
165
- else{ date_tag_type = 'hidden'; disabled='disabled';}
166
- if( me.showTimepicker ) format_label.push('HH:mm');
167
-
168
- return '<div class="fields '+me.csslayout+' '+n+' cff-date-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+n+'">'+me.title+''+((me.required)?"<span class='r'>*</span>":"")+( (format_label.length) ? ' <span class="dformat">('+format_label.join(' ')+')</span>' : '' )+'</label><div class="dfield"><input id="'+n+'" name="'+n+'" type="hidden" value="'+$.fbuilder.htmlEncode(me.predefined)+'"/><input id="'+n+'_date" name="'+n+'_date" class="'+date_tag_class+' date-component" type="'+date_tag_type+'" '+attr+'="'+$.fbuilder.htmlEncode(me.predefined)+'" '+disabled+' />'+( ( me.showTimepicker ) ? ' '+me.get_hours()+me.get_minutes()+' '+me.get_ampm() : '' )+'<span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
169
},
170
- setDefaultDate : function()
171
{
172
var me = this,
173
p = {
174
dateFormat: me.dformat.replace(/yyyy/g,"yy"),
175
- minDate: me.minDate,
176
- maxDate: me.maxDate
177
},
178
dp = $( "#"+me.name+"_date" ),
179
dd = (me.defaultDate != "") ? me.defaultDate : ( ( me.predefined != "" ) ? me.predefined : new Date() );
180
181
dp.click( function(){ $(document).click(); $(this).focus(); } );
182
- if (me.showDropdown )
183
- {
184
- if( me.dropdownRange.indexOf( ':' ) == -1 ) me.dropdownRange = '-10:+10';
185
- p = $.extend(p,{changeMonth: true,changeYear: true,yearRange: me.dropdownRange});
186
- }
187
- p = $.extend(p, { beforeShowDay: ( function ( w, i ) { return function( d ){ return [me.validateDate( d, w, i ), ""]; }; } )( me.working_dates, me.invalidDates ) } );
188
dp.datepicker(p);
189
- if( !me.predefinedClick ) dp.datepicker( "setDate", dd);
190
- if( !me.validateDate( dp.datepicker( "getDate"), me.working_dates, me.invalidDates) )
191
- {
192
- dp.datepicker( "setDate", '');
193
- }
194
},
195
- setDefaultTime : function()
196
{
197
- var me = this;
198
- function setValue( f, v, m )
199
- {
200
- v = Math.min( v*1, m*1 );
201
- v = ( v < 10 ) ? 0+''+v : v;
202
- $( '#' + f + ' [value="' + v + '"]' ).prop( 'selected', true );
203
- };
204
205
if( me.showTimepicker )
206
{
@@ -219,66 +300,32 @@
219
if(time[ 'hour' ] == me.maxHour) time[ 'minute' ] = Math.min(time['minute'],me.maxMinute);
220
}
221
222
- setValue(
223
me.name+'_hours',
224
( me.tformat == 12 ) ? ( ( time[ 'hour' ] > 12 ) ? time[ 'hour' ] - 12 : ( ( time[ 'hour' ] == 0 ) ? 12 : time[ 'hour' ] ) ) : time[ 'hour' ],
225
( me.tformat == 12 ) ? 12 : me.maxHour
226
);
227
228
- setValue( me.name+'_minutes', time[ 'minute' ], me.maxMinute );
229
$( '#'+me.name+'_ampm'+' [value="' + ( ( time[ 'hour' ] < 12 ) ? 'am' : 'pm' ) + '"]' ).prop( 'selected', true );
230
}
231
},
232
- setEvents : function()
233
{
234
- var me = this,
235
- f = function(){
236
- $( '#'+me.name+'_date' ).valid();
237
- me.set_date_time();
238
- };
239
240
- $( document ).on( 'change', '#'+me.name+'_date', function(){ f(); } );
241
- $( document ).on( 'change', '#'+me.name+'_hours', function(){ f(); } );
242
- $( document ).on( 'change', '#'+me.name+'_minutes', function(){ f(); } );
243
- $( document ).on( 'change', '#'+me.name+'_ampm', function(){ f(); } );
244
245
- $( '#cp_calculatedfieldsf_pform'+me.form_identifier ).bind( 'reset', function(){ setTimeout( function(){ me.setDefaultDate(); me.setDefaultTime(); me.set_date_time(); }, 500 ); } );
246
- },
247
- validateDate: function( d, w, i )
248
- {
249
- try{
250
- if( d === null || !w[ d.getDay()] ) return false;
251
- if( i !== null )
252
- {
253
- for( var j = 0, h = i.length; j < h; j++ )
254
- {
255
- if( d.getDate() == i[ j ].getDate() && d.getMonth() == i[ j ].getMonth() && d.getFullYear() == i[ j ].getFullYear() ) return false;
256
- }
257
- }
258
- }
259
- catch( _err ){}
260
- return true;
261
- },
262
- validateTime : function( e, i )
263
- {
264
- if( i.showTimepicker )
265
- {
266
- var base = e.name.replace( '_date', '' ),
267
- h = $('#'+base+'_hours').val(),
268
- m = $('#'+base+'_minutes').val();
269
- if( i.tformat == 12 )
270
- {
271
- if( $('#'+base+'_ampm').val() == 'pm' && h != 12 ) h = h*1 + 12;
272
- if( $('#'+base+'_ampm').val() == 'am' && h == 12 ) h = 0;
273
- }
274
- if(
275
- h < i.minHour ||
276
- i.maxHour < h ||
277
- (h == i.minHour && m < i.minMinute) ||
278
- (h == i.maxHour && i.maxMinute < m)
279
- ) return false;
280
- }
281
- return true;
282
},
283
after_show:function()
284
{
@@ -307,8 +354,8 @@
307
(
308
( minDate == null || date >= minDate ) &&
309
( maxDate == null || date <= maxDate ) &&
310
- item.validateDate( $( e ).datepicker( 'getDate' ), item.working_dates, item.invalidDates ) &&
311
- item.validateTime( e, item )
312
);
313
}
314
return true;
@@ -321,10 +368,10 @@
321
322
if(!(date_format in $.validator.methods)) $.validator.addMethod(date_format, validator );
323
324
- me.setDefaultDate();
325
- me.setDefaultTime();
326
- me.setEvents();
327
- me.set_date_time();
328
},
329
val:function(raw)
330
{
@@ -370,14 +417,8 @@
370
break;
371
}
372
373
- if( me.showTimepicker )
374
- {
375
- return date.valueOf() / 86400000;
376
- }
377
- else
378
- {
379
- return Math.ceil( date.valueOf() / 86400000 );
380
- }
381
}
382
}
383
return 0;
@@ -390,13 +431,13 @@
390
.replace( /\s+/g, ' ' )
391
.split( ' ' );
392
this.defaultDate = v[ 0 ];
393
- this.setDefaultDate();
394
if( v.length == 2 )
395
{
396
this.defaultTime = v[ 1 ];
397
- this.setDefaultTime();
398
}
399
- this.set_date_time();
400
}
401
catch( err )
402
{}
28
showDatepicker: true,
29
showTimepicker: false,
30
31
+ ariaHourLabel: 'hours',
32
+ ariaMinuteLabel: 'minutes',
33
+ ariaAMPMLabel: 'am or pm',
34
+
35
defaultDate:"",
36
defaultTime:"",
37
working_dates:[true,true,true,true,true,true,true],
38
+
39
+ _getAttr:function(attr)
40
+ {
41
+ var me = this, f, v = $.trim(me[attr]);
42
+ if($.isNumeric(v)) return parseFloat(v);
43
+ f = (/^fieldname\d+#x2F;i.test(v)) ? me.getField(v) : false;
44
+ if(f)
45
+ {
46
+ v = f.val();
47
+ if(f.ftype == 'fdate') return new Date(v*86400000);
48
+ if($.isNumeric(v)) return parseFloat(v);
49
+ return v.replace(/^"+/, '').replace(/"+#x2F;, '');
50
+ }
51
+ return v;
52
+ },
53
+ _setHndl:function(attr, one)
54
{
55
+ var me = this, v = $.trim(me[attr]);
56
+ if(/^fieldname\d+#x2F;i.test(v))
57
{
58
+ var s = '[id*="'+v+me.form_identifier+'"]',
59
+ i = (one) ? 'one' : 'on';
60
+ $(document)[i]('change', s, function(){ if(me['set_'+attr]) me['set_'+attr](me._getAttr(attr));});
61
}
62
+ },
63
+ _set_Events : function()
64
+ {
65
+ var me = this,
66
+ f = function(){
67
+ $( '#'+me.name+'_date' ).valid();
68
+ me.set_dateTime();
69
+ };
70
71
+ $( document ).on( 'change', '#'+me.name+'_date', function(){ f(); } );
72
+ $( document ).on( 'change', '#'+me.name+'_hours', function(){ f(); } );
73
+ $( document ).on( 'change', '#'+me.name+'_minutes', function(){ f(); } );
74
+ $( document ).on( 'change', '#'+me.name+'_ampm', function(){ f(); } );
75
+
76
+ $( '#cp_calculatedfieldsf_pform'+me.form_identifier ).bind( 'reset', function(){ setTimeout( function(){ me.set_DefaultDate(); me.set_DefaultTime(); me.set_dateTime(); }, 500 ); } );
77
+ },
78
+ _validateDate: function( d, w, i )
79
+ {
80
+ try{
81
+ if( d === null || !w[ d.getDay()] ) return false;
82
+ if( i !== null )
83
+ {
84
+ for( var j = 0, h = i.length; j < h; j++ )
85
+ {
86
+ if( d.getDate() == i[ j ].getDate() && d.getMonth() == i[ j ].getMonth() && d.getFullYear() == i[ j ].getFullYear() ) return false;
87
+ }
88
+ }
89
+ }
90
+ catch( _err ){}
91
+ return true;
92
+ },
93
+ _validateTime : function( e, i )
94
+ {
95
+ if( i.showTimepicker )
96
+ {
97
+ var base = e.name.replace( '_date', '' ),
98
+ h = $('#'+base+'_hours').val(),
99
+ m = $('#'+base+'_minutes').val();
100
+ if( i.tformat == 12 )
101
+ {
102
+ if( $('#'+base+'_ampm').val() == 'pm' && h != 12 ) h = h*1 + 12;
103
+ if( $('#'+base+'_ampm').val() == 'am' && h == 12 ) h = 0;
104
+ }
105
+ if(
106
+ h < i.minHour ||
107
+ i.maxHour < h ||
108
+ (h == i.minHour && m < i.minMinute) ||
109
+ (h == i.maxHour && i.maxMinute < m)
110
+ ) return false;
111
+ }
112
+ return true;
113
+ },
114
+ init:function()
115
+ {
116
+ var me = this,
117
+ _checkValue = function( v, min, max )
118
+ {
119
+ v = parseInt( v );
120
+ v = ( isNaN( v ) ) ? max : v;
121
+ return Math.min(Math.max(v,min),max);
122
+ };
123
124
+ // Date
125
+ me.dformat = me.dformat.replace(/\//g, me.dseparator);
126
me.invalidDates = me.invalidDates.replace( /\s+/g, '' );
127
+ if( me.dropdownRange.indexOf( ':' ) == -1 ) me.dropdownRange = '-10:+10';
128
if( !/^\s*#x2F;.test( me.invalidDates ) )
129
{
130
var dateRegExp = new RegExp( /^\d{1,2}\/\d{1,2}\/\d{4}#x2F; ),
161
}
162
}
163
}
164
+
165
+ // Time
166
+ me.minHour = _checkValue( me.minHour, 0, 23 );
167
+ me.maxHour = _checkValue( me.maxHour, 0, 23 );
168
+ me.minMinute = _checkValue( me.minMinute, 0, 59 );
169
+ me.maxMinute = _checkValue( me.maxMinute, 0, 59 );
170
+ me.stepHour = _checkValue( me.stepHour, 1, Math.max( 1, me.maxHour - me.minHour ) );
171
+ me.stepMinute = _checkValue( me.stepMinute, 1, Math.max( 1, me.maxMinute - me.minMinute ) );
172
+
173
+ // Set handles
174
+ me._setHndl('minDate');
175
+ me._setHndl('maxDate');
176
},
177
get_hours:function()
178
{
185
186
while( ( h = from + me.stepHour * i ) <= to )
187
{
188
if( h < 10 ) h = '0'+''+h;
189
str += '<option value="' + h + '">' + h + '</option>';
190
i++;
191
}
192
+ return '<select id="'+me.name+'_hours" name="'+me.name+'_hours" class="hours-component" aria-label="'+$.fbuilder.htmlEncode(me.ariaHourLabel)+'">' + str + '</select>:';
193
},
194
get_minutes:function()
195
{
206
str += '<option value="' + m + '">' + m + '</option>';
207
i++;
208
}
209
+ return '<select id="'+me.name+'_minutes" name="'+me.name+'_minutes" class="minutes-component" aria-label="'+$.fbuilder.htmlEncode(me.ariaMinuteLabel)+'">' + str + '</select>';
210
},
211
get_ampm:function()
212
{
213
var str = '';
214
if( this.tformat == 12 )
215
{
216
+ return '<select id="'+this.name+'_ampm" class="ampm-component" aria-label="'+$.fbuilder.htmlEncode(this.ariaAMPMLabel)+'"><option value="am">am</option><option value="pm">pm</option></select>';
217
}
218
return str;
219
},
220
+ set_dateTime:function()
221
{
222
var me = this,
223
str = $( '#'+me.name+'_date' ).val();
236
}
237
$( '#'+me.name ).val( str ).change();
238
},
239
+ set_minDate:function(v)
240
{
241
+ var e = $('[id*="'+this.name+'"].hasDatepicker');
242
+ if(e.length)
243
+ {
244
+ e.datepicker('option', 'minDate', v);
245
+ e.change();
246
+ }
247
+ },
248
+ set_maxDate:function(v)
249
+ {
250
+ var e = $('[id*="'+this.name+'"].hasDatepicker');
251
+ if(e.length)
252
+ {
253
+ e.datepicker('option', 'maxDate', v);
254
+ e.change();
255
+ }
256
},
257
+ set_DefaultDate : function()
258
{
259
var me = this,
260
p = {
261
dateFormat: me.dformat.replace(/yyyy/g,"yy"),
262
+ minDate: me._getAttr('minDate'),
263
+ maxDate: me._getAttr('maxDate')
264
},
265
dp = $( "#"+me.name+"_date" ),
266
dd = (me.defaultDate != "") ? me.defaultDate : ( ( me.predefined != "" ) ? me.predefined : new Date() );
267
268
dp.click( function(){ $(document).click(); $(this).focus(); } );
269
+ if(me.showDropdown ) p = $.extend(p,{changeMonth: true,changeYear: true,yearRange: me.dropdownRange});
270
+ p = $.extend(p, {beforeShowDay:(function(w,i) { return function(d){return [me._validateDate(d, w, i), ""];};})(me.working_dates, me.invalidDates)});
271
+
272
dp.datepicker(p);
273
+ if(!me.predefinedClick) dp.datepicker( "setDate", dd);
274
+ if(!me._validateDate(dp.datepicker("getDate"), me.working_dates, me.invalidDates)) dp.datepicker( "setDate", '');
275
},
276
+ set_DefaultTime : function()
277
{
278
+ var me = this,
279
+ _setValue = function( f, v, m )
280
+ {
281
+ v = Math.min( v*1, m*1 );
282
+ v = ( v < 10 ) ? 0+''+v : v;
283
+ $( '#' + f + ' [value="' + v + '"]' ).prop( 'selected', true );
284
+ };
285
286
if( me.showTimepicker )
287
{
300
if(time[ 'hour' ] == me.maxHour) time[ 'minute' ] = Math.min(time['minute'],me.maxMinute);
301
}
302
303
+ _setValue(
304
me.name+'_hours',
305
( me.tformat == 12 ) ? ( ( time[ 'hour' ] > 12 ) ? time[ 'hour' ] - 12 : ( ( time[ 'hour' ] == 0 ) ? 12 : time[ 'hour' ] ) ) : time[ 'hour' ],
306
( me.tformat == 12 ) ? 12 : me.maxHour
307
);
308
309
+ _setValue( me.name+'_minutes', time[ 'minute' ], me.maxMinute );
310
$( '#'+me.name+'_ampm'+' [value="' + ( ( time[ 'hour' ] < 12 ) ? 'am' : 'pm' ) + '"]' ).prop( 'selected', true );
311
}
312
},
313
+ show:function()
314
{
315
+ var me = this,
316
+ n = me.name,
317
+ attr = 'value',
318
+ format_label = [],
319
+ date_tag_type = 'text',
320
+ disabled = '',
321
+ date_tag_class = 'field date'+me.dformat.replace(/[^a-z]/ig,"")+' '+me.size+((me.required)?' required': '');
322
323
+ if( me.predefinedClick ) attr = 'placeholder';
324
+ if( me.showDatepicker ) format_label.push(me.dformat);
325
+ else{ date_tag_type = 'hidden'; disabled='disabled';}
326
+ if( me.showTimepicker ) format_label.push('HH:mm');
327
328
+ return '<div class="fields '+me.csslayout+' '+n+' cff-date-field" id="field'+me.form_identifier+'-'+me.index+'"><label for="'+n+'_date">'+me.title+''+((me.required)?"<span class='r'>*</span>":"")+( (format_label.length) ? ' <span class="dformat">('+format_label.join(' ')+')</span>' : '' )+'</label><div class="dfield"><input id="'+n+'" name="'+n+'" type="hidden" value="'+$.fbuilder.htmlEncode(me.predefined)+'"/><input id="'+n+'_date" name="'+n+'_date" class="'+date_tag_class+' date-component" type="'+date_tag_type+'" '+attr+'="'+$.fbuilder.htmlEncode(me.predefined)+'" '+disabled+' />'+( ( me.showTimepicker ) ? ' '+me.get_hours()+me.get_minutes()+' '+me.get_ampm() : '' )+'<span class="uh">'+me.userhelp+'</span></div><div class="clearer"></div></div>';
329
},
330
after_show:function()
331
{
354
(
355
( minDate == null || date >= minDate ) &&
356
( maxDate == null || date <= maxDate ) &&
357
+ item._validateDate( $( e ).datepicker( 'getDate' ), item.working_dates, item.invalidDates ) &&
358
+ item._validateTime( e, item )
359
);
360
}
361
return true;
368
369
if(!(date_format in $.validator.methods)) $.validator.addMethod(date_format, validator );
370
371
+ me.set_DefaultDate();
372
+ me.set_DefaultTime();
373
+ me._set_Events();
374
+ me.set_dateTime();
375
},
376
val:function(raw)
377
{
417
break;
418
}
419
420
+ if( me.showTimepicker ) return date.valueOf() / 86400000;
421
+ else return Math.ceil( date.valueOf() / 86400000 );
422
}
423
}
424
return 0;
431
.replace( /\s+/g, ' ' )
432
.split( ' ' );
433
this.defaultDate = v[ 0 ];
434
+ this.set_DefaultDate();
435
if( v.length == 2 )
436
{
437
this.defaultTime = v[ 1 ];
438
+ this.set_DefaultTime();
439
}
440
+ this.set_dateTime();
441
}
442
catch( err )
443
{}
js/fields-public/06_fbuilder.fcheck.js CHANGED
@@ -65,6 +65,7 @@
65
var checked = e.checked;
66
for( var j = 0, k = me.choicesDep[ i ].length; j < k; j++)
67
{
68
var dep = me.choicesDep[i][j]+form_identifier;
69
if( isHidden || !checked)
70
{
65
var checked = e.checked;
66
for( var j = 0, k = me.choicesDep[ i ].length; j < k; j++)
67
{
68
+ if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
69
var dep = me.choicesDep[i][j]+form_identifier;
70
if( isHidden || !checked)
71
{
js/fields-public/07_fbuilder.fradio.js CHANGED
@@ -72,6 +72,7 @@
72
var checked = e.checked;
73
for( var j = 0, k = me.choicesDep[ i ].length; j < k; j++)
74
{
75
var dep = me.choicesDep[i][j]+form_identifier;
76
if(isHidden || !checked)
77
{
72
var checked = e.checked;
73
for( var j = 0, k = me.choicesDep[ i ].length; j < k; j++)
74
{
75
+ if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
76
var dep = me.choicesDep[i][j]+form_identifier;
77
if(isHidden || !checked)
78
{
js/fields-public/08_fbuilder.fdropdown.js CHANGED
@@ -77,6 +77,7 @@
77
{
78
for( var j = 0, k = me.choicesDep[ i ].length; j < k; j++)
79
{
80
var dep = me.choicesDep[i][j]+form_identifier;
81
if( isHidden || $.inArray(i,selected) == -1)
82
{
77
{
78
for( var j = 0, k = me.choicesDep[ i ].length; j < k; j++)
79
{
80
+ if(!/fieldname/i.test(me.choicesDep[i][j])) continue;
81
var dep = me.choicesDep[i][j]+form_identifier;
82
if( isHidden || $.inArray(i,selected) == -1)
83
{
js/fields-public/28_fbuilder.fcontainer.js CHANGED
@@ -25,6 +25,7 @@
25
26
for( var i = 0, h = me.fields.length; i < h; i++ )
27
{
28
fId = me.fields[ i ]+me.form_identifier;
29
if( isHidden )
30
{
25
26
for( var i = 0, h = me.fields.length; i < h; i++ )
27
{
28
+ if(!/fieldname/i.test(me.fields[ i ])) continue;
29
fId = me.fields[ i ]+me.form_identifier;
30
if( isHidden )
31
{
js/fields-public/fbuilder.fcalculated.js CHANGED
@@ -117,6 +117,7 @@
117
118
for ( i=0; i<d.length; i++ )
119
{
120
dep = d[i]+identifier;
121
delete toHide[ dep ];
122
if( typeof toShow[ dep ] == 'undefined' )
@@ -132,6 +133,7 @@
132
133
for ( i=0; i<n.length; i++ )
134
{
135
dep = n[i]+identifier;
136
clearRef(dep);
137
if (
117
118
for ( i=0; i<d.length; i++ )
119
{
120
+ if(!/fieldname/i.test(d[i])) continue;
121
dep = d[i]+identifier;
122
delete toHide[ dep ];
123
if( typeof toShow[ dep ] == 'undefined' )
133
134
for ( i=0; i<n.length; i++ )
135
{
136
+ if(!/fieldname/i.test(n[i])) continue;
137
dep = n[i]+identifier;
138
clearRef(dep);
139
if (
pagebuilders/elementor/assets/elementor.css ADDED
@@ -0,0 +1,7 @@
1
+ .cff-widefat *{
2
+ width: 100% !important;
3
+ clear: both !important;
4
+ display: block !important;
5
+ max-width: 100% !important;
6
+ margin: 0 !important;
7
+ }
pagebuilders/{elementor.pb.php → elementor/elementor.pb.php} RENAMED
@@ -58,6 +58,7 @@ class Elementor_CFF_Widget extends Widget_Base
58
array(
59
'label' => __('Select a form', 'calculated-fields-form'),
60
'type' => Controls_Manager::SELECT,
61
'options' => $options,
62
'default' => $default
63
)
@@ -68,6 +69,7 @@ class Elementor_CFF_Widget extends Widget_Base
68
array(
69
'label' => __('Additional attributes', 'calculated-fields-form'),
70
'type' => Controls_Manager::TEXT,
71
'input_type' => 'text',
72
'placeholder' => 'attr="value"'
73
)
@@ -170,6 +172,7 @@ class Elementor_CFFV_Widget extends Widget_Shortcode
170
array(
171
'label' => __( 'Variable shortcode', 'calculated-fields-form' ),
172
'type' => Controls_Manager::TEXT,
173
'input_type' => 'text',
174
'default' => '[CP_CALCULATED_FIELDS_VAR name="varname"]',
175
'description' => '<a href="https://cff.dwbooster.com/documentation#javascript-variables" target="_blank">'.__( 'I need help [+]', 'calculated-fields-form' ).'</a>'
58
array(
59
'label' => __('Select a form', 'calculated-fields-form'),
60
'type' => Controls_Manager::SELECT,
61
+ 'classes' => 'cff-widefat',
62
'options' => $options,
63
'default' => $default
64
)
69
array(
70
'label' => __('Additional attributes', 'calculated-fields-form'),
71
'type' => Controls_Manager::TEXT,
72
+ 'classes' => 'cff-widefat',
73
'input_type' => 'text',
74
'placeholder' => 'attr="value"'
75
)
172
array(
173
'label' => __( 'Variable shortcode', 'calculated-fields-form' ),
174
'type' => Controls_Manager::TEXT,
175
+ 'classes' => 'cff-widefat',
176
'input_type' => 'text',
177
'default' => '[CP_CALCULATED_FIELDS_VAR name="varname"]',
178
'description' => '<a href="https://cff.dwbooster.com/documentation#javascript-variables" target="_blank">'.__( 'I need help [+]', 'calculated-fields-form' ).'</a>'
pagebuilders/{elementor_category.pb.php → elementor/elementor_category.pb.php} RENAMED
File without changes
{css → pagebuilders/gutenberg/assets/css}/gutenberg.css RENAMED
File without changes
js/cp_calculatedfieldsf_gutenberg.js → pagebuilders/gutenberg/assets/js/gutenberg.js RENAMED
@@ -93,7 +93,6 @@ jQuery(function()
93
config = {key: key, value: form_id};
94
95
if( /^\s*#x2F;.test(id)) id = form_id;
96
- if(id == form_id) config['selected'] = 'selected';
97
options.push(el('option', config, cpcff_gutenberg_editor_config['forms'][form_id]));
98
}
99
generate_shortcode();
@@ -101,8 +100,8 @@ jQuery(function()
101
if(!/^\s*#x2F;.test(id))
102
{
103
children.push(
104
- el( 'div', {className: 'cff-iframe-container'},
105
- el('div', {className: 'cff-iframe-overlay'}),
106
el('iframe',
107
{
108
key: 'cpcff_form_iframe',
@@ -171,7 +170,8 @@ jQuery(function()
171
{
172
key : 'cpcff_inspector_forms_list',
173
style : {width: '100%'},
174
- onChange : set_attributes
175
},
176
options
177
),
93
config = {key: key, value: form_id};
94
95
if( /^\s*#x2F;.test(id)) id = form_id;
96
options.push(el('option', config, cpcff_gutenberg_editor_config['forms'][form_id]));
97
}
98
generate_shortcode();
100
if(!/^\s*#x2F;.test(id))
101
{
102
children.push(
103
+ el( 'div', {className: 'cff-iframe-container', key: 'cpcff_form_container'},
104
+ el('div', {className: 'cff-iframe-overlay', key: 'cpcff_form_overlay'}),
105
el('iframe',
106
{
107
key: 'cpcff_form_iframe',
170
{
171
key : 'cpcff_inspector_forms_list',
172
style : {width: '100%'},
173
+ onChange : set_attributes,
174
+ value: id
175
},
176
options
177
),
pagebuilders/siteorigin/siteorigin-cpcff-variable/assets/banner.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z" fill="#3391C9" /></svg>
pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php ADDED
@@ -0,0 +1,67 @@
1
+ <?php
2
+ /*
3
+ Widget Name: Calculated Fields Form Variable Shortcode
4
+ Description: Insert a javascript generator shortcode on page.
5
+ Documentation: https://cff.dwbooster.com/documentation#javascript-variables
6
+ */
7
+
8
+ class SiteOrigin_CFF_Variable_Shortcode extends SiteOrigin_Widget
9
+ {
10
+ function __construct()
11
+ {
12
+ parent::__construct(
13
+ 'siteorigin-cff-variable-shortcode',
14
+ __('Calculated Fields Form, Variable Shortcode', 'calculated-fields-form'),
15
+ array(
16
+ 'description' => __('Shortcode to generate a javascript variable from the url parameters (GET or POST), session variables, cookies, or define it directly', 'calculated-fields-form'),
17
+ 'panels_groups' => array('calculated-fields-form'),
18
+ 'help' => 'https://cff.dwbooster.com/documentation#javascript-variables',
19
+ ),
20
+ array(),
21
+ array(
22
+ 'name' => array(
23
+ 'type' => 'text',
24
+ 'label' => __( 'Variable name', 'calculated-fields-form' ),
25
+ 'default' => '',
26
+ ),
27
+ 'from' => array(
28
+ 'type' => 'select',
29
+ 'label' => __('Generate variable from', 'calculated-fields-form' ),
30
+ 'default' => '',
31
+ 'options' => array(
32
+ '' => __( 'Any source', 'calculated-fields-form' ),
33
+ 'from="get"' => __( 'GET parameter', 'calculated-fields-form' ),
34
+ 'from="post"' => __( 'POST parameter', 'calculated-fields-form' ),
35
+ 'from="session"' => __( 'Session variable', 'calculated-fields-form' ),
36
+ 'from="cookie"' => __( 'Cookie', 'calculated-fields-form' ),
37
+ )
38
+ ),
39
+ 'default_value' => array(
40
+ 'type' => 'text',
41
+ 'label' => __( 'Default value (used when variables are generated from a source)', 'calculated-fields-form' ),
42
+ 'default' => '',
43
+ ),
44
+ 'value' => array(
45
+ 'type' => 'text',
46
+ 'label' => __( 'Value (value of the variable when it is generated directly)', 'calculated-fields-form' ),
47
+ 'default' => '',
48
+ ),
49
+ ),
50
+ plugin_dir_path(__FILE__)
51
+ );
52
+ } // End __construct
53
+
54
+ function get_template_name($instance)
55
+ {
56
+ return 'siteorigin-cff-variable-shortcode';
57
+ } // End get_template_name
58
+
59
+ function get_style_name($instance)
60
+ {
61
+ return '';
62
+ } // End get_style_name
63
+
64
+ } // End Class SiteOrigin_CFF_Variable_Shortcode
65
+
66
+ // Registering the widget
67
+ siteorigin_widget_register('siteorigin-cff-variable-shortcode', __FILE__, 'SiteOrigin_CFF_Variable_Shortcode');
pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php ADDED
@@ -0,0 +1,15 @@
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
+ {
9
+ $shortcode .= '[CP_CALCULATED_FIELDS_VAR name="'.esc_attr($name).'"';
10
+ if(!empty($from)) $shortcode .= ' '.$from;
11
+ if(!empty($default_value)) $shortcode .= ' default_value="'.esc_attr($default_value).'"';
12
+ if(!empty($value)) $shortcode .= ' value="'.esc_attr($value).'"';
13
+ $shortcode .= ']';
14
+ }
15
+ print $shortcode;
pagebuilders/siteorigin/siteorigin-cpcff/assets/banner.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z" fill="#3391C9" /><path d="M0 0h24v24H0z" fill="none"/></svg>
pagebuilders/siteorigin/siteorigin-cpcff/siteorigin-cpcff.php ADDED
@@ -0,0 +1,64 @@
1
+ <?php
2
+ /*
3
+ Widget Name: Calculated Fields Form Shortcode
4
+ Description: Insert a form on page.
5
+ Documentation: https://cff.dwbooster.com/documentation#insertion-page
6
+ */
7
+
8
+ class SiteOrigin_CFF_Shortcode extends SiteOrigin_Widget
9
+ {
10
+ function __construct()
11
+ {
12
+ global $wpdb;
13
+ $options = array();
14
+ $default = '';
15
+ $forms = $wpdb->get_results( "SELECT id, form_name FROM ".$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE. " ORDER BY id ASC" );
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(
23
+ 'siteorigin-cff-shortcode',
24
+ __('Calculated Fields Form Shortcode', 'calculated-fields-form'),
25
+ array(
26
+ 'description' => __('Includes the shortcode for inserting a form', 'calculated-fields-form'),
27
+ 'panels_groups' => array('calculated-fields-form'),
28
+ 'help' => 'https://cff.dwbooster.com/documentation#insertion-page',
29
+ ),
30
+ array(),
31
+ array(
32
+ 'form' => array(
33
+ 'type' => 'select',
34
+ 'label' => __( 'Form to include', 'calculated-fields-form' ),
35
+ 'default' => $default,
36
+ 'options' => $options
37
+ ),
38
+ 'class_name' => array(
39
+ 'type' => 'text',
40
+ 'label' => __('Enter a class name to be assigned to the form (optional)', 'calculated-fields-form')
41
+ ),
42
+ 'attrs' => array(
43
+ 'type' => 'text',
44
+ 'label' => __('Pass additional attributes to the form. Ex: attr_name="attr_value" (optional)', 'calculated-fields-form')
45
+ ),
46
+ ),
47
+ plugin_dir_path(__FILE__)
48
+ );
49
+ } // End __construct
50
+
51
+ function get_template_name($instance)
52
+ {
53
+ return 'siteorigin-cff-shortcode';
54
+ } // End get_template_name
55
+
56
+ function get_style_name($instance)
57
+ {
58
+ return '';
59
+ } // End get_style_name
60
+
61
+ } // End Class SiteOrigin_CFF_Shortcode
62
+
63
+ // Registering the widget
64
+ siteorigin_widget_register('siteorigin-cff-shortcode', __FILE__, 'SiteOrigin_CFF_Shortcode');
pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php ADDED
@@ -0,0 +1,13 @@
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
+ {
8
+ $shortcode .= '[CP_CALCULATED_FIELDS id="'.esc_attr($form).'"';
9
+ if(!empty($class_name)) $shortcode .= ' class="'.esc_attr($class_name).'"';
10
+ if(!empty($attrs)) $shortcode .= ' '.$attrs;
11
+ $shortcode .= ']';
12
+ }
13
+ print $shortcode;