Version Description
- Modifies the operations: ROUND, CEIL and FLOOR for accepting a second parameter (optional) and rounding the number in multiples of second parameter.
- Modifies the appearance of the forms builder settings in the free version of the plugin.
- The fields' tags to insert into the results shortcodes (paid versions of the plugin) accept a new set of attributes for taking more control about how and whe to include the fields (if_value_is_greater_than, if_value_is_greater_than_or_equal_to, if_value_is_less_than, if_value_is_less_than_or_equal_to, if_value_is, if_value_is_not, if_value_like and if_value_unlike)
Download this release
Release Info
Developer | codepeople |
Plugin | Calculated Fields Form |
Version | 1.0.235 |
Comparing to | |
See all releases |
Code changes from version 1.0.231 to 1.0.235
- README.txt +27 -23
- changelog.txt +19 -0
- config/cpcff_config.cfg.php +1 -0
- cp_calculatedfieldsf_free.php +2 -2
- css/style.css +19 -1
- inc/cpcff_admin_int.inc.php +50 -41
- inc/cpcff_form.inc.php +41 -4
- inc/cpcff_install_uninstall.inc.php +10 -0
- inc/cpcff_main.inc.php +9 -0
- inc/cpcff_revisions.inc.php +157 -0
- js/fbuilder-loader-admin.php +3 -3
- js/fbuilder-loader-public.php +12 -11
- js/modules/01_mathematical_logical/admin/module_admin.js +3 -3
- js/modules/01_mathematical_logical/public/module_public.js +51 -12
- templates/03/style.css +1 -1
README.txt
CHANGED
@@ -115,6 +115,7 @@ The plugin has two additional (commercial) versions: **Premium** and **Developer
|
|
115 |
* Includes the ip2location add-on to identify the users data from the ip2location databases. Requires PHP 5.3 and over.
|
116 |
* Includes the "Google Places" add-on that allows integrate the input fields with the Google Places API to autocomplete the addresses entered by the users.
|
117 |
* 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.
|
|
|
118 |
* 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.
|
119 |
* Includes the "MailChimp" add-on to add new members to the MailChimp Service using the data collected by the form.
|
120 |
* Includes the "Emma" add-on to add new members to the Emma Service using the data collected by the form.
|
@@ -373,6 +374,12 @@ The "Signature" add-on converts the selected fields in "Signature" fields, allow
|
|
373 |
|
374 |
[CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#signature-addon "Signature add-on")
|
375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
= WebMerge add-on - Only available in the Platinum version of the plugin =
|
377 |
|
378 |
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.
|
@@ -871,6 +878,25 @@ A: Please, visit the following entry in our technical blog:
|
|
871 |
|
872 |
== Changelog ==
|
873 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
874 |
= 1.0.231 =
|
875 |
|
876 |
* Fixes an issue in the fields validation.
|
@@ -904,30 +930,8 @@ A: Please, visit the following entry in our technical blog:
|
|
904 |
* Fixes an issue accepting .rar files with the Uploads add-on(Platinum version).
|
905 |
* Allows to select groups by default in the MailChimp add-on(Platinum version).
|
906 |
|
907 |
-
= 1.0.225 =
|
908 |
-
|
909 |
-
* Fixes an issue in the definition of dependencies in the calculated fields.
|
910 |
-
|
911 |
-
= 1.0.224 =
|
912 |
-
|
913 |
-
* Modifies the size of the container fields to improve dragging fields into the containers.
|
914 |
-
* Fixes an issue with the validation rules in the non-visible fields (fields into hidden containers).
|
915 |
-
* Includes a new special attribute in the form's shortcode (class), to assign class names to the forms.
|
916 |
-
* Dissables the submit button when it is pressed to prevent the form be submitted multiple times (Professional, Developer and Platinum versions).
|
917 |
-
* Fixes an issue with the Widgets (Professional, Developer and Platinum versions).
|
918 |
-
* Fixes an issue checking if the nonce that protects the public form is active or not (Professional, Developer and Platinum versions).
|
919 |
-
* Modifies the way that the cp_calculatedfieldsf_insert_in_database.php file is included, to allow include in the $params array the itemnumber, that represents the submission's id (Developer and Platinum versions).
|
920 |
-
|
921 |
-
= 1.0.223 =
|
922 |
-
|
923 |
-
* Modifies the default title in the Acceptance control.
|
924 |
-
|
925 |
-
= 1.0.222 =
|
926 |
-
|
927 |
-
* Includes the Acceptance (GDPR) control for inserting a required checkbox field in the form for asking the users their consent to store and use the information provided.
|
928 |
-
|
929 |
== Upgrade Notice ==
|
930 |
|
931 |
-
= 1.0.
|
932 |
|
933 |
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
|
115 |
* Includes the ip2location add-on to identify the users data from the ip2location databases. Requires PHP 5.3 and over.
|
116 |
* Includes the "Google Places" add-on that allows integrate the input fields with the Google Places API to autocomplete the addresses entered by the users.
|
117 |
* 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.
|
118 |
+
* 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.
|
119 |
* 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.
|
120 |
* Includes the "MailChimp" add-on to add new members to the MailChimp Service using the data collected by the form.
|
121 |
* Includes the "Emma" add-on to add new members to the Emma Service using the data collected by the form.
|
374 |
|
375 |
[CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#signature-addon "Signature add-on")
|
376 |
|
377 |
+
= iCal add-on - Only available in the Platinum version of the plugin =
|
378 |
+
|
379 |
+
The "iCal" add-on sends 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.
|
380 |
+
|
381 |
+
[CLICK HERE for additional information ](http://cff.dwbooster.com/documentation#ical-addon "iCal add-on")
|
382 |
+
|
383 |
= WebMerge add-on - Only available in the Platinum version of the plugin =
|
384 |
|
385 |
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.
|
878 |
|
879 |
== Changelog ==
|
880 |
|
881 |
+
= 1.0.235 =
|
882 |
+
|
883 |
+
* Modifies the operations: ROUND, CEIL and FLOOR for accepting a second parameter (optional) and rounding the number in multiples of second parameter.
|
884 |
+
* Modifies the appearance of the forms builder settings in the free version of the plugin.
|
885 |
+
* The fields' tags to insert into the results shortcodes (paid versions of the plugin) accept a new set of attributes for taking more control about how and whe to include the fields (if_value_is_greater_than, if_value_is_greater_than_or_equal_to, if_value_is_less_than, if_value_is_less_than_or_equal_to, if_value_is, if_value_is_not, if_value_like and if_value_unlike)
|
886 |
+
|
887 |
+
= 1.0.234 =
|
888 |
+
|
889 |
+
* Modifies the code to be compatible with older versions of PHP.
|
890 |
+
|
891 |
+
= 1.0.233 =
|
892 |
+
|
893 |
+
* Fixes an issue generating the revisions table.
|
894 |
+
|
895 |
+
= 1.0.232 =
|
896 |
+
|
897 |
+
* Includes the revisions module to create different revisions of the forms when they are updated.
|
898 |
+
* Modifies the code that generates the forms to prevent that uncaugth javascript errors in the webpage affect the forms.
|
899 |
+
|
900 |
= 1.0.231 =
|
901 |
|
902 |
* Fixes an issue in the fields validation.
|
930 |
* Fixes an issue accepting .rar files with the Uploads add-on(Platinum version).
|
931 |
* Allows to select groups by default in the MailChimp add-on(Platinum version).
|
932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
933 |
== Upgrade Notice ==
|
934 |
|
935 |
+
= 1.0.235 =
|
936 |
|
937 |
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
|
changelog.txt
CHANGED
@@ -1,5 +1,24 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
= 1.0.231 =
|
4 |
|
5 |
* Fixes an issue in the fields validation.
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 1.0.235 =
|
4 |
+
|
5 |
+
* Modifies the operations: ROUND, CEIL and FLOOR for accepting a second parameter (optional) and rounding the number in multiples of second parameter.
|
6 |
+
* Modifies the appearance of the forms builder settings in the free version of the plugin.
|
7 |
+
* The fields' tags to insert into the results shortcodes (paid versions of the plugin) accept a new set of attributes for taking more control about how and whe to include the fields (if_value_is_greater_than, if_value_is_greater_than_or_equal_to, if_value_is_less_than, if_value_is_less_than_or_equal_to, if_value_is, if_value_is_not, if_value_like and if_value_unlike)
|
8 |
+
|
9 |
+
= 1.0.234 =
|
10 |
+
|
11 |
+
* Modifies the code to be compatible with older versions of PHP.
|
12 |
+
|
13 |
+
= 1.0.233 =
|
14 |
+
|
15 |
+
* Fixes an issue generating the revisions table.
|
16 |
+
|
17 |
+
= 1.0.232 =
|
18 |
+
|
19 |
+
* Includes the revisions module to create different revisions of the forms when they are updated.
|
20 |
+
* Modifies the code that generates the forms to prevent that uncaugth javascript errors in the webpage affect the forms.
|
21 |
+
|
22 |
= 1.0.231 =
|
23 |
|
24 |
* Fixes an issue in the fields validation.
|
config/cpcff_config.cfg.php
CHANGED
@@ -70,6 +70,7 @@ define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE','EN');
|
|
70 |
// Database table names
|
71 |
global $wpdb;
|
72 |
define('CP_CALCULATEDFIELDSF_FORMS_TABLE', 'cp_calculated_fields_form_settings');
|
|
|
73 |
define('CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX', "cp_calculated_fields_form_discount_codes");
|
74 |
define('CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME', @$wpdb->prefix ."cp_calculated_fields_form_discount_codes");
|
75 |
define('CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX', "cp_calculated_fields_form_posts");
|
70 |
// Database table names
|
71 |
global $wpdb;
|
72 |
define('CP_CALCULATEDFIELDSF_FORMS_TABLE', 'cp_calculated_fields_form_settings');
|
73 |
+
define('CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE', 'cp_calculated_fields_form_revision');
|
74 |
define('CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX', "cp_calculated_fields_form_discount_codes");
|
75 |
define('CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME', @$wpdb->prefix ."cp_calculated_fields_form_discount_codes");
|
76 |
define('CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX', "cp_calculated_fields_form_posts");
|
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.
|
7 |
Text Domain: calculated-fields-form
|
8 |
Author: CodePeople
|
9 |
Author URI: https://cff.dwbooster.com
|
@@ -20,7 +20,7 @@ require_once 'inc/cpcff_session.inc.php';
|
|
20 |
if( !defined('DOING_AJAX') ) CP_SESSION::session_start();
|
21 |
|
22 |
// Defining main constants
|
23 |
-
define('CP_CALCULATEDFIELDSF_VERSION', '1.0.
|
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.235
|
7 |
Text Domain: calculated-fields-form
|
8 |
Author: CodePeople
|
9 |
Author URI: https://cff.dwbooster.com
|
20 |
if( !defined('DOING_AJAX') ) CP_SESSION::session_start();
|
21 |
|
22 |
// Defining main constants
|
23 |
+
define('CP_CALCULATEDFIELDSF_VERSION', '1.0.235' );
|
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 ) );
|
css/style.css
CHANGED
@@ -135,6 +135,9 @@ a.helpfbuilder{font-size:80%;text-decoration:underline;color:#00f;cursor:pointer
|
|
135 |
|
136 |
.ui-state-highlight { height: 65px; line-height: 65px; }
|
137 |
|
|
|
|
|
|
|
138 |
@media only screen and (max-width: 640px){
|
139 |
.cff-custom-table,
|
140 |
.cff-custom-table thead,
|
@@ -167,7 +170,22 @@ a.helpfbuilder{font-size:80%;text-decoration:underline;color:#00f;cursor:pointer
|
|
167 |
.ctrlsColumn{width:100% !important;position:relative !important;}
|
168 |
.form-builder .button{margin:0; padding:0;width:50%;}
|
169 |
#fbuilder{margin-top:10px;padding:0;}
|
|
|
|
|
|
|
170 |
}
|
171 |
@media only screen and (max-width: 480px){
|
172 |
.cff-custom-table input[type="button"]{margin:0 !important; width:100% !important;display:block !important;}
|
173 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
.ui-state-highlight { height: 65px; line-height: 65px; }
|
137 |
|
138 |
+
.cff-revisions-container{float:right;padding:10px;}
|
139 |
+
.cff-form-name-shortcode{font-size:0.8em;}
|
140 |
+
|
141 |
@media only screen and (max-width: 640px){
|
142 |
.cff-custom-table,
|
143 |
.cff-custom-table thead,
|
170 |
.ctrlsColumn{width:100% !important;position:relative !important;}
|
171 |
.form-builder .button{margin:0; padding:0;width:50%;}
|
172 |
#fbuilder{margin-top:10px;padding:0;}
|
173 |
+
.cff-form-name-shortcode{display:none;}
|
174 |
+
.cff-revisions-container{float:none; width:100%;padding:10px 5%;}
|
175 |
+
.cff_form_builder .postbox .cff-revisions-container select{width:90% !important;}
|
176 |
}
|
177 |
@media only screen and (max-width: 480px){
|
178 |
.cff-custom-table input[type="button"]{margin:0 !important; width:100% !important;display:block !important;}
|
179 |
+
}
|
180 |
+
|
181 |
+
#metabox_basic_settings0,
|
182 |
+
#metabox_basic_settings1,
|
183 |
+
#metabox_basic_settings2,
|
184 |
+
#metabox_basic_settings3,
|
185 |
+
#metabox_basic_settings4{cursor:pointer !important;}
|
186 |
+
|
187 |
+
#metabox_basic_settings0 * ,
|
188 |
+
#metabox_basic_settings1 * ,
|
189 |
+
#metabox_basic_settings2 * ,
|
190 |
+
#metabox_basic_settings3 * ,
|
191 |
+
#metabox_basic_settings4 * {color:#bfbdbd91 !important;pointer-events: none !important;}
|
inc/cpcff_admin_int.inc.php
CHANGED
@@ -18,6 +18,15 @@ if (!defined('CP_CALCULATEDFIELDSF_ID'))
|
|
18 |
$cpcff_main = CPCFF_MAIN::instance();
|
19 |
$form_obj = $cpcff_main->get_form(intval($_GET["cal"]));
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cp_calculatedfieldsf_post_options'] ) )
|
22 |
echo "<div id='setting-error-settings_updated' class='updated settings-error'> <p><strong>".__( 'Settings saved', 'calculated-fields-form' )."</strong></p></div>";
|
23 |
|
@@ -33,7 +42,7 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
|
33 |
?>
|
34 |
<div class="wrap">
|
35 |
<h1><?php
|
36 |
-
print __( 'Calculated Fields Form', 'calculated-fields-form' ).'
|
37 |
?></h1>
|
38 |
|
39 |
<input type="button" name="backbtn" value="<?php esc_attr_e( 'Back to items list...', 'calculated-fields-form' ); ?>" onclick="document.location='admin.php?page=cp_calculated_fields_form';">
|
@@ -50,7 +59,25 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
|
50 |
<hr />
|
51 |
<div><?php _e( '* Different form styles available on the tab Form Settings >> Form Template', 'calculated-fields-form' ); ?></div>
|
52 |
<div id="metabox_basic_settings" class="postbox" >
|
53 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
<div class="inside">
|
55 |
<div class="form-builder-error-messages"><?php
|
56 |
global $cff_structure_error;
|
@@ -77,6 +104,20 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
|
77 |
calculatedFieldsFormImport(); return;
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
var f = $calculatedfieldsfQuery("#fbuilder").fbuilder();
|
81 |
window['cff_form'] = f;
|
82 |
f.fBuild.loadData( "form_structure", "templates" );
|
@@ -92,45 +133,13 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
|
92 |
f.fBuild.addItem(ui.draggable.attr("id"));
|
93 |
}
|
94 |
});
|
95 |
-
jQuery("#metabox_basic_settings0")
|
96 |
-
|
97 |
-
jQuery("#c0").click( function(){
|
98 |
if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
|
99 |
document.location = 'https://cff.dwbooster.com/';
|
100 |
-
}
|
101 |
-
|
102 |
-
|
103 |
-
jQuery("#c1").click( function(){
|
104 |
-
if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
|
105 |
-
document.location = 'https://cff.dwbooster.com/';
|
106 |
-
} );
|
107 |
-
jQuery("#metabox_basic_settings2").append('<div id="c2" style="position:absolute;top:0px;left:0px;background:#aaa;z-index:1;"></div>');
|
108 |
-
jQuery("#c2").css({ opacity: 0.5 });
|
109 |
-
jQuery("#c2").click( function(){
|
110 |
-
if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
|
111 |
-
document.location = 'https://cff.dwbooster.com/';
|
112 |
-
} );
|
113 |
-
jQuery("#metabox_basic_settings3").append('<div id="c3" style="position:absolute;top:0px;left:0px;background:#aaa;z-index:1;"></div>');
|
114 |
-
jQuery("#c3").css({ opacity: 0.5 });
|
115 |
-
jQuery("#c3").click( function(){
|
116 |
-
if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
|
117 |
-
document.location = 'https://cff.dwbooster.com/';
|
118 |
-
} );
|
119 |
-
jQuery("#metabox_basic_settings4").append('<div id="c4" style="position:absolute;top:0px;left:0px;background:#aaa;z-index:1;"></div>');
|
120 |
-
jQuery("#c4").css({ opacity: 0.5 });
|
121 |
-
jQuery("#c4").click( function(){
|
122 |
-
if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
|
123 |
-
document.location = 'https://cff.dwbooster.com/';
|
124 |
-
} );
|
125 |
-
var rLayer = function(){
|
126 |
-
jQuery("#c0").css("width",jQuery("#metabox_basic_settings0").width()+"px").css("height",jQuery("#metabox_basic_settings0").height()+"px");
|
127 |
-
jQuery("#c1").css("width",jQuery("#metabox_basic_settings1").width()+"px").css("height",jQuery("#metabox_basic_settings1").height()+"px");
|
128 |
-
jQuery("#c2").css("width",jQuery("#metabox_basic_settings2").width()+"px").css("height",jQuery("#metabox_basic_settings2").height()+"px");
|
129 |
-
jQuery("#c3").css("width",jQuery("#metabox_basic_settings3").width()+"px").css("height",jQuery("#metabox_basic_settings3").height()+"px");
|
130 |
-
jQuery("#c4").css("width",jQuery("#metabox_basic_settings4").width()+"px").css("height",jQuery("#metabox_basic_settings4").height()+"px");
|
131 |
-
}
|
132 |
-
rLayer();
|
133 |
-
jQuery(window).resize(function() {rLayer();});
|
134 |
};
|
135 |
|
136 |
function calculatedFieldsFormImport()
|
@@ -226,7 +235,7 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
|
226 |
</div>
|
227 |
|
228 |
<p class="submit">
|
229 |
-
<input type="submit" name="save" id="save" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'calculated-fields-form' ); ?>" title="Saves the form's structure and settings" />
|
230 |
<input type="button" name="previewbtn" id="previewbtn" class="button-primary" value="<?php esc_attr_e( 'Preview', 'calculated-fields-form' ); ?>" onclick="jQuery.fbuilder.preview( this );" title="Saves the form's structure only, and opens a preview windows" />
|
231 |
</p>
|
232 |
|
@@ -347,7 +356,7 @@ $cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
|
347 |
</div>
|
348 |
|
349 |
<p class="submit">
|
350 |
-
<input type="submit" name="save" id="save" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'calculated-fields-form' ); ?>"
|
351 |
</p>
|
352 |
|
353 |
[<a href="https://cff.dwbooster.com/customization" target="_blank"><?php _e( 'Request Custom Modifications', 'calculated-fields-form' ); ?></a>] | [<a href="https://wordpress.org/support/plugin/calculated-fields-form#new-post" target="_blank"><?php _e( 'Help', 'calculated-fields-form' ); ?></a>]
|
18 |
$cpcff_main = CPCFF_MAIN::instance();
|
19 |
$form_obj = $cpcff_main->get_form(intval($_GET["cal"]));
|
20 |
|
21 |
+
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cpcff_revision_to_apply'] ) )
|
22 |
+
{
|
23 |
+
$revision_id = @intval($_POST['cpcff_revision_to_apply']);
|
24 |
+
if($revision_id)
|
25 |
+
{
|
26 |
+
$form_obj->apply_revision($revision_id);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cp_calculatedfieldsf_post_options'] ) )
|
31 |
echo "<div id='setting-error-settings_updated' class='updated settings-error'> <p><strong>".__( 'Settings saved', 'calculated-fields-form' )."</strong></p></div>";
|
32 |
|
42 |
?>
|
43 |
<div class="wrap">
|
44 |
<h1><?php
|
45 |
+
print __( 'Calculated Fields Form', 'calculated-fields-form' ).' <span class="cff-form-name-shortcode">(<b>'.__('Form', 'calculated-fields-form').' '.CP_CALCULATEDFIELDSF_ID.' - '.$form_obj->get_option( 'form_name', '').'</b>) Shortcode: [CP_CALCULATED_FIELDS id="'.CP_CALCULATEDFIELDSF_ID.'"]</span>';
|
46 |
?></h1>
|
47 |
|
48 |
<input type="button" name="backbtn" value="<?php esc_attr_e( 'Back to items list...', 'calculated-fields-form' ); ?>" onclick="document.location='admin.php?page=cp_calculated_fields_form';">
|
59 |
<hr />
|
60 |
<div><?php _e( '* Different form styles available on the tab Form Settings >> Form Template', 'calculated-fields-form' ); ?></div>
|
61 |
<div id="metabox_basic_settings" class="postbox" >
|
62 |
+
<div class="hndle">
|
63 |
+
<h3 style="padding:5px;display:inline-block;"><span><?php _e( 'Form Builder', 'calculated-fields-form' ); ?></span></h3>
|
64 |
+
<div class="cff-revisions-container">
|
65 |
+
<?php _e('Revisions','calculated-fields-form'); ?>
|
66 |
+
<select name="cff_revision_list">
|
67 |
+
|
68 |
+
<?php
|
69 |
+
print '<option value="0">'.esc_html(__('Select a revision', 'calculated-fields-form')).'</option>';
|
70 |
+
$revisions_obj = $form_obj->get_revisions();
|
71 |
+
$revisions = $revisions_obj->revisions_list();
|
72 |
+
foreach($revisions as $revision_id => $revision_data)
|
73 |
+
{
|
74 |
+
print '<option value="'.esc_attr($revision_id).'">'.esc_html($revision_data['time']).'</option>';
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
</select>
|
78 |
+
<input type="button" name="cff_apply_revision" value="<?php print esc_attr('Load Revision', 'calculated-fields-form'); ?>" />
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
<div class="inside">
|
82 |
<div class="form-builder-error-messages"><?php
|
83 |
global $cff_structure_error;
|
104 |
calculatedFieldsFormImport(); return;
|
105 |
}
|
106 |
|
107 |
+
/* Revisions code */
|
108 |
+
$calculatedfieldsfQuery('[name="cff_apply_revision"]').click(
|
109 |
+
function(){
|
110 |
+
var revision = $calculatedfieldsfQuery('[name="cff_revision_list"]').val();
|
111 |
+
if(revision*1)
|
112 |
+
{
|
113 |
+
result = window.confirm('<?php print esc_js(__('The action will load the revision selected, the data are not stored will be lose. Do you want continue?', 'calculated-fields-form'));?>');
|
114 |
+
if(result)
|
115 |
+
{
|
116 |
+
$calculatedfieldsfQuery('<form method="post" action="" name="cpformconf" class="cff_form_builder"><input type="hidden" name="_cpcff_nonce" value="<?php echo wp_create_nonce( 'session_id_'.CP_SESSION::session_id() ); ?>" /><input name="cp_calculatedfieldsf_id" type="hidden" value="<?php echo CP_CALCULATEDFIELDSF_ID; ?>" /><input type="hidden" name="cpcff_revision_to_apply" value="'+revision+'"></form>').appendTo('body').submit();
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
);
|
121 |
var f = $calculatedfieldsfQuery("#fbuilder").fbuilder();
|
122 |
window['cff_form'] = f;
|
123 |
f.fBuild.loadData( "form_structure", "templates" );
|
133 |
f.fBuild.addItem(ui.draggable.attr("id"));
|
134 |
}
|
135 |
});
|
136 |
+
jQuery("#metabox_basic_settings0,#metabox_basic_settings1,#metabox_basic_settings2,#metabox_basic_settings3,#metabox_basic_settings4")
|
137 |
+
.click( function(){
|
|
|
138 |
if(confirm("<?php _e( 'These features aren\'t available in this version. Do you want to open the plugin\'s page to check other versions?', 'calculated-fields-form' ); ?>"))
|
139 |
document.location = 'https://cff.dwbooster.com/';
|
140 |
+
})
|
141 |
+
.find('*')
|
142 |
+
.prop('disabled', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
};
|
144 |
|
145 |
function calculatedFieldsFormImport()
|
235 |
</div>
|
236 |
|
237 |
<p class="submit">
|
238 |
+
<input type="submit" name="save" id="save" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'calculated-fields-form' ); ?>" title="Saves the form's structure and settings and creates a revision" />
|
239 |
<input type="button" name="previewbtn" id="previewbtn" class="button-primary" value="<?php esc_attr_e( 'Preview', 'calculated-fields-form' ); ?>" onclick="jQuery.fbuilder.preview( this );" title="Saves the form's structure only, and opens a preview windows" />
|
240 |
</p>
|
241 |
|
356 |
</div>
|
357 |
|
358 |
<p class="submit">
|
359 |
+
<input type="submit" name="save" id="save" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'calculated-fields-form' ); ?>" title="Saves the form's structure and settings and creates a revision" />
|
360 |
</p>
|
361 |
|
362 |
[<a href="https://cff.dwbooster.com/customization" target="_blank"><?php _e( 'Request Custom Modifications', 'calculated-fields-form' ); ?></a>] | [<a href="https://wordpress.org/support/plugin/calculated-fields-form#new-post" target="_blank"><?php _e( 'Help', 'calculated-fields-form' ); ?></a>]
|
inc/cpcff_form.inc.php
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
* @package CFF.
|
6 |
* @since 1.0.179
|
7 |
*/
|
|
|
8 |
|
9 |
if(!class_exists('CPCFF_FORM'))
|
10 |
{
|
@@ -39,6 +40,10 @@ if(!class_exists('CPCFF_FORM'))
|
|
39 |
*/
|
40 |
private $_fields;
|
41 |
|
|
|
|
|
|
|
|
|
42 |
/*********************************** PUBLIC METHODS ********************************************/
|
43 |
|
44 |
/**
|
@@ -51,6 +56,7 @@ if(!class_exists('CPCFF_FORM'))
|
|
51 |
$this->_id = $id;
|
52 |
$this->_settings = array();
|
53 |
$this->_fields = array();
|
|
|
54 |
} // End __construct
|
55 |
|
56 |
/**
|
@@ -129,7 +135,7 @@ if(!class_exists('CPCFF_FORM'))
|
|
129 |
)
|
130 |
)
|
131 |
{
|
132 |
-
return new
|
133 |
}
|
134 |
return false;
|
135 |
} // End create_default
|
@@ -294,15 +300,46 @@ if(!class_exists('CPCFF_FORM'))
|
|
294 |
'cv_text_enter_valid_captcha' => (isset($params['cv_text_enter_valid_captcha'])) ? $params['cv_text_enter_valid_captcha'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha
|
295 |
);
|
296 |
|
297 |
-
|
298 |
$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
299 |
$data,
|
300 |
array( 'id' => $this->_id ),
|
301 |
array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ),
|
302 |
array( '%d' )
|
303 |
);
|
|
|
|
|
|
|
304 |
} // End save_settings
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
/**
|
307 |
* Updates the form's name
|
308 |
*
|
@@ -330,6 +367,7 @@ if(!class_exists('CPCFF_FORM'))
|
|
330 |
public function delete_form()
|
331 |
{
|
332 |
global $wpdb;
|
|
|
333 |
return $wpdb->delete(
|
334 |
$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
335 |
array('id' => $this->_id),
|
@@ -351,8 +389,7 @@ if(!class_exists('CPCFF_FORM'))
|
|
351 |
global $wpdb;
|
352 |
if(empty($this->_settings))
|
353 |
{
|
354 |
-
$row = $
|
355 |
-
|
356 |
if(!empty($row)) $this->_settings = $row;
|
357 |
}
|
358 |
return $this->_settings;
|
5 |
* @package CFF.
|
6 |
* @since 1.0.179
|
7 |
*/
|
8 |
+
require_once dirname(__FILE__).'/cpcff_revisions.inc.php';
|
9 |
|
10 |
if(!class_exists('CPCFF_FORM'))
|
11 |
{
|
40 |
*/
|
41 |
private $_fields;
|
42 |
|
43 |
+
/**
|
44 |
+
* Instance of the CPCFF_REVISIONS object to interact with the form's revisions.
|
45 |
+
*/
|
46 |
+
private $_revisions_obj;
|
47 |
/*********************************** PUBLIC METHODS ********************************************/
|
48 |
|
49 |
/**
|
56 |
$this->_id = $id;
|
57 |
$this->_settings = array();
|
58 |
$this->_fields = array();
|
59 |
+
$this->_revisions_obj = new CPCFF_REVISIONS($this);
|
60 |
} // End __construct
|
61 |
|
62 |
/**
|
135 |
)
|
136 |
)
|
137 |
{
|
138 |
+
return new self($wpdb->insert_id);
|
139 |
}
|
140 |
return false;
|
141 |
} // End create_default
|
300 |
'cv_text_enter_valid_captcha' => (isset($params['cv_text_enter_valid_captcha'])) ? $params['cv_text_enter_valid_captcha'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha
|
301 |
);
|
302 |
|
303 |
+
$updated_rows = $wpdb->update (
|
304 |
$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
305 |
$data,
|
306 |
array( 'id' => $this->_id ),
|
307 |
array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ),
|
308 |
array( '%d' )
|
309 |
);
|
310 |
+
|
311 |
+
if($updated_rows !== false && !isset($params['preview'])) $this->_revisions_obj->create_revision();
|
312 |
+
return $updated_rows;
|
313 |
} // End save_settings
|
314 |
|
315 |
+
/**
|
316 |
+
* Gets the correspond rown in the database
|
317 |
+
*/
|
318 |
+
public function get_raw_data()
|
319 |
+
{
|
320 |
+
global $wpdb;
|
321 |
+
$row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE." WHERE id=%d", $this->_id), ARRAY_A);
|
322 |
+
return $row;
|
323 |
+
} // End get_raw_data
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Returns an instance of the CPCFF_REVISIONS revisions object
|
327 |
+
*/
|
328 |
+
public function get_revisions()
|
329 |
+
{
|
330 |
+
return $this->_revisions_obj;
|
331 |
+
} // End get_revisions
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Creates or replace the property $this->_settings with the data stored in the revisions
|
335 |
+
*/
|
336 |
+
public function apply_revision($revision_id)
|
337 |
+
{
|
338 |
+
$this->_get_settings();
|
339 |
+
$revision_data = $this->_revisions_obj->data($revision_id);
|
340 |
+
$this->_settings = CPCFF_AUXILIARY::array_replace_recursive($this->_settings,$revision_data);
|
341 |
+
} // End apply_revision
|
342 |
+
|
343 |
/**
|
344 |
* Updates the form's name
|
345 |
*
|
367 |
public function delete_form()
|
368 |
{
|
369 |
global $wpdb;
|
370 |
+
$this->_revisions_obj->delete_form();
|
371 |
return $wpdb->delete(
|
372 |
$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
373 |
array('id' => $this->_id),
|
389 |
global $wpdb;
|
390 |
if(empty($this->_settings))
|
391 |
{
|
392 |
+
$row = $this->get_raw_data();
|
|
|
393 |
if(!empty($row)) $this->_settings = $row;
|
394 |
}
|
395 |
return $this->_settings;
|
inc/cpcff_install_uninstall.inc.php
CHANGED
@@ -261,6 +261,16 @@ if(!class_exists('CPCFF_INSTALLER'))
|
|
261 |
|
262 |
// Insert the predefined forms into the forms table
|
263 |
self::_predefined_forms();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
} // End _db_structure
|
265 |
|
266 |
/**
|
261 |
|
262 |
// Insert the predefined forms into the forms table
|
263 |
self::_predefined_forms();
|
264 |
+
|
265 |
+
// Revisions table
|
266 |
+
$sql = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE." (
|
267 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
268 |
+
formid mediumint(9) NOT NULL,
|
269 |
+
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
|
270 |
+
revision longtext NOT NULL,
|
271 |
+
UNIQUE KEY id (id)
|
272 |
+
) $charset_collate;";
|
273 |
+
$wpdb->query($sql);
|
274 |
} // End _db_structure
|
275 |
|
276 |
/**
|
inc/cpcff_main.inc.php
CHANGED
@@ -153,6 +153,15 @@ if(!class_exists('CPCFF_MAIN'))
|
|
153 |
{
|
154 |
if ( $this->_is_admin ) // Initializes the WordPress modules.
|
155 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
// Adds the plugin links in the plugins sections
|
157 |
add_filter( 'plugin_action_links_'.CP_CALCULATEDFIELDSF_BASE_NAME, array($this, 'links' ) );
|
158 |
|
153 |
{
|
154 |
if ( $this->_is_admin ) // Initializes the WordPress modules.
|
155 |
{
|
156 |
+
if(
|
157 |
+
false === ($CP_CALCULATEDFIELDSF_VERSION = get_option('CP_CALCULATEDFIELDSF_VERSION')) ||
|
158 |
+
$CP_CALCULATEDFIELDSF_VERSION != CP_CALCULATEDFIELDSF_VERSION
|
159 |
+
)
|
160 |
+
{
|
161 |
+
if(class_exists('CPCFF_INSTALLER')) CPCFF_INSTALLER::install(is_multisite());
|
162 |
+
update_option('CP_CALCULATEDFIELDSF_VERSION', CP_CALCULATEDFIELDSF_VERSION);
|
163 |
+
}
|
164 |
+
|
165 |
// Adds the plugin links in the plugins sections
|
166 |
add_filter( 'plugin_action_links_'.CP_CALCULATEDFIELDSF_BASE_NAME, array($this, 'links' ) );
|
167 |
|
inc/cpcff_revisions.inc.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Revisions class with database interaction, data, and methods.
|
4 |
+
*
|
5 |
+
* @package CFF.
|
6 |
+
* @since 1.0.232
|
7 |
+
*/
|
8 |
+
|
9 |
+
if(!class_exists('CPCFF_REVISIONS'))
|
10 |
+
{
|
11 |
+
class CPCFF_REVISIONS
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* CPCFF_FORM instance
|
15 |
+
*/
|
16 |
+
private $_form_obj;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* List of revisions rows corresponding to the form
|
20 |
+
*/
|
21 |
+
private $_revisions;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Instance of the $wpdb object
|
25 |
+
*/
|
26 |
+
private $_db;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Name of revisions table
|
30 |
+
*/
|
31 |
+
private $_table;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* The number of revisions per form
|
35 |
+
*/
|
36 |
+
private $_max = 10;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Constructs a CPCFF_REVISIONS object.
|
40 |
+
*
|
41 |
+
* @param integer $form_obj instance of CPCFF_FORM
|
42 |
+
*/
|
43 |
+
public function __construct($form_obj)
|
44 |
+
{
|
45 |
+
global $wpdb;
|
46 |
+
$this->_db = $wpdb;
|
47 |
+
$this->_table = $wpdb->prefix.CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE;
|
48 |
+
$this->_form_obj = $form_obj;
|
49 |
+
$this->revisions_list();
|
50 |
+
} // End construct
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Returns the list of revisions rows in the database as array
|
54 |
+
*/
|
55 |
+
public function revisions_list()
|
56 |
+
{
|
57 |
+
if(empty($this->_revisions))
|
58 |
+
{
|
59 |
+
$results = $this->_db->get_results(
|
60 |
+
$this->_db->prepare(
|
61 |
+
'SELECT * FROM '.$this->_table.' WHERE formid=%d ORDER BY time DESC',
|
62 |
+
$this->_form_obj->get_id()
|
63 |
+
),
|
64 |
+
ARRAY_A
|
65 |
+
);
|
66 |
+
$this->_revisions = array();
|
67 |
+
foreach($results as $revision)
|
68 |
+
{
|
69 |
+
$this->_revisions[$revision['id']] = $revision;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
return $this->_revisions;
|
73 |
+
|
74 |
+
} // End revisions_list
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Creates a new entry in the revisions table, if there are more than _max revisions remove the older.
|
78 |
+
*
|
79 |
+
* @return int returns the revision's id or false if fails.
|
80 |
+
*/
|
81 |
+
public function create_revision()
|
82 |
+
{
|
83 |
+
$form_data = $this->_form_obj->get_raw_data();
|
84 |
+
|
85 |
+
$data = array(
|
86 |
+
'formid' => $this->_form_obj->get_id(),
|
87 |
+
'time' => current_time('mysql'),
|
88 |
+
'revision' => serialize($form_data)
|
89 |
+
);
|
90 |
+
|
91 |
+
if(
|
92 |
+
$this->_db->insert(
|
93 |
+
$this->_table,
|
94 |
+
$data,
|
95 |
+
array('%d','%s','%s')
|
96 |
+
)
|
97 |
+
)
|
98 |
+
{
|
99 |
+
$data['id'] = $this->_db->insert_id;
|
100 |
+
$this->_revisions[$data['id']] = $data;
|
101 |
+
krsort($this->_revisions);
|
102 |
+
if($this->_max < count($this->_revisions))
|
103 |
+
{
|
104 |
+
array_splice($this->_revisions,$this->_max);
|
105 |
+
$this->_delete_older();
|
106 |
+
}
|
107 |
+
return $data['id'];
|
108 |
+
}
|
109 |
+
return false;
|
110 |
+
} // End create_revision
|
111 |
+
|
112 |
+
/**
|
113 |
+
* returns the form data unserialized or an empty array
|
114 |
+
*/
|
115 |
+
public function data( $revision_id )
|
116 |
+
{
|
117 |
+
if(
|
118 |
+
!empty($this->_revisions) &&
|
119 |
+
isset($this->_revisions[$revision_id])
|
120 |
+
)
|
121 |
+
{
|
122 |
+
return unserialize($this->_revisions[$revision_id]['revision']);
|
123 |
+
}
|
124 |
+
return array();
|
125 |
+
} // End data
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Deletes the list of revisions belonging to the form
|
129 |
+
*/
|
130 |
+
public function delete_form()
|
131 |
+
{
|
132 |
+
$this->_db->delete(
|
133 |
+
$this->_table,
|
134 |
+
array('formid' => $this->_form_obj->get_id()),
|
135 |
+
array('%d')
|
136 |
+
);
|
137 |
+
$this->_revisions = array();
|
138 |
+
} // End delete_form
|
139 |
+
|
140 |
+
|
141 |
+
/*********************************** PRIVATE METHODS ********************************************/
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Deletes the older revisions, leaving only the _max
|
145 |
+
*/
|
146 |
+
private function _delete_older()
|
147 |
+
{
|
148 |
+
$formid = $this->_form_obj->get_id();
|
149 |
+
$this->_db->query(
|
150 |
+
$this->_db->prepare(
|
151 |
+
'DELETE FROM '.$this->_table.' WHERE formid=%d AND id IN (SELECT * FROM (SELECT id FROM '.$this->_table.' WHERE formid=%d ORDER BY time DESC LIMIT %d,18446744073709551615) AS tmp)',
|
152 |
+
$formid,$formid,$this->_max
|
153 |
+
)
|
154 |
+
);
|
155 |
+
} // End _delete_older
|
156 |
+
} // End CPCFF_REVISIONS
|
157 |
+
}
|
js/fbuilder-loader-admin.php
CHANGED
@@ -3,7 +3,7 @@ error_reporting(E_ERROR|E_PARSE);
|
|
3 |
header('Content-Type: application/x-javascript; charset=UTF-8');
|
4 |
?>
|
5 |
fbuilderjQuery = (typeof fbuilderjQuery != 'undefined' ) ? fbuilderjQuery : jQuery;
|
6 |
-
fbuilderjQueryGenerator = function(){
|
7 |
if('fbuilderGeneratorFlag' in fbuilderjQuery) return;
|
8 |
(function($) {
|
9 |
// Namespace of fbuilder
|
@@ -75,5 +75,5 @@ fbuilderjQueryGenerator = function(){
|
|
75 |
})(fbuilderjQuery);
|
76 |
fbuilderjQuery.fbuilderGeneratorFlag = 1;
|
77 |
};
|
78 |
-
fbuilderjQuery(fbuilderjQueryGenerator);
|
79 |
-
fbuilderjQuery(window).on('load',fbuilderjQueryGenerator);
|
3 |
header('Content-Type: application/x-javascript; charset=UTF-8');
|
4 |
?>
|
5 |
fbuilderjQuery = (typeof fbuilderjQuery != 'undefined' ) ? fbuilderjQuery : jQuery;
|
6 |
+
fbuilderjQuery.fbuilderjQueryGenerator = function(){
|
7 |
if('fbuilderGeneratorFlag' in fbuilderjQuery) return;
|
8 |
(function($) {
|
9 |
// Namespace of fbuilder
|
75 |
})(fbuilderjQuery);
|
76 |
fbuilderjQuery.fbuilderGeneratorFlag = 1;
|
77 |
};
|
78 |
+
fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);
|
79 |
+
fbuilderjQuery(window).on('load',fbuilderjQuery.fbuilderjQueryGenerator);
|
js/fbuilder-loader-public.php
CHANGED
@@ -5,11 +5,12 @@ ob_start(); // Turn on output buffering
|
|
5 |
?>
|
6 |
fbuilderjQuery = (typeof fbuilderjQuery != 'undefined' ) ? fbuilderjQuery : jQuery;
|
7 |
fbuilderjQuery(window).bind( 'pageshow', function( event ){ if( typeof event.originalEvent[ 'persisted' ] != 'undefined' && event.originalEvent[ 'persisted' ] ) location.reload(); } );
|
8 |
-
fbuilderjQuery
|
9 |
-
(
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
<?php
|
15 |
// Load Module files
|
@@ -95,10 +96,12 @@ fbuilderjQuery(function(){
|
|
95 |
fcount++;
|
96 |
fnum = "_"+fcount;
|
97 |
}
|
98 |
-
})(fbuilderjQuery);
|
99 |
-
|
|
|
|
|
|
|
100 |
<?php
|
101 |
-
|
102 |
$buffered_contents = ob_get_contents();
|
103 |
ob_end_clean(); // Clean the output buffer and turn off output buffering
|
104 |
if( !empty( $_REQUEST[ 'min' ] ) )
|
@@ -114,6 +117,4 @@ fbuilderjQuery(function(){
|
|
114 |
@file_put_contents( $all_js_path, $buffered_contents );
|
115 |
}catch( Exception $err){}
|
116 |
}
|
117 |
-
print $buffered_contents;
|
118 |
-
|
119 |
-
?>
|
5 |
?>
|
6 |
fbuilderjQuery = (typeof fbuilderjQuery != 'undefined' ) ? fbuilderjQuery : jQuery;
|
7 |
fbuilderjQuery(window).bind( 'pageshow', function( event ){ if( typeof event.originalEvent[ 'persisted' ] != 'undefined' && event.originalEvent[ 'persisted' ] ) location.reload(); } );
|
8 |
+
fbuilderjQuery.fbuilderjQueryGenerator = function(){
|
9 |
+
if('fbuilderGeneratorFlag' in fbuilderjQuery) return;
|
10 |
+
(function($) {
|
11 |
+
// Namespace of fbuilder
|
12 |
+
$.fbuilder = $.fbuilder || {};
|
13 |
+
$.fbuilder[ 'objName' ] = 'fbuilderjQuery';
|
14 |
|
15 |
<?php
|
16 |
// Load Module files
|
96 |
fcount++;
|
97 |
fnum = "_"+fcount;
|
98 |
}
|
99 |
+
})(fbuilderjQuery);
|
100 |
+
fbuilderjQuery.fbuilderGeneratorFlag = 1;
|
101 |
+
};
|
102 |
+
fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);
|
103 |
+
fbuilderjQuery(window).on('load',fbuilderjQuery.fbuilderjQueryGenerator);
|
104 |
<?php
|
|
|
105 |
$buffered_contents = ob_get_contents();
|
106 |
ob_end_clean(); // Clean the output buffer and turn off output buffering
|
107 |
if( !empty( $_REQUEST[ 'min' ] ) )
|
117 |
@file_put_contents( $all_js_path, $buffered_contents );
|
118 |
}catch( Exception $err){}
|
119 |
}
|
120 |
+
print $buffered_contents;
|
|
|
|
js/modules/01_mathematical_logical/admin/module_admin.js
CHANGED
@@ -16,9 +16,9 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
16 |
{ "value" : ")", "code" : ")", "tip" : "" },
|
17 |
{ "value" : ",", "code" : ",", "tip" : "" },
|
18 |
{ "value" : "ABS", "code" : "ABS(", "tip" : "Returns the absolute value of the number passed as parameter. <strong>ABS(number)</strong>" },
|
19 |
-
{ "value" : "CEIL", "code" : "CEIL(", "tip" : "Returns the next higher integer that is greater than or equal to the number passed as parameter. <strong>CEIL(number)</strong>" },
|
20 |
-
{ "value" : "FLOOR", "code" : "FLOOR(", "tip" : "Returns the next lower integer that is less than or equal to the number passed as parameter. <strong>FLOOR(number)</strong>" },
|
21 |
-
{ "value" : "ROUND", "code" : "ROUND(", "tip" : "Returns an integer that follows rounding rules. If the value of the passed parameter is greater than or equal to x.5, the returned value is x+1; otherwise the returned value is x. <strong>ROUND(number)</strong>" },
|
22 |
{ "value" : "PREC", "code" : "PREC(", "tip" : "Returns the value of the number passed in the first parameter with so many decimal digits as the number passed in the second parameter. <strong>PREC(number1, number2)</strong>" },
|
23 |
{ "value" : "CDATE", "code" : "CDATE(", "tip" : "Returns the number formatted like a Date. <strong>CDATE(number,format)</strong>. The second parameter defines the format of the output date: "mm/dd.yyyy", "dd/mm/yyyy"" },
|
24 |
{ "value" : "LOG", "code" : "LOG(", "tip" : "Returns the natural logarithm (base e) of the number passed as parameter. <strong>LOG(number)</strong>" },
|
16 |
{ "value" : ")", "code" : ")", "tip" : "" },
|
17 |
{ "value" : ",", "code" : ",", "tip" : "" },
|
18 |
{ "value" : "ABS", "code" : "ABS(", "tip" : "Returns the absolute value of the number passed as parameter. <strong>ABS(number)</strong>" },
|
19 |
+
{ "value" : "CEIL", "code" : "CEIL(", "tip" : "Returns the next higher integer that is greater than or equal to the number passed as parameter. <strong>CEIL(number)</strong><br>The CEIL operation accepts a second parameter for rounding the number to the next multiple of this second parameter. <strong>CEIL(X,Y)</strong>" },
|
20 |
+
{ "value" : "FLOOR", "code" : "FLOOR(", "tip" : "Returns the next lower integer that is less than or equal to the number passed as parameter. <strong>FLOOR(number)</strong><br>The FLOOR operation accepts a second parameter for rounding the number to the previous multiple of this second parameter. <strong>FLOOR(X,Y)</strong>" },
|
21 |
+
{ "value" : "ROUND", "code" : "ROUND(", "tip" : "Returns an integer that follows rounding rules. If the value of the passed parameter is greater than or equal to x.5, the returned value is x+1; otherwise the returned value is x. <strong>ROUND(number)</strong><br>The ROUND operation accepts a second parameter for rounding the number to the nearest multiple of this second parameter. <strong>ROUND(X,Y)</strong>" },
|
22 |
{ "value" : "PREC", "code" : "PREC(", "tip" : "Returns the value of the number passed in the first parameter with so many decimal digits as the number passed in the second parameter. <strong>PREC(number1, number2)</strong>" },
|
23 |
{ "value" : "CDATE", "code" : "CDATE(", "tip" : "Returns the number formatted like a Date. <strong>CDATE(number,format)</strong>. The second parameter defines the format of the output date: "mm/dd.yyyy", "dd/mm/yyyy"" },
|
24 |
{ "value" : "LOG", "code" : "LOG(", "tip" : "Returns the natural logarithm (base e) of the number passed as parameter. <strong>LOG(number)</strong>" },
|
js/modules/01_mathematical_logical/public/module_public.js
CHANGED
@@ -6,6 +6,45 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
6 |
'prefix' : '',
|
7 |
'callback' : function()
|
8 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
if(window.PREC == undefined)
|
10 |
{
|
11 |
window.PREC = window.prec = function (num, pr)
|
@@ -28,7 +67,7 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
28 |
if(isFinite(num*1))
|
29 |
{
|
30 |
num = Math.round(num*86400000);
|
31 |
-
|
32 |
var date = new Date(num),
|
33 |
d = date.getDate(),
|
34 |
m = date.getMonth()+1,
|
@@ -37,10 +76,10 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
37 |
i = date.getMinutes(),
|
38 |
s = date.getSeconds(),
|
39 |
a = '';
|
40 |
-
|
41 |
m = (m < 10) ? '0'+m : m;
|
42 |
d = (d < 10) ? '0'+d : d;
|
43 |
-
|
44 |
if( /a/.test( format ) )
|
45 |
{
|
46 |
a = ( h >= 12 ) ? 'pm' : 'am';
|
@@ -50,7 +89,7 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
50 |
h = (h < 10) ? '0'+h : h;
|
51 |
i = (i < 10) ? '0'+i : i;
|
52 |
s = (s < 10) ? '0'+s : s;
|
53 |
-
|
54 |
return format.replace( /y+/i, y)
|
55 |
.replace( /m+/i, m)
|
56 |
.replace( /d+/i, d)
|
@@ -62,7 +101,7 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
62 |
return num;
|
63 |
};
|
64 |
} // End if window.CDATE
|
65 |
-
|
66 |
if(window.GCD == undefined)
|
67 |
{
|
68 |
window.GCD = window.gcd = function( a, b)
|
@@ -70,17 +109,17 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
70 |
if ( ! b) return a;
|
71 |
return GCD(b, a % b);
|
72 |
};
|
73 |
-
} // End if window.GCD
|
74 |
-
|
75 |
if(window.LOGAB == undefined)
|
76 |
{
|
77 |
window.LOGAB = window.logab = function( a, b)
|
78 |
{
|
79 |
return LOG(a)/LOG(b);
|
80 |
};
|
81 |
-
} // End if window.LOGAB
|
82 |
-
|
83 |
-
var math_prop = ["LN10", "PI", "E", "LOG10E", "SQRT2", "LOG2E", "SQRT1_2", "LN2", "cos", "pow", "log", "tan", "sqrt", "
|
84 |
|
85 |
for(var i = 0, h = math_prop.length; i < h; i++)
|
86 |
{
|
@@ -89,10 +128,10 @@ fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ] = {
|
|
89 |
window[ math_prop[ i ] ] = window[ math_prop[ i ].toUpperCase() ] = Math[ math_prop[ i ] ];
|
90 |
}
|
91 |
}
|
92 |
-
|
93 |
fbuilderjQuery[ 'fbuilder' ][ 'extend_window' ]( fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ][ 'prefix' ], CF_LOGICAL );
|
94 |
},
|
95 |
-
|
96 |
'validator' : function( v )
|
97 |
{
|
98 |
return ( typeof v == 'number' ) ? isFinite( v ) : ( typeof v != 'undefined' );
|
6 |
'prefix' : '',
|
7 |
'callback' : function()
|
8 |
{
|
9 |
+
function ROUNDx(operation, num, y)
|
10 |
+
{
|
11 |
+
if(y && y != 0)
|
12 |
+
{
|
13 |
+
return operation(num/y)*y;
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
return operation(num);
|
18 |
+
}
|
19 |
+
};
|
20 |
+
|
21 |
+
if(window.ROUND == undefined)
|
22 |
+
{
|
23 |
+
window.ROUND = window.round = function(num, y)
|
24 |
+
{
|
25 |
+
if(y) return ROUNDx(Math.round, num, y);
|
26 |
+
return ROUNDx(Math.round, num);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
if(window.FLOOR == undefined)
|
31 |
+
{
|
32 |
+
window.FLOOR = window.floor = function(num, y)
|
33 |
+
{
|
34 |
+
if(y) return ROUNDx(Math.floor, num, y);
|
35 |
+
return ROUNDx(Math.floor, num);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
if(window.CEIL == undefined)
|
40 |
+
{
|
41 |
+
window.CEIL = window.ceil = function(num, y)
|
42 |
+
{
|
43 |
+
if(y) return ROUNDx(Math.ceil, num, y);
|
44 |
+
return ROUNDx(Math.ceil, num);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
if(window.PREC == undefined)
|
49 |
{
|
50 |
window.PREC = window.prec = function (num, pr)
|
67 |
if(isFinite(num*1))
|
68 |
{
|
69 |
num = Math.round(num*86400000);
|
70 |
+
|
71 |
var date = new Date(num),
|
72 |
d = date.getDate(),
|
73 |
m = date.getMonth()+1,
|
76 |
i = date.getMinutes(),
|
77 |
s = date.getSeconds(),
|
78 |
a = '';
|
79 |
+
|
80 |
m = (m < 10) ? '0'+m : m;
|
81 |
d = (d < 10) ? '0'+d : d;
|
82 |
+
|
83 |
if( /a/.test( format ) )
|
84 |
{
|
85 |
a = ( h >= 12 ) ? 'pm' : 'am';
|
89 |
h = (h < 10) ? '0'+h : h;
|
90 |
i = (i < 10) ? '0'+i : i;
|
91 |
s = (s < 10) ? '0'+s : s;
|
92 |
+
|
93 |
return format.replace( /y+/i, y)
|
94 |
.replace( /m+/i, m)
|
95 |
.replace( /d+/i, d)
|
101 |
return num;
|
102 |
};
|
103 |
} // End if window.CDATE
|
104 |
+
|
105 |
if(window.GCD == undefined)
|
106 |
{
|
107 |
window.GCD = window.gcd = function( a, b)
|
109 |
if ( ! b) return a;
|
110 |
return GCD(b, a % b);
|
111 |
};
|
112 |
+
} // End if window.GCD
|
113 |
+
|
114 |
if(window.LOGAB == undefined)
|
115 |
{
|
116 |
window.LOGAB = window.logab = function( a, b)
|
117 |
{
|
118 |
return LOG(a)/LOG(b);
|
119 |
};
|
120 |
+
} // End if window.LOGAB
|
121 |
+
|
122 |
+
var math_prop = ["LN10", "PI", "E", "LOG10E", "SQRT2", "LOG2E", "SQRT1_2", "LN2", "cos", "pow", "log", "tan", "sqrt", "asin", "abs", "max", "exp", "atan2", "random", "acos", "atan", "min", "sin"];
|
123 |
|
124 |
for(var i = 0, h = math_prop.length; i < h; i++)
|
125 |
{
|
128 |
window[ math_prop[ i ] ] = window[ math_prop[ i ].toUpperCase() ] = Math[ math_prop[ i ] ];
|
129 |
}
|
130 |
}
|
131 |
+
|
132 |
fbuilderjQuery[ 'fbuilder' ][ 'extend_window' ]( fbuilderjQuery[ 'fbuilder' ][ 'modules' ][ 'default' ][ 'prefix' ], CF_LOGICAL );
|
133 |
},
|
134 |
+
|
135 |
'validator' : function( v )
|
136 |
{
|
137 |
return ( typeof v == 'number' ) ? isFinite( v ) : ( typeof v != 'undefined' );
|
templates/03/style.css
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
}
|
43 |
}
|
44 |
@media screen and (max-width: 640px){
|
45 |
-
.cp_cff_natural #fbuilder .medium,
|
46 |
.cp_cff_natural #fbuilder .small{
|
47 |
width: calc( 100% - 12px ) !important;
|
48 |
width: -moz-calc( 100% - 12px ) !important;
|
42 |
}
|
43 |
}
|
44 |
@media screen and (max-width: 640px){
|
45 |
+
.cp_cff_natural #fbuilder .medium,
|
46 |
.cp_cff_natural #fbuilder .small{
|
47 |
width: calc( 100% - 12px ) !important;
|
48 |
width: -moz-calc( 100% - 12px ) !important;
|