Version Description
- Improves the plugin code.
- Includes additional forms to the forms library.
Download this release
Release Info
Developer | codepeople |
Plugin | Calculated Fields Form |
Version | 1.1.111 |
Comparing to | |
See all releases |
Code changes from version 1.1.110 to 1.1.111
- README.txt +7 -10
- captcha/captcha.php +169 -177
- changelog.txt +5 -0
- config/cpcff_config.cfg.php +178 -179
- cp_calculatedfieldsf_free.php +59 -63
- feedback/cp-feedback.php +86 -97
- inc/cpcff_admin_int.inc.php +741 -719
- inc/cpcff_admin_int_list.inc.php +436 -445
- inc/cpcff_amp.inc.php +229 -222
- inc/cpcff_auxiliary.inc.php +387 -407
- inc/cpcff_banner.inc.php +106 -107
- inc/cpcff_compatibility.inc.php +100 -110
- inc/cpcff_form.inc.php +509 -479
- inc/cpcff_install_uninstall.inc.php +323 -337
- inc/cpcff_main.inc.php +1074 -1093
- inc/cpcff_page_builders.inc.php +187 -210
- inc/cpcff_public_int.inc.php +80 -85
- inc/cpcff_revisions.inc.php +148 -158
- inc/cpcff_session.inc.php +185 -195
- inc/cpcff_templates.inc.php +154 -175
- inc/cpcff_trial.php +66 -61
- js/JSMin.php +334 -343
- js/fbuilder-loader-admin.php +72 -89
- js/fbuilder-loader-public.php +148 -151
- languages/calculated-fields-form-en_US.mo +0 -0
- languages/calculated-fields-form-en_US.po +223 -201
- pagebuilders/beaverbuilder/cff/cff.inc.php +51 -50
- pagebuilders/beaverbuilder/cff/cff/cff.php +21 -20
- pagebuilders/beaverbuilder/cff/cff/includes/frontend.php +18 -15
- pagebuilders/beaverbuilder/cffvar/cffvar.inc.php +38 -38
- pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php +21 -20
- pagebuilders/beaverbuilder/cffvar/cffvar/includes/frontend.php +17 -17
- pagebuilders/divi/cff.pb.php +79 -78
- pagebuilders/elementor/elementor.pb.php +197 -210
- pagebuilders/elementor/elementor_category.pb.php +16 -16
- pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php +64 -67
- pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php +20 -15
- pagebuilders/siteorigin/siteorigin-cpcff/fields/cff-button.class.php +5 -6
- pagebuilders/siteorigin/siteorigin-cpcff/siteorigin-cpcff.php +72 -75
- pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php +16 -13
- vendors/forms.js +15 -0
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://cff.dwbooster.com
|
|
4 |
Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
|
5 |
Requires at least: 3.0.5
|
6 |
Tested up to: 6.0
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -965,6 +965,11 @@ A: Please, follow the steps below:
|
|
965 |
|
966 |
== Changelog ==
|
967 |
|
|
|
|
|
|
|
|
|
|
|
968 |
= 1.1.110 =
|
969 |
|
970 |
* Fixes a minor issue with Upload File and Summary fields settigns.
|
@@ -1009,12 +1014,4 @@ A: Please, follow the steps below:
|
|
1009 |
|
1010 |
= 1.1.102 =
|
1011 |
|
1012 |
-
* Fixes an issue with the radio buttons when switching on/off is enabled.
|
1013 |
-
|
1014 |
-
= 1.1.101 =
|
1015 |
-
|
1016 |
-
* Modifies the Textarea control to preserve the changes of line accessing the raw field's value.
|
1017 |
-
* Fixes an issue in the calculated fields formatted automatically with manually entered values.
|
1018 |
-
* Removes the extra columns and rows in the generated CSV files from the Messages section (Professional, Developer, and Platinum versions).
|
1019 |
-
* Implements the new control "HTML Content DS" to display plain HTML content read from an external data source (Developer and Platinum versions).
|
1020 |
-
* Modifies the "CFF - WooCommerce" add-on to support the "WooCommerce One Page Checkout" plugin (Developer and Platinum versions).
|
4 |
Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
|
5 |
Requires at least: 3.0.5
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 1.1.111
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
965 |
|
966 |
== Changelog ==
|
967 |
|
968 |
+
= 1.1.111 =
|
969 |
+
|
970 |
+
* Improves the plugin code.
|
971 |
+
* Includes additional forms to the forms library.
|
972 |
+
|
973 |
= 1.1.110 =
|
974 |
|
975 |
* Fixes a minor issue with Upload File and Summary fields settigns.
|
1014 |
|
1015 |
= 1.1.102 =
|
1016 |
|
1017 |
+
* Fixes an issue with the radio buttons when switching on/off is enabled.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
captcha/captcha.php
CHANGED
@@ -4,196 +4,188 @@ PHP Captcha by Codepeople.net
|
|
4 |
http://www.codepeople.net
|
5 |
*/
|
6 |
|
7 |
-
if(!defined('WP_DEBUG') || true != WP_DEBUG)
|
8 |
-
|
9 |
-
error_reporting(E_ERROR|E_PARSE);
|
10 |
}
|
11 |
|
12 |
-
if (!ini_get(
|
|
|
|
|
13 |
|
14 |
-
if(!function_exists('cff_captcha_sanitize_key'))
|
15 |
-
{
|
16 |
function cff_captcha_sanitize_key( $key ) {
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
if (!isset($_GET["ps"])) $_GET["ps"] = '';
|
26 |
-
|
27 |
-
if( isset($_GET["hdwtest"]) && $_GET["hdwtest"] == "sessiontest" )
|
28 |
-
{
|
29 |
-
if( !isset( $_GET["autocall"] ) || $_GET["autocall"] != 1 )
|
30 |
-
{
|
31 |
-
if( class_exists( 'CP_SESSION' ) ) CP_SESSION::set_var("tmpvar", "ok");
|
32 |
-
else $_SESSION[ "tmpvar" ] = "ok";
|
33 |
-
}
|
34 |
-
else
|
35 |
-
{
|
36 |
-
if(
|
37 |
-
( class_exists( 'CP_SESSION' ) && CP_SESSION::get_var("tmpvar") != "ok") ||
|
38 |
-
(!class_exists( 'CP_SESSION' ) && empty( $_SESSION[ "tmpvar" ] ) )
|
39 |
-
)
|
40 |
-
{
|
41 |
-
die("Session Error");
|
42 |
-
}
|
43 |
-
else
|
44 |
-
{
|
45 |
-
die("Sessions works on your server!");
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
$current_url = ( !empty( $_SERVER[ 'REQUEST_URI' ] ) ) ? $_SERVER[ 'REQUEST_URI' ] : $_SERVER['PATH_INFO'];
|
50 |
-
$current_url .= ( ( strpos( $current_url, "?" ) === false ) ? "?" : "&" )."hdwtest=sessiontest&autocall=1";
|
51 |
-
header("Location: ".$current_url );
|
52 |
-
exit;
|
53 |
-
}
|
54 |
-
|
55 |
-
if(empty($_GET["width"]) || !is_numeric($_GET["width"])) $_GET["width"] = "180";
|
56 |
-
if(empty($_GET["height"]) || !is_numeric($_GET["height"])) $_GET["height"] = "60";
|
57 |
-
if(empty($_GET["letter_count"]) || !is_numeric($_GET["letter_count"])) $_GET["letter_count"] = "5";
|
58 |
-
if(empty($_GET["min_size"]) || !is_numeric($_GET["min_size"])) $_GET["min_size"] = "35";
|
59 |
-
if(empty($_GET["max_size"]) || !is_numeric($_GET["max_size"])) $_GET["max_size"] = "45";
|
60 |
-
if(empty($_GET["noise"]) || !is_numeric($_GET["noise"])) $_GET["noise"] = "200";
|
61 |
-
if(empty($_GET["noiselength"]) || !is_numeric($_GET["noiselength"])) $_GET["noiselength"] = "5";
|
62 |
-
if(empty($_GET["bcolor"])) $_GET["bcolor"] = "FFFFFF";
|
63 |
-
if(empty($_GET["border"])) $_GET["border"] = "000000";
|
64 |
-
|
65 |
-
//configuration
|
66 |
-
$imgX = ( isset($_GET["width"]) && is_numeric( $_GET["width"] ) )? $_GET["width"] : "180" ;
|
67 |
-
$imgY = ( isset($_GET["height"]) && is_numeric( $_GET["height"] ) )? $_GET["height"] : "60" ;
|
68 |
-
|
69 |
-
$letter_count = ( isset($_GET["letter_count"]) && is_numeric( $_GET["letter_count"] ) )? $_GET["letter_count"] : "5";
|
70 |
-
$min_size = ( isset($_GET["min_size"]) && is_numeric( $_GET["min_size"] ) )? $_GET["min_size"] : "35";
|
71 |
-
$max_size = ( isset($_GET["max_size"]) && is_numeric( $_GET["max_size"] ) )? $_GET["max_size"] : "45";
|
72 |
-
$noise = ( isset($_GET["noise"]) && is_numeric( $_GET["noise"] ) )? $_GET["noise"] : "200";
|
73 |
-
$noiselength = ( isset($_GET["noiselength"]) && is_numeric( $_GET["noiselength"] ) )? $_GET["noiselength"] : "5";
|
74 |
-
$bcolor = cpcff_decodeColor($_GET["bcolor"]);
|
75 |
-
$border = cpcff_decodeColor($_GET["border"]);
|
76 |
-
|
77 |
-
$noisecolor = 0xcdcdcd;
|
78 |
-
$random_noise_color= true;
|
79 |
-
$tcolor = cpcff_decodeColor("666666");
|
80 |
-
$random_text_color= true;
|
81 |
-
|
82 |
-
header("Cache-Control: no-store, no-cache, must-revalidate");
|
83 |
-
header("Pragma: no-cache");
|
84 |
-
|
85 |
-
function cpcff_decodeColor($hexcolor)
|
86 |
-
{
|
87 |
-
$color = hexdec($hexcolor);
|
88 |
-
$c["b"] = $color % 256;
|
89 |
-
$color = $color / 256;
|
90 |
-
$c["g"] = $color % 256;
|
91 |
-
$color = $color / 256;
|
92 |
-
$c["r"] = $color % 256;
|
93 |
-
return $c;
|
94 |
-
}
|
95 |
-
|
96 |
-
function cpcff_similarColors($c1, $c2)
|
97 |
-
{
|
98 |
-
return sqrt( pow($c1["r"]-$c2["r"],2) + pow($c1["g"]-$c2["g"],2) + pow($c1["b"]-$c2["b"],2)) < 125;
|
99 |
}
|
100 |
|
101 |
function cpcff_make_seed() {
|
102 |
-
|
103 |
-
|
104 |
}
|
105 |
-
mt_srand(cpcff_make_seed());
|
106 |
$randval = mt_rand();
|
107 |
|
108 |
-
$str
|
109 |
$length = 0;
|
110 |
-
for ($i = 0; $i < $letter_count; $i++) {
|
111 |
-
$str .= chr(mt_rand(97, 122)).
|
112 |
-
}
|
113 |
-
|
114 |
-
if( class_exists( 'CP_SESSION' ) )
|
115 |
-
|
116 |
-
|
117 |
-
$
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
{
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
{
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
$font = dirname( __FILE__ ) . "/" . $selected_font; // font
|
163 |
|
164 |
// Removed @2x, the patch fixes an issue caused by other plugin that includes the @2x in the name of font files.
|
165 |
-
$font = str_replace( array(
|
166 |
-
|
167 |
-
$font_size = rand($min_size, $max_size);
|
168 |
-
|
169 |
-
$angle = rand(-15, 15);
|
170 |
-
|
171 |
-
if (function_exists(
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
header("Content-type: image/png");
|
197 |
-
imagepng($image);
|
198 |
-
imagedestroy ($image);
|
199 |
-
exit;
|
4 |
http://www.codepeople.net
|
5 |
*/
|
6 |
|
7 |
+
if ( ! defined( 'WP_DEBUG' ) || true != WP_DEBUG ) {
|
8 |
+
error_reporting( E_ERROR | E_PARSE );
|
|
|
9 |
}
|
10 |
|
11 |
+
if ( ! ini_get( 'zlib.output_compression' ) ) {
|
12 |
+
ob_clean();
|
13 |
+
}
|
14 |
|
15 |
+
if ( ! function_exists( 'cff_captcha_sanitize_key' ) ) {
|
|
|
16 |
function cff_captcha_sanitize_key( $key ) {
|
17 |
+
$key = strtolower( $key );
|
18 |
+
$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );
|
19 |
+
return $key;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
if ( ! function_exists( 'sanitize_text_field' ) ) {
|
24 |
+
function sanitize_text_field( $v ) {
|
25 |
+
return strip_tags( $v );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
if ( ! function_exists( 'wp_unslash' ) ) {
|
30 |
+
function wp_unslash( $v ) {
|
31 |
+
return stripcslashes( $v );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! class_exists( 'CP_SESSION' ) && session_id() == '' ) {
|
36 |
+
session_start();
|
37 |
+
}
|
38 |
+
|
39 |
+
$_ps = isset( $_GET['ps'] ) ? cff_captcha_sanitize_key( sanitize_text_field( wp_unslash( $_GET['ps'] ) ) ) : '';
|
40 |
+
|
41 |
+
if ( isset( $_GET['hdwtest'] ) && 'sessiontest' == $_GET['hdwtest'] ) {
|
42 |
+
if ( ! isset( $_GET['autocall'] ) || 1 != $_GET['autocall'] ) {
|
43 |
+
if ( class_exists( 'CP_SESSION' ) ) {
|
44 |
+
CP_SESSION::set_var( 'tmpvar', 'ok' );
|
45 |
+
} else {
|
46 |
+
$_SESSION['tmpvar'] = 'ok';
|
47 |
+
}
|
48 |
+
} else {
|
49 |
+
if (
|
50 |
+
( class_exists( 'CP_SESSION' ) && CP_SESSION::get_var( 'tmpvar' ) != 'ok' ) ||
|
51 |
+
( ! class_exists( 'CP_SESSION' ) && empty( $_SESSION['tmpvar'] ) )
|
52 |
+
) {
|
53 |
+
die( 'Session Error' );
|
54 |
+
} else {
|
55 |
+
die( 'Sessions works on your server!' );
|
56 |
+
}
|
57 |
}
|
58 |
+
|
59 |
+
$current_url = ( ! empty( $_SERVER['REQUEST_URI'] ) ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ( ! empty( $_SERVER['PATH_INFO'] ) ? sanitize_text_field( wp_unslash( $_SERVER['PATH_INFO'] ) ) : '' );
|
60 |
+
$current_url .= ( ( strpos( $current_url, '?' ) === false ) ? '?' : '&' ) . 'hdwtest=sessiontest&autocall=1';
|
61 |
+
header( 'Location: ' . $current_url );
|
62 |
+
exit;
|
63 |
+
}
|
64 |
+
|
65 |
+
// configuration
|
66 |
+
$imgX = ( ! empty( $_GET['width'] ) && is_numeric( $_GET['width'] ) ) ? intval( $_GET['width'] ) : 180;
|
67 |
+
$imgY = ( ! empty( $_GET['height'] ) && is_numeric( $_GET['height'] ) ) ? intval( $_GET['height'] ) : 60;
|
68 |
+
|
69 |
+
$letter_count = ( ! empty( $_GET['letter_count'] ) && is_numeric( $_GET['letter_count'] ) ) ? intval( $_GET['letter_count'] ) : 5;
|
70 |
+
$min_size = ( ! empty( $_GET['min_size'] ) && is_numeric( $_GET['min_size'] ) ) ? floatval( $_GET['min_size'] ) : 35;
|
71 |
+
$max_size = ( ! empty( $_GET['max_size'] ) && is_numeric( $_GET['max_size'] ) ) ? floatval( $_GET['max_size'] ) : 45;
|
72 |
+
$noise = ( ! empty( $_GET['noise'] ) && is_numeric( $_GET['noise'] ) ) ? intval( $_GET['noise'] ) : 200;
|
73 |
+
$noiselength = ( ! empty( $_GET['noiselength'] ) && is_numeric( $_GET['noiselength'] ) ) ? intval( $_GET['noiselength'] ) : 5;
|
74 |
+
$bcolor = cpcff_decodeColor( ! empty( $_GET['bcolor'] ) ? sanitize_text_field( wp_unslash( $_GET['bcolor'] ) ) : 'FFFFFF' );
|
75 |
+
$border = cpcff_decodeColor( ! empty( $_GET['border'] ) ? sanitize_text_field( wp_unslash( $_GET['border'] ) ) : '000000' );
|
76 |
+
|
77 |
+
$noisecolor = 0xcdcdcd;
|
78 |
+
$random_noise_color = true;
|
79 |
+
$tcolor = cpcff_decodeColor( '666666' );
|
80 |
+
$random_text_color = true;
|
81 |
+
|
82 |
+
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
|
83 |
+
header( 'Pragma: no-cache' );
|
84 |
+
|
85 |
+
function cpcff_decodeColor( $hexcolor ) {
|
86 |
+
$color = hexdec( $hexcolor );
|
87 |
+
$c['b'] = $color % 256;
|
88 |
+
$color = $color / 256;
|
89 |
+
$c['g'] = $color % 256;
|
90 |
+
$color = $color / 256;
|
91 |
+
$c['r'] = $color % 256;
|
92 |
+
return $c;
|
93 |
}
|
94 |
|
95 |
+
function cpcff_similarColors( $c1, $c2 ) {
|
96 |
+
return sqrt( pow( $c1['r'] - $c2['r'], 2 ) + pow( $c1['g'] - $c2['g'], 2 ) + pow( $c1['b'] - $c2['b'], 2 ) ) < 125;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
function cpcff_make_seed() {
|
100 |
+
list($usec, $sec) = explode( ' ', microtime() );
|
101 |
+
return (float) $sec + ( (float) $usec * 100000 );
|
102 |
}
|
103 |
+
mt_srand( cpcff_make_seed() );
|
104 |
$randval = mt_rand();
|
105 |
|
106 |
+
$str = '';
|
107 |
$length = 0;
|
108 |
+
for ( $i = 0; $i < $letter_count; $i++ ) {
|
109 |
+
$str .= chr( mt_rand( 97, 122 ) ) . ' ';
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( class_exists( 'CP_SESSION' ) ) {
|
113 |
+
CP_SESSION::set_var( 'rand_code' . $_ps, str_replace( ' ', '', $str ) );
|
114 |
+
} else {
|
115 |
+
$_SESSION[ 'rand_code' . $_ps ] = str_replace( ' ', '', $str );
|
116 |
+
}
|
117 |
+
|
118 |
+
$image = imagecreatetruecolor( $imgX, $imgY );
|
119 |
+
$backgr_col = imagecolorallocate( $image, $bcolor['r'], $bcolor['g'], $bcolor['b'] );
|
120 |
+
$border_col = imagecolorallocate( $image, $border['r'], $border['g'], $border['b'] );
|
121 |
+
|
122 |
+
if ( $random_text_color ) {
|
123 |
+
do {
|
124 |
+
$selcolor = mt_rand( 0, 256 * 256 * 256 );
|
125 |
+
} while ( cpcff_similarColors( cpcff_decodeColor( $selcolor ), $bcolor ) );
|
126 |
+
$tcolor = cpcff_decodeColor( $selcolor );
|
127 |
+
}
|
128 |
+
|
129 |
+
$text_col = imagecolorallocate( $image, $tcolor['r'], $tcolor['g'], $tcolor['b'] );
|
130 |
+
|
131 |
+
imagefilledrectangle( $image, 0, 0, $imgX, $imgY, $backgr_col );
|
132 |
+
imagerectangle( $image, 0, 0, $imgX - 1, $imgY - 1, $border_col );
|
133 |
+
for ( $i = 0;$i < $noise;$i++ ) {
|
134 |
+
if ( $random_noise_color ) {
|
135 |
+
$color = mt_rand( 0, 256 * 256 * 256 );
|
136 |
+
} else {
|
137 |
+
$color = $noisecolor;
|
138 |
+
}
|
139 |
+
$x1 = mt_rand( 2, $imgX - 2 );
|
140 |
+
$y1 = mt_rand( 2, $imgY - 2 );
|
141 |
+
imageline( $image, $x1, $y1, mt_rand( $x1 - $noiselength, $x1 + $noiselength ), mt_rand( $y1 - $noiselength, $y1 + $noiselength ), $color );
|
142 |
+
}
|
143 |
+
|
144 |
+
$selected_font = 'font-1.ttf';
|
145 |
+
if ( isset( $_GET['font'] ) ) {
|
146 |
+
switch ( $_GET['font'] ) {
|
147 |
+
case 'font-2.ttf':
|
148 |
+
$selected_font = 'font-2.ttf';
|
149 |
+
break;
|
150 |
+
case 'font-3.ttf':
|
151 |
+
$selected_font = 'font-3.ttf';
|
152 |
+
break;
|
153 |
+
case 'font-4.ttf':
|
154 |
+
$selected_font = 'font-4.ttf';
|
155 |
+
break;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
$font = dirname( __FILE__ ) . '/' . $selected_font; // font
|
|
|
160 |
|
161 |
// Removed @2x, the patch fixes an issue caused by other plugin that includes the @2x in the name of font files.
|
162 |
+
$font = str_replace( array( '\\', '@2x' ), array( '/', '' ), $font );
|
163 |
+
|
164 |
+
$font_size = rand( $min_size, $max_size );
|
165 |
+
|
166 |
+
$angle = rand( -15, 15 );
|
167 |
+
|
168 |
+
if ( function_exists( 'imagettfbbox' ) && function_exists( 'imagettftext' ) ) {
|
169 |
+
$box = imagettfbbox( $font_size, $angle, $font, $str );
|
170 |
+
$x = (int) ( $imgX - $box[4] ) / 2;
|
171 |
+
$y = (int) ( $imgY - $box[5] ) / 2;
|
172 |
+
imagettftext( $image, $font_size, $angle, $x, $y, $text_col, $font, $str );
|
173 |
+
} elseif ( function_exists( 'imageFtBBox' ) && function_exists( 'imageFTText' ) ) {
|
174 |
+
$box = imageFtBBox( $font_size, $angle, $font, $str );
|
175 |
+
$x = (int) ( $imgX - $box[4] ) / 2;
|
176 |
+
$y = (int) ( $imgY - $box[5] ) / 2;
|
177 |
+
imageFTText( $image, $font_size, $angle, $x, $y, $text_col, $font, $str );
|
178 |
+
} else {
|
179 |
+
$angle = 0;
|
180 |
+
$font = 6;
|
181 |
+
$wf = ImageFontWidth( 6 ) * strlen( $str );
|
182 |
+
$hf = ImageFontHeight( 6 );
|
183 |
+
$x = (int) ( $imgX - $wf ) / 2;
|
184 |
+
$y = (int) ( $imgY - $hf ) / 2;
|
185 |
+
imagestring( $image, $font, $x, $y, $str, $text_col );
|
186 |
+
}
|
187 |
+
|
188 |
+
header( 'Content-type: image/png' );
|
189 |
+
imagepng( $image );
|
190 |
+
imagedestroy( $image );
|
191 |
+
exit;
|
|
|
|
|
|
|
|
|
|
changelog.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
== Changelog ==
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
= 1.1.110 =
|
4 |
|
5 |
* Fixes a minor issue with Upload File and Summary fields settigns.
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 1.1.111 =
|
4 |
+
|
5 |
+
* Improves the plugin code.
|
6 |
+
* Includes additional forms to the forms library.
|
7 |
+
|
8 |
= 1.1.110 =
|
9 |
|
10 |
* Fixes a minor issue with Upload File and Summary fields settigns.
|
config/cpcff_config.cfg.php
CHANGED
@@ -1,179 +1,178 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Defines the plugin's constants and global variables
|
4 |
-
*/
|
5 |
-
|
6 |
-
// Calculated Fields Form constants and global variables
|
7 |
-
define('CP_CFF_PHPVERSION', phpversion());
|
8 |
-
define('CP_SCHEME', ( is_ssl() ) ? 'https://' : 'http://' );
|
9 |
-
$GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'] = (get_option('CP_CFF_LOAD_SCRIPTS',
|
10 |
-
define('CP_CALCULATEDFIELDSF_USE_CACHE', 1 );
|
11 |
-
define('CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', 0 );
|
12 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_use_validation', 'true');
|
13 |
-
define('CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN', 1);
|
14 |
-
|
15 |
-
// Forms access:
|
16 |
-
define('CP_CALCULATEDFIELDSF_AMP', 1 );
|
17 |
-
define('CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', 1 );
|
18 |
-
|
19 |
-
// Thank you page cache control
|
20 |
-
define('CP_CALCULATEDFIELDSF_TYPC', 1 );
|
21 |
-
|
22 |
-
// Admin pages
|
23 |
-
define('CP_CALCULATED_FIELDS_SETTINGS_PAGE',
|
24 |
-
define('CP_CALCULATED_FIELDS_SETTINGS_PAGE2', 'cp_calculated_fields_form_sub2');
|
25 |
-
define('CP_CALCULATED_FIELDS_SETTINGS_PAGE3', 'cp_calculated_fields_form_sub3');
|
26 |
-
|
27 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_template', get_option('CP_CALCULATEDFIELDSF_DEFAULT_template','cp_cff_13'));
|
28 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_display_submit_button', get_option('CP_CALCULATEDFIELDSF_DEFAULT_display_submit_button',''));
|
29 |
-
|
30 |
-
// Default forms
|
31 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_form_structure', '[[{"name":"fieldname2","index":0,"title":"Number","predefined":"5","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"medium","min":"","max":"","dformat":"digits","formats":["digits","number"]},{"name":"separator1","index":1,"title":"The field below will show the double of the number above.","userhelp":"","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname1","index":2,"title":"Calculated Value","eq":"fieldname2*2","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":true}],[{"title":"Calculated Form","description":"Starting form. Basic calculated fields sample. ","formlayout":"top_aligned", "formtemplate": "'.esc_js(CP_CALCULATEDFIELDSF_DEFAULT_template).'"}]]');
|
32 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_form_structure1', '[[{"name":"fieldname5","index":0,"title":"Simple Sum of two numbers","userhelp":"","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname2","index":1,"title":"First Number","userhelp":"","dformat":"number","min":"","max":"","predefined":"3","ftype":"fnumber","csslayout":"","required":false,"size":"small","formats":["digits","number"]},{"name":"fieldname6","index":2,"title":"Second Number","predefined":"2","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"small","min":"","max":"","dformat":"digits","formats":["digits","number"]},{"name":"fieldname4","index":3,"readonly":true,"title":"Sum","predefined":"","userhelp":"Note: Sum of First Number + Second Number","eq":"fieldname2+fieldname6","ftype":"fCalculated","csslayout":"","required":false,"size":"medium"},{"name":"fieldname7","index":4,"title":"Sum of selected fields","userhelp":"","ftype":"fSectionBreak","csslayout":""},{"choices":["Item A: $10","Item B: $20","Item C: $40"],"choiceSelected":[true,true,false],"name":"fieldname8","index":5,"title":"Select/un-select some items","ftype":"fcheck","userhelp":"","csslayout":"","layout":"one_column","required":false},{"name":"fieldname9","index":6,"title":"Sum of selected items","eq":"fieldname8","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Simple Operations","description":"Below you can test two simple and frequent operations.","formlayout":"top_aligned", "formtemplate": "'.esc_js(CP_CALCULATEDFIELDSF_DEFAULT_template).'"}]]');
|
33 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_form_structure2', '[[{"name":"fieldname1","index":0,"title":"Check-in","ftype":"fdate","userhelp":"","csslayout":"","predefined":"","size":"medium","required":false,"dformat":"mm/dd/yyyy","showDropdown":false,"dropdownRange":"-10:+10","formats":["mm/dd/yyyy","dd/mm/yyyy"]},{"name":"fieldname2","index":1,"title":"Check-out","ftype":"fdate","userhelp":"","csslayout":"","predefined":"","size":"medium","required":false,"dformat":"mm/dd/yyyy","showDropdown":false,"dropdownRange":"-10:+10","formats":["mm/dd/yyyy","dd/mm/yyyy"]},{"choices":["Parking - $10","Breakfast - $20","Premium Internet Access - $3"],"choiceSelected":[false,false,false],"name":"fieldname3","index":2,"title":"Optional Services","ftype":"fcheck","userhelp":"","csslayout":"","layout":"one_column","required":false,"choicesVal":["10","20","3"]},{"name":"fieldname4","index":3,"title":"","userhelp":"Note: The cost of the optional services are per each night.","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname5","index":4,"title":"Total Cost","eq":"abs(fieldname2-fieldname1) * (fieldname3+50)","userhelp":"The formula is: (checkout - checkin) * (optionals + base rate)<br />Without the optional services the formula would be: (checkout-checkin) * base rate","ftype":"fCalculated","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Calculation with Dates","description":"The form below gives a quote for a stay in a hotel based in the check-in date, check-out date and some optional services. The base rate used is $50 per night.","formlayout":"top_aligned", "formtemplate": "'.esc_js(CP_CALCULATEDFIELDSF_DEFAULT_template).'"}]]');
|
34 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_form_structure3', '[[{"name":"fieldname2","index":0,"title":"Height","userhelp":"In centimeters","dformat":"number","min":"30","max":"250","predefined":"180","ftype":"fnumber","csslayout":"","required":false,"size":"small","formats":["digits","number"]},{"choices":["Male","Female"],"name":"fieldname3","index":1,"choiceSelected":"Male","title":"Sex","ftype":"fdropdown","userhelp":"","csslayout":"","size":"medium","required":false},{"name":"fieldname5","index":2,"title":"Ideal Weight","userhelp":"Formula used:<br />Men: (height - 100)*0.90<br />Woman: (height - 100)*0.85","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname4","index":3,"readonly":true,"title":"Ideal Weight","predefined":"","userhelp":"Note: Based in the above data and formula","eq":"(fieldname2-100)*(fieldname3==\'Male\'?0.90:0.85)","ftype":"fCalculated","csslayout":"","required":false,"size":"medium"}],[{"title":"Ideal Weight Calculator","description":"This sample uses a simple formula but with a conditional rule (if male or female). The conditional expression is built using the JavaScript ternary operator. It\'s basically as follows: <em>condition ? value_if_true : value_if_false</em>.","formlayout":"top_aligned", "formtemplate": "'.esc_js(CP_CALCULATEDFIELDSF_DEFAULT_template).'"}]]');
|
35 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_form_structure4', '[[{"name":"fieldname1","index":0,"title":"Enter the first day of last menstrual period","ftype":"fdate","userhelp":"","csslayout":"","predefined":"01/01/2013","size":"medium","required":false,"dformat":"mm/dd/yyyy","showDropdown":false,"dropdownRange":"-10:+10","formats":["mm/dd/yyyy","dd/mm/yyyy"]},{"name":"fieldname4","index":1,"title":"","userhelp":"Note: The dates below are approximate calculations. The real date may be slightly different.","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname5","index":2,"title":"Conception Date","eq":"cdate(fieldname1+14)","userhelp":"","ftype":"fCalculated","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false},{"name":"fieldname6","index":3,"title":"Due Date","eq":"cdate(fieldname1+40*7)","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Pregnancy Calculator","description":"The form below calculates the conception date and due date based in the first day of last menstrual period. The calculated values are converted to date again after the calculation.","formlayout":"top_aligned", "formtemplate": "'.esc_js(CP_CALCULATEDFIELDSF_DEFAULT_template).'"}]]');
|
36 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_form_structure5', '[[{"name":"fieldname2","index":0,"title":"Loan Amount","userhelp":"","dformat":"number","min":"","max":"","predefined":"20000","ftype":"fnumber","csslayout":"","required":false,"size":"small","formats":["digits","number"]},{"name":"fieldname6","index":1,"title":"Residual Value","userhelp":"","predefined":"10000","ftype":"fnumber","csslayout":"","required":false,"size":"small","min":"","max":"","dformat":"number","formats":["digits","number"]},{"name":"fieldname7","index":2,"predefined":"7.5","title":"Interest Rate %","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"small","min":"","max":"","dformat":"number","formats":["digits","number"]},{"name":"fieldname8","index":3,"title":"Number of Months","dformat":"number","predefined":"36","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"small","min":"","max":"","formats":["digits","number"]},{"name":"fieldname5","index":4,"title":"","userhelp":"Results based in the data entered above:","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname4","index":5,"readonly":true,"title":"Monthly Payment","predefined":"","userhelp":"","eq":"prec((fieldname2*fieldname7/1200*pow(1+fieldname7/1200,fieldname8)-fieldname6*fieldname7/1200)/(pow(1+fieldname7/1200,fieldname8)-1),2)","ftype":"fCalculated","csslayout":"","required":false,"size":"medium","dformat":"number"},{"name":"fieldname9","index":6,"title":"Total Payment","readonly":true,"eq":"prec(fieldname4*fieldname8,2)","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium"},{"name":"fieldname10","index":7,"title":"Interest Amount","eq":"prec(fieldname6+fieldname9-fieldname2,2)","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Lease Calculator","description":"This sample uses a more complex formula for a lease calculator. It includes the \"power\" (pow) and \"precision\" (prec) functions.","formlayout":"top_aligned", "formtemplate": "'.esc_js(CP_CALCULATEDFIELDSF_DEFAULT_template).'"}]]');
|
37 |
-
|
38 |
-
// Email constants
|
39 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_fp_subject', 'Contact from the blog...');
|
40 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_fp_inc_additional_info', 'true');
|
41 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_fp_return_page', CPCFF_AUXILIARY::site_url().'/' );
|
42 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_fp_message', "The following contact message has been sent:\n\n<%INFO%>\n\n");
|
43 |
-
|
44 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cu_enable_copy_to_user', 'true');
|
45 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cu_user_email_field', '');
|
46 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cu_subject', 'Confirmation: Message received...');
|
47 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cu_message', "Thank you for your message. We will reply you as soon as possible.\n\nThis is a copy of the data sent:\n\n<%INFO%>\n\nBest Regards.");
|
48 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_email_format','text');
|
49 |
-
|
50 |
-
// Captcha constants
|
51 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha', get_option('CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha','true'));
|
52 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_width', '180');
|
53 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_height', '60');
|
54 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_chars', '5');
|
55 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_font', 'font-1.ttf');
|
56 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size', '25');
|
57 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size', '35');
|
58 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_noise', '200');
|
59 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length', '4');
|
60 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_background', 'ffffff');
|
61 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_border', '000000');
|
62 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha', 'Please enter a valid captcha code.');
|
63 |
-
|
64 |
-
// Payments contstants
|
65 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY_SYMBOL','$');
|
66 |
-
define('CP_CALCULATEDFIELDSF_GBP_CURRENCY_SYMBOL',chr(163));
|
67 |
-
define('CP_CALCULATEDFIELDSF_EUR_CURRENCY_SYMBOL_A','EUR ');
|
68 |
-
define('CP_CALCULATEDFIELDSF_EUR_CURRENCY_SYMBOL_B',chr(128));
|
69 |
-
|
70 |
-
// PayPal constants
|
71 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_ENABLE_PAYPAL', 1);
|
72 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE', 'production');
|
73 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT', '0');
|
74 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_IDENTIFY_PRICES', '0');
|
75 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT', '0');
|
76 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_EMAIL','put_your@email_here.com');
|
77 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PRODUCT_NAME','Reservation');
|
78 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_COST','25');
|
79 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY','USD');
|
80 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE','EN');
|
81 |
-
|
82 |
-
// Database table names
|
83 |
-
global $wpdb;
|
84 |
-
define('CP_CALCULATEDFIELDSF_FORMS_TABLE', 'cp_calculated_fields_form_settings');
|
85 |
-
define('CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE', 'cp_calculated_fields_form_revision');
|
86 |
-
define('CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX',
|
87 |
-
define('CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME', @$wpdb->prefix .
|
88 |
-
define('CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX',
|
89 |
-
define('CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME', @$wpdb->prefix .
|
90 |
-
|
91 |
-
// Default texts constants and global variables
|
92 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required', 'This field is required.');
|
93 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email', 'Please enter a valid email address.');
|
94 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy', 'Please enter a valid date with this format(mm/dd/yyyy)');
|
95 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy', 'Please enter a valid date with this format(dd/mm/yyyy)');
|
96 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number', 'Please enter a valid number.');
|
97 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits', 'Please enter only digits.');
|
98 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max', 'Please enter a value less than or equal to {0}.');
|
99 |
-
define('CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min', 'Please enter a value greater than or equal to {0}.');
|
100 |
-
|
101 |
-
global $cpcff_default_texts_array;
|
102 |
-
$cpcff_default_texts_array = array(
|
103 |
-
'page_of_text'
|
104 |
-
'label' => 'Page X of Y (text)',
|
105 |
-
'text'
|
106 |
-
),
|
107 |
-
'audio_tutorial_text' => array(
|
108 |
-
'label' => 'Audio tutorial (text)',
|
109 |
-
'text'
|
110 |
-
),
|
111 |
-
'errors'
|
112 |
-
'currency'
|
113 |
-
'label' => '"Invalid Currency" text',
|
114 |
-
'text'
|
115 |
-
),
|
116 |
-
'maxlength'
|
117 |
-
'label' => '"Max length/characters" text',
|
118 |
-
'text'
|
119 |
-
),
|
120 |
-
'minlength'
|
121 |
-
'label' => '"Min length/characters" text',
|
122 |
-
'text'
|
123 |
-
),
|
124 |
-
'equalTo'
|
125 |
-
'label' => '"Equal to" text',
|
126 |
-
'text'
|
127 |
-
),
|
128 |
-
'accept'
|
129 |
-
'label' => '"Accept these file extensions" text',
|
130 |
-
'text'
|
131 |
-
),
|
132 |
-
'upload_size' => array(
|
133 |
-
'label' => '"Maximum upload size in kB" text',
|
134 |
-
'text'
|
135 |
-
),
|
136 |
-
'phone'
|
137 |
-
'label' => '"Phone number" text',
|
138 |
-
'text'
|
139 |
-
)
|
140 |
-
)
|
141 |
-
);
|
142 |
-
|
143 |
-
add_action('init', 'cpcff_init_constants', 1);
|
144 |
-
if(!function_exists('cpcff_init_constants'))
|
145 |
-
{
|
146 |
-
|
147 |
-
|
148 |
-
$
|
149 |
-
$
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Defines the plugin's constants and global variables
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Calculated Fields Form constants and global variables
|
7 |
+
define( 'CP_CFF_PHPVERSION', phpversion() );
|
8 |
+
define( 'CP_SCHEME', ( is_ssl() ) ? 'https://' : 'http://' );
|
9 |
+
$GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'] = ( get_option( 'CP_CFF_LOAD_SCRIPTS', '1' ) == '1' ? true : false );
|
10 |
+
define( 'CP_CALCULATEDFIELDSF_USE_CACHE', 1 );
|
11 |
+
define( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', 0 );
|
12 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_use_validation', 'true' );
|
13 |
+
define( 'CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN', 1 );
|
14 |
+
|
15 |
+
// Forms access:
|
16 |
+
define( 'CP_CALCULATEDFIELDSF_AMP', 1 );
|
17 |
+
define( 'CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', 1 );
|
18 |
+
|
19 |
+
// Thank you page cache control
|
20 |
+
define( 'CP_CALCULATEDFIELDSF_TYPC', 1 );
|
21 |
+
|
22 |
+
// Admin pages
|
23 |
+
define( 'CP_CALCULATED_FIELDS_SETTINGS_PAGE', 'cp_calculated_fields_form' );
|
24 |
+
define( 'CP_CALCULATED_FIELDS_SETTINGS_PAGE2', 'cp_calculated_fields_form_sub2' );
|
25 |
+
define( 'CP_CALCULATED_FIELDS_SETTINGS_PAGE3', 'cp_calculated_fields_form_sub3' );
|
26 |
+
|
27 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_template', get_option( 'CP_CALCULATEDFIELDSF_DEFAULT_template', 'cp_cff_13' ) );
|
28 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_display_submit_button', get_option( 'CP_CALCULATEDFIELDSF_DEFAULT_display_submit_button', '' ) );
|
29 |
+
|
30 |
+
// Default forms
|
31 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_form_structure', '[[{"name":"fieldname2","index":0,"title":"Number","predefined":"5","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"medium","min":"","max":"","dformat":"digits","formats":["digits","number"]},{"name":"separator1","index":1,"title":"The field below will show the double of the number above.","userhelp":"","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname1","index":2,"title":"Calculated Value","eq":"fieldname2*2","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":true}],[{"title":"Calculated Form","description":"Starting form. Basic calculated fields sample. ","formlayout":"top_aligned", "formtemplate": "' . esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ) . '"}]]' );
|
32 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_form_structure1', '[[{"name":"fieldname5","index":0,"title":"Simple Sum of two numbers","userhelp":"","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname2","index":1,"title":"First Number","userhelp":"","dformat":"number","min":"","max":"","predefined":"3","ftype":"fnumber","csslayout":"","required":false,"size":"small","formats":["digits","number"]},{"name":"fieldname6","index":2,"title":"Second Number","predefined":"2","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"small","min":"","max":"","dformat":"digits","formats":["digits","number"]},{"name":"fieldname4","index":3,"readonly":true,"title":"Sum","predefined":"","userhelp":"Note: Sum of First Number + Second Number","eq":"fieldname2+fieldname6","ftype":"fCalculated","csslayout":"","required":false,"size":"medium"},{"name":"fieldname7","index":4,"title":"Sum of selected fields","userhelp":"","ftype":"fSectionBreak","csslayout":""},{"choices":["Item A: $10","Item B: $20","Item C: $40"],"choiceSelected":[true,true,false],"name":"fieldname8","index":5,"title":"Select/un-select some items","ftype":"fcheck","userhelp":"","csslayout":"","layout":"one_column","required":false},{"name":"fieldname9","index":6,"title":"Sum of selected items","eq":"fieldname8","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Simple Operations","description":"Below you can test two simple and frequent operations.","formlayout":"top_aligned", "formtemplate": "' . esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ) . '"}]]' );
|
33 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_form_structure2', '[[{"name":"fieldname1","index":0,"title":"Check-in","ftype":"fdate","userhelp":"","csslayout":"","predefined":"","size":"medium","required":false,"dformat":"mm/dd/yyyy","showDropdown":false,"dropdownRange":"-10:+10","formats":["mm/dd/yyyy","dd/mm/yyyy"]},{"name":"fieldname2","index":1,"title":"Check-out","ftype":"fdate","userhelp":"","csslayout":"","predefined":"","size":"medium","required":false,"dformat":"mm/dd/yyyy","showDropdown":false,"dropdownRange":"-10:+10","formats":["mm/dd/yyyy","dd/mm/yyyy"]},{"choices":["Parking - $10","Breakfast - $20","Premium Internet Access - $3"],"choiceSelected":[false,false,false],"name":"fieldname3","index":2,"title":"Optional Services","ftype":"fcheck","userhelp":"","csslayout":"","layout":"one_column","required":false,"choicesVal":["10","20","3"]},{"name":"fieldname4","index":3,"title":"","userhelp":"Note: The cost of the optional services are per each night.","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname5","index":4,"title":"Total Cost","eq":"abs(fieldname2-fieldname1) * (fieldname3+50)","userhelp":"The formula is: (checkout - checkin) * (optionals + base rate)<br />Without the optional services the formula would be: (checkout-checkin) * base rate","ftype":"fCalculated","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Calculation with Dates","description":"The form below gives a quote for a stay in a hotel based in the check-in date, check-out date and some optional services. The base rate used is $50 per night.","formlayout":"top_aligned", "formtemplate": "' . esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ) . '"}]]' );
|
34 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_form_structure3', '[[{"name":"fieldname2","index":0,"title":"Height","userhelp":"In centimeters","dformat":"number","min":"30","max":"250","predefined":"180","ftype":"fnumber","csslayout":"","required":false,"size":"small","formats":["digits","number"]},{"choices":["Male","Female"],"name":"fieldname3","index":1,"choiceSelected":"Male","title":"Sex","ftype":"fdropdown","userhelp":"","csslayout":"","size":"medium","required":false},{"name":"fieldname5","index":2,"title":"Ideal Weight","userhelp":"Formula used:<br />Men: (height - 100)*0.90<br />Woman: (height - 100)*0.85","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname4","index":3,"readonly":true,"title":"Ideal Weight","predefined":"","userhelp":"Note: Based in the above data and formula","eq":"(fieldname2-100)*(fieldname3==\'Male\'?0.90:0.85)","ftype":"fCalculated","csslayout":"","required":false,"size":"medium"}],[{"title":"Ideal Weight Calculator","description":"This sample uses a simple formula but with a conditional rule (if male or female). The conditional expression is built using the JavaScript ternary operator. It\'s basically as follows: <em>condition ? value_if_true : value_if_false</em>.","formlayout":"top_aligned", "formtemplate": "' . esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ) . '"}]]' );
|
35 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_form_structure4', '[[{"name":"fieldname1","index":0,"title":"Enter the first day of last menstrual period","ftype":"fdate","userhelp":"","csslayout":"","predefined":"01/01/2013","size":"medium","required":false,"dformat":"mm/dd/yyyy","showDropdown":false,"dropdownRange":"-10:+10","formats":["mm/dd/yyyy","dd/mm/yyyy"]},{"name":"fieldname4","index":1,"title":"","userhelp":"Note: The dates below are approximate calculations. The real date may be slightly different.","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname5","index":2,"title":"Conception Date","eq":"cdate(fieldname1+14)","userhelp":"","ftype":"fCalculated","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false},{"name":"fieldname6","index":3,"title":"Due Date","eq":"cdate(fieldname1+40*7)","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Pregnancy Calculator","description":"The form below calculates the conception date and due date based in the first day of last menstrual period. The calculated values are converted to date again after the calculation.","formlayout":"top_aligned", "formtemplate": "' . esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ) . '"}]]' );
|
36 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_form_structure5', '[[{"name":"fieldname2","index":0,"title":"Loan Amount","userhelp":"","dformat":"number","min":"","max":"","predefined":"20000","ftype":"fnumber","csslayout":"","required":false,"size":"small","formats":["digits","number"]},{"name":"fieldname6","index":1,"title":"Residual Value","userhelp":"","predefined":"10000","ftype":"fnumber","csslayout":"","required":false,"size":"small","min":"","max":"","dformat":"number","formats":["digits","number"]},{"name":"fieldname7","index":2,"predefined":"7.5","title":"Interest Rate %","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"small","min":"","max":"","dformat":"number","formats":["digits","number"]},{"name":"fieldname8","index":3,"title":"Number of Months","dformat":"number","predefined":"36","ftype":"fnumber","userhelp":"","csslayout":"","required":false,"size":"small","min":"","max":"","formats":["digits","number"]},{"name":"fieldname5","index":4,"title":"","userhelp":"Results based in the data entered above:","ftype":"fSectionBreak","csslayout":""},{"name":"fieldname4","index":5,"readonly":true,"title":"Monthly Payment","predefined":"","userhelp":"","eq":"prec((fieldname2*fieldname7/1200*pow(1+fieldname7/1200,fieldname8)-fieldname6*fieldname7/1200)/(pow(1+fieldname7/1200,fieldname8)-1),2)","ftype":"fCalculated","csslayout":"","required":false,"size":"medium","dformat":"number"},{"name":"fieldname9","index":6,"title":"Total Payment","readonly":true,"eq":"prec(fieldname4*fieldname8,2)","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium"},{"name":"fieldname10","index":7,"title":"Interest Amount","eq":"prec(fieldname6+fieldname9-fieldname2,2)","ftype":"fCalculated","userhelp":"","csslayout":"","predefined":"","required":false,"size":"medium","readonly":false}],[{"title":"Lease Calculator","description":"This sample uses a more complex formula for a lease calculator. It includes the \"power\" (pow) and \"precision\" (prec) functions.","formlayout":"top_aligned", "formtemplate": "' . esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ) . '"}]]' );
|
37 |
+
|
38 |
+
// Email constants
|
39 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_subject', 'Contact from the blog...' );
|
40 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_inc_additional_info', 'true' );
|
41 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_return_page', CPCFF_AUXILIARY::site_url() . '/' );
|
42 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_message', "The following contact message has been sent:\n\n<%INFO%>\n\n" );
|
43 |
+
|
44 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cu_enable_copy_to_user', 'true' );
|
45 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cu_user_email_field', '' );
|
46 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cu_subject', 'Confirmation: Message received...' );
|
47 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cu_message', "Thank you for your message. We will reply you as soon as possible.\n\nThis is a copy of the data sent:\n\n<%INFO%>\n\nBest Regards." );
|
48 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_email_format', 'text' );
|
49 |
+
|
50 |
+
// Captcha constants
|
51 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha', get_option( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha', 'true' ) );
|
52 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_width', '180' );
|
53 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_height', '60' );
|
54 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_chars', '5' );
|
55 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_font', 'font-1.ttf' );
|
56 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size', '25' );
|
57 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size', '35' );
|
58 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_noise', '200' );
|
59 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length', '4' );
|
60 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_background', 'ffffff' );
|
61 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_border', '000000' );
|
62 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha', 'Please enter a valid captcha code.' );
|
63 |
+
|
64 |
+
// Payments contstants
|
65 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY_SYMBOL', '$' );
|
66 |
+
define( 'CP_CALCULATEDFIELDSF_GBP_CURRENCY_SYMBOL', chr( 163 ) );
|
67 |
+
define( 'CP_CALCULATEDFIELDSF_EUR_CURRENCY_SYMBOL_A', 'EUR ' );
|
68 |
+
define( 'CP_CALCULATEDFIELDSF_EUR_CURRENCY_SYMBOL_B', chr( 128 ) );
|
69 |
+
|
70 |
+
// PayPal constants
|
71 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_ENABLE_PAYPAL', 1 );
|
72 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE', 'production' );
|
73 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT', '0' );
|
74 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_IDENTIFY_PRICES', '0' );
|
75 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT', '0' );
|
76 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_EMAIL', 'put_your@email_here.com' );
|
77 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PRODUCT_NAME', 'Reservation' );
|
78 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_COST', '25' );
|
79 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY', 'USD' );
|
80 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE', 'EN' );
|
81 |
+
|
82 |
+
// Database table names
|
83 |
+
global $wpdb;
|
84 |
+
define( 'CP_CALCULATEDFIELDSF_FORMS_TABLE', 'cp_calculated_fields_form_settings' );
|
85 |
+
define( 'CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE', 'cp_calculated_fields_form_revision' );
|
86 |
+
define( 'CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX', 'cp_calculated_fields_form_discount_codes' );
|
87 |
+
define( 'CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME', @$wpdb->prefix . 'cp_calculated_fields_form_discount_codes' );
|
88 |
+
define( 'CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX', 'cp_calculated_fields_form_posts' );
|
89 |
+
define( 'CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME', @$wpdb->prefix . 'cp_calculated_fields_form_posts' );
|
90 |
+
|
91 |
+
// Default texts constants and global variables
|
92 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required', 'This field is required.' );
|
93 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email', 'Please enter a valid email address.' );
|
94 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy', 'Please enter a valid date with this format(mm/dd/yyyy)' );
|
95 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy', 'Please enter a valid date with this format(dd/mm/yyyy)' );
|
96 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number', 'Please enter a valid number.' );
|
97 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits', 'Please enter only digits.' );
|
98 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max', 'Please enter a value less than or equal to {0}.' );
|
99 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min', 'Please enter a value greater than or equal to {0}.' );
|
100 |
+
|
101 |
+
global $cpcff_default_texts_array;
|
102 |
+
$cpcff_default_texts_array = array(
|
103 |
+
'page_of_text' => array(
|
104 |
+
'label' => 'Page X of Y (text)',
|
105 |
+
'text' => 'Page {0} of {0}',
|
106 |
+
),
|
107 |
+
'audio_tutorial_text' => array(
|
108 |
+
'label' => 'Audio tutorial (text)',
|
109 |
+
'text' => 'Help',
|
110 |
+
),
|
111 |
+
'errors' => array(
|
112 |
+
'currency' => array(
|
113 |
+
'label' => '"Invalid Currency" text',
|
114 |
+
'text' => 'Please enter a valid currency value.',
|
115 |
+
),
|
116 |
+
'maxlength' => array(
|
117 |
+
'label' => '"Max length/characters" text',
|
118 |
+
'text' => 'Please enter no more than {0} characters.',
|
119 |
+
),
|
120 |
+
'minlength' => array(
|
121 |
+
'label' => '"Min length/characters" text',
|
122 |
+
'text' => 'Please enter at least {0} characters.',
|
123 |
+
),
|
124 |
+
'equalTo' => array(
|
125 |
+
'label' => '"Equal to" text',
|
126 |
+
'text' => 'Please enter the same value again.',
|
127 |
+
),
|
128 |
+
'accept' => array(
|
129 |
+
'label' => '"Accept these file extensions" text',
|
130 |
+
'text' => 'Please enter a value with a valid extension.',
|
131 |
+
),
|
132 |
+
'upload_size' => array(
|
133 |
+
'label' => '"Maximum upload size in kB" text',
|
134 |
+
'text' => 'The file you\'ve chosen is too big, maximum is {0} kB.',
|
135 |
+
),
|
136 |
+
'phone' => array(
|
137 |
+
'label' => '"Phone number" text',
|
138 |
+
'text' => 'Invalid phone number.',
|
139 |
+
),
|
140 |
+
),
|
141 |
+
);
|
142 |
+
|
143 |
+
add_action( 'init', 'cpcff_init_constants', 1 );
|
144 |
+
if ( ! function_exists( 'cpcff_init_constants' ) ) {
|
145 |
+
function cpcff_init_constants() {
|
146 |
+
$current_user_id = get_current_user_id();
|
147 |
+
$host = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
|
148 |
+
preg_match( '/[^\.\/]+(\.[^\.\/]+)?$/', $host, $matches );
|
149 |
+
$domain = ( ! empty( $matches ) ) ? $matches[0] : '';
|
150 |
+
|
151 |
+
if ( ! empty( $current_user_id ) ) {
|
152 |
+
// User emails
|
153 |
+
if ( ! defined( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email' ) ) {
|
154 |
+
$user_email = get_the_author_meta( 'user_email', $current_user_id );
|
155 |
+
if ( empty( $user_email ) || ( $pos = strpos( $user_email, $domain ) ) === false ) {
|
156 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email', 'admin@' . $domain );
|
157 |
+
} else {
|
158 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email', $user_email );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
if ( ! defined( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails' ) ) {
|
163 |
+
if ( ! isset( $user_email ) ) {
|
164 |
+
$user_email = get_the_author_meta( 'user_email', $current_user_id );
|
165 |
+
}
|
166 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails', ( ! empty( $user_email ) ) ? $user_email : CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email );
|
167 |
+
}
|
168 |
+
} else {
|
169 |
+
if ( ! defined( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email' ) ) {
|
170 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email', 'admin@' . $domain );
|
171 |
+
}
|
172 |
+
|
173 |
+
if ( ! defined( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails' ) ) {
|
174 |
+
define( 'CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails', CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email );
|
175 |
+
}
|
176 |
+
}
|
177 |
+
} // End cpcff_init_constants
|
178 |
+
}
|
|
cp_calculatedfieldsf_free.php
CHANGED
@@ -3,27 +3,26 @@
|
|
3 |
Plugin Name: Calculated Fields Form
|
4 |
Plugin URI: https://cff.dwbooster.com
|
5 |
Description: Create forms with field values calculated based in other form field values.
|
6 |
-
Version: 1.1.
|
7 |
Text Domain: calculated-fields-form
|
8 |
Author: CodePeople
|
9 |
Author URI: https://cff.dwbooster.com
|
10 |
License: GPL
|
11 |
*/
|
12 |
|
13 |
-
if(!defined('WP_DEBUG') || true != WP_DEBUG)
|
14 |
-
|
15 |
-
error_reporting(E_ERROR|E_PARSE);
|
16 |
}
|
17 |
|
18 |
// Defining main constants
|
19 |
-
define('CP_CALCULATEDFIELDSF_VERSION', '1.1.
|
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 ) );
|
23 |
|
24 |
// Feedback system
|
25 |
require_once 'feedback/cp-feedback.php';
|
26 |
-
new CP_FEEDBACK('calculated-fields-form', __FILE__, 'https://cff.dwbooster.com/contact-us');
|
27 |
|
28 |
require_once 'inc/cpcff_auxiliary.inc.php';
|
29 |
require_once 'config/cpcff_config.cfg.php';
|
@@ -40,21 +39,19 @@ add_action( 'init', 'cp_calculated_fields_form_check_posted_data', 11 );
|
|
40 |
add_action( 'init', 'cp_calculated_fields_form_direct_form_access', 1 );
|
41 |
|
42 |
// functions
|
43 |
-
|
44 |
-
function cp_calculated_fields_form_direct_form_access()
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
)
|
51 |
-
{
|
52 |
$cpcff_main = CPCFF_MAIN::instance();
|
53 |
$cpcff_main->form_preview(
|
54 |
array(
|
55 |
-
'shortcode_atts' => array('id' => @intval($_GET['cff-form'])),
|
56 |
-
'page_title'
|
57 |
-
'page'
|
58 |
)
|
59 |
);
|
60 |
}
|
@@ -62,75 +59,74 @@ function cp_calculated_fields_form_direct_form_access()
|
|
62 |
|
63 |
function cp_calculated_fields_form_check_posted_data() {
|
64 |
|
65 |
-
|
66 |
|
67 |
$cpcff_main = CPCFF_MAIN::instance();
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
isset($_POST['
|
75 |
-
|
76 |
-
|
|
|
77 |
$cpcff_main->form_preview(
|
78 |
array(
|
79 |
-
'shortcode_atts' => array('id' =>
|
80 |
-
'page_title'
|
81 |
-
'wp_die'
|
82 |
)
|
83 |
);
|
84 |
}
|
85 |
return;
|
86 |
-
|
87 |
}
|
88 |
|
89 |
-
function cp_calculatedfieldsf_save_options()
|
90 |
-
{
|
91 |
check_admin_referer( 'cff-form-settings', '_cpcff_nonce' );
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
95 |
|
96 |
$error_occur = false;
|
97 |
-
if( isset( $_POST[
|
98 |
-
|
|
|
|
|
99 |
// Remove bom characters
|
100 |
-
$
|
101 |
|
102 |
-
$form_structure_obj = CPCFF_AUXILIARY::json_decode( $
|
103 |
-
if( !empty( $form_structure_obj ) )
|
104 |
-
|
105 |
-
$form_structure_obj = CPCFF_FORM::sanitize_structure($form_structure_obj);
|
106 |
|
107 |
global $cpcff_default_texts_array;
|
108 |
$cpcff_text_array = '';
|
109 |
|
110 |
-
$
|
111 |
-
|
112 |
-
if( isset( $_POST[
|
|
|
|
|
113 |
|
114 |
$cpcff_main = CPCFF_MAIN::instance();
|
115 |
-
|
116 |
-
{
|
117 |
global $cff_structure_error;
|
118 |
-
$cff_structure_error = __('<div class="error-text">The data cannot be stored in database because has occurred an error with the database structure. Please, go to the plugins section and Deactivate/Activate the plugin to be sure the structure of database has been checked, and corrected if needed. If the issue persist, please <a href="https://cff.dwbooster.com/contact-us">contact us</a></div>', 'calculated-fields-form' );
|
119 |
}
|
120 |
-
}
|
121 |
-
else
|
122 |
-
{
|
123 |
$error_occur = true;
|
124 |
}
|
125 |
-
}
|
126 |
-
else
|
127 |
-
{
|
128 |
$error_occur = true;
|
129 |
-
|
130 |
|
131 |
-
if( $error_occur )
|
132 |
-
{
|
133 |
global $cff_structure_error;
|
134 |
-
|
135 |
}
|
136 |
-
}
|
3 |
Plugin Name: Calculated Fields Form
|
4 |
Plugin URI: https://cff.dwbooster.com
|
5 |
Description: Create forms with field values calculated based in other form field values.
|
6 |
+
Version: 1.1.111
|
7 |
Text Domain: calculated-fields-form
|
8 |
Author: CodePeople
|
9 |
Author URI: https://cff.dwbooster.com
|
10 |
License: GPL
|
11 |
*/
|
12 |
|
13 |
+
if ( ! defined( 'WP_DEBUG' ) || true != WP_DEBUG ) {
|
14 |
+
error_reporting( E_ERROR | E_PARSE );
|
|
|
15 |
}
|
16 |
|
17 |
// Defining main constants
|
18 |
+
define( 'CP_CALCULATEDFIELDSF_VERSION', '1.1.111' );
|
19 |
+
define( 'CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
|
20 |
+
define( 'CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
|
21 |
+
define( 'CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
|
22 |
|
23 |
// Feedback system
|
24 |
require_once 'feedback/cp-feedback.php';
|
25 |
+
new CP_FEEDBACK( 'calculated-fields-form', __FILE__, 'https://cff.dwbooster.com/contact-us' );
|
26 |
|
27 |
require_once 'inc/cpcff_auxiliary.inc.php';
|
28 |
require_once 'config/cpcff_config.cfg.php';
|
39 |
add_action( 'init', 'cp_calculated_fields_form_direct_form_access', 1 );
|
40 |
|
41 |
// functions
|
42 |
+
// ------------------------------------------
|
43 |
+
function cp_calculated_fields_form_direct_form_access() {
|
44 |
+
if (
|
45 |
+
get_option( 'CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS ) &&
|
46 |
+
! empty( $_GET['cff-form'] ) &&
|
47 |
+
@intval( $_GET['cff-form'] )
|
48 |
+
) {
|
|
|
|
|
49 |
$cpcff_main = CPCFF_MAIN::instance();
|
50 |
$cpcff_main->form_preview(
|
51 |
array(
|
52 |
+
'shortcode_atts' => array( 'id' => @intval( $_GET['cff-form'] ) ),
|
53 |
+
'page_title' => 'CFF',
|
54 |
+
'page' => true,
|
55 |
)
|
56 |
);
|
57 |
}
|
59 |
|
60 |
function cp_calculated_fields_form_check_posted_data() {
|
61 |
|
62 |
+
global $wpdb;
|
63 |
|
64 |
$cpcff_main = CPCFF_MAIN::instance();
|
65 |
|
66 |
+
if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cp_calculatedfieldsf_post_options'] ) && is_admin() && isset( $_POST['_cpcff_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_cpcff_nonce'] ) ), 'cff-form-settings' ) ) {
|
67 |
+
|
68 |
+
cp_calculatedfieldsf_save_options();
|
69 |
+
|
70 |
+
if (
|
71 |
+
isset( $_POST['preview'] ) &&
|
72 |
+
isset( $_POST['cp_calculatedfieldsf_id'] ) &&
|
73 |
+
is_numeric( $_POST['cp_calculatedfieldsf_id'] )
|
74 |
+
) {
|
75 |
$cpcff_main->form_preview(
|
76 |
array(
|
77 |
+
'shortcode_atts' => array( 'id' => intval( $_POST['cp_calculatedfieldsf_id'] ) ),
|
78 |
+
'page_title' => __( 'Form Preview', 'calculated-fields-form' ),
|
79 |
+
'wp_die' => 1,
|
80 |
)
|
81 |
);
|
82 |
}
|
83 |
return;
|
84 |
+
}
|
85 |
}
|
86 |
|
87 |
+
function cp_calculatedfieldsf_save_options() {
|
|
|
88 |
check_admin_referer( 'cff-form-settings', '_cpcff_nonce' );
|
89 |
+
global $wpdb;
|
90 |
+
if ( ! defined( 'CP_CALCULATEDFIELDSF_ID' ) && isset( $_POST['cp_calculatedfieldsf_id'] ) ) {
|
91 |
+
define( 'CP_CALCULATEDFIELDSF_ID', sanitize_text_field( wp_unslash( $_POST['cp_calculatedfieldsf_id'] ) ) );
|
92 |
+
}
|
93 |
|
94 |
$error_occur = false;
|
95 |
+
if ( isset( $_POST['form_structure'] ) ) {
|
96 |
+
|
97 |
+
$_cff_POST = $_POST;
|
98 |
+
|
99 |
// Remove bom characters
|
100 |
+
$_cff_POST['form_structure'] = CPCFF_AUXILIARY::clean_bom( $_cff_POST['form_structure'] ); // phpcs:ignore WordPress.Security.EscapeOutput
|
101 |
|
102 |
+
$form_structure_obj = CPCFF_AUXILIARY::json_decode( $_cff_POST['form_structure'] );
|
103 |
+
if ( ! empty( $form_structure_obj ) ) {
|
104 |
+
$form_structure_obj = CPCFF_FORM::sanitize_structure( $form_structure_obj );
|
|
|
105 |
|
106 |
global $cpcff_default_texts_array;
|
107 |
$cpcff_text_array = '';
|
108 |
|
109 |
+
$_cff_POST = CPCFF_AUXILIARY::stripcslashes_recursive( $_cff_POST );
|
110 |
+
$_POST['form_structure'] = json_encode( $form_structure_obj );
|
111 |
+
if ( isset( $_POST['cpcff_text_array'] ) ) {
|
112 |
+
$_cff_POST['vs_all_texts'] = $_cff_POST['cpcff_text_array'];
|
113 |
+
}
|
114 |
|
115 |
$cpcff_main = CPCFF_MAIN::instance();
|
116 |
+
$_cff_calculatedfieldsf_id = isset( $_cff_POST['cp_calculatedfieldsf_id'] ) && is_numeric( $_cff_POST['cp_calculatedfieldsf_id'] ) ? intval( $_cff_POST['cp_calculatedfieldsf_id'] ) : 0;
|
117 |
+
if ( $cpcff_main->get_form( $_cff_calculatedfieldsf_id )->save_settings( $_cff_POST ) === false ) {
|
118 |
global $cff_structure_error;
|
119 |
+
$cff_structure_error = __( '<div class="error-text">The data cannot be stored in database because has occurred an error with the database structure. Please, go to the plugins section and Deactivate/Activate the plugin to be sure the structure of database has been checked, and corrected if needed. If the issue persist, please <a href="https://cff.dwbooster.com/contact-us">contact us</a></div>', 'calculated-fields-form' );
|
120 |
}
|
121 |
+
} else {
|
|
|
|
|
122 |
$error_occur = true;
|
123 |
}
|
124 |
+
} else {
|
|
|
|
|
125 |
$error_occur = true;
|
126 |
+
}
|
127 |
|
128 |
+
if ( $error_occur ) {
|
|
|
129 |
global $cff_structure_error;
|
130 |
+
$cff_structure_error = __( '<div class="error-text">The data cannot be stored in database because has occurred an error with the form structure. Please, try to save the data again. If have been copied and pasted data from external text editors, the data can contain invalid characters. If the issue persist, please <a href="https://cff.dwbooster.com/contact-us">contact us</a></div>', 'calculated-fields-form' );
|
131 |
}
|
132 |
+
}
|
feedback/cp-feedback.php
CHANGED
@@ -1,97 +1,86 @@
|
|
1 |
-
<?php
|
2 |
-
if(!class_exists('CP_FEEDBACK'))
|
3 |
-
{
|
4 |
-
|
5 |
-
|
6 |
-
private $
|
7 |
-
private $
|
8 |
-
private $
|
9 |
-
private $
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
$this->
|
15 |
-
$this->
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
$
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
)
|
88 |
-
);
|
89 |
-
|
90 |
-
wp_die(); // this is required to terminate immediately and return a proper response
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
} // End feedback_action
|
95 |
-
|
96 |
-
} // End class
|
97 |
-
}
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'CP_FEEDBACK' ) ) {
|
3 |
+
class CP_FEEDBACK {
|
4 |
+
|
5 |
+
private $feedback_url = 'https://wordpress.dwbooster.com/licensesystem/debug-data.php';
|
6 |
+
private $plugin_slug;
|
7 |
+
private $plugin_file;
|
8 |
+
private $support_link;
|
9 |
+
private $full_support_link;
|
10 |
+
|
11 |
+
public function __construct( $plugin_slug, $plugin_file, $support_link ) {
|
12 |
+
$this->plugin_slug = $plugin_slug;
|
13 |
+
$this->plugin_file = $plugin_file;
|
14 |
+
$this->support_link = $support_link;
|
15 |
+
$this->full_support_link = $support_link . ( ( strpos( $support_link, '?' ) === false ) ? '?' : '&' ) . 'priority-support=yes';
|
16 |
+
|
17 |
+
// To know when the plugin was installed
|
18 |
+
if ( ! get_option( 'installed_' . $this->plugin_slug, false ) ) {
|
19 |
+
update_option( 'installed_' . $this->plugin_slug, time() );
|
20 |
+
}
|
21 |
+
// Actions and filters
|
22 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
|
23 |
+
add_action( 'wp_ajax_cp_feedback', array( $this, 'feedback_action' ) );
|
24 |
+
} // End __construct
|
25 |
+
|
26 |
+
public function enqueue_scripts( $hook ) {
|
27 |
+
if ( 'plugins.php' == $hook ) {
|
28 |
+
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
29 |
+
wp_enqueue_script( 'jquery' );
|
30 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
31 |
+
|
32 |
+
add_action( 'admin_footer', array( $this, 'feedback_interface' ) );
|
33 |
+
}
|
34 |
+
} // End insert_admin_scripts
|
35 |
+
|
36 |
+
public function feedback_interface() {
|
37 |
+
// Varibles to use into the feedback interface
|
38 |
+
$plugin_slug = $this->plugin_slug;
|
39 |
+
$support_link = $this->support_link;
|
40 |
+
$full_support_link = $this->full_support_link;
|
41 |
+
|
42 |
+
include_once dirname( $this->plugin_file ) . '/feedback/feedback.html';
|
43 |
+
} // End feedback_interface
|
44 |
+
|
45 |
+
// This function is used only if explicitly accepted (opt-in) by the user
|
46 |
+
public function feedback_action() {
|
47 |
+
if ( isset( $_POST['feedback_plugin'] ) && $_POST['feedback_plugin'] == $this->plugin_slug ) { // phpcs:ignore WordPress.Security.NonceVerification
|
48 |
+
$plugin_data = get_plugin_data( $this->plugin_file );
|
49 |
+
$plugin_version = $plugin_data['Version'];
|
50 |
+
$time = time() - get_option( 'installed_' . $this->plugin_slug, 0 );
|
51 |
+
|
52 |
+
$data = array(
|
53 |
+
'plugin' => $plugin_data['Name'],
|
54 |
+
'pluginv' => $plugin_version,
|
55 |
+
'wordpress' => get_bloginfo( 'version' ),
|
56 |
+
'itime' => $time,
|
57 |
+
'phpversion' => phpversion(),
|
58 |
+
);
|
59 |
+
|
60 |
+
foreach ( $_POST as $parameter => $value ) { // phpcs:ignore WordPress.Security.NonceVerification
|
61 |
+
$data[ $parameter ] = sanitize_text_field( wp_unslash( $value ) );
|
62 |
+
}
|
63 |
+
|
64 |
+
if ( ! isset( $_POST['cp_feedback_anonymous'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
65 |
+
$current_user = wp_get_current_user();
|
66 |
+
$data['email'] = $current_user->user_email;
|
67 |
+
$data['website'] = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
|
68 |
+
$data['url'] = get_site_url();
|
69 |
+
}
|
70 |
+
|
71 |
+
// Send data
|
72 |
+
$response = wp_remote_post(
|
73 |
+
$this->feedback_url,
|
74 |
+
array(
|
75 |
+
'body' => $data,
|
76 |
+
'sslverify' => false,
|
77 |
+
)
|
78 |
+
);
|
79 |
+
|
80 |
+
wp_die(); // this is required to terminate immediately and return a proper response
|
81 |
+
}
|
82 |
+
|
83 |
+
} // End feedback_action
|
84 |
+
|
85 |
+
} // End class
|
86 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_admin_int.inc.php
CHANGED
@@ -1,725 +1,747 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !is_admin() )
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
{
|
31 |
-
$form_obj->apply_revision($revision_id);
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cp_calculatedfieldsf_post_options'] ) )
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
$cpcff_texts_array =
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
<
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
?></h1>
|
60 |
-
<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';" class="button-secondary" />
|
61 |
-
<br /><br />
|
62 |
-
<?php $_cpcff_nonce = wp_create_nonce( 'cff-form-settings' )
|
63 |
-
<form method="post" action="" id="cpformconf" name="cpformconf" class="cff_form_builder">
|
64 |
-
<input type="hidden" name="_cpcff_nonce" value="<?php echo $_cpcff_nonce; ?>" />
|
65 |
-
<input name="cp_calculatedfieldsf_post_options" type="hidden" value="1" />
|
66 |
-
<input name="cp_calculatedfieldsf_id" type="hidden" value="<?php echo CP_CALCULATEDFIELDSF_ID; ?>" />
|
67 |
-
|
68 |
-
<div id="normal-sortables" class="meta-box-sortables">
|
69 |
-
|
70 |
-
<h2><?php
|
71 |
-
<!-- Form category -->
|
72 |
-
<div class="postbox" >
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
</div>
|
82 |
-
</div>
|
83 |
-
<hr />
|
84 |
-
<div><?php _e( '* Different form styles available on the tab Form Settings >> Form Template', 'calculated-fields-form' ); ?></div>
|
85 |
-
<div id="metabox_form_structure" class="postbox" >
|
86 |
-
<div class="hndle">
|
87 |
-
<h3 style="padding:5px;display:inline-block;"><span><?php _e( 'Form Builder', 'calculated-fields-form' ); ?></span></h3>
|
88 |
-
<div class="cff-revisions-container">
|
89 |
-
<?php
|
90 |
-
if(get_option('CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS) == 0):
|
91 |
-
_e('Revisions','calculated-fields-form');
|
92 |
-
?>
|
93 |
-
<select name="cff_revision_list">
|
94 |
-
|
95 |
-
<?php
|
96 |
-
print '<option value="0">'.esc_html(__('Select a revision', 'calculated-fields-form')).'</option>';
|
97 |
-
$revisions_obj = $form_obj->get_revisions();
|
98 |
-
$revisions = $revisions_obj->revisions_list();
|
99 |
-
foreach($revisions as $revision_id => $revision_data)
|
100 |
-
{
|
101 |
-
print '<option value="'.esc_attr($revision_id).'">'.esc_html($revision_data['time']).'</option>';
|
102 |
-
}
|
103 |
-
?>
|
104 |
-
</select>
|
105 |
-
<input type="button" name="cff_apply_revision" value="<?php print esc_attr('Load Revision', 'calculated-fields-form'); ?>" class="button" style="float:none;" />
|
106 |
-
<?php
|
107 |
-
endif;
|
108 |
-
?>
|
109 |
-
<input type="button" name="previewbtn" id="previewbtn2" class="button-primary" value="<?php esc_attr_e( 'Preview', 'calculated-fields-form' ); ?>" onclick="fbuilderjQuery.fbuilder.preview( this );" title="<?php esc_attr_e("Saves the form's structure only, and opens a preview windows", 'calculated-fields-form');?>" />
|
110 |
-
<input type="button" name="cff_fields_list" class="button-secondary" value="☰" title="<?php esc_attr_e( 'Fields List', 'calculated-fields-form'); ?>" onclick="fbuilderjQuery.fbuilder.printFields();" />
|
111 |
</div>
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
)
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
</ul>
|
234 |
-
<div id="tabs-1"></div>
|
235 |
-
<div id="tabs-2"></div>
|
236 |
-
<div id="tabs-3"></div>
|
237 |
-
</div>
|
238 |
-
</div>
|
239 |
-
<div class="columnr dashboardColumn padding10" id="fbuilder">
|
240 |
-
<div id="formheader"></div>
|
241 |
-
<div id="fieldlist"></div>
|
242 |
-
</div>
|
243 |
-
<div class="clearer"></div>
|
244 |
-
|
245 |
-
</div>
|
246 |
-
|
247 |
-
</div>
|
248 |
-
</div>
|
249 |
-
|
250 |
-
<p class="submit">
|
251 |
-
<input type="submit" name="save" id="save2" 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" />
|
252 |
-
<input type="button" name="previewbtn" id="previewbtn" class="button-primary" value="<?php esc_attr_e( 'Preview', 'calculated-fields-form' ); ?>" onclick="fbuilderjQuery.fbuilder.preview( this );" title="Saves the form's structure only, and opens a preview windows" />
|
253 |
-
<?php
|
254 |
-
if(get_option('CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS) == 0):
|
255 |
-
?>
|
256 |
-
| <input type="checkbox" name="cff-revisions-in-preview" <?php if(get_option('CP_CALCULATEDFIELDSF_REVISIONS_IN_PREVIEW', true)) print 'CHECKED'; ?> />
|
257 |
-
<?php
|
258 |
-
_e('Generate revisions in the form preview as well', 'calculated-fields-form');
|
259 |
-
endif;
|
260 |
-
?>
|
261 |
-
</p>
|
262 |
-
<div style="margin-bottom:20px;">
|
263 |
-
<a href="#metabox_define_texts"><?php _e('Texts definition', 'calculated-fields-form'); ?></a> |
|
264 |
-
<a href="#metabox_define_validation_texts"><?php _e('Error texts', 'calculated-fields-form'); ?></a> |
|
265 |
-
<a href="#metabox_payment_settings"><?php _e('General payment settings', 'calculated-fields-form'); ?></a> |
|
266 |
-
<a href="#metabox_paypal_integration"><?php _e('PayPal integration', 'calculated-fields-form'); ?></a> |
|
267 |
-
<a href="#metabox_notification_email"><?php _e('Notification email', 'calculated-fields-form'); ?></a> |
|
268 |
-
<a href="#metabox_email_copy_to_user"><?php _e('Email copy to user', 'calculated-fields-form'); ?></a> |
|
269 |
-
<a href="#metabox_captcha_settings"><?php _e('Captcha settings', 'calculated-fields-form'); ?></a>
|
270 |
-
</div>
|
271 |
-
<div id="metabox_define_texts" class="postbox cff-metabox <?php print esc_attr($cpcff_main->metabox_status( 'metabox_define_texts' ) ); ?>" >
|
272 |
-
<h3 class='hndle' style="padding:5px;"><span><?php _e( 'Define Texts', 'calculated-fields-form' ); ?></span></h3>
|
273 |
-
<div class="inside">
|
274 |
-
<table class="form-table">
|
275 |
-
<tr valign="top">
|
276 |
-
<th scope="row"><?php _e( 'Previous button label (text)', 'calculated-fields-form' ); ?>:</th>
|
277 |
-
<td><input type="text" name="vs_text_previousbtn" class="width75" value="<?php $label = esc_attr($form_obj->get_option('vs_text_previousbtn', 'Previous')); echo ($label==''?'Previous':$label); ?>" /></td>
|
278 |
-
</tr>
|
279 |
-
<tr valign="top">
|
280 |
-
<th scope="row"><?php _e( 'Next button label (text)', 'calculated-fields-form' ); ?>:</th>
|
281 |
-
<td><input type="text" name="vs_text_nextbtn" class="width75" value="<?php $label = esc_attr($form_obj->get_option('vs_text_nextbtn', 'Next')); echo ($label==''?'Next':$label); ?>" /></td>
|
282 |
-
</tr>
|
283 |
-
<tr valign="top">
|
284 |
-
<td colspan="2">
|
285 |
-
<?php _e( '- The styles can be applied into any of the CSS files of your theme or into the CSS file <em>"calculated-fields-form\css\stylepublic.css"</em>.', 'calculated-fields-form' ); ?><br />
|
286 |
-
<?php _e( '- For general CSS styles modifications to the form and samples <a href="https://cff.dwbooster.com/faq#q82" target="_blank">check this FAQ</a>.', 'calculated-fields-form' ); ?>
|
287 |
-
</tr>
|
288 |
-
<?php
|
289 |
-
// Display all other text fields
|
290 |
-
foreach( $cpcff_texts_array as $cpcff_text_index => $cpcff_text_attr )
|
291 |
-
{
|
292 |
-
if( $cpcff_text_index !== 'errors' && isset($cpcff_text_attr[ 'label' ]) )
|
293 |
-
{
|
294 |
-
print '
|
295 |
-
<tr valign="top">
|
296 |
-
<th scope="row">'.$cpcff_text_attr[ 'label' ].':</th>
|
297 |
-
<td><input type="text" name="cpcff_text_array['.$cpcff_text_index.'][text]" class="width75" value="'. esc_attr( $cpcff_text_attr[ 'text' ] ).'" /></td>
|
298 |
-
</tr>
|
299 |
-
';
|
300 |
-
}
|
301 |
-
}
|
302 |
-
?>
|
303 |
-
</table>
|
304 |
-
<div class="cff-goto-top"><a href="#cpformconf"><?php _e('Up to form structure', 'calculated-fields-form'); ?></a></div>
|
305 |
-
</div>
|
306 |
-
</div>
|
307 |
-
|
308 |
-
<div id="metabox_define_validation_texts" class="postbox cff-metabox <?php print esc_attr($cpcff_main->metabox_status( 'metabox_define_validation_texts' ) ); ?>" >
|
309 |
-
<h3 class='hndle' style="padding:5px;"><span><?php _e( 'Validation Settings', 'calculated-fields-form' ); ?></span></h3>
|
310 |
-
<div class="inside">
|
311 |
-
<table class="form-table">
|
312 |
-
<tr valign="top">
|
313 |
-
<th scope="row"><?php _e( '"is required" text', 'calculated-fields-form' ); ?>:</th>
|
314 |
-
<td><input type="text" name="vs_text_is_required" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_is_required', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required)); ?>" /></td>
|
315 |
-
</tr>
|
316 |
-
<tr valign="top">
|
317 |
-
<th scope="row"><?php _e( '"is email" text', 'calculated-fields-form' ); ?>:</th>
|
318 |
-
<td><input type="text" name="vs_text_is_email" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_is_email', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email)); ?>" /></td>
|
319 |
-
</tr>
|
320 |
-
<tr valign="top">
|
321 |
-
<th scope="row"><?php _e( '"is valid captcha" text', 'calculated-fields-form' ); ?>:</th>
|
322 |
-
<td><input type="text" name="cv_text_enter_valid_captcha" class="width75" value="<?php echo esc_attr($form_obj->get_option('cv_text_enter_valid_captcha', CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha)); ?>" /></td>
|
323 |
-
</tr>
|
324 |
-
|
325 |
-
<tr valign="top">
|
326 |
-
<th scope="row"><?php _e( '"is valid date (mm/dd/yyyy)" text', 'calculated-fields-form' ); ?>:</th>
|
327 |
-
<td><input type="text" name="vs_text_datemmddyyyy" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_datemmddyyyy', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy)); ?>" /></td>
|
328 |
-
</tr>
|
329 |
-
<tr valign="top">
|
330 |
-
<th scope="row"><?php _e( '"is valid date (dd/mm/yyyy)" text', 'calculated-fields-form' ); ?>:</th>
|
331 |
-
<td><input type="text" name="vs_text_dateddmmyyyy" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_dateddmmyyyy', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy)); ?>" /></td>
|
332 |
-
</tr>
|
333 |
-
<tr valign="top">
|
334 |
-
<th scope="row"><?php _e( '"is number" text', 'calculated-fields-form' ); ?>:</th>
|
335 |
-
<td><input type="text" name="vs_text_number" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_number', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number)); ?>" /></td>
|
336 |
-
</tr>
|
337 |
-
<tr valign="top">
|
338 |
-
<th scope="row"><?php _e( '"only digits" text', 'calculated-fields-form' ); ?>:</th>
|
339 |
-
<td><input type="text" name="vs_text_digits" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_digits', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits)); ?>" /></td>
|
340 |
-
</tr>
|
341 |
-
<tr valign="top">
|
342 |
-
<th scope="row"><?php _e( '"under maximum" text', 'calculated-fields-form' ); ?>:</th>
|
343 |
-
<td><input type="text" name="vs_text_max" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_max', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max)); ?>" /></td>
|
344 |
-
</tr>
|
345 |
-
<tr valign="top">
|
346 |
-
<th scope="row"><?php _e( '"over minimum" text', 'calculated-fields-form' ); ?>:</th>
|
347 |
-
<td><input type="text" name="vs_text_min" class="width75" value="<?php echo esc_attr($form_obj->get_option('vs_text_min', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min)); ?>" /></td>
|
348 |
-
</tr>
|
349 |
-
<?php
|
350 |
-
// Display all other text fields
|
351 |
-
if( !empty( $cpcff_texts_array[ 'errors' ] ) )
|
352 |
{
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
}
|
365 |
}
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
<div
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
<
|
389 |
-
<
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
<
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
</td>
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
<option value="0"><?php _e( 'No', 'calculated-fields-form' ); ?></option>
|
468 |
-
</select>
|
469 |
-
<br /><i style="font-size:11px;"><?php _e( 'Note: If "Optional" is selected, a radiobutton will appear in the form to select if the payment will be made with PayPal or not.', 'calculated-fields-form' ); ?></i>
|
470 |
-
<div id="cff_paypal_options_label" style="margin-top:10px;background:#EEF5FB;border: 1px dotted #888888;padding:10px;width:260px;">
|
471 |
-
<?php _e( 'Label for the "<strong>Pay with PayPal</strong>" option', 'calculated-fields-form' ); ?>:<br />
|
472 |
-
<input type="text" size="40" style="width:250px;" />
|
473 |
-
</div></td>
|
474 |
-
</tr>
|
475 |
-
|
476 |
-
<tr valign="top">
|
477 |
-
<th scope="row"><?php _e( 'Paypal Mode', 'calculated-fields-form' ); ?></th>
|
478 |
-
<td><select name="paypal_mode" class="width75">
|
479 |
-
<option value="production" <?php if ($form_obj->get_option('paypal_mode',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE) != 'sandbox') echo 'selected'; ?>><?php _e( 'Production - real payments processed', 'calculated-fields-form' ); ?></option>
|
480 |
-
<option value="sandbox" <?php if ($form_obj->get_option('paypal_mode',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE) == 'sandbox') echo 'selected'; ?>><?php _e( 'SandBox - PayPal testing sandbox area', 'calculated-fields-form' ); ?></option>
|
481 |
-
</select>
|
482 |
-
</td>
|
483 |
-
</tr>
|
484 |
-
|
485 |
-
<tr valign="top">
|
486 |
-
<th scope="row"><?php _e( 'Paypal email', 'calculated-fields-form' ); ?></th>
|
487 |
-
<td><input type="text" name="paypal_email" class="width75" value="<?php echo esc_attr($form_obj->get_option('paypal_email',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_EMAIL)); ?>" /></td>
|
488 |
-
</tr>
|
489 |
-
|
490 |
-
<tr valign="top">
|
491 |
-
<th scope="row"><?php _e( 'A $0 amount to pay means', 'calculated-fields-form' ); ?>:</th>
|
492 |
-
<td><select name="paypal_zero_payment" class="width75">
|
493 |
-
<option value="0" <?php if ($form_obj->get_option('paypal_zero_payment',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT) != '1') echo 'selected'; ?>><?php _e( 'Let the user enter any amount at PayPal (ex: for a donation)', 'calculated-fields-form' ); ?></option>
|
494 |
-
<option value="1" <?php if ($form_obj->get_option('paypal_zero_payment',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT) == '1') echo 'selected'; ?>><?php _e( 'Don\'t require any payment. Form is submitted skiping the PayPal page.', 'calculated-fields-form' ); ?></option>
|
495 |
-
</select>
|
496 |
-
</td>
|
497 |
-
</tr>
|
498 |
-
|
499 |
-
<tr valign="top">
|
500 |
-
<th scope="row"><?php _e( 'Paypal language', 'calculated-fields-form' ); ?></th>
|
501 |
-
<td><input type="text" name="paypal_language" value="<?php echo esc_attr($form_obj->get_option('paypal_language',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE)); ?>" /></td>
|
502 |
-
</tr>
|
503 |
-
|
504 |
-
<tr valign="top">
|
505 |
-
<th scope="row"><?php _e( 'Payment frequency', 'calculated-fields-form' ); ?></th>
|
506 |
-
<td><select name="paypal_recurrent" class="width75">
|
507 |
-
<option value="0" <?php if ($form_obj->get_option('paypal_recurrent',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT) == '0' ||
|
508 |
-
$form_obj->get_option('paypal_recurrent',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT) == ''
|
509 |
-
) echo 'selected'; ?>><?php _e( 'One time payment (default option, user is billed only once)', 'calculated-fields-form' ); ?></option>
|
510 |
-
<option value="1" <?php if ($form_obj->get_option('paypal_recurrent',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT) == '1') echo 'selected'; ?>><?php _e( 'Bill the user every 1 month', 'calculated-fields-form' ); ?></option>
|
511 |
-
<option value="3" <?php if ($form_obj->get_option('paypal_recurrent',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT) == '3') echo 'selected'; ?>><?php _e( 'Bill the user every 3 months', 'calculated-fields-form' ); ?></option>
|
512 |
-
<option value="6" <?php if ($form_obj->get_option('paypal_recurrent',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT) == '6') echo 'selected'; ?>><?php _e( 'Bill the user every 6 months', 'calculated-fields-form' ); ?></option>
|
513 |
-
<option value="12" <?php if ($form_obj->get_option('paypal_recurrent',CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT) == '12') echo 'selected'; ?>><?php _e( 'Bill the user every 12 months', 'calculated-fields-form' ); ?></option>
|
514 |
-
</select>
|
515 |
-
</td>
|
516 |
-
</tr>
|
517 |
-
<tr valign="top">
|
518 |
-
<th scope="row"><?php _e( 'Paypal prompt buyers for shipping address', 'calculated-fields-form' ); ?></th>
|
519 |
-
<td>
|
520 |
-
<?php $paypal_address = $form_obj->get_option('paypal_address', 1); ?>
|
521 |
-
<select name="paypal_address" class="width75">
|
522 |
-
<option value="1" <?php if($paypal_address == 1) print 'SELECTED'; ?>><?php _e('Do not prompt for an address', 'calculated-fields-form'); ?></option>
|
523 |
-
<option value="0" <?php if($paypal_address == 0) print 'SELECTED'; ?>><?php _e('Prompt for an address, but do not require one', 'calculated-fields-form'); ?></option>
|
524 |
-
<option value="2" <?php if($paypal_address == 2) print 'SELECTED'; ?>><?php _e('Prompt for an address and require one', 'calculated-fields-form'); ?></option>
|
525 |
</select>
|
526 |
</td>
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
</div>
|
622 |
-
</div>
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
<
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
<?php
|
692 |
-
|
693 |
-
?>
|
694 |
-
</
|
695 |
-
|
696 |
-
|
697 |
-
<
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
<
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! is_admin() ) {
|
4 |
+
print 'Direct access not allowed.';
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
// Required scripts
|
9 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_templates.inc.php';
|
10 |
+
|
11 |
+
check_admin_referer( 'cff-form-settings', '_cpcff_nonce' );
|
12 |
+
|
13 |
+
// Load resources
|
14 |
+
wp_enqueue_media();
|
15 |
+
if ( function_exists( 'wp_enqueue_code_editor' ) ) {
|
16 |
+
wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
|
17 |
+
}
|
18 |
+
wp_enqueue_style( 'cff-chosen-css', plugins_url( '/vendors/chosen/chosen.min.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
19 |
+
wp_enqueue_script( 'cff-chosen-js', plugins_url( '/vendors/chosen/chosen.jquery.min.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'jquery' ), CP_CALCULATEDFIELDSF_VERSION );
|
20 |
+
|
21 |
+
if ( ! defined( 'CP_CALCULATEDFIELDSF_ID' ) ) {
|
22 |
+
define( 'CP_CALCULATEDFIELDSF_ID', isset( $_GET['cal'] ) && is_numeric( $_GET['cal'] ) ? intval( $_GET['cal'] ) : 0 );
|
23 |
+
}
|
24 |
+
|
25 |
+
$cpcff_main = CPCFF_MAIN::instance();
|
26 |
+
$form_obj = $cpcff_main->get_form( intval( $_GET['cal'] ) );
|
27 |
+
|
28 |
+
if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cpcff_revision_to_apply'] ) && is_numeric( $_POST['cpcff_revision_to_apply'] ) ) {
|
29 |
+
$revision_id = intval( $_POST['cpcff_revision_to_apply'] );
|
30 |
+
if ( $revision_id ) {
|
31 |
+
$form_obj->apply_revision( $revision_id );
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['cp_calculatedfieldsf_post_options'] ) ) {
|
36 |
+
echo "<div id='setting-error-settings_updated' class='updated settings-error'> <p><strong>" . esc_html__( 'Settings saved', 'calculated-fields-form' ) . '</strong></p></div>';
|
37 |
+
}
|
38 |
+
|
39 |
+
global $cpcff_default_texts_array;
|
40 |
+
$cpcff_texts_array = $form_obj->get_option( 'vs_all_texts', $cpcff_default_texts_array );
|
41 |
+
$cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
42 |
+
$cpcff_default_texts_array,
|
43 |
+
( is_string( $cpcff_texts_array ) && is_array( unserialize( $cpcff_texts_array ) ) )
|
44 |
+
? unserialize( $cpcff_texts_array )
|
45 |
+
: ( ( is_array( $cpcff_texts_array ) ) ? $cpcff_texts_array : array() )
|
46 |
+
);
|
47 |
+
|
48 |
+
?>
|
49 |
+
<div class="wrap">
|
50 |
+
<h1 class="cff-form-name"><?php
|
51 |
+
print esc_html__( 'Calculated Fields Form', 'calculated-fields-form' ) . ' <span class="cff-form-name-shortcode">(<b>' . esc_html__( 'Form', 'calculated-fields-form' ) . ' ' . esc_html( CP_CALCULATEDFIELDSF_ID ) . ' - ' . esc_html( $form_obj->get_option( 'form_name', '' ) ) . '</b>) Shortcode: [CP_CALCULATED_FIELDS id="' . esc_attr( CP_CALCULATEDFIELDSF_ID ) . '"]</span>';
|
52 |
+
|
53 |
+
if ( get_option( 'CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS ) ) {
|
54 |
+
$url = CPCFF_AUXILIARY::site_url();
|
55 |
+
$url .= ( strpos( $url, '?' ) === false ) ? '?' : '&';
|
56 |
+
$url .= 'cff-form=' . CP_CALCULATEDFIELDSF_ID;
|
57 |
+
print '<br><span style="font-size:14px;font-style:italic;">' . esc_html__( 'Direct form URL', 'calculated-fields-form' ) . ': <a href="' . esc_attr( $url ) . '" target="_blank">' . esc_html( $url ) . '</a></span>';
|
58 |
+
}
|
59 |
+
?></h1>
|
60 |
+
<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';" class="button-secondary" />
|
61 |
+
<br /><br />
|
62 |
+
<?php $_cpcff_nonce = wp_create_nonce( 'cff-form-settings' ); ?>
|
63 |
+
<form method="post" action="" id="cpformconf" name="cpformconf" class="cff_form_builder">
|
64 |
+
<input type="hidden" name="_cpcff_nonce" value="<?php echo esc_attr( $_cpcff_nonce ); ?>" />
|
65 |
+
<input name="cp_calculatedfieldsf_post_options" type="hidden" value="1" />
|
66 |
+
<input name="cp_calculatedfieldsf_id" type="hidden" value="<?php echo esc_attr( CP_CALCULATEDFIELDSF_ID ); ?>" />
|
67 |
+
|
68 |
+
<div id="normal-sortables" class="meta-box-sortables">
|
69 |
+
|
70 |
+
<h2><?php esc_html_e( 'Form Settings', 'calculated-fields-form' ); ?>:</h2>
|
71 |
+
<!-- Form category -->
|
72 |
+
<div class="postbox" >
|
73 |
+
<div class="inside">
|
74 |
+
<b><?php esc_html_e( 'Form Category', 'calculated-fields-form' ); ?></b>
|
75 |
+
<input type="text" name="calculated-fields-form-category" class="width75" value="<?php print esc_attr( $form_obj->get_option( 'category', '' ) ); ?>" list="calculated-fields-form-categories" />
|
76 |
+
<datalist id="calculated-fields-form-categories">
|
77 |
+
<?php
|
78 |
+
print $cpcff_main->get_categories( 'DATALIST' ); // phpcs:ignore WordPress.Security.EscapeOutput
|
79 |
+
?>
|
80 |
+
</datalist>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</div>
|
82 |
+
</div>
|
83 |
+
<hr />
|
84 |
+
<div><?php esc_html_e( '* Different form styles available on the tab Form Settings >> Form Template', 'calculated-fields-form' ); ?></div>
|
85 |
+
<div id="metabox_form_structure" class="postbox" >
|
86 |
+
<div class="hndle">
|
87 |
+
<h3 style="padding:5px;display:inline-block;"><span><?php esc_html_e( 'Form Builder', 'calculated-fields-form' ); ?></span></h3>
|
88 |
+
<div class="cff-revisions-container">
|
89 |
+
<?php
|
90 |
+
if ( get_option( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS ) == 0 ) :
|
91 |
+
esc_html_e( 'Revisions', 'calculated-fields-form' );
|
92 |
+
?>
|
93 |
+
<select name="cff_revision_list">
|
94 |
+
|
95 |
+
<?php
|
96 |
+
print '<option value="0">' . esc_html__( 'Select a revision', 'calculated-fields-form' ) . '</option>';
|
97 |
+
$revisions_obj = $form_obj->get_revisions();
|
98 |
+
$revisions = $revisions_obj->revisions_list();
|
99 |
+
foreach ( $revisions as $revision_id => $revision_data ) {
|
100 |
+
print '<option value="' . esc_attr( $revision_id ) . '">' . esc_html( $revision_data['time'] ) . '</option>';
|
101 |
+
}
|
102 |
+
?>
|
103 |
+
</select>
|
104 |
+
<input type="button" name="cff_apply_revision" value="<?php print esc_attr( 'Load Revision', 'calculated-fields-form' ); ?>" class="button" style="float:none;" />
|
105 |
+
<?php
|
106 |
+
endif;
|
107 |
+
?>
|
108 |
+
<input type="button" name="previewbtn" id="previewbtn2" class="button-primary" value="<?php esc_attr_e( 'Preview', 'calculated-fields-form' ); ?>" onclick="fbuilderjQuery.fbuilder.preview( this );" title="<?php esc_attr_e( "Saves the form's structure only, and opens a preview windows", 'calculated-fields-form' ); ?>" />
|
109 |
+
<input type="button" name="cff_fields_list" class="button-secondary" value="☰" title="<?php esc_attr_e( 'Fields List', 'calculated-fields-form' ); ?>" onclick="fbuilderjQuery.fbuilder.printFields();" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<div class="inside">
|
113 |
+
<div class="form-builder-error-messages"><?php
|
114 |
+
global $cff_structure_error;
|
115 |
+
if ( ! empty( $cff_structure_error ) ) {
|
116 |
+
echo $cff_structure_error; // phpcs:ignore WordPress.Security.EscapeOutput
|
117 |
+
}
|
118 |
+
?></div>
|
119 |
+
<p style="border:1px solid #F0AD4E;background:#FBE6CA;padding:10px;"><span style="font-weight:bold;"><?php esc_html_e( 'If the form is not loading in the public website, go to the settings page of the plugin through the menu option: "Settings/Calculated Fields Form", select the "Classic" option for the attribute: "Script load method", and press the "Update" button.', 'calculated-fields-form' ); ?></span><br /><?php _e( 'If you need also the form to be sent to the server side for processing (for example to deliver emails) then the <a href="https://cff.dwbooster.com/download" target="_blank">Commercial versions</a> of the plugin are required.', 'calculated-fields-form' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></p>
|
120 |
+
<input type="hidden" name="form_structure" id="form_structure" value="<?php print esc_attr( preg_replace( '/"/i', '&quot;', json_encode( $form_obj->get_option( 'form_structure', CP_CALCULATEDFIELDSF_DEFAULT_form_structure ) ) ) ); ?>" />
|
121 |
+
<input type="hidden" name="templates" id="templates" value="<?php print esc_attr( json_encode( CPCFF_TEMPLATES::load_templates() ) ); ?>" />
|
122 |
+
<link href="<?php print esc_attr( plugins_url( '/vendors/jquery-ui/jquery-ui.min.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>" type="text/css" rel="stylesheet" property="stylesheet" />
|
123 |
+
<pre style="display:none;">
|
124 |
+
<script type="text/javascript">
|
125 |
+
var cff_metabox_nonce = '<?php print esc_js( wp_create_nonce( 'cff-metabox-status' ) ); ?>';
|
126 |
+
try
|
127 |
+
{
|
128 |
+
function calculatedFieldsFormReady()
|
129 |
+
{
|
130 |
+
/* Revisions code */
|
131 |
+
$calculatedfieldsfQuery('[name="cff_apply_revision"]').click(
|
132 |
+
function(){
|
133 |
+
var revision = $calculatedfieldsfQuery('[name="cff_revision_list"]').val();
|
134 |
+
if(revision*1)
|
135 |
+
{
|
136 |
+
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' ) ); ?>');
|
137 |
+
if(result)
|
138 |
+
{
|
139 |
+
$calculatedfieldsfQuery('<form method="post" action="" id="cpformconf" name="cpformconf" class="cff_form_builder"><input type="hidden" name="_cpcff_nonce" value="<?php echo esc_attr( $_cpcff_nonce ); ?>" /><input name="cp_calculatedfieldsf_id" type="hidden" value="<?php echo esc_attr( CP_CALCULATEDFIELDSF_ID ); ?>" /><input type="hidden" name="cpcff_revision_to_apply" value="'+esc_attr( revision )+'"></form>').appendTo('body').submit();
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
);
|
144 |
+
|
145 |
+
// Form builder code
|
146 |
+
|
147 |
+
var f;
|
148 |
+
function run_fbuilder($)
|
149 |
+
{
|
150 |
+
f = $("#fbuilder").fbuilder();
|
151 |
+
window['cff_form'] = f;
|
152 |
+
f.fBuild.loadData( "form_structure", "templates" );
|
153 |
+
};
|
154 |
+
|
155 |
+
if(!('fbuilder' in $calculatedfieldsfQuery.fn))
|
156 |
+
{
|
157 |
+
$calculatedfieldsfQuery.getScript(
|
158 |
+
location.protocol + '//' + location.host + location.pathname+'?page=cp_calculated_fields_form&cp_cff_resources=admin',
|
159 |
+
function(){run_fbuilder(fbuilderjQuery);}
|
160 |
+
);
|
161 |
+
}
|
162 |
+
else
|
163 |
+
{
|
164 |
+
run_fbuilder($calculatedfieldsfQuery);
|
165 |
+
}
|
166 |
+
|
167 |
+
$calculatedfieldsfQuery(".itemForm").click(function() {
|
168 |
+
f.fBuild.addItem($calculatedfieldsfQuery(this).attr("id"));
|
169 |
+
})
|
170 |
+
.draggable({
|
171 |
+
connectToSortable: '#fbuilder #fieldlist',
|
172 |
+
delay: 100,
|
173 |
+
helper: function() {
|
174 |
+
var $ = $calculatedfieldsfQuery,
|
175 |
+
e = $(this),
|
176 |
+
width = e.outerWidth(),
|
177 |
+
text = e.text(),
|
178 |
+
type = e.attr('id'),
|
179 |
+
el = $('<div class="cff-button-drag '+type+'">');
|
180 |
+
|
181 |
+
return el.html( text ).css( 'width', width ).attr('data-control',type);
|
182 |
+
},
|
183 |
+
revert: 'invalid',
|
184 |
+
cancel: false,
|
185 |
+
scroll: false,
|
186 |
+
opacity: 1,
|
187 |
+
containment: 'document',
|
188 |
+
stop: function(){$calculatedfieldsfQuery('.ctrlsColumn .itemForm').removeClass('button-primary');}
|
189 |
+
});
|
190 |
+
|
191 |
+
jQuery(".metabox_disabled_section .inside")
|
192 |
+
.click( function(){
|
193 |
+
if(confirm("<?php esc_html_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' ); ?>"))
|
194 |
+
document.location = 'https://cff.dwbooster.com/';
|
195 |
+
})
|
196 |
+
.find('*')
|
197 |
+
.prop('disabled', true);
|
198 |
+
};
|
199 |
+
}
|
200 |
+
catch( err ){}
|
201 |
+
try{$calculatedfieldsfQuery = jQuery.noConflict();} catch ( err ) {}
|
202 |
+
if (typeof $calculatedfieldsfQuery == 'undefined')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
{
|
204 |
+
if(window.addEventListener){
|
205 |
+
window.addEventListener('load', function(){
|
206 |
+
try{$calculatedfieldsfQuery = jQuery.noConflict();} catch ( err ) {return;}
|
207 |
+
calculatedFieldsFormReady();
|
208 |
+
});
|
209 |
+
}else{
|
210 |
+
window.attachEvent('onload', function(){
|
211 |
+
try{$calculatedfieldsfQuery = jQuery.noConflict();} catch ( err ) {return;}
|
212 |
+
calculatedFieldsFormReady();
|
213 |
+
});
|
214 |
+
}
|
|
|
215 |
}
|
216 |
+
else
|
217 |
+
{
|
218 |
+
$calculatedfieldsfQuery(document).ready( calculatedFieldsFormReady );
|
219 |
+
}
|
220 |
+
</script>
|
221 |
+
</pre>
|
222 |
+
<div style="background:#fafafa;" class="form-builder">
|
223 |
+
|
224 |
+
<div class="column ctrlsColumn">
|
225 |
+
<div id="tabs">
|
226 |
+
<span class="ui-icon ui-icon-triangle-1-e expand-shrink"></span>
|
227 |
+
<ul>
|
228 |
+
<li><a href="#tabs-1"><?php esc_html_e( 'Add a Field', 'calculated-fields-form' ); ?></a></li>
|
229 |
+
<li><a href="#tabs-2"><?php esc_html_e( 'Field Settings', 'calculated-fields-form' ); ?></a></li>
|
230 |
+
<li><a href="#tabs-3"><?php esc_html_e( 'Form Settings', 'calculated-fields-form' ); ?></a></li>
|
231 |
+
</ul>
|
232 |
+
<div id="tabs-1"></div>
|
233 |
+
<div id="tabs-2"></div>
|
234 |
+
<div id="tabs-3"></div>
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
<div class="columnr dashboardColumn padding10" id="fbuilder">
|
238 |
+
<div id="formheader"></div>
|
239 |
+
<div id="fieldlist"></div>
|
240 |
+
</div>
|
241 |
+
<div class="clearer"></div>
|
242 |
+
|
243 |
+
</div>
|
244 |
+
|
245 |
+
</div>
|
246 |
+
</div>
|
247 |
+
|
248 |
+
<p class="submit">
|
249 |
+
<input type="submit" name="save" id="save2" 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" />
|
250 |
+
<input type="button" name="previewbtn" id="previewbtn" class="button-primary" value="<?php esc_attr_e( 'Preview', 'calculated-fields-form' ); ?>" onclick="fbuilderjQuery.fbuilder.preview( this );" title="Saves the form's structure only, and opens a preview windows" />
|
251 |
+
<?php
|
252 |
+
if ( get_option( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS ) == 0 ) :
|
253 |
+
?>
|
254 |
+
| <input type="checkbox" name="cff-revisions-in-preview" <?php if ( get_option( 'CP_CALCULATEDFIELDSF_REVISIONS_IN_PREVIEW', true ) ) {
|
255 |
+
print 'CHECKED';} ?> />
|
256 |
+
<?php
|
257 |
+
esc_html_e( 'Generate revisions in the form preview as well', 'calculated-fields-form' );
|
258 |
+
endif;
|
259 |
+
?>
|
260 |
+
</p>
|
261 |
+
<div style="margin-bottom:20px;">
|
262 |
+
<a href="#metabox_define_texts"><?php esc_html_e( 'Texts definition', 'calculated-fields-form' ); ?></a> |
|
263 |
+
<a href="#metabox_define_validation_texts"><?php esc_html_e( 'Error texts', 'calculated-fields-form' ); ?></a> |
|
264 |
+
<a href="#metabox_payment_settings"><?php esc_html_e( 'General payment settings', 'calculated-fields-form' ); ?></a> |
|
265 |
+
<a href="#metabox_paypal_integration"><?php esc_html_e( 'PayPal integration', 'calculated-fields-form' ); ?></a> |
|
266 |
+
<a href="#metabox_notification_email"><?php esc_html_e( 'Notification email', 'calculated-fields-form' ); ?></a> |
|
267 |
+
<a href="#metabox_email_copy_to_user"><?php esc_html_e( 'Email copy to user', 'calculated-fields-form' ); ?></a> |
|
268 |
+
<a href="#metabox_captcha_settings"><?php esc_html_e( 'Captcha settings', 'calculated-fields-form' ); ?></a>
|
269 |
+
</div>
|
270 |
+
<div id="metabox_define_texts" class="postbox cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_define_texts' ) ); ?>" >
|
271 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Define Texts', 'calculated-fields-form' ); ?></span></h3>
|
272 |
+
<div class="inside">
|
273 |
+
<table class="form-table">
|
274 |
+
<tr valign="top">
|
275 |
+
<th scope="row"><?php esc_html_e( 'Previous button label (text)', 'calculated-fields-form' ); ?>:</th>
|
276 |
+
<td><input type="text" name="vs_text_previousbtn" class="width75" value="<?php $label = $form_obj->get_option( 'vs_text_previousbtn', 'Previous' );
|
277 |
+
echo esc_attr( '' == $label ? 'Previous' : $label ); ?>" /></td>
|
278 |
+
</tr>
|
279 |
+
<tr valign="top">
|
280 |
+
<th scope="row"><?php esc_html_e( 'Next button label (text)', 'calculated-fields-form' ); ?>:</th>
|
281 |
+
<td><input type="text" name="vs_text_nextbtn" class="width75" value="<?php $label = $form_obj->get_option( 'vs_text_nextbtn', 'Next' );
|
282 |
+
echo esc_attr( '' == $label ? 'Next' : $label ); ?>" /></td>
|
283 |
+
</tr>
|
284 |
+
<tr valign="top">
|
285 |
+
<td colspan="2">
|
286 |
+
<?php _e( '- The styles can be applied into any of the CSS files of your theme or into the CSS file <em>"calculated-fields-form\css\stylepublic.css"</em>.', 'calculated-fields-form' ); // phpcs:ignore WordPress.Security.EscapeOutput ?><br />
|
287 |
+
<?php _e( '- For general CSS styles modifications to the form and samples <a href="https://cff.dwbooster.com/faq#q82" target="_blank">check this FAQ</a>.', 'calculated-fields-form' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
288 |
+
</tr>
|
289 |
+
<?php
|
290 |
+
// Display all other text fields
|
291 |
+
foreach ( $cpcff_texts_array as $cpcff_text_index => $cpcff_text_attr ) {
|
292 |
+
if ( 'errors' !== $cpcff_text_index && isset( $cpcff_text_attr['label'] ) ) {
|
293 |
+
print '
|
294 |
+
<tr valign="top">
|
295 |
+
<th scope="row">' . esc_html( $cpcff_text_attr['label'] ) . ':</th>
|
296 |
+
<td><input type="text" name="cpcff_text_array[' . esc_attr( $cpcff_text_index ) . '][text]" class="width75" value="' . esc_attr( $cpcff_text_attr['text'] ) . '" /></td>
|
297 |
+
</tr>
|
298 |
+
';
|
299 |
+
}
|
300 |
+
}
|
301 |
+
?>
|
302 |
+
</table>
|
303 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
304 |
+
</div>
|
305 |
+
</div>
|
306 |
+
|
307 |
+
<div id="metabox_define_validation_texts" class="postbox cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_define_validation_texts' ) ); ?>" >
|
308 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Validation Settings', 'calculated-fields-form' ); ?></span></h3>
|
309 |
+
<div class="inside">
|
310 |
+
<table class="form-table">
|
311 |
+
<tr valign="top">
|
312 |
+
<th scope="row"><?php esc_html_e( '"is required" text', 'calculated-fields-form' ); ?>:</th>
|
313 |
+
<td><input type="text" name="vs_text_is_required" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_is_required', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required ) ); ?>" /></td>
|
314 |
+
</tr>
|
315 |
+
<tr valign="top">
|
316 |
+
<th scope="row"><?php esc_html_e( '"is email" text', 'calculated-fields-form' ); ?>:</th>
|
317 |
+
<td><input type="text" name="vs_text_is_email" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_is_email', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email ) ); ?>" /></td>
|
318 |
+
</tr>
|
319 |
+
<tr valign="top">
|
320 |
+
<th scope="row"><?php esc_html_e( '"is valid captcha" text', 'calculated-fields-form' ); ?>:</th>
|
321 |
+
<td><input type="text" name="cv_text_enter_valid_captcha" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'cv_text_enter_valid_captcha', CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha ) ); ?>" /></td>
|
322 |
+
</tr>
|
323 |
+
|
324 |
+
<tr valign="top">
|
325 |
+
<th scope="row"><?php esc_html_e( '"is valid date (mm/dd/yyyy)" text', 'calculated-fields-form' ); ?>:</th>
|
326 |
+
<td><input type="text" name="vs_text_datemmddyyyy" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_datemmddyyyy', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy ) ); ?>" /></td>
|
327 |
+
</tr>
|
328 |
+
<tr valign="top">
|
329 |
+
<th scope="row"><?php esc_html_e( '"is valid date (dd/mm/yyyy)" text', 'calculated-fields-form' ); ?>:</th>
|
330 |
+
<td><input type="text" name="vs_text_dateddmmyyyy" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_dateddmmyyyy', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy ) ); ?>" /></td>
|
331 |
+
</tr>
|
332 |
+
<tr valign="top">
|
333 |
+
<th scope="row"><?php esc_html_e( '"is number" text', 'calculated-fields-form' ); ?>:</th>
|
334 |
+
<td><input type="text" name="vs_text_number" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_number', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number ) ); ?>" /></td>
|
335 |
+
</tr>
|
336 |
+
<tr valign="top">
|
337 |
+
<th scope="row"><?php esc_html_e( '"only digits" text', 'calculated-fields-form' ); ?>:</th>
|
338 |
+
<td><input type="text" name="vs_text_digits" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_digits', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits ) ); ?>" /></td>
|
339 |
+
</tr>
|
340 |
+
<tr valign="top">
|
341 |
+
<th scope="row"><?php esc_html_e( '"under maximum" text', 'calculated-fields-form' ); ?>:</th>
|
342 |
+
<td><input type="text" name="vs_text_max" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_max', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max ) ); ?>" /></td>
|
343 |
+
</tr>
|
344 |
+
<tr valign="top">
|
345 |
+
<th scope="row"><?php esc_html_e( '"over minimum" text', 'calculated-fields-form' ); ?>:</th>
|
346 |
+
<td><input type="text" name="vs_text_min" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'vs_text_min', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min ) ); ?>" /></td>
|
347 |
+
</tr>
|
348 |
+
<?php
|
349 |
+
// Display all other text fields
|
350 |
+
if ( ! empty( $cpcff_texts_array['errors'] ) ) {
|
351 |
+
foreach ( $cpcff_texts_array['errors'] as $cpcff_text_index => $cpcff_text_attr ) {
|
352 |
+
if ( isset( $cpcff_text_attr['label'] ) ) {
|
353 |
+
print '
|
354 |
+
<tr valign="top">
|
355 |
+
<th scope="row">' . esc_html( $cpcff_text_attr['label'] ) . ':</th>
|
356 |
+
<td><input type="text" name="cpcff_text_array[errors][' . esc_attr( $cpcff_text_index ) . '][text]" class="width75" value="' . esc_attr( $cpcff_text_attr['text'] ) . '" /></td>
|
357 |
+
</tr>
|
358 |
+
';
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
?>
|
363 |
+
</table>
|
364 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
365 |
+
</div>
|
366 |
+
</div>
|
367 |
+
|
368 |
+
<div id="metabox_basic_settings" class="postbox" >
|
369 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Note', 'calculated-fields-form' ); ?></span></h3>
|
370 |
+
<div class="inside">
|
371 |
+
<?php esc_html_e( 'To display the form in a post/page, enter your shortcode in the post/page content:', 'calculated-fields-form' ); ?>
|
372 |
+
<?php print '<b>[CP_CALCULATED_FIELDS id="' . esc_attr( CP_CALCULATEDFIELDSF_ID ) . '"]</b>'; ?><br />
|
373 |
+
<?php esc_html_e( 'The CFF plugin implements widgets and blocks to allow inserting the form visually with the most popular page builders such as Gutenberg Editor, Classic Editor, Elementor, Site Origin, Visual Composer, Beaver Builder, Divi, and for the other page builders insert the shortcode directly.', 'calculated-fields-form' ); ?>
|
374 |
+
<br /><br />
|
375 |
+
</div>
|
376 |
+
</div>
|
377 |
+
|
378 |
+
<p class="submit">
|
379 |
+
<input type="submit" name="save" id="save1" 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" />
|
380 |
+
</p>
|
381 |
+
|
382 |
+
[<a href="https://cff.dwbooster.com/customization" target="_blank"><?php esc_html_e( 'Request Custom Modifications', 'calculated-fields-form' ); ?></a>] | [<a href="https://wordpress.org/support/plugin/calculated-fields-form#new-post" target="_blank"><?php esc_html_e( 'Help', 'calculated-fields-form' ); ?></a>]
|
383 |
+
|
384 |
+
<br /><br /><br />
|
385 |
+
<style>@media screen and (min-width:710px){.cff-plugin-promote{width: calc( 100% - 180px );}} @media screen and (max-width:710px){.cff-plugin-logo-promote{display:none;}}</style>
|
386 |
+
<div id="cff-upgrade-frame" style="border:1px solid #F0AD4E;background:#FBE6CA;padding:10px;color:#3c434a;">
|
387 |
+
<a href="https://cff.dwbooster.com/download" target="_blank" style="text-decoration:none;float:left;" class="cff-plugin-logo-promote"><img src="https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg" style="width:160px;border:2px solid white;margin-right:10px;margin-bottom:10px;"></a>
|
388 |
+
<div style="float:left;" class="cff-plugin-promote">
|
389 |
+
<div style="font-weight:500;font-size:20px;line-height:28px;"><?php _e( 'The following features are available in the commercial version of the <a href="https://cff.dwbooster.com/download" target="_blank" style="text-decoration:none;">"Calculated Fields Form"</a>', 'calculated-fields-form' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></div>
|
390 |
+
<div style="text-transform: uppercase; font-weight:700; font-size:24px;margin-top:15px;margin-bottom:15px;line-height:28px;"><a href="https://cff.dwbooster.com/download" target="_blank" style="text-decoration:none;color:#3c434a;text-shadow:1px 1px 2px white;"><?php esc_html_e( 'Pay only ONCE, use it FOREVER', 'calculated-fields-form' ); ?></a></div>
|
391 |
+
<div style="font-size:18px; font-weight:400;line-height:28px;">No additional charges, <span style="background:white;display:inline-block;padding:0 5px;"><a href="https://cff.dwbooster.com/terms" target="_blank" style="text-decoration:none;">lifetime updates</a></span>, one copy for all your websites.</div>
|
392 |
+
<div style="font-size:16px; font-weight:400; font-style: italic;">And you get notification emails, payment gateways integration, data and forms exportation, advanced operations and more...</div>
|
393 |
+
<?php
|
394 |
+
print get_option( 'cff-t-t', '<div style="text-align:right; font-size:16px; font-weight:600;margin-top:15px;">To test some of the commercial features of the "Calculated Fields Form" plugin, you can <a class="button-primary" href="admin.php?page=cp_calculated_fields_form&cal=' . CP_CALCULATEDFIELDSF_ID . '&_cpcff_nonce=' . $_cpcff_nonce . '&cff-install-trial=1#cff-upgrade-frame">install the trial version</a></div>' ); // phpcs:ignore WordPress.Security.EscapeOutput
|
395 |
+
?>
|
396 |
+
</div>
|
397 |
+
<div style="clear:both;"></div>
|
398 |
+
</div>
|
399 |
+
<h2><?php esc_html_e( 'Form Processing and Payment Settings', 'calculated-fields-form' ); ?>:</h2>
|
400 |
+
<hr />
|
401 |
+
|
402 |
+
<div id="metabox_payment_settings" class="postbox metabox_disabled_section cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_payment_settings' ) ); ?>" style="position:relative;">
|
403 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Payment Settings', 'calculated-fields-form' ); ?></span></h3>
|
404 |
+
<div class="inside">
|
405 |
+
|
406 |
+
<table class="form-table">
|
407 |
+
<tr valign="top">
|
408 |
+
<th scope="row"><?php esc_html_e( 'Request cost', 'calculated-fields-form' ); ?></th>
|
409 |
+
<td><select name="request_cost" id="request_cost" class="width75"></select></td>
|
410 |
+
</tr>
|
411 |
+
|
412 |
+
<tr valign="top">
|
413 |
+
<th scope="row"><?php esc_html_e( 'Currency', 'calculated-fields-form' ); ?></th>
|
414 |
+
<td><input type="text" name="currency" value="<?php echo esc_attr( $form_obj->get_option( 'currency', CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY ) ); ?>" /><br>
|
415 |
+
<b>USD</b> (<?php esc_html_e( 'United States dollar', 'calculated-fields-form' ); ?>), <b>EUR</b> (Euro), <b>GBP</b> (<?php esc_html_e( 'Pound sterling', 'calculated-fields-form' ); ?>), ... (<a href="https://developer.paypal.com/docs/api/reference/currency-codes/" target="_blank"><?php esc_html_e( 'PayPal Currency Codes', 'calculated-fields-form' ); ?></a>)
|
416 |
+
</td>
|
417 |
+
</tr>
|
418 |
+
|
419 |
+
<tr valign="top">
|
420 |
+
<th scope="row"><?php esc_html_e( 'Base amount', 'calculated-fields-form' ); ?>:</th>
|
421 |
+
<td><input type="text" name="paypal_base_amount" value="<?php echo esc_attr( $form_obj->get_option( 'paypal_base_amount', '0.01' ) ); ?>" /><br><i style="font-size:11px;"><?php esc_html_e( 'Minimum amount to charge. If the final price is lesser than this number, the base amount will be applied.', 'calculated-fields-form' ); ?></i>
|
422 |
+
</td>
|
423 |
+
</tr>
|
424 |
+
|
425 |
+
<tr valign="top">
|
426 |
+
<th scope="row"><?php esc_html_e( 'Paypal product name', 'calculated-fields-form' ); ?></th>
|
427 |
+
<td><input type="text" name="paypal_product_name" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'paypal_product_name', CP_CALCULATEDFIELDSF_DEFAULT_PRODUCT_NAME ) ); ?>" /></td>
|
428 |
+
</tr>
|
429 |
+
|
430 |
+
<tr valign="top">
|
431 |
+
<th scope="row"><?php esc_html_e( 'Discount Codes', 'calculated-fields-form' ); ?></th>
|
432 |
+
<td>
|
433 |
+
<div id="dex_nocodes_availmsg"><?php esc_html_e( 'This feature isn\'t available in this version.', 'calculated-fields-form' ); ?></div>
|
434 |
+
|
435 |
+
<br />
|
436 |
+
<strong><?php esc_html_e( 'Add new discount code', 'calculated-fields-form' ); ?>:</strong>
|
437 |
+
<br />
|
438 |
+
<nobr><?php esc_html_e( 'Code', 'calculated-fields-form' ); ?>: <input type="text" name="dex_dc_code" id="dex_dc_code" value="" /></nobr>
|
439 |
+
<nobr><?php esc_html_e( 'Discount', 'calculated-fields-form' ); ?>: <input type="text" size="3" name="dex_dc_discount" id="dex_dc_discount" value="25" /><select name="dex_dc_discounttype" id="dex_dc_discounttype">
|
440 |
+
<option value="0"><?php esc_html_e( 'Percent', 'calculated-fields-form' ); ?></option>
|
441 |
+
<option value="1"><?php esc_html_e( 'Fixed Value', 'calculated-fields-form' ); ?></option>
|
442 |
+
</select></nobr>
|
443 |
+
|
444 |
+
<nobr><?php esc_html_e( 'Valid until', 'calculated-fields-form' ); ?>: <input type="text" size="10" name="dex_dc_expires" id="dex_dc_expires" value="" /></nobr>
|
445 |
+
<input type="button" name="dex_dc_subccode" id="dex_dc_subccode" value="<?php esc_attr_e( 'Add', 'calculated-fields-form' ); ?>" onclick="alert('This feature ins\'t available in this version');" class="button-secondary" />
|
446 |
+
<br />
|
447 |
+
<em style="font-size:11px;"><?php esc_html_e( 'Note: Expiration date based in server time. Server time now is', 'calculated-fields-form' ); ?> <?php echo esc_html( gmdate( 'Y-m-d H:i' ) ); ?></em>
|
448 |
</td>
|
449 |
+
</tr>
|
450 |
+
</table>
|
451 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
452 |
+
</div>
|
453 |
+
</div>
|
454 |
+
|
455 |
+
<div id="metabox_paypal_integration" class="postbox metabox_disabled_section cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_paypal_integration' ) ); ?>">
|
456 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Paypal Payment Configuration', 'calculated-fields-form' ); ?></span></h3>
|
457 |
+
<div class="inside">
|
458 |
+
|
459 |
+
<table class="form-table">
|
460 |
+
<tr valign="top">
|
461 |
+
<th scope="row"><?php esc_html_e( 'Enable Paypal Payments?', 'calculated-fields-form' ); ?></th>
|
462 |
+
<td><select name="enable_paypal">
|
463 |
+
<option value="0"><?php esc_html_e( 'No', 'calculated-fields-form' ); ?></option>
|
464 |
+
</select>
|
465 |
+
<br /><i style="font-size:11px;"><?php esc_html_e( 'Note: If "Optional" is selected, a radiobutton will appear in the form to select if the payment will be made with PayPal or not.', 'calculated-fields-form' ); ?></i>
|
466 |
+
<div id="cff_paypal_options_label" style="margin-top:10px;background:#EEF5FB;border: 1px dotted #888888;padding:10px;width:260px;">
|
467 |
+
<?php _e( 'Label for the "<strong>Pay with PayPal</strong>" option', 'calculated-fields-form' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>:<br />
|
468 |
+
<input type="text" size="40" style="width:250px;" />
|
469 |
+
</div></td>
|
470 |
+
</tr>
|
471 |
+
|
472 |
+
<tr valign="top">
|
473 |
+
<th scope="row"><?php esc_html_e( 'Paypal Mode', 'calculated-fields-form' ); ?></th>
|
474 |
+
<td><select name="paypal_mode" class="width75">
|
475 |
+
<option value="production" <?php if ( 'sandbox' != $form_obj->get_option( 'paypal_mode', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE ) ) {
|
476 |
+
echo 'selected';} ?>><?php esc_html_e( 'Production - real payments processed', 'calculated-fields-form' ); ?></option>
|
477 |
+
<option value="sandbox" <?php if ( 'sandbox' == $form_obj->get_option( 'paypal_mode', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE ) ) {
|
478 |
+
echo 'selected';} ?>><?php esc_html_e( 'SandBox - PayPal testing sandbox area', 'calculated-fields-form' ); ?></option>
|
479 |
+
</select>
|
480 |
+
</td>
|
481 |
+
</tr>
|
482 |
+
|
483 |
+
<tr valign="top">
|
484 |
+
<th scope="row"><?php esc_html_e( 'Paypal email', 'calculated-fields-form' ); ?></th>
|
485 |
+
<td><input type="text" name="paypal_email" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'paypal_email', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_EMAIL ) ); ?>" /></td>
|
486 |
+
</tr>
|
487 |
+
|
488 |
+
<tr valign="top">
|
489 |
+
<th scope="row"><?php esc_html_e( 'A $0 amount to pay means', 'calculated-fields-form' ); ?>:</th>
|
490 |
+
<td><select name="paypal_zero_payment" class="width75">
|
491 |
+
<option value="0" <?php if ( '1' != $form_obj->get_option( 'paypal_zero_payment', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT ) ) {
|
492 |
+
echo 'selected';} ?>><?php esc_html_e( 'Let the user enter any amount at PayPal (ex: for a donation)', 'calculated-fields-form' ); ?></option>
|
493 |
+
<option value="1" <?php if ( $form_obj->get_option( 'paypal_zero_payment', '1' == CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT ) ) {
|
494 |
+
echo 'selected';} ?>><?php esc_html_e( 'Don\'t require any payment. Form is submitted skiping the PayPal page.', 'calculated-fields-form' ); ?></option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
495 |
</select>
|
496 |
</td>
|
497 |
+
</tr>
|
498 |
+
|
499 |
+
<tr valign="top">
|
500 |
+
<th scope="row"><?php esc_html_e( 'Paypal language', 'calculated-fields-form' ); ?></th>
|
501 |
+
<td><input type="text" name="paypal_language" value="<?php echo esc_attr( $form_obj->get_option( 'paypal_language', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE ) ); ?>" /></td>
|
502 |
+
</tr>
|
503 |
+
|
504 |
+
<tr valign="top">
|
505 |
+
<th scope="row"><?php esc_html_e( 'Payment frequency', 'calculated-fields-form' ); ?></th>
|
506 |
+
<td><select name="paypal_recurrent" class="width75">
|
507 |
+
<option value="0" <?php if ( '0' == $form_obj->get_option( 'paypal_recurrent', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT ) ||
|
508 |
+
'' == $form_obj->get_option( 'paypal_recurrent', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT )
|
509 |
+
) {
|
510 |
+
echo 'selected';} ?>><?php esc_html_e( 'One time payment (default option, user is billed only once)', 'calculated-fields-form' ); ?></option>
|
511 |
+
<option value="1" <?php if ( '1' == $form_obj->get_option( 'paypal_recurrent', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT ) ) {
|
512 |
+
echo 'selected';} ?>><?php esc_html_e( 'Bill the user every 1 month', 'calculated-fields-form' ); ?></option>
|
513 |
+
<option value="3" <?php if ( '3' == $form_obj->get_option( 'paypal_recurrent', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT ) ) {
|
514 |
+
echo 'selected';} ?>><?php esc_html_e( 'Bill the user every 3 months', 'calculated-fields-form' ); ?></option>
|
515 |
+
<option value="6" <?php if ( '6' == $form_obj->get_option( 'paypal_recurrent', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT ) ) {
|
516 |
+
echo 'selected';} ?>><?php esc_html_e( 'Bill the user every 6 months', 'calculated-fields-form' ); ?></option>
|
517 |
+
<option value="12" <?php if ( '12' == $form_obj->get_option( 'paypal_recurrent', CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT ) ) {
|
518 |
+
echo 'selected';} ?>><?php esc_html_e( 'Bill the user every 12 months', 'calculated-fields-form' ); ?></option>
|
519 |
+
</select>
|
520 |
+
</td>
|
521 |
+
</tr>
|
522 |
+
<tr valign="top">
|
523 |
+
<th scope="row"><?php esc_html_e( 'Paypal prompt buyers for shipping address', 'calculated-fields-form' ); ?></th>
|
524 |
+
<td>
|
525 |
+
<?php $paypal_address = $form_obj->get_option( 'paypal_address', 1 ); ?>
|
526 |
+
<select name="paypal_address" class="width75">
|
527 |
+
<option value="1" <?php if ( 1 == $paypal_address ) {
|
528 |
+
print 'SELECTED';} ?>><?php esc_html_e( 'Do not prompt for an address', 'calculated-fields-form' ); ?></option>
|
529 |
+
<option value="0" <?php if ( 0 == $paypal_address ) {
|
530 |
+
print 'SELECTED';} ?>><?php esc_html_e( 'Prompt for an address, but do not require one', 'calculated-fields-form' ); ?></option>
|
531 |
+
<option value="2" <?php if ( 2 == $paypal_address ) {
|
532 |
+
print 'SELECTED';} ?>><?php esc_html_e( 'Prompt for an address and require one', 'calculated-fields-form' ); ?></option>
|
533 |
+
</select>
|
534 |
+
</td>
|
535 |
+
</tr>
|
536 |
+
</table>
|
537 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
538 |
+
</div>
|
539 |
+
</div>
|
540 |
+
|
541 |
+
<div id="metabox_notification_email" class="postbox metabox_disabled_section cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_notification_email' ) ); ?>" >
|
542 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Form Processing / Email Settings', 'calculated-fields-form' ); ?></span></h3>
|
543 |
+
<div class="inside">
|
544 |
+
<table class="form-table">
|
545 |
+
<tr valign="top">
|
546 |
+
<th scope="row"><?php esc_html_e( '"From" email', 'calculated-fields-form' ); ?></th>
|
547 |
+
<td><input type="text" name="fp_from_email" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'fp_from_email', CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email ) ); ?>" /><br><b><em style="font-size:11px;">Ex: admin@<?php echo esc_html( isset( $_SERVER['HTTP_HOST'] ) ? str_replace( 'www.', '', sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) ) : '' ); ?></em></b><br><em style="font-size:11px;"><?php esc_html_e( 'This email is required if the "From fixed email address" option is selected, or it is enabled the email copy to the user.', 'calculated-fields-form' ); ?></em></td>
|
548 |
+
</tr>
|
549 |
+
<tr valign="top">
|
550 |
+
<th scope="row"><?php esc_html_e( 'Destination emails (comma separated)', 'calculated-fields-form' ); ?></th>
|
551 |
+
<td><input type="text" name="fp_destination_emails" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'fp_destination_emails', CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails ) ); ?>" /></td>
|
552 |
+
</tr>
|
553 |
+
<tr valign="top">
|
554 |
+
<th scope="row"><?php esc_html_e( 'Email subject', 'calculated-fields-form' ); ?></th>
|
555 |
+
<td><input type="text" name="fp_subject" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'fp_subject', CP_CALCULATEDFIELDSF_DEFAULT_fp_subject ) ); ?>" /></td>
|
556 |
+
</tr>
|
557 |
+
<tr valign="top">
|
558 |
+
<th scope="row"><?php esc_html_e( 'Include additional information?', 'calculated-fields-form' ); ?></th>
|
559 |
+
<td>
|
560 |
+
<?php $option = $form_obj->get_option( 'fp_inc_additional_info', CP_CALCULATEDFIELDSF_DEFAULT_fp_inc_additional_info ); ?>
|
561 |
+
<select name="fp_inc_additional_info">
|
562 |
+
<option value="true"<?php if ( 'true' == $option ) {
|
563 |
+
echo ' selected';} ?>><?php esc_html_e( 'Yes', 'calculated-fields-form' ); ?></option>
|
564 |
+
<option value="false"<?php if ( 'false' == $option ) {
|
565 |
+
echo ' selected';} ?>><?php esc_html_e( 'No', 'calculated-fields-form' ); ?></option>
|
566 |
+
</select> <em style="font-size:11px;"><?php esc_html_e( 'If the "No" option is selected the plugin won\'t capture the IP address of users.', 'calculated-fields-form' ); ?></em>
|
567 |
+
</td>
|
568 |
+
</tr>
|
569 |
+
<tr valign="top">
|
570 |
+
<th scope="row"><?php esc_html_e( 'Thank you page (after sending the message)', 'calculated-fields-form' ); ?></th>
|
571 |
+
<td><input type="text" name="fp_return_page" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'fp_return_page', CP_CALCULATEDFIELDSF_DEFAULT_fp_return_page ) ); ?>" /></td>
|
572 |
+
</tr>
|
573 |
+
<tr valign="top">
|
574 |
+
<th scope="row"><?php esc_html_e( 'Email format?', 'calculated-fields-form' ); ?></th>
|
575 |
+
<td>
|
576 |
+
<?php $option = $form_obj->get_option( 'fp_emailformat', CP_CALCULATEDFIELDSF_DEFAULT_email_format ); ?>
|
577 |
+
<select name="fp_emailformat" class="width75">
|
578 |
+
<option value="text"<?php if ( 'html' != $option ) {
|
579 |
+
echo ' selected';} ?>><?php esc_html_e( 'Plain Text (default)', 'calculated-fields-form' ); ?></option>
|
580 |
+
<option value="html"<?php if ( 'html' == $option ) {
|
581 |
+
echo ' selected';} ?>><?php esc_html_e( 'HTML (use html in the textarea below)', 'calculated-fields-form' ); ?></option>
|
582 |
+
</select>
|
583 |
+
</td>
|
584 |
+
</tr>
|
585 |
+
<tr valign="top">
|
586 |
+
<th scope="row"><?php esc_html_e( 'Message', 'calculated-fields-form' ); ?></th>
|
587 |
+
<td><textarea type="text" name="fp_message" rows="6" class="width75"><?php echo esc_textarea( $form_obj->get_option( 'fp_message', CP_CALCULATEDFIELDSF_DEFAULT_fp_message ) ); ?></textarea></td>
|
588 |
+
</tr>
|
589 |
+
</table>
|
590 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
591 |
+
</div>
|
592 |
+
</div>
|
593 |
+
|
594 |
+
|
595 |
+
<div id="metabox_email_copy_to_user" class="postbox metabox_disabled_section cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_email_copy_to_user' ) ); ?>" >
|
596 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Email Copy to User', 'calculated-fields-form' ); ?></span></h3>
|
597 |
+
<div class="inside">
|
598 |
+
<table class="form-table">
|
599 |
+
<tr valign="top">
|
600 |
+
<th scope="row"><?php esc_html_e( 'Send confirmation/thank you message to user?', 'calculated-fields-form' ); ?></th>
|
601 |
+
<td>
|
602 |
+
<?php $option = $form_obj->get_option( 'cu_enable_copy_to_user', CP_CALCULATEDFIELDSF_DEFAULT_cu_enable_copy_to_user ); ?>
|
603 |
+
<select name="cu_enable_copy_to_user">
|
604 |
+
<option value="true"<?php if ( 'true' == $option ) {
|
605 |
+
echo ' selected';} ?>><?php esc_html_e( 'Yes', 'calculated-fields-form' ); ?></option>
|
606 |
+
<option value="false"<?php if ( 'false' == $option ) {
|
607 |
+
echo ' selected';} ?>><?php esc_html_e( 'No', 'calculated-fields-form' ); ?></option>
|
608 |
+
</select>
|
609 |
+
</td>
|
610 |
+
</tr>
|
611 |
+
<tr valign="top">
|
612 |
+
<th scope="row"><?php esc_html_e( 'Email field on the form', 'calculated-fields-form' ); ?></th>
|
613 |
+
<td><select id="cu_user_email_field" name="cu_user_email_field" def="<?php echo esc_attr( $form_obj->get_option( 'cu_user_email_field', CP_CALCULATEDFIELDSF_DEFAULT_cu_user_email_field ) ); ?>" class="width75"></select></td>
|
614 |
+
</tr>
|
615 |
+
<tr valign="top">
|
616 |
+
<th scope="row"><?php esc_html_e( 'Email subject', 'calculated-fields-form' ); ?></th>
|
617 |
+
<td><input type="text" name="cu_subject" class="width75" value="<?php echo esc_attr( $form_obj->get_option( 'cu_subject', CP_CALCULATEDFIELDSF_DEFAULT_cu_subject ) ); ?>" /></td>
|
618 |
+
</tr>
|
619 |
+
<tr valign="top">
|
620 |
+
<th scope="row"><?php esc_html_e( 'Email format?', 'calculated-fields-form' ); ?></th>
|
621 |
+
<td>
|
622 |
+
<?php $option = $form_obj->get_option( 'cu_emailformat', CP_CALCULATEDFIELDSF_DEFAULT_email_format ); ?>
|
623 |
+
<select name="cu_emailformat" class="width75">
|
624 |
+
<option value="text"<?php if ( 'html' != $option ) {
|
625 |
+
echo ' selected';} ?>><?php esc_html_e( 'Plain Text (default)', 'calculated-fields-form' ); ?></option>
|
626 |
+
<option value="html"<?php if ( 'html' == $option ) {
|
627 |
+
echo ' selected';} ?>><?php esc_html_e( 'HTML (use html in the textarea below)', 'calculated-fields-form' ); ?></option>
|
628 |
+
</select>
|
629 |
+
</td>
|
630 |
+
</tr>
|
631 |
+
<tr valign="top">
|
632 |
+
<th scope="row"><?php esc_html_e( 'Message', 'calculated-fields-form' ); ?></th>
|
633 |
+
<td><textarea type="text" name="cu_message" rows="6" class="width75"><?php echo esc_textarea( $form_obj->get_option( 'cu_message', CP_CALCULATEDFIELDSF_DEFAULT_cu_message ) ); ?></textarea></td>
|
634 |
+
</tr>
|
635 |
+
</table>
|
636 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
637 |
+
</div>
|
638 |
+
</div>
|
639 |
+
|
640 |
+
<div id="metabox_captcha_settings" class="postbox metabox_disabled_section cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_captcha_settings' ) ); ?>" >
|
641 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Captcha Verification', 'calculated-fields-form' ); ?></span></h3>
|
642 |
+
<div class="inside">
|
643 |
+
<table class="form-table">
|
644 |
+
<tr valign="top">
|
645 |
+
<th scope="row"><?php esc_html_e( 'Use Captcha Verification?', 'calculated-fields-form' ); ?></th>
|
646 |
+
<td colspan="5">
|
647 |
+
<?php $option = $form_obj->get_option( 'cv_enable_captcha', CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha ); ?>
|
648 |
+
<select name="cv_enable_captcha">
|
649 |
+
<option value="true"<?php if ( 'true' == $option ) {
|
650 |
+
echo ' selected';} ?>><?php esc_html_e( 'Yes', 'calculated-fields-form' ); ?></option>
|
651 |
+
<option value="false"<?php if ( 'false' == $option ) {
|
652 |
+
echo ' selected';} ?>><?php esc_html_e( 'No', 'calculated-fields-form' ); ?></option>
|
653 |
+
</select>
|
654 |
+
</td>
|
655 |
+
</tr>
|
656 |
+
|
657 |
+
<tr valign="top">
|
658 |
+
<th scope="row"><?php esc_html_e( 'Width', 'calculated-fields-form' ); ?>:</th>
|
659 |
+
<td><input type="text" readonly=readonly name="cv_width" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_width', CP_CALCULATEDFIELDSF_DEFAULT_cv_width ) ); ?>" onblur="generateCaptcha();" /></td>
|
660 |
+
<th scope="row"><?php esc_html_e( 'Height', 'calculated-fields-form' ); ?>:</th>
|
661 |
+
<td><input type="text" readonly=readonly name="cv_height" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_height', CP_CALCULATEDFIELDSF_DEFAULT_cv_height ) ); ?>" onblur="generateCaptcha();" /></td>
|
662 |
+
<th scope="row"><?php esc_html_e( 'Chars', 'calculated-fields-form' ); ?>:</th>
|
663 |
+
<td><input type="text" readonly=readonly name="cv_chars" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_chars', CP_CALCULATEDFIELDSF_DEFAULT_cv_chars ) ); ?>" onblur="generateCaptcha();" /></td>
|
664 |
+
</tr>
|
665 |
+
|
666 |
+
<tr valign="top">
|
667 |
+
<th scope="row"><?php esc_html_e( 'Min font size', 'calculated-fields-form' ); ?>:</th>
|
668 |
+
<td><input type="text" readonly=readonly name="cv_min_font_size" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_min_font_size', CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size ) ); ?>" onblur="generateCaptcha();" /></td>
|
669 |
+
<th scope="row"><?php esc_html_e( 'Max font size', 'calculated-fields-form' ); ?>:</th>
|
670 |
+
<td><input type="text" readonly=readonly name="cv_max_font_size" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_max_font_size', CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size ) ); ?>" onblur="generateCaptcha();" /></td>
|
671 |
+
<td colspan="2" rowspan="">
|
672 |
+
<?php esc_html_e( 'Preview', 'calculated-fields-form' ); ?>:<br />
|
673 |
+
<br />
|
674 |
+
<img src="<?php echo esc_url( plugins_url( '/captcha/captcha.php', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) ); ?>" id="captchaimg" alt="<?php esc_attr_e( 'security code', 'calculated-fields-form' ); ?>" border="0" class="skip-lazy" />
|
675 |
+
</td>
|
676 |
+
</tr>
|
677 |
+
|
678 |
+
|
679 |
+
<tr valign="top">
|
680 |
+
<th scope="row"><?php esc_html_e( 'Noise', 'calculated-fields-form' ); ?>:</th>
|
681 |
+
<td><input type="text" readonly=readonly name="cv_noise" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_noise', CP_CALCULATEDFIELDSF_DEFAULT_cv_noise ) ); ?>" onblur="generateCaptcha();" /></td>
|
682 |
+
<th scope="row"><?php esc_html_e( 'Noise Length', 'calculated-fields-form' ); ?>:</th>
|
683 |
+
<td><input type="text" readonly=readonly name="cv_noise_length" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_noise_length', CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length ) ); ?>" onblur="generateCaptcha();" /></td>
|
684 |
+
</tr>
|
685 |
+
|
686 |
+
<tr valign="top">
|
687 |
+
<th scope="row"><?php esc_html_e( 'Background', 'calculated-fields-form' ); ?>:</th>
|
688 |
+
<td><input type="text" readonly=readonly name="cv_background" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_background', CP_CALCULATEDFIELDSF_DEFAULT_cv_background ) ); ?>" onblur="generateCaptcha();" /></td>
|
689 |
+
<th scope="row">Border:</th>
|
690 |
+
<td><input type="text" readonly=readonly name="cv_border" size="10" value="<?php echo esc_attr( $form_obj->get_option( 'cv_border', CP_CALCULATEDFIELDSF_DEFAULT_cv_border ) ); ?>" onblur="generateCaptcha();" /></td>
|
691 |
+
</tr>
|
692 |
+
|
693 |
+
<tr valign="top">
|
694 |
+
<th scope="row"><?php esc_html_e( 'Font', 'calculated-fields-form' ); ?>:</th>
|
695 |
+
<td>
|
696 |
+
<select name="cv_font" onchange="generateCaptcha();" >
|
697 |
+
<option value="font-1.ttf"<?php if ( 'font-1.ttf' == $form_obj->get_option( 'cv_font', CP_CALCULATEDFIELDSF_DEFAULT_cv_font ) ) {
|
698 |
+
echo ' selected';} ?>>Font 1</option>
|
699 |
+
<option value="font-2.ttf"<?php if ( 'font-2.ttf' == $form_obj->get_option( 'cv_font', CP_CALCULATEDFIELDSF_DEFAULT_cv_font ) ) {
|
700 |
+
echo ' selected';} ?>>Font 2</option>
|
701 |
+
<option value="font-3.ttf"<?php if ( 'font-3.ttf' == $form_obj->get_option( 'cv_font', CP_CALCULATEDFIELDSF_DEFAULT_cv_font ) ) {
|
702 |
+
echo ' selected';} ?>>Font 3</option>
|
703 |
+
<option value="font-4.ttf"<?php if ( 'font-4.ttf' == $form_obj->get_option( 'cv_font', CP_CALCULATEDFIELDSF_DEFAULT_cv_font ) ) {
|
704 |
+
echo ' selected';} ?>>Font 4</option>
|
705 |
+
</select>
|
706 |
+
</td>
|
707 |
+
</tr>
|
708 |
+
</table>
|
709 |
+
<div class="cff-goto-top"><a href="#cpformconf"><?php esc_html_e( 'Up to form structure', 'calculated-fields-form' ); ?></a></div>
|
710 |
+
</div>
|
711 |
+
</div>
|
712 |
+
<a id="metabox_addons_section"></a>
|
713 |
+
<?php
|
714 |
+
do_action( 'cpcff_form_settings', CP_CALCULATEDFIELDSF_ID );
|
715 |
+
?>
|
716 |
+
</div>
|
717 |
+
|
718 |
+
|
719 |
+
<p class="submit">
|
720 |
+
<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" />
|
721 |
+
</p>
|
722 |
+
|
723 |
+
[<a href="https://cff.dwbooster.com/customization" target="_blank"><?php esc_html_e( 'Request Custom Modifications', 'calculated-fields-form' ); ?></a>] | [<a href="https://wordpress.org/support/plugin/calculated-fields-form#new-post" target="_blank"><?php esc_html_e( 'Help', 'calculated-fields-form' ); ?></a>]
|
724 |
+
</form>
|
725 |
+
</div>
|
726 |
+
<script type="text/javascript">
|
727 |
+
function generateCaptcha()
|
728 |
+
{
|
729 |
+
var d=new Date(),
|
730 |
+
f = document.cpformconf,
|
731 |
+
qs = "?width="+f.cv_width.value;
|
732 |
+
|
733 |
+
qs += "&height="+f.cv_height.value;
|
734 |
+
qs += "&letter_count="+f.cv_chars.value;
|
735 |
+
qs += "&min_size="+f.cv_min_font_size.value;
|
736 |
+
qs += "&max_size="+f.cv_max_font_size.value;
|
737 |
+
qs += "&noise="+f.cv_noise.value;
|
738 |
+
qs += "&noiselength="+f.cv_noise_length.value;
|
739 |
+
qs += "&bcolor="+f.cv_background.value;
|
740 |
+
qs += "&border="+f.cv_border.value;
|
741 |
+
qs += "&font="+f.cv_font.options[f.cv_font.selectedIndex].value;
|
742 |
+
qs += "&rand="+d;
|
743 |
+
|
744 |
+
document.getElementById("captchaimg").src= "<?php echo esc_url( plugins_url( '/captcha/captcha.php', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) ); ?>"+qs;
|
745 |
+
}
|
746 |
+
generateCaptcha();
|
747 |
+
</script>
|
inc/cpcff_admin_int_list.inc.php
CHANGED
@@ -1,449 +1,440 @@
|
|
1 |
-
<?php
|
2 |
-
if ( !is_admin() )
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
$_GET['
|
9 |
-
$_GET['
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
$cp_default_template
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
{
|
72 |
-
|
73 |
}
|
74 |
-
}
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
if( get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE ) == false )
|
105 |
-
{
|
106 |
-
if( file_exists( $public_js_path ) )
|
107 |
-
{
|
108 |
-
unlink( $public_js_path );
|
109 |
-
}
|
110 |
-
}
|
111 |
-
else
|
112 |
{
|
113 |
-
|
114 |
-
{
|
115 |
-
wp_remote_get(CPCFF_AUXILIARY::wp_url().((strpos(CPCFF_AUXILIARY::wp_url(),'?') === false) ? '/?' : '&').'cp_cff_resources=public&min=1', array('sslverify' => false));
|
116 |
-
}
|
117 |
}
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
<
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
<div
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
?>
|
323 |
-
</tbody>
|
324 |
-
</table>
|
325 |
-
</div>
|
326 |
-
</div>
|
327 |
-
|
328 |
-
<div id="metabox_new_form_area" class="postbox" >
|
329 |
-
<h3 class='hndle' style="padding:5px;"><span><?php _e( 'New Form', 'calculated-fields-form' ); ?></span></h3>
|
330 |
-
<div class="inside">
|
331 |
-
<form name="additem">
|
332 |
-
<?php _e( 'Item Name', 'calculated-fields-form' ); ?>(*):<br />
|
333 |
-
<div>
|
334 |
-
<input type="text" name="cp_itemname" id="cp_itemname" value="" onkeyup="cp_addItem_keyup( event );" style="margin-top:5px;" required />
|
335 |
-
<input type="text" name="calculated-fields-form-category" id="calculated-fields-form-category" value="<?php print esc_attr($cff_current_form_category); ?>" style="margin-top:5px;" placeholder="<?php esc_attr_e('Category', 'calculated-fields-form'); ?>" list="calculated-fields-form-categories" />
|
336 |
-
<datalist id="calculated-fields-form-categories">
|
337 |
-
<?php
|
338 |
-
print $cpcff_main->get_categories('DATALIST');
|
339 |
-
?>
|
340 |
-
</datalist>
|
341 |
-
<input type="button" onclick="cp_addItem();" name="gobtn" value="<?php esc_attr_e( 'Create Form', 'calculated-fields-form' ); ?>" class="button-secondary" style="margin-top:5px;" />
|
342 |
-
<input type="button" onclick="cff_openLibraryDialog();" name="gobtn" value="<?php esc_attr_e( 'From Template', 'calculated-fields-form' ); ?>" class="button-secondary" style="margin-top:5px;" />
|
343 |
-
</div>
|
344 |
-
</form>
|
345 |
-
</div>
|
346 |
-
</div>
|
347 |
-
<i id="default-settings-section"></i>
|
348 |
-
<div id="metabox_default_settings" class="postbox cff-metabox <?php print esc_attr($cpcff_main->metabox_status( 'metabox_default_settings' ) ); ?>" >
|
349 |
-
<h3 class='hndle' style="padding:5px;"><span><?php _e( 'Default Settings', 'calculated-fields-form' ); ?></span></h3>
|
350 |
-
<div class="inside">
|
351 |
-
<p><?php _e('Applies the default settings to new forms.', 'calculated-fields-form'); ?></p>
|
352 |
-
<form name="defaultsettings" action="admin.php?page=cp_calculated_fields_form" method="post">
|
353 |
-
<?php _e( 'Default Template', 'calculated-fields-form' ); ?>:<br />
|
354 |
-
<?php
|
355 |
-
require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/inc/cpcff_templates.inc.php';
|
356 |
-
$templates_list = CPCFF_TEMPLATES::load_templates();
|
357 |
-
$template_options = '<option value="">Use default template</option>';
|
358 |
-
$template_information = '';
|
359 |
-
foreach($templates_list as $template_item)
|
360 |
-
{
|
361 |
-
$template_options .= '<option value="'.esc_attr($template_item['prefix']).'" '.($template_item['prefix'] == $cp_default_template ? 'SELECTED' : '').'>'.esc_html($template_item['title']).'</option>';
|
362 |
-
$template_information .= '<div class="width50 cp_template_info cp_template_'.esc_attr($template_item['prefix']).'" style="text-align:center;padding:10px 0; display:'.($template_item['prefix'] == $cp_default_template ? 'block' : 'none').'; margin:10px 0; border: 1px dashed #CCC;">'.(!empty($template_item['thumbnail']) ? '<img src="'.esc_attr($template_item['thumbnail']).'"><br>' : '').(!empty($template_item['description']) ? esc_html($template_item['description']) : '').'</div>';
|
363 |
-
}
|
364 |
-
?>
|
365 |
-
<select name="cp_default_template" id="cp_default_template"class="width50" onchange="cp_select_template();"><?php print $template_options; ?></select><br />
|
366 |
-
<?php print $template_information; ?>
|
367 |
-
<br /><br />
|
368 |
-
<div style="border:1px solid #DADADA; padding:10px;" class="width50">
|
369 |
-
<input type="checkbox" aria-label="<?php esc_attr_e('Apply To Existing Forms', 'calculated-fields-form'); ?>" name="cp_default_existing_forms" /> <?php _e( 'Apply To Existing Forms', 'calculated-fields-form' ); ?> (<i><?php _e('It will modify the settings of existing forms', 'calculated-fields-form'); ?></i>)
|
370 |
-
</div>
|
371 |
-
<br />
|
372 |
-
<input type="button" name="cp_save_default_settings" value="<?php esc_attr_e( 'Update', 'calculated-fields-form' ); ?>" class="button-secondary" onclick="cp_update_default_settings(this);" />
|
373 |
-
<input type="hidden" name="_cpcff_nonce" value="<?php echo wp_create_nonce( 'cff-default-settings' ); ?>" />
|
374 |
-
</form>
|
375 |
-
</div>
|
376 |
-
</div>
|
377 |
-
<div style="border:1px solid #F0AD4E;background:#FBE6CA;padding:10px;margin:10px 0;font-size:1.3em;">
|
378 |
-
<div><?php _e('For additional resources visit the plugin\'s', 'calculated-fields-form')?> <a href="https://cff-bundles.dwbooster.com" target="_blank" style="font-weight:bold;"><?php _e('Marketplace', 'calculated-fields-form'); ?></a></div>
|
379 |
-
<div class="cff-bundles-plugin"></div>
|
380 |
-
</div>
|
381 |
-
<div id="metabox_troubleshoot_area" class="postbox cff-metabox <?php print esc_attr($cpcff_main->metabox_status( 'metabox_troubleshoot_area' ) ); ?>" >
|
382 |
-
<h3 class='hndle' style="padding:5px;"><span><?php _e( 'Troubleshoot Area & General Settings', 'calculated-fields-form' ); ?></span></h3>
|
383 |
-
<div class="inside">
|
384 |
-
<form name="updatesettings">
|
385 |
-
<div style="border:1px solid #DADADA; padding:10px;">
|
386 |
-
<p><?php _e( '<strong>Important!</strong>: Use this area <strong>only</strong> if you are experiencing conflicts with third party plugins, with the theme scripts or with the character encoding.', 'calculated-fields-form' ); ?></p>
|
387 |
-
<?php _e( 'Script load method', 'calculated-fields-form' ); ?>:<br />
|
388 |
-
<select id="ccscriptload" name="ccscriptload" class="width50">
|
389 |
-
<option value="0" <?php if (get_option('CP_CFF_LOAD_SCRIPTS',"0") == "1") echo 'selected'; ?>><?php _e( 'Classic (Recommended)', 'calculated-fields-form' ); ?></option>
|
390 |
-
<option value="1" <?php if (get_option('CP_CFF_LOAD_SCRIPTS',"0") != "1") echo 'selected'; ?>><?php _e( 'Direct', 'calculated-fields-form' ); ?></option>
|
391 |
-
</select><br />
|
392 |
-
<em><?php _e( '* Change the script load method if the form doesn\'t appear in the public website.', 'calculated-fields-form' ); ?></em>
|
393 |
-
<br /><br />
|
394 |
-
<?php _e( 'Character encoding', 'calculated-fields-form' ); ?>:<br />
|
395 |
-
<select id="cccharsets" name="cccharsets" class="width50">
|
396 |
-
<option value=""><?php _e( 'Keep current charset (Recommended)', 'calculated-fields-form' ); ?></option>
|
397 |
-
<option value="utf8_general_ci">UTF-8 (<?php _e( 'try this first', 'calculated-fields-form' ); ?>)</option>
|
398 |
-
<option value="utf8mb4_general_ci">UTF-8mb4 (<?php _e( 'Only from MySQL 5.5', 'calculated-fields-form' ); ?>)</option>
|
399 |
-
<option value="latin1_swedish_ci">latin1_swedish_ci</option>
|
400 |
-
</select><br />
|
401 |
-
<em><?php _e( '* Update the charset if you are getting problems displaying special/non-latin characters. After updated you need to edit the special characters again.', 'calculated-fields-form' ); ?></em>
|
402 |
-
<br /><br />
|
403 |
-
<?php
|
404 |
-
$compatibility_warnings = $cpcff_main->compatibility_warnings();
|
405 |
-
if(!empty($compatibility_warnings))
|
406 |
-
{
|
407 |
-
print '<div style="margin:10px 0; border:1px dashed #FF0000; padding:10px; color:red;">'.$compatibility_warnings;
|
408 |
-
}
|
409 |
-
_e( "There is active an optimization plugin in WordPress", 'calculated-fields-form' ); ?>:<br />
|
410 |
-
<input type="checkbox" id="ccoptimizationplugin" name="ccoptimizationplugin" value="1" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN', CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN ) ) ? 'CHECKED' : ''; ?> /><em><?php _e('* Tick the checkbox if there is an optimization plugin active on the website, and the forms are not visible.', 'calculated-fields-form'); ?></em>
|
411 |
-
<?php
|
412 |
-
if(!empty($compatibility_warnings))
|
413 |
-
{
|
414 |
-
print '</div>';
|
415 |
-
}
|
416 |
-
?>
|
417 |
-
</div>
|
418 |
-
<br />
|
419 |
-
<input type="checkbox" name="ccdisablerevisions" id="ccdisablerevisions" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS ) ) ? 'CHECKED' : ''; ?> /> <?php _e( 'Disable Form Revisions', 'calculated-fields-form' ); ?>
|
420 |
-
<br /><br />
|
421 |
-
<input type="checkbox" name="ccjscache" id="ccjscache" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE ) ) ? 'CHECKED' : ''; ?> /> <?php _e( 'Activate Javascript Cache', 'calculated-fields-form' ); ?>
|
422 |
-
<br /><br />
|
423 |
-
<input type="checkbox" name="ccdirectform" id="ccdirectform" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS ) ) ? 'CHECKED' : ''; ?> /> <?php _e( 'Allows to access the forms directly', 'calculated-fields-form' ); ?>
|
424 |
-
<br /><br />
|
425 |
-
<input type="checkbox" name="ccampform" id="ccampform" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_AMP', CP_CALCULATEDFIELDSF_AMP ) ) ? 'CHECKED' : ''; ?> /> <?php _e( 'Allows to access the forms from amp pages', 'calculated-fields-form' ); ?>
|
426 |
-
<br /><br />
|
427 |
-
<input type="checkbox" name="ccexcludecrawler" id="ccexcludecrawler" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_EXCLUDE_CRAWLERS', false ) ) ? 'CHECKED' : ''; ?> /> <?php _e( 'Do not load the forms with crawlers', 'calculated-fields-form' ); ?>
|
428 |
-
<br /><i><?php _e( '* The forms are not loaded when website is being indexed by searchers.', 'calculated-fields-form' ); ?></i>
|
429 |
-
<br /><br />
|
430 |
-
<input type="button" onclick="cp_updateConfig();" name="gobtn" value="<?php esc_attr_e( 'UPDATE', 'calculated-fields-form' ); ?>" class="button-secondary" />
|
431 |
-
<br />
|
432 |
-
</form>
|
433 |
-
</div>
|
434 |
-
</div>
|
435 |
-
</div>
|
436 |
-
</div><!-- End Forms & Settings Section -->
|
437 |
-
<div style="margin-top:20px;display:<?php print (!empty($_GET['cff-tab']) && $_GET['cff-tab'] == 'marketplace' ) ? 'block' : 'none'; ?>;"><!-- Marketplace Section -->
|
438 |
-
<div id="metabox_basic_settings" class="postbox" >
|
439 |
-
<h3 class='hndle' style="padding:5px;"><span><?php _e( 'Calculated Fields Form Marketplace', 'calculated-fields-form' ); ?></span></h3>
|
440 |
-
<div class="inside">
|
441 |
-
<div class="cff-marketplace"></div>
|
442 |
-
</div>
|
443 |
-
</div>
|
444 |
-
</div><!-- End Marketplace Section -->
|
445 |
-
[<a href="https://cff.dwbooster.com/customization" target="_blank"><?php _e( 'Request Custom Modifications', 'calculated-fields-form' ); ?></a>] | [<a href="https://cff.dwbooster.com/download" target="_blank"><?php _e( 'Upgrade', '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>]
|
446 |
-
</div>
|
447 |
-
<script>cff_current_version='free';</script>
|
448 |
-
<script src="https://cff-bundles.dwbooster.com/plugins/plugins.js?v=<?php print CP_CALCULATEDFIELDSF_VERSION.'_'.date('Y-m-d'); ?>"></script>
|
449 |
-
<script src="<?php print esc_attr( plugins_url('/vendors/forms.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH).'?v='.CP_CALCULATEDFIELDSF_VERSION.'_'.date('Y-m-d') ); ?>"></script>
|
1 |
+
<?php
|
2 |
+
if ( ! is_admin() ) {
|
3 |
+
print 'Direct access not allowed.';
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
$_GET['u'] = ( isset( $_GET['u'] ) ) ? intval( @$_GET['u'] ) : 0;
|
8 |
+
$_GET['c'] = ( isset( $_GET['c'] ) ) ? intval( @$_GET['c'] ) : 0;
|
9 |
+
$_GET['d'] = ( isset( $_GET['d'] ) ) ? intval( @$_GET['d'] ) : 0;
|
10 |
+
|
11 |
+
global $wpdb;
|
12 |
+
$cpcff_main = CPCFF_MAIN::instance();
|
13 |
+
|
14 |
+
$message = '';
|
15 |
+
|
16 |
+
if ( isset( $_GET['orderby'] ) ) {
|
17 |
+
update_option( 'CP_CALCULATEDFIELDSF_FORMS_LIST_ORDERBY', 'form_name' == $_GET['orderby'] ? 'form_name' : 'id' );
|
18 |
+
}
|
19 |
+
|
20 |
+
$cp_default_template = CP_CALCULATEDFIELDSF_DEFAULT_template;
|
21 |
+
|
22 |
+
if ( isset( $_REQUEST['cp_default_template'] ) ) {
|
23 |
+
check_admin_referer( 'cff-default-settings', '_cpcff_nonce' );
|
24 |
+
|
25 |
+
$cp_default_template = sanitize_text_field( wp_unslash( $_REQUEST['cp_default_template'] ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
26 |
+
|
27 |
+
// Update default settings
|
28 |
+
update_option( 'CP_CALCULATEDFIELDSF_DEFAULT_template', $cp_default_template );
|
29 |
+
|
30 |
+
if ( isset( $_REQUEST['cp_default_existing_forms'] ) ) {
|
31 |
+
$myrows = $wpdb->get_results( 'SELECT id,form_structure,enable_submit,cv_enable_captcha FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
32 |
+
foreach ( $myrows as $item ) {
|
33 |
+
$form_structure = preg_replace( '/"formtemplate"\s*\:\s*"[^"]*"/', '"formtemplate":"' . esc_js( $cp_default_template ) . '"', $item->form_structure );
|
34 |
+
|
35 |
+
$wpdb->update(
|
36 |
+
$wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
37 |
+
array(
|
38 |
+
'form_structure' => $form_structure,
|
39 |
+
),
|
40 |
+
array(
|
41 |
+
'id' => $item->id,
|
42 |
+
),
|
43 |
+
array( '%s' ),
|
44 |
+
array( '%d' )
|
45 |
+
);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
$message = __( 'Default settings updated', 'calculated-fields-form' );
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( isset( $_GET['a'] ) && '1' == $_GET['a'] ) {
|
53 |
+
check_admin_referer( 'cff-add-form', '_cpcff_nonce' );
|
54 |
+
$new_form = $cpcff_main->create_form(
|
55 |
+
isset( $_GET['name'] ) ? sanitize_text_field( wp_unslash( $_GET['name'] ) ) : '',
|
56 |
+
isset( $_GET['category'] ) ? sanitize_text_field( wp_unslash( $_GET['category'] ) ) : '',
|
57 |
+
isset( $_GET['ftpl'] ) ? sanitize_text_field( wp_unslash( $_GET['ftpl'] ) ) : 0
|
58 |
+
);
|
59 |
+
// Update the default category
|
60 |
+
$cff_current_form_category = get_option( 'calculated-fields-form-category', '' );
|
61 |
+
if ( ! empty( $cff_current_form_category ) ) {
|
62 |
+
update_option( 'calculated-fields-form-category', sanitize_text_field( wp_unslash( $_GET['category'] ) ) );
|
63 |
+
}
|
64 |
+
|
65 |
+
$message = __( 'Item added', 'calculated-fields-form' );
|
66 |
+
if ( $new_form ) {
|
67 |
+
print "<script>document.location = 'admin.php?page=cp_calculated_fields_form&cal=" . esc_js( $new_form->get_id() ) . '&r=' . esc_js( rand() ) . '&_cpcff_nonce=' . esc_js( wp_create_nonce( 'cff-form-settings' ) ) . "';</script>";
|
68 |
+
}
|
69 |
+
} elseif ( ! empty( $_GET['u'] ) ) {
|
70 |
+
check_admin_referer( 'cff-update-form', '_cpcff_nonce' );
|
71 |
+
$cpcff_main->get_form( sanitize_text_field( wp_unslash( $_GET['u'] ) ) )->update_name( ( isset( $_GET['name'] ) ) ? sanitize_text_field( wp_unslash( $_GET['name'] ) ) : '' );
|
72 |
+
$message = __( 'Item updated', 'calculated-fields-form' );
|
73 |
+
} elseif ( ! empty( $_GET['d'] ) ) {
|
74 |
+
check_admin_referer( 'cff-delete-form', '_cpcff_nonce' );
|
75 |
+
$cpcff_main->delete_form( sanitize_text_field( wp_unslash( $_GET['d'] ) ) );
|
76 |
+
$message = __( 'Item deleted', 'calculated-fields-form' );
|
77 |
+
} elseif ( ! empty( $_GET['c'] ) ) {
|
78 |
+
check_admin_referer( 'cff-clone-form', '_cpcff_nonce' );
|
79 |
+
if ( is_numeric( $_GET['c'] ) && $cpcff_main->clone_form( intval( $_GET['c'] ) ) !== false ) {
|
80 |
+
$message = __( 'Item duplicated/cloned', 'calculated-fields-form' );
|
81 |
+
} else {
|
82 |
+
$message = __( 'Duplicate/Clone Error, the form cannot be cloned', 'calculated-fields-form' );
|
83 |
+
}
|
84 |
+
} elseif ( isset( $_GET['ac'] ) && 'st' == $_GET['ac'] ) {
|
85 |
+
check_admin_referer( 'cff-update-general-settings', '_cpcff_nonce' );
|
86 |
+
update_option( 'CP_CFF_LOAD_SCRIPTS', ( isset( $_GET['scr'] ) && '1' == $_GET['scr'] ? '0' : '1' ) );
|
87 |
+
update_option( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', ( isset( $_GET['dr'] ) && '1' == $_GET['dr'] ? 1 : 0 ) );
|
88 |
+
update_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', ( isset( $_GET['jsc'] ) && '1' == $_GET['jsc'] ? 1 : 0 ) );
|
89 |
+
update_option( 'CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN', ( isset( $_GET['optm'] ) && '1' == $_GET['optm'] ? 1 : 0 ) );
|
90 |
+
update_option( 'CP_CALCULATEDFIELDSF_EXCLUDE_CRAWLERS', ( isset( $_GET['ecr'] ) && '1' == $_GET['ecr'] ? 1 : 0 ) );
|
91 |
+
update_option( 'CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', ( isset( $_GET['df'] ) && '1' == $_GET['df'] ? 1 : 0 ) );
|
92 |
+
update_option( 'CP_CALCULATEDFIELDSF_AMP', ( isset( $_GET['amp'] ) && '1' == $_GET['amp'] ? 1 : 0 ) );
|
93 |
+
|
94 |
+
$public_js_path = CP_CALCULATEDFIELDSF_BASE_PATH . '/js/cache/all.js';
|
95 |
+
try {
|
96 |
+
if ( get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE ) == false ) {
|
97 |
+
if ( file_exists( $public_js_path ) ) {
|
98 |
+
unlink( $public_js_path );
|
99 |
+
}
|
100 |
+
} else {
|
101 |
+
if ( ! file_exists( $public_js_path ) ) {
|
102 |
+
wp_remote_get( CPCFF_AUXILIARY::wp_url() . ( ( strpos( CPCFF_AUXILIARY::wp_url(), '?' ) === false ) ? '/?' : '&' ) . 'cp_cff_resources=public&min=1', array( 'sslverify' => false ) );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
} catch ( Exception $err ) {
|
106 |
+
error_log( $err->getMessage() );
|
107 |
+
}
|
108 |
+
|
109 |
+
if ( ! empty( $_GET['chs'] ) ) {
|
110 |
+
$target_charset = sanitize_text_field( wp_unslash( $_GET['chs'] ) );
|
111 |
+
if ( ! in_array( $target_charset, array( 'utf8_general_ci', 'utf8mb4_general_ci', 'latin1_swedish_ci' ) ) ) {
|
112 |
+
$target_charset = 'utf8_general_ci';
|
113 |
+
}
|
114 |
+
|
115 |
+
$tables = array( $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE, $wpdb->prefix . CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX );
|
116 |
+
foreach ( $tables as $tab ) { // phpcs:ignore WordPress.WP.GlobalVariablesOverride
|
117 |
+
$myrows = $wpdb->get_results( "DESCRIBE {$tab}" ); // phpcs:ignore WordPress.DB.PreparedSQL
|
118 |
+
foreach ( $myrows as $item ) {
|
119 |
+
$name = $item->Field;
|
120 |
+
$type = $item->Type; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
|
121 |
+
if ( preg_match( '/^varchar\((\d+)\)$/i', $type, $mat ) || ! strcasecmp( $type, 'CHAR' ) || ! strcasecmp( $type, 'TEXT' ) || ! strcasecmp( $type, 'MEDIUMTEXT' ) ) {
|
122 |
+
$wpdb->query( "ALTER TABLE {$tab} CHANGE {$name} {$name} {$type} COLLATE {$target_charset}" ); // phpcs:ignore WordPress.DB.PreparedSQL
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$message = __( 'Troubleshoot settings updated', 'calculated-fields-form' );
|
128 |
+
}
|
129 |
+
|
130 |
+
// For sortin the forms list
|
131 |
+
$orderby = get_option( 'CP_CALCULATEDFIELDSF_FORMS_LIST_ORDERBY', 'id' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
|
132 |
+
if ( $message ) {
|
133 |
+
echo "<div id='setting-error-settings_updated' class='" . ( stripos( $message, 'error' ) !== false ? 'error' : 'updated' ) . " settings-error'><p><strong>" . esc_html( $message ) . '</strong></p></div>';
|
134 |
+
}
|
135 |
+
|
136 |
+
?>
|
137 |
+
<div class="wrap">
|
138 |
+
<?php
|
139 |
+
if ( get_option( 'cff-t-f', 0 ) ) :
|
140 |
+
?>
|
141 |
+
<div style="border:1px solid #F0AD4E;background:#FBE6CA;padding:10px;margin:10px 0;font-size:1.3em;">
|
142 |
+
<?php print get_option( 'cff-t-t', '' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
143 |
+
</div>
|
144 |
+
<?php
|
145 |
+
delete_option( 'cff-t-f' );
|
146 |
+
endif;
|
147 |
+
?>
|
148 |
+
<h1><?php esc_html_e( 'Calculated Fields Form', 'calculated-fields-form' ); ?></h1>
|
149 |
+
|
150 |
+
<script type="text/javascript">
|
151 |
+
var cff_metabox_nonce = '<?php print esc_js( wp_create_nonce( 'cff-metabox-status' ) ); ?>';
|
152 |
+
function cp_addItem()
|
153 |
+
{
|
154 |
+
var e = jQuery("#cp_itemname"),
|
155 |
+
form_tag = e.closest('form')[0],
|
156 |
+
calname = e.val().replace(/^\s*/, '').replace(/^\s*/, '').replace(/\s*$/, ''),
|
157 |
+
category = document.getElementById("calculated-fields-form-category").value;
|
158 |
+
|
159 |
+
e.val(calname);
|
160 |
+
|
161 |
+
if('reportValidity' in form_tag && !form_tag.reportValidity()) return;
|
162 |
+
|
163 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&a=1&r='+Math.random()+'&name='+encodeURIComponent(calname)+'&category='+encodeURIComponent(category)+'&_cpcff_nonce=<?php echo esc_js( wp_create_nonce( 'cff-add-form' ) ); ?>';
|
164 |
+
}
|
165 |
+
|
166 |
+
function cp_addItem_keyup( e )
|
167 |
+
{
|
168 |
+
e.which = e.which || e.keyCode;
|
169 |
+
if(e.which == 13) cp_addItem();
|
170 |
+
}
|
171 |
+
|
172 |
+
function cp_updateItem(id)
|
173 |
+
{
|
174 |
+
var calname = document.getElementById("calname_"+id).value;
|
175 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&u='+id+'&r='+Math.random()+'&name='+encodeURIComponent(calname)+'&_cpcff_nonce=<?php echo esc_js( wp_create_nonce( 'cff-update-form' ) ); ?>';
|
176 |
+
}
|
177 |
+
|
178 |
+
function cp_cloneItem(id)
|
179 |
+
{
|
180 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&c='+id+'&r='+Math.random()+'&_cpcff_nonce=<?php echo esc_js( wp_create_nonce( 'cff-clone-form' ) ); ?>';
|
181 |
+
}
|
182 |
+
|
183 |
+
function cp_manageSettings(id)
|
184 |
+
{
|
185 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&cal='+id+'&r='+Math.random()+'&_cpcff_nonce=<?php echo esc_js( wp_create_nonce( 'cff-form-settings' ) ); ?>';
|
186 |
+
}
|
187 |
+
|
188 |
+
function cp_viewMessages(id)
|
189 |
+
{
|
190 |
+
alert('Not available in this version. Check other versions at: '+"\n\n"+'https://cff.dwbooster.com/download');
|
191 |
+
}
|
192 |
+
|
193 |
+
function cp_BookingsList(id)
|
194 |
+
{
|
195 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&cal='+id+'&list=1&r='+Math.random();
|
196 |
+
}
|
197 |
+
|
198 |
+
function cp_deleteItem(id)
|
199 |
+
{
|
200 |
+
if (confirm('<?php esc_html_e( 'Are you sure you want to delete this item?', 'calculated-fields-form' ); ?>'))
|
201 |
{
|
202 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&d='+id+'&r='+Math.random()+'&_cpcff_nonce=<?php echo esc_js( wp_create_nonce( 'cff-delete-form' ) ); ?>';
|
203 |
}
|
204 |
+
}
|
205 |
+
|
206 |
+
function cp_updateConfig()
|
207 |
+
{
|
208 |
+
if (confirm('<?php esc_html_e( 'Are you sure you want to update these settings?', 'calculated-fields-form' ); ?>'))
|
209 |
+
{
|
210 |
+
var scr = document.getElementById("ccscriptload").value,
|
211 |
+
chs = document.getElementById("cccharsets").value,
|
212 |
+
dr = (document.getElementById("ccdisablerevisions").checked) ? 1 : 0,
|
213 |
+
jsc = (document.getElementById("ccjscache").checked) ? 1 : 0,
|
214 |
+
optm = (document.getElementById("ccoptimizationplugin").checked) ? 1 : 0,
|
215 |
+
df = (document.getElementById("ccdirectform").checked) ? 1 : 0,
|
216 |
+
amp = (document.getElementById("ccampform").checked) ? 1 : 0,
|
217 |
+
ecr = (document.getElementById("ccexcludecrawler").checked) ? 1 : 0;
|
218 |
+
|
219 |
+
document.location = 'admin.php?page=cp_calculated_fields_form&ecr='+ecr+'&ac=st&scr='+scr+'&chs='+chs+'&dr='+dr+'&jsc='+jsc+'&optm='+optm+'&df='+df+'&='+amp+'&r='+Math.random()+'&_cpcff_nonce=<?php echo esc_js( wp_create_nonce( 'cff-update-general-settings' ) ); ?>';
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
function cp_select_template()
|
224 |
+
{
|
225 |
+
jQuery('.cp_template_info').hide();
|
226 |
+
jQuery('.cp_template_'+jQuery('#cp_default_template').val()).show();
|
227 |
+
}
|
228 |
+
|
229 |
+
function cp_update_default_settings(e)
|
230 |
+
{
|
231 |
+
if(jQuery('[name="cp_default_existing_forms"]').prop('checked'))
|
232 |
+
{
|
233 |
+
if (confirm('<?php esc_html_e( 'Are you sure you want to modify existing forms?\\nWe recommend modifying the forms one by one.', 'calculated-fields-form' ); ?>'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
{
|
235 |
+
e.form.submit();
|
|
|
|
|
|
|
236 |
}
|
237 |
+
}
|
238 |
+
else e.form.submit();
|
239 |
+
}
|
240 |
+
</script>
|
241 |
+
<h2 class="nav-tab-wrapper">
|
242 |
+
<a href="admin.php?page=cp_calculated_fields_form&cff-tab=forms" class="nav-tab <?php if ( empty( $_GET['cff-tab'] ) || 'forms' == $_GET['cff-tab'] ) {
|
243 |
+
print 'nav-tab-active';} ?>"><?php esc_html_e( 'Forms and Settings', 'calculated-fields-form' ); ?></a>
|
244 |
+
<a href="admin.php?page=cp_calculated_fields_form&cff-tab=marketplace" class="nav-tab <?php if ( ! empty( $_GET['cff-tab'] ) && 'marketplace' == $_GET['cff-tab'] ) {
|
245 |
+
print 'nav-tab-active';} ?>"><?php esc_html_e( 'Marketplace', 'calculated-fields-form' ); ?></a>
|
246 |
+
</h2>
|
247 |
+
<div style="margin-top:20px;display:<?php print ( empty( $_GET['cff-tab'] ) || 'forms' == $_GET['cff-tab'] ) ? 'block' : 'none'; ?>;"><!-- Forms & Settings Section -->
|
248 |
+
<div id="normal-sortables" class="meta-box-sortables">
|
249 |
+
|
250 |
+
<!-- Form Categories -->
|
251 |
+
<div id="metabox_categories_list" class="postbox" >
|
252 |
+
<div class="inside" style="overflow-x:auto;">
|
253 |
+
<form action="admin.php?page=cp_calculated_fields_form" method="post">
|
254 |
+
<?php
|
255 |
+
if ( isset( $_POST['calculated-fields-form-category'] ) ) {
|
256 |
+
check_admin_referer( 'cff-change-category', '_cpcff_nonce' );
|
257 |
+
update_option( 'calculated-fields-form-category', sanitize_text_field( wp_unslash( $_POST['calculated-fields-form-category'] ) ) );
|
258 |
+
}
|
259 |
+
$cff_current_form_category = get_option( 'calculated-fields-form-category', '' );
|
260 |
+
?>
|
261 |
+
<input type="hidden" name="_cpcff_nonce" value="<?php echo esc_attr( wp_create_nonce( 'cff-change-category' ) ); ?>" />
|
262 |
+
<b><?php esc_html_e( 'Form Categories', 'calculated-fields-form' ); ?></b>
|
263 |
+
<select name="calculated-fields-form-category" class="width50" onchange="this.form.submit();">
|
264 |
+
<option value=""><?php esc_html_e( 'All forms', 'calculated-fields-form' ); ?></option>
|
265 |
+
<?php
|
266 |
+
print $cpcff_main->get_categories( 'SELECT', $cff_current_form_category ); // phpcs:ignore WordPress.Security.EscapeOutput
|
267 |
+
?>
|
268 |
+
</select>
|
269 |
+
</form>
|
270 |
+
</div>
|
271 |
+
</div>
|
272 |
+
|
273 |
+
<!-- Forms List -->
|
274 |
+
<div id="metabox_form_list" class="postbox" >
|
275 |
+
<h3 class='hndle' style="padding:5px;"><span><?php
|
276 |
+
esc_html_e( 'Form List / Items List', 'calculated-fields-form' );
|
277 |
+
|
278 |
+
if ( '' != $cff_current_form_category ) {
|
279 |
+
print ' ' . esc_html__( 'in', 'calculated-fields-form' ) . ' <u>' . esc_html( $cff_current_form_category ) . '</u> ' . esc_html__( 'category', 'calculated-fields-form' );
|
280 |
+
}
|
281 |
+
?></span></h3>
|
282 |
+
<div class="inside" style="overflow-x:auto;">
|
283 |
+
<table cellspacing="10" class="cff-custom-table cff-forms-list">
|
284 |
+
<thead>
|
285 |
+
<tr>
|
286 |
+
<th align="left"><a href="?page=cp_calculated_fields_form&orderby=id" <?php if ( 'id' == $orderby ) {
|
287 |
+
print 'class="cff-active-column"';} ?>><?php esc_html_e( 'ID', 'calculated-fields-form' ); ?></a></th>
|
288 |
+
<th align="left"><a href="?page=cp_calculated_fields_form&orderby=form_name" <?php if ( 'form_name' == $orderby ) {
|
289 |
+
print 'class="cff-active-column"';} ?>><?php esc_html_e( 'Form Name', 'calculated-fields-form' ); ?></a></th>
|
290 |
+
<th align="center"><?php esc_html_e( 'Options', 'calculated-fields-form' ); ?></th>
|
291 |
+
<th align="left"><?php esc_html_e( 'Category/Shortcode', 'calculated-fields-form' ); ?></th>
|
292 |
+
</tr>
|
293 |
+
</thead>
|
294 |
+
<tbody>
|
295 |
+
<?php
|
296 |
+
$myrows = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . ( '' != $cff_current_form_category ? $wpdb->prepare( ' WHERE category=%s ', $cff_current_form_category ) : '' ) . ' ORDER BY ' . $orderby . ' ASC' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
297 |
+
foreach ( $myrows as $item ) {
|
298 |
+
?>
|
299 |
+
<tr>
|
300 |
+
<td nowrap><?php echo esc_html( $item->id ); ?></td>
|
301 |
+
<td nowrap><input type="text" name="calname_<?php echo esc_attr( $item->id ); ?>" id="calname_<?php echo esc_attr( $item->id ); ?>" value="<?php echo esc_attr( $item->form_name ); ?>" /></td>
|
302 |
+
<td nowrap>
|
303 |
+
<input type="button" name="calupdate_<?php echo esc_attr( $item->id ); ?>" value="<?php esc_attr_e( 'Update', 'calculated-fields-form' ); ?>" onclick="cp_updateItem(<?php echo esc_attr( $item->id ); ?>);" class="button-secondary" />
|
304 |
+
<input type="button" name="calmanage_<?php echo esc_attr( $item->id ); ?>" value="<?php esc_attr_e( 'Settings', 'calculated-fields-form' ); ?>" onclick="cp_manageSettings(<?php echo esc_attr( $item->id ); ?>);" class="button-primary" />
|
305 |
+
<input type="button" name="calmanage_<?php echo esc_attr( $item->id ); ?>" value="<?php esc_attr_e( 'Messages', 'calculated-fields-form' ); ?>" onclick="cp_viewMessages(<?php echo esc_attr( $item->id ); ?>);" class="button-secondary" />
|
306 |
+
<input type="button" name="calclone_<?php echo esc_attr( $item->id ); ?>" value="<?php esc_attr_e( 'Clone', 'calculated-fields-form' ); ?>" onclick="cp_cloneItem(<?php echo esc_attr( $item->id ); ?>);" class="button-secondary" />
|
307 |
+
<input type="button" name="caldelete_<?php echo esc_attr( $item->id ); ?>" value="<?php esc_attr_e( 'Delete', 'calculated-fields-form' ); ?>" onclick="cp_deleteItem(<?php echo esc_attr( $item->id ); ?>);" class="button-secondary" />
|
308 |
+
</td>
|
309 |
+
<td><?php if ( ! empty( $item->category ) ) {
|
310 |
+
print esc_html__( 'Category: ', 'calculated-fields-form' ) . '<b>' . esc_html( $item->category ) . '</b><br>';} ?><div style="white-space:nowrap;">[CP_CALCULATED_FIELDS id="<?php echo esc_attr( $item->id ); ?>"]</div></td>
|
311 |
+
</tr>
|
312 |
+
<?php
|
313 |
+
}
|
314 |
+
?>
|
315 |
+
</tbody>
|
316 |
+
</table>
|
317 |
+
</div>
|
318 |
+
</div>
|
319 |
+
|
320 |
+
<div id="metabox_new_form_area" class="postbox" >
|
321 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'New Form', 'calculated-fields-form' ); ?></span></h3>
|
322 |
+
<div class="inside">
|
323 |
+
<form name="additem">
|
324 |
+
<?php esc_html_e( 'Item Name', 'calculated-fields-form' ); ?>(*):<br />
|
325 |
+
<div>
|
326 |
+
<input type="text" name="cp_itemname" id="cp_itemname" value="" onkeyup="cp_addItem_keyup( event );" style="margin-top:5px;" required />
|
327 |
+
<input type="text" name="calculated-fields-form-category" id="calculated-fields-form-category" value="<?php print esc_attr( $cff_current_form_category ); ?>" style="margin-top:5px;" placeholder="<?php esc_attr_e( 'Category', 'calculated-fields-form' ); ?>" list="calculated-fields-form-categories" />
|
328 |
+
<datalist id="calculated-fields-form-categories">
|
329 |
+
<?php
|
330 |
+
print $cpcff_main->get_categories( 'DATALIST' ); // phpcs:ignore WordPress.Security.EscapeOutput
|
331 |
+
?>
|
332 |
+
</datalist>
|
333 |
+
<input type="button" onclick="cp_addItem();" name="gobtn" value="<?php esc_attr_e( 'Create Form', 'calculated-fields-form' ); ?>" class="button-secondary" style="margin-top:5px;" />
|
334 |
+
<input type="button" onclick="cff_openLibraryDialog();" name="gobtn" value="<?php esc_attr_e( 'From Template', 'calculated-fields-form' ); ?>" class="button-secondary" style="margin-top:5px;" />
|
335 |
+
</div>
|
336 |
+
</form>
|
337 |
+
</div>
|
338 |
+
</div>
|
339 |
+
<i id="default-settings-section"></i>
|
340 |
+
<div id="metabox_default_settings" class="postbox cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_default_settings' ) ); ?>" >
|
341 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Default Settings', 'calculated-fields-form' ); ?></span></h3>
|
342 |
+
<div class="inside">
|
343 |
+
<p><?php esc_html_e( 'Applies the default settings to new forms.', 'calculated-fields-form' ); ?></p>
|
344 |
+
<form name="defaultsettings" action="admin.php?page=cp_calculated_fields_form" method="post">
|
345 |
+
<?php esc_html_e( 'Default Template', 'calculated-fields-form' ); ?>:<br />
|
346 |
+
<?php
|
347 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_templates.inc.php';
|
348 |
+
$templates_list = CPCFF_TEMPLATES::load_templates();
|
349 |
+
$template_options = '<option value="">Use default template</option>';
|
350 |
+
$template_information = '';
|
351 |
+
foreach ( $templates_list as $template_item ) {
|
352 |
+
$template_options .= '<option value="' . esc_attr( $template_item['prefix'] ) . '" ' . ( $template_item['prefix'] == $cp_default_template ? 'SELECTED' : '' ) . '>' . esc_html( $template_item['title'] ) . '</option>';
|
353 |
+
$template_information .= '<div class="width50 cp_template_info cp_template_' . esc_attr( $template_item['prefix'] ) . '" style="text-align:center;padding:10px 0; display:' . ( $template_item['prefix'] == $cp_default_template ? 'block' : 'none' ) . '; margin:10px 0; border: 1px dashed #CCC;">' . ( ! empty( $template_item['thumbnail'] ) ? '<img src="' . esc_attr( $template_item['thumbnail'] ) . '"><br>' : '' ) . ( ! empty( $template_item['description'] ) ? esc_html( $template_item['description'] ) : '' ) . '</div>';
|
354 |
+
}
|
355 |
+
?>
|
356 |
+
<select name="cp_default_template" id="cp_default_template"class="width50" onchange="cp_select_template();"><?php print $template_options; // phpcs:ignore WordPress.Security.EscapeOutput ?></select><br />
|
357 |
+
<?php print $template_information; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
358 |
+
<br /><br />
|
359 |
+
<div style="border:1px solid #DADADA; padding:10px;" class="width50">
|
360 |
+
<input type="checkbox" aria-label="<?php esc_attr_e( 'Apply To Existing Forms', 'calculated-fields-form' ); ?>" name="cp_default_existing_forms" /> <?php esc_html_e( 'Apply To Existing Forms', 'calculated-fields-form' ); ?> (<i><?php esc_html_e( 'It will modify the settings of existing forms', 'calculated-fields-form' ); ?></i>)
|
361 |
+
</div>
|
362 |
+
<br />
|
363 |
+
<input type="button" name="cp_save_default_settings" value="<?php esc_attr_e( 'Update', 'calculated-fields-form' ); ?>" class="button-secondary" onclick="cp_update_default_settings(this);" />
|
364 |
+
<input type="hidden" name="_cpcff_nonce" value="<?php echo esc_attr( wp_create_nonce( 'cff-default-settings' ) ); ?>" />
|
365 |
+
</form>
|
366 |
+
</div>
|
367 |
+
</div>
|
368 |
+
<div style="border:1px solid #F0AD4E;background:#FBE6CA;padding:10px;margin:10px 0;font-size:1.3em;">
|
369 |
+
<div><?php esc_html_e( 'For additional resources visit the plugin\'s', 'calculated-fields-form' ); ?> <a href="https://cff-bundles.dwbooster.com" target="_blank" style="font-weight:bold;"><?php esc_html_e( 'Marketplace', 'calculated-fields-form' ); ?></a></div>
|
370 |
+
<div class="cff-bundles-plugin"></div>
|
371 |
+
</div>
|
372 |
+
<div id="metabox_troubleshoot_area" class="postbox cff-metabox <?php print esc_attr( $cpcff_main->metabox_status( 'metabox_troubleshoot_area' ) ); ?>" >
|
373 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Troubleshoot Area & General Settings', 'calculated-fields-form' ); ?></span></h3>
|
374 |
+
<div class="inside">
|
375 |
+
<form name="updatesettings">
|
376 |
+
<div style="border:1px solid #DADADA; padding:10px;">
|
377 |
+
<p><?php _e( '<strong>Important!</strong>: Use this area <strong>only</strong> if you are experiencing conflicts with third party plugins, with the theme scripts or with the character encoding.', 'calculated-fields-form' ); // phpcs:ignore WordPress.Security.EscapeOutput ?></p>
|
378 |
+
<?php esc_html_e( 'Script load method', 'calculated-fields-form' ); ?>:<br />
|
379 |
+
<select id="ccscriptload" name="ccscriptload" class="width50">
|
380 |
+
<option value="0" <?php if ( get_option( 'CP_CFF_LOAD_SCRIPTS', '0' ) == '1' ) {
|
381 |
+
echo 'selected';} ?>><?php esc_html_e( 'Classic (Recommended)', 'calculated-fields-form' ); ?></option>
|
382 |
+
<option value="1" <?php if ( get_option( 'CP_CFF_LOAD_SCRIPTS', '0' ) != '1' ) {
|
383 |
+
echo 'selected';} ?>><?php esc_html_e( 'Direct', 'calculated-fields-form' ); ?></option>
|
384 |
+
</select><br />
|
385 |
+
<em><?php esc_html_e( '* Change the script load method if the form doesn\'t appear in the public website.', 'calculated-fields-form' ); ?></em>
|
386 |
+
<br /><br />
|
387 |
+
<?php esc_html_e( 'Character encoding', 'calculated-fields-form' ); ?>:<br />
|
388 |
+
<select id="cccharsets" name="cccharsets" class="width50">
|
389 |
+
<option value=""><?php esc_html_e( 'Keep current charset (Recommended)', 'calculated-fields-form' ); ?></option>
|
390 |
+
<option value="utf8_general_ci">UTF-8 (<?php esc_html_e( 'try this first', 'calculated-fields-form' ); ?>)</option>
|
391 |
+
<option value="utf8mb4_general_ci">UTF-8mb4 (<?php esc_html_e( 'Only from MySQL 5.5', 'calculated-fields-form' ); ?>)</option>
|
392 |
+
<option value="latin1_swedish_ci">latin1_swedish_ci</option>
|
393 |
+
</select><br />
|
394 |
+
<em><?php esc_html_e( '* Update the charset if you are getting problems displaying special/non-latin characters. After updated you need to edit the special characters again.', 'calculated-fields-form' ); ?></em>
|
395 |
+
<br /><br />
|
396 |
+
<?php
|
397 |
+
$compatibility_warnings = $cpcff_main->compatibility_warnings();
|
398 |
+
if ( ! empty( $compatibility_warnings ) ) {
|
399 |
+
print '<div style="margin:10px 0; border:1px dashed #FF0000; padding:10px; color:red;">' . $compatibility_warnings; // phpcs:ignore WordPress.Security.EscapeOutput
|
400 |
+
}
|
401 |
+
esc_html_e( 'There is active an optimization plugin in WordPress', 'calculated-fields-form' ); ?>:<br />
|
402 |
+
<input type="checkbox" id="ccoptimizationplugin" name="ccoptimizationplugin" value="1" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN', CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN ) ) ? 'CHECKED' : ''; ?> /><em><?php esc_html_e( '* Tick the checkbox if there is an optimization plugin active on the website, and the forms are not visible.', 'calculated-fields-form' ); ?></em>
|
403 |
+
<?php
|
404 |
+
if ( ! empty( $compatibility_warnings ) ) {
|
405 |
+
print '</div>';
|
406 |
+
}
|
407 |
+
?>
|
408 |
+
</div>
|
409 |
+
<br />
|
410 |
+
<input type="checkbox" name="ccdisablerevisions" id="ccdisablerevisions" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS ) ) ? 'CHECKED' : ''; ?> /> <?php esc_html_e( 'Disable Form Revisions', 'calculated-fields-form' ); ?>
|
411 |
+
<br /><br />
|
412 |
+
<input type="checkbox" name="ccjscache" id="ccjscache" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE ) ) ? 'CHECKED' : ''; ?> /> <?php esc_html_e( 'Activate Javascript Cache', 'calculated-fields-form' ); ?>
|
413 |
+
<br /><br />
|
414 |
+
<input type="checkbox" name="ccdirectform" id="ccdirectform" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS', CP_CALCULATEDFIELDSF_DIRECT_FORM_ACCESS ) ) ? 'CHECKED' : ''; ?> /> <?php esc_html_e( 'Allows to access the forms directly', 'calculated-fields-form' ); ?>
|
415 |
+
<br /><br />
|
416 |
+
<input type="checkbox" name="ccampform" id="ccampform" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_AMP', CP_CALCULATEDFIELDSF_AMP ) ) ? 'CHECKED' : ''; ?> /> <?php esc_html_e( 'Allows to access the forms from amp pages', 'calculated-fields-form' ); ?>
|
417 |
+
<br /><br />
|
418 |
+
<input type="checkbox" name="ccexcludecrawler" id="ccexcludecrawler" <?php echo ( get_option( 'CP_CALCULATEDFIELDSF_EXCLUDE_CRAWLERS', false ) ) ? 'CHECKED' : ''; ?> /> <?php esc_html_e( 'Do not load the forms with crawlers', 'calculated-fields-form' ); ?>
|
419 |
+
<br /><i><?php esc_html_e( '* The forms are not loaded when website is being indexed by searchers.', 'calculated-fields-form' ); ?></i>
|
420 |
+
<br /><br />
|
421 |
+
<input type="button" onclick="cp_updateConfig();" name="gobtn" value="<?php esc_attr_e( 'UPDATE', 'calculated-fields-form' ); ?>" class="button-secondary" />
|
422 |
+
<br />
|
423 |
+
</form>
|
424 |
+
</div>
|
425 |
+
</div>
|
426 |
+
</div>
|
427 |
+
</div><!-- End Forms & Settings Section -->
|
428 |
+
<div style="margin-top:20px;display:<?php print ( ! empty( $_GET['cff-tab'] ) && 'marketplace' == $_GET['cff-tab'] ) ? 'block' : 'none'; ?>;"><!-- Marketplace Section -->
|
429 |
+
<div id="metabox_basic_settings" class="postbox" >
|
430 |
+
<h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Calculated Fields Form Marketplace', 'calculated-fields-form' ); ?></span></h3>
|
431 |
+
<div class="inside">
|
432 |
+
<div class="cff-marketplace"></div>
|
433 |
+
</div>
|
434 |
+
</div>
|
435 |
+
</div><!-- End Marketplace Section -->
|
436 |
+
[<a href="https://cff.dwbooster.com/customization" target="_blank"><?php esc_html_e( 'Request Custom Modifications', 'calculated-fields-form' ); ?></a>] | [<a href="https://cff.dwbooster.com/download" target="_blank"><?php esc_html_e( 'Upgrade', 'calculated-fields-form' ); ?></a>] | [<a href="https://wordpress.org/support/plugin/calculated-fields-form#new-post" target="_blank"><?php esc_html_e( 'Help', 'calculated-fields-form' ); ?></a>]
|
437 |
+
</div>
|
438 |
+
<script>cff_current_version='free';</script>
|
439 |
+
<script src="https://cff-bundles.dwbooster.com/plugins/plugins.js?v=<?php print esc_attr( CP_CALCULATEDFIELDSF_VERSION . '_' . gmdate( 'Y-m-d' ) ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>"></script>
|
440 |
+
<script src="<?php print esc_attr( plugins_url( '/vendors/forms.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) . '?v=' . CP_CALCULATEDFIELDSF_VERSION . '_' . gmdate( 'Y-m-d' ) ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_amp.inc.php
CHANGED
@@ -1,222 +1,229 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Actions required to include the forms in the AMP pages: CPCFF_AMP class
|
4 |
-
*
|
5 |
-
* @package CFF.
|
6 |
-
* @since 1.0.230
|
7 |
-
*/
|
8 |
-
|
9 |
-
if(!class_exists('CPCFF_AMP'))
|
10 |
-
|
11 |
-
|
12 |
-
*
|
13 |
-
*
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
*
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'>'.
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
|
62 |
-
if(
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
if(
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
'</
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
*
|
112 |
-
*
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
{
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
} // End
|
182 |
-
|
183 |
-
/**
|
184 |
-
*
|
185 |
-
*
|
186 |
-
*
|
187 |
-
*
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
$
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Actions required to include the forms in the AMP pages: CPCFF_AMP class
|
4 |
+
*
|
5 |
+
* @package CFF.
|
6 |
+
* @since 1.0.230
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CPCFF_AMP' ) ) {
|
10 |
+
/**
|
11 |
+
* Class that defines the operations to display the foms in AMP pages.
|
12 |
+
*
|
13 |
+
* @since 1.0.170
|
14 |
+
*/
|
15 |
+
class CPCFF_AMP {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Main plugin object
|
19 |
+
*/
|
20 |
+
private $_main_obj;
|
21 |
+
|
22 |
+
public function __construct( $main_obj ) {
|
23 |
+
$this->_main_obj = $main_obj;
|
24 |
+
add_action( 'init', array( $this, 'amp_init' ) ); // for amp pages.
|
25 |
+
} // End __construct
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Loads the form's preview in AMP pages.
|
29 |
+
*
|
30 |
+
* @return void.
|
31 |
+
*/
|
32 |
+
public function amp_init() {
|
33 |
+
if (
|
34 |
+
! empty( $_GET['cff-amp-form'] ) &&
|
35 |
+
get_option( 'CP_CALCULATEDFIELDSF_AMP', CP_CALCULATEDFIELDSF_AMP )
|
36 |
+
) {
|
37 |
+
$atts = $this->_params_to_attrs();
|
38 |
+
$page_title = ( ! empty( $atts['page_title'] ) ) ? $atts['page_title'] : '';
|
39 |
+
print '<!DOCTYPE html><html ' .
|
40 |
+
( ( function_exists( 'is_rtl' ) && is_rtl() ) ? 'dir="rtl"' : '' ) .
|
41 |
+
'>' .
|
42 |
+
'<head>' .
|
43 |
+
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' .
|
44 |
+
'<meta name="viewport" content="width=device-width">' .
|
45 |
+
'<title>' . esc_html( $page_title ) . '</title>';
|
46 |
+
|
47 |
+
// Patch for editor preview
|
48 |
+
if ( empty( $_GET['cff-editor-preview'] ) ) {
|
49 |
+
print '<style>' .
|
50 |
+
'body{background:#FFF;overflow:hidden;margin:0;}' .
|
51 |
+
'html, body {height:100%;position:relative;min-height:100%;display:block;}' .
|
52 |
+
'#fbuilder{' . $this->_get_styles() . 'box-sizing:border-box!important;}' . // phpcs:ignore WordPress.Security.EscapeOutput
|
53 |
+
'</style>';
|
54 |
+
}
|
55 |
+
|
56 |
+
global $wp_styles, $wp_scripts;
|
57 |
+
if ( ! empty( $wp_scripts ) ) {
|
58 |
+
$wp_scripts->reset();
|
59 |
+
}
|
60 |
+
$message = $this->_main_obj->public_form( $atts );
|
61 |
+
// Patch for editor preview
|
62 |
+
if ( empty( $_GET['cff-editor-preview'] ) ) {
|
63 |
+
$message = preg_replace( '/<form\s+/i', '<form target="_parent" ', $message, 1 );
|
64 |
+
$message = preg_replace(
|
65 |
+
'/<\/form>/i',
|
66 |
+
'</form><pre style="display:none !important;"><script>try{
|
67 |
+
document.addEventListener("DOMContentLoaded",
|
68 |
+
function(){fbuilderjQuery(document).one("showHideDepEvent", function(){window.parent.postMessage({sentinel: "amp",type:"embed-size",height: document.body.scrollHeight+25}, "*");});});}catch(err){console.log(err);}</script></pre>',
|
69 |
+
$message,
|
70 |
+
1
|
71 |
+
);
|
72 |
+
}
|
73 |
+
ob_start();
|
74 |
+
if ( ! empty( $wp_styles ) ) {
|
75 |
+
$wp_styles->do_items();
|
76 |
+
}
|
77 |
+
if ( ! empty( $wp_scripts ) ) {
|
78 |
+
$wp_scripts->do_items();
|
79 |
+
}
|
80 |
+
if ( class_exists( 'Error' ) ) {
|
81 |
+
try {
|
82 |
+
wp_footer(); } catch ( Error $err ) {
|
83 |
+
error_log( $err->getMessage() );
|
84 |
+
}
|
85 |
+
}
|
86 |
+
$message .= ob_get_contents();
|
87 |
+
ob_end_clean();
|
88 |
+
|
89 |
+
// Patch for editor preview
|
90 |
+
if ( ! empty( $_GET['cff-editor-preview'] ) ) {
|
91 |
+
$message .= '<script type="text/javascript">
|
92 |
+
window.addEventListener("load",
|
93 |
+
function() {
|
94 |
+
var frameEl = window.frameElement;
|
95 |
+
if(frameEl && typeof fbuilderjQuery != "undefined")
|
96 |
+
frameEl.height = fbuilderjQuery("form").outerHeight(true) + 25;
|
97 |
+
}, false);
|
98 |
+
</script>';
|
99 |
+
}
|
100 |
+
print '</head>' .
|
101 |
+
'<body>' .
|
102 |
+
$message . // phpcs:ignore WordPress.Security.EscapeOutput
|
103 |
+
'</body>' .
|
104 |
+
'</html>';
|
105 |
+
remove_all_actions( 'shutdown' );
|
106 |
+
exit;
|
107 |
+
}
|
108 |
+
} // End amp_init
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Checks if the page is AMP or not
|
112 |
+
*
|
113 |
+
* Checks first for the existence of functions: "is_amp_endpoint" or "ampforwp_is_amp_endpoint",
|
114 |
+
* and if they don't exists, checks the URL.
|
115 |
+
*
|
116 |
+
* @return bool.
|
117 |
+
*/
|
118 |
+
public function is_amp() {
|
119 |
+
if ( ! get_option( 'CP_CALCULATEDFIELDSF_AMP', CP_CALCULATEDFIELDSF_AMP ) ) {
|
120 |
+
return false;
|
121 |
+
}
|
122 |
+
if ( ! empty( $_REQUEST['isamp'] ) ) {
|
123 |
+
return true;
|
124 |
+
}
|
125 |
+
if ( empty( $_GET['non-amp'] ) ) {
|
126 |
+
if ( function_exists( 'ampforwp_is_amp_endpoint' ) ) {
|
127 |
+
return ampforwp_is_amp_endpoint();
|
128 |
+
} elseif ( function_exists( 'is_amp_endpoint' ) ) {
|
129 |
+
return is_amp_endpoint();
|
130 |
+
}
|
131 |
+
}
|
132 |
+
return false;
|
133 |
+
} // End is_amp
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Returns an iframe tag for loading the a webpage with the form only, specially useful for AMP pages.
|
137 |
+
*
|
138 |
+
* @return string, the iframe tag's structure for loading a page with the form.
|
139 |
+
*/
|
140 |
+
public function get_iframe( $atts ) {
|
141 |
+
$url = CPCFF_AUXILIARY::site_url();
|
142 |
+
$url = preg_replace( '/^http\:/i', 'https:', $url );
|
143 |
+
$url .= ( strpos( $url, '?' ) === false ) ? '?' : '&';
|
144 |
+
$url .= 'cff-amp-form=' . ( ( ! empty( $atts['id'] ) ) ? $atts['id'] : '' );
|
145 |
+
$height = '';
|
146 |
+
$width = '';
|
147 |
+
foreach ( $atts as $attr_name => $attr_value ) {
|
148 |
+
if ( 'amp_iframe_height' == $attr_name ) {
|
149 |
+
$height = $attr_value;
|
150 |
+
} elseif ( 'amp_iframe_width' == $attr_name ) {
|
151 |
+
$width = $attr_value;
|
152 |
+
} elseif ( 'id' != $attr_name ) {
|
153 |
+
$url .= '&cff-form-attr-' . $attr_name . '=' . $attr_value;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
if ( empty( $height ) ) {
|
158 |
+
$height = 320;
|
159 |
+
} else {
|
160 |
+
$url .= '&cff-form-height=' . $height;
|
161 |
+
}
|
162 |
+
if ( empty( $width ) ) {
|
163 |
+
$width = 500;
|
164 |
+
}
|
165 |
+
|
166 |
+
$url .= '&non-amp=1';
|
167 |
+
|
168 |
+
add_action( 'amp_post_template_css', array( $this, 'amp_css' ) );
|
169 |
+
add_filter( 'amp_post_template_data', array( $this, 'amp_iframe' ) );
|
170 |
+
|
171 |
+
return '<amp-iframe id="cff-form-iframe" src="' . esc_attr( esc_url( $url ) ) . '" layout="responsive" resizable sandbox="allow-popups allow-forms allow-top-navigation allow-modals allow-scripts" width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '"><amp-img src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBpZD0ic3ZnOCIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMTMuMjI5MTY3IDEzLjIyOTE2NyIgaGVpZ2h0PSI1MCIgd2lkdGg9IjUwIj48ZGVmcyBpZD0iZGVmczIiIC8+PG1ldGFkYXRhIGlkPSJtZXRhZGF0YTUiPjxyZGY6UkRGPjxjYzpXb3JrIHJkZjphYm91dD0iIj48ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD48ZGM6dHlwZSByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPjxkYzp0aXRsZT48L2RjOnRpdGxlPjwvY2M6V29yaz48L3JkZjpSREY+PC9tZXRhZGF0YT48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLC0yODMuNzcwODMpIiBpZD0ibGF5ZXIxIiAvPjwvc3ZnPg==" placeholder layout="responsive" width="50" height="50" /><div overflow tabindex=0 role=button style="bottom:0;border-bottom:2px dotted #ccc; width:100%;"><div aria-label="' . esc_attr__( 'Click to expand', 'calculated-fields-form' ) . '" style="margin-bottom:10px;margin-left:50%;transform:translate(-50%);padding:10px 20px;background:#666;color:white;border-radius:5px;display:inline-block;">' . esc_html( __( 'Click to expand', 'calculated-fields-form' ) ) . '</div></div></amp-iframe>';
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Includes the CSS rules for the amp version of form
|
176 |
+
*
|
177 |
+
* @param object, template.
|
178 |
+
*/
|
179 |
+
public function amp_css( $template ) {
|
180 |
+
print '#cff-form-iframe{margin:0;}';
|
181 |
+
} // End amp_css
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Checks if the amp-iframe.js was included, and includes it if not.
|
185 |
+
*
|
186 |
+
* @param $data, associative array.
|
187 |
+
* @return $data, associative array.
|
188 |
+
*/
|
189 |
+
public function amp_iframe( $data ) {
|
190 |
+
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
|
191 |
+
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
|
192 |
+
}
|
193 |
+
return $data;
|
194 |
+
} // End amp_iframe
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Converts the URL parameters related with the form in the redirection process required for load the forms into the amp-frames
|
198 |
+
*
|
199 |
+
* The parameter cff-amp-form is converted in the id attribute,
|
200 |
+
* and the parameteres with the name: cff-form-attr-<param>, are converted in the attributes <param>
|
201 |
+
*
|
202 |
+
* @return array $attrs.
|
203 |
+
*/
|
204 |
+
private function _params_to_attrs() {
|
205 |
+
$attrs = array();
|
206 |
+
if ( ! empty( $_GET ) ) {
|
207 |
+
foreach ( $_GET as $param => $value ) {
|
208 |
+
if ( 'cff-amp-form' == $param ) {
|
209 |
+
$attrs['id'] = @intval( $value );
|
210 |
+
} elseif ( preg_match( '/^cff\-form\-attr\-/i', $param ) ) {
|
211 |
+
$param = preg_replace( '/^cff\-form\-attr\-/i', '', $param );
|
212 |
+
$param = sanitize_text_field( $param );
|
213 |
+
$attrs[ $param ] = sanitize_text_field( $value );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
return $attrs;
|
218 |
+
} // End _params_to_attrs
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Reads the form height from the URL parameter cff-form-height, returns 500 by default.
|
222 |
+
*
|
223 |
+
* @return int.
|
224 |
+
*/
|
225 |
+
private function _get_styles() {
|
226 |
+
return ( ! empty( $_GET['cff-form-height'] ) && is_numeric( $_GET['cff-form-height'] ) && ( $height = intval( $_GET['cff-form-height'] ) ) !== 0 ) ? 'overflow-x:hidden;overflow-y:auto;height:' . $height . 'px;padding:5px 32px 5px 5px;' : ''; // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
inc/cpcff_auxiliary.inc.php
CHANGED
@@ -1,407 +1,387 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Miscellaneous operations: CPCFF_AUXILIARY class
|
4 |
-
*
|
5 |
-
* Metaclass with miscellanous operations used through all plugin.
|
6 |
-
*
|
7 |
-
* @package CFF.
|
8 |
-
* @since 1.0.167
|
9 |
-
*/
|
10 |
-
|
11 |
-
if(!class_exists('CPCFF_AUXILIARY'))
|
12 |
-
|
13 |
-
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
*
|
24 |
-
*
|
25 |
-
* @
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
*
|
32 |
-
*
|
33 |
-
* @
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
*
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
*
|
47 |
-
*
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
*
|
54 |
-
*
|
55 |
-
*
|
56 |
-
*
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
return self::$_wp_id;
|
63 |
-
} // End blog_id
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Returns the public URL of the current blog.
|
67 |
-
*
|
68 |
-
* If the URL was read previously, uses the value stored in class property.
|
69 |
-
*
|
70 |
-
* @since 1.0.167
|
71 |
-
* @return string.
|
72 |
-
*/
|
73 |
-
public static function site_url( $no_protocol = false )
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
return $_site_url;
|
83 |
-
} // End site_url
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Returns the URL to the WordPress of the current blog.
|
87 |
-
*
|
88 |
-
* If the URL was read previously, uses the value stored in class property.
|
89 |
-
*
|
90 |
-
* @since 1.0.167
|
91 |
-
* @return string.
|
92 |
-
*/
|
93 |
-
public static function wp_url()
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
} // End wp_current_url
|
126 |
-
|
127 |
-
/**
|
128 |
-
* Sanitizes the value received as parameter, supporting the same posts tags
|
129 |
-
*
|
130 |
-
* @since Pro 5.0.235, Dev 5.0.279, Plat 10.0.318
|
131 |
-
*
|
132 |
-
* @params mixed $v.
|
133 |
-
* @return sanitized value.
|
134 |
-
*/
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
*
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
$
|
210 |
-
|
211 |
-
//
|
212 |
-
$
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
$sql
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
*
|
236 |
-
*
|
237 |
-
*
|
238 |
-
*
|
239 |
-
* @
|
240 |
-
*
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
*
|
259 |
-
*
|
260 |
-
*
|
261 |
-
*
|
262 |
-
* @
|
263 |
-
*
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
{
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
{
|
277 |
-
$array1[ $key1 ][ $key2 ] = $val2;
|
278 |
-
}
|
279 |
-
}
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
}
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
*
|
295 |
-
*
|
296 |
-
*
|
297 |
-
*
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
return
|
316 |
-
}
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
*
|
340 |
-
*
|
341 |
-
*
|
342 |
-
*
|
343 |
-
* @
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
)
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
*
|
360 |
-
*
|
361 |
-
* @
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
true == WP_DEBUG
|
389 |
-
)
|
390 |
-
{
|
391 |
-
if(
|
392 |
-
is_array( $log ) ||
|
393 |
-
is_object( $log )
|
394 |
-
)
|
395 |
-
{
|
396 |
-
error_log( print_r( $log, true ) );
|
397 |
-
}
|
398 |
-
else
|
399 |
-
{
|
400 |
-
error_log( $log );
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}catch(Exception $err){}
|
404 |
-
} // End write_log
|
405 |
-
|
406 |
-
} // End CPCFF_AUXILIARY
|
407 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Miscellaneous operations: CPCFF_AUXILIARY class
|
4 |
+
*
|
5 |
+
* Metaclass with miscellanous operations used through all plugin.
|
6 |
+
*
|
7 |
+
* @package CFF.
|
8 |
+
* @since 1.0.167
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'CPCFF_AUXILIARY' ) ) {
|
12 |
+
/**
|
13 |
+
* Metaclass with miscellaneous operations.
|
14 |
+
*
|
15 |
+
* Publishes miscellanous operations to be used through all plugin's sections.
|
16 |
+
*
|
17 |
+
* @since 1.0.167
|
18 |
+
*/
|
19 |
+
class CPCFF_AUXILIARY {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Public URL of the current blog.
|
23 |
+
*
|
24 |
+
* @since 1.0.167
|
25 |
+
* @var string $_site_url
|
26 |
+
*/
|
27 |
+
private static $_site_url;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* URL to the WordPress of the current blog.
|
31 |
+
*
|
32 |
+
* @since 1.0.167
|
33 |
+
* @var string $_wp_url
|
34 |
+
*/
|
35 |
+
private static $_wp_url;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Current URL.
|
39 |
+
*
|
40 |
+
* @var string $_current_url
|
41 |
+
*/
|
42 |
+
private static $_current_url;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* ID of the current blog.
|
46 |
+
*
|
47 |
+
* @var string $_wp_id
|
48 |
+
*/
|
49 |
+
private static $_wp_id;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Returns the id of current blog.
|
53 |
+
*
|
54 |
+
* If the ID was read previously, uses the value stored in class property.
|
55 |
+
*
|
56 |
+
* @return int.
|
57 |
+
*/
|
58 |
+
public static function blog_id() {
|
59 |
+
if ( empty( self::$_wp_id ) ) {
|
60 |
+
self::$_wp_id = get_current_blog_id();
|
61 |
+
}
|
62 |
+
return self::$_wp_id;
|
63 |
+
} // End blog_id
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Returns the public URL of the current blog.
|
67 |
+
*
|
68 |
+
* If the URL was read previously, uses the value stored in class property.
|
69 |
+
*
|
70 |
+
* @since 1.0.167
|
71 |
+
* @return string.
|
72 |
+
*/
|
73 |
+
public static function site_url( $no_protocol = false ) {
|
74 |
+
if ( empty( self::$_site_url ) ) {
|
75 |
+
$blog = self::blog_id();
|
76 |
+
self::$_site_url = get_home_url( $blog, '', is_ssl() ? 'https' : 'http' );
|
77 |
+
}
|
78 |
+
$_site_url = rtrim( self::$_site_url, '/' );
|
79 |
+
if ( $no_protocol ) {
|
80 |
+
$_site_url = preg_replace( '/^http(s?)\:/i', '', $_site_url );
|
81 |
+
}
|
82 |
+
return $_site_url;
|
83 |
+
} // End site_url
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Returns the URL to the WordPress of the current blog.
|
87 |
+
*
|
88 |
+
* If the URL was read previously, uses the value stored in class property.
|
89 |
+
*
|
90 |
+
* @since 1.0.167
|
91 |
+
* @return string.
|
92 |
+
*/
|
93 |
+
public static function wp_url() {
|
94 |
+
if ( empty( self::$_wp_url ) ) {
|
95 |
+
$blog = self::blog_id();
|
96 |
+
self::$_wp_url = get_admin_url( $blog );
|
97 |
+
}
|
98 |
+
return rtrim( self::$_wp_url, '/' );
|
99 |
+
} // End wp_url
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Returns the form editor.
|
103 |
+
*/
|
104 |
+
public static function editor_url() {
|
105 |
+
return self::wp_url() . '/admin.php?page=cp_calculated_fields_form&_cpcff_nonce=' . wp_create_nonce( 'cff-form-settings' ) . '&cal=';
|
106 |
+
} // End editor_url
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Returns the URL to the current post url.
|
110 |
+
*
|
111 |
+
* @return string.
|
112 |
+
*/
|
113 |
+
public static function wp_current_url() {
|
114 |
+
if ( is_admin() ) {
|
115 |
+
return self::site_url();
|
116 |
+
}
|
117 |
+
if ( ! empty( self::$_current_url ) ) {
|
118 |
+
return self::$_current_url;
|
119 |
+
}
|
120 |
+
|
121 |
+
$protocol = ( ( ! empty( $_SERVER['HTTPS'] ) && 'off' != $_SERVER['HTTPS'] ) || ( ! empty( $_SERVER['SERVER_PORT'] ) && 443 == $_SERVER['SERVER_PORT'] ) ) ? 'https://' : 'http://';
|
122 |
+
|
123 |
+
self::$_current_url = $protocol . ( isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '' ) . ( isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '' );
|
124 |
+
return self::$_current_url;
|
125 |
+
} // End wp_current_url
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Sanitizes the value received as parameter, supporting the same posts tags
|
129 |
+
*
|
130 |
+
* @since Pro 5.0.235, Dev 5.0.279, Plat 10.0.318
|
131 |
+
*
|
132 |
+
* @params mixed $v.
|
133 |
+
* @return sanitized value.
|
134 |
+
*/
|
135 |
+
public static function sanitize( $v ) {
|
136 |
+
$allowed_tags = wp_kses_allowed_html( 'post' );
|
137 |
+
|
138 |
+
add_filter(
|
139 |
+
'safecss_filter_attr_allow_css',
|
140 |
+
function( $allow_css, $css_test_string ) {
|
141 |
+
if ( preg_match( '/rgb(a)?\(/i', $css_test_string ) ) {
|
142 |
+
return true;
|
143 |
+
}
|
144 |
+
return $allow_css;
|
145 |
+
},
|
146 |
+
10,
|
147 |
+
2
|
148 |
+
);
|
149 |
+
|
150 |
+
$v = wp_kses( $v, $allowed_tags );
|
151 |
+
|
152 |
+
// the str_replace is a patch to solve an issue with the data: part in signature fields
|
153 |
+
// that are removed by wp_kse.
|
154 |
+
return str_replace(
|
155 |
+
array( '"image/svg+xml;base64', '"image/png;base64' ),
|
156 |
+
array( '"data:image/svg+xml;base64', '"data:image/png;base64' ),
|
157 |
+
$v
|
158 |
+
);
|
159 |
+
} // End sanitize
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Removes Bom characters.
|
163 |
+
*
|
164 |
+
* @since 1.0.179
|
165 |
+
*
|
166 |
+
* @param string $str.
|
167 |
+
* @return string.
|
168 |
+
*/
|
169 |
+
public static function clean_bom( $str ) {
|
170 |
+
$bom = pack( 'H*', 'EFBBBF' );
|
171 |
+
return preg_replace( "/$bom/", '', $str );
|
172 |
+
} // End clean_bom
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Converts some characters in a JSON string.
|
176 |
+
*
|
177 |
+
* @since 1.0.169
|
178 |
+
*
|
179 |
+
* @param string $str JSON string.
|
180 |
+
* @return string.
|
181 |
+
*/
|
182 |
+
public static function clean_json( $str ) {
|
183 |
+
return str_replace(
|
184 |
+
array( ' ', "\n", "\r" ),
|
185 |
+
array( ' ', '\n', '' ),
|
186 |
+
$str
|
187 |
+
);
|
188 |
+
} // End clean_json
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Set the hook for cleanning the expired transients
|
192 |
+
*
|
193 |
+
* @since 1.0.281
|
194 |
+
*/
|
195 |
+
public static function clean_transients_hook() {
|
196 |
+
add_action( 'cpcff_clean_transients', array( 'CPCFF_AUXILIARY', 'clean_transients' ) );
|
197 |
+
if ( ! wp_next_scheduled( 'cpcff_clean_transients' ) ) {
|
198 |
+
wp_schedule_event( time() + 5, 'daily', 'cpcff_clean_transients' );
|
199 |
+
}
|
200 |
+
} // End clean_transients_hook
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Clean the expired transients
|
204 |
+
*
|
205 |
+
* @since 1.0.281
|
206 |
+
*/
|
207 |
+
public static function clean_transients() {
|
208 |
+
global $wpdb;
|
209 |
+
$table = $wpdb->options;
|
210 |
+
|
211 |
+
// get current PHP time, offset by a minute to avoid clashes with other tasks
|
212 |
+
$threshold = time() - MINUTE_IN_SECONDS;
|
213 |
+
|
214 |
+
// delete expired transients, using the paired timeout record to find them
|
215 |
+
$sql = "
|
216 |
+
delete from t1, t2
|
217 |
+
using $table t1
|
218 |
+
join $table t2 on t2.option_name = replace(t1.option_name, '_timeout', '')
|
219 |
+
where t1.option_name like '\_transient\_timeout\_%'
|
220 |
+
and t1.option_value < '$threshold'
|
221 |
+
";
|
222 |
+
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
223 |
+
|
224 |
+
// delete orphaned transient expirations
|
225 |
+
$sql = "
|
226 |
+
delete from $table
|
227 |
+
where option_name like '\_transient\_timeout\_%'
|
228 |
+
and option_value < '$threshold'
|
229 |
+
";
|
230 |
+
|
231 |
+
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
232 |
+
} // End clean_transients
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Decodes a JSON string.
|
236 |
+
*
|
237 |
+
* Decode a JSON string, and receive a parameter to apply strip slashes first or not.
|
238 |
+
*
|
239 |
+
* @since 1.0.169
|
240 |
+
*
|
241 |
+
* @param string $str JSON string.
|
242 |
+
* @param string $stripcslashes Optional. To apply a stripcslashes to the text before json_decode. Default 'unescape'.
|
243 |
+
* @return mixed PHP Oject or False.
|
244 |
+
*/
|
245 |
+
public static function json_decode( $str, $stripcslashes = 'unescape' ) {
|
246 |
+
try {
|
247 |
+
$str = self::clean_json( $str );
|
248 |
+
if ( 'unescape' == $stripcslashes ) {
|
249 |
+
$str = stripcslashes( $str );
|
250 |
+
}
|
251 |
+
$obj = json_decode( $str );
|
252 |
+
} catch ( Exception $err ) {
|
253 |
+
self::write_log( $err ); }
|
254 |
+
return ( ! empty( $obj ) ) ? $obj : false;
|
255 |
+
} // End unserialize
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Replaces recursively the elements in an array by the elements in another one.
|
259 |
+
*
|
260 |
+
* The method will use the PHP function: array_replace_recursive if exists.
|
261 |
+
*
|
262 |
+
* @since 1.0.169
|
263 |
+
*
|
264 |
+
* @param array $array1
|
265 |
+
* @param array $array2
|
266 |
+
* @return array
|
267 |
+
*/
|
268 |
+
public static function array_replace_recursive( $array1, $array2 ) {
|
269 |
+
// If the array_replace_recursive function exists, use it
|
270 |
+
if ( function_exists( 'array_replace_recursive' ) ) {
|
271 |
+
return array_replace_recursive( $array1, $array2 );
|
272 |
+
}
|
273 |
+
foreach ( $array2 as $key1 => $val1 ) {
|
274 |
+
if ( isset( $array1[ $key1 ] ) ) {
|
275 |
+
if ( is_array( $val1 ) ) {
|
276 |
+
foreach ( $val1 as $key2 => $val2 ) {
|
277 |
+
$array1[ $key1 ][ $key2 ] = $val2;
|
278 |
+
}
|
279 |
+
} else {
|
280 |
+
$array1[ $key1 ] = $val1;
|
281 |
+
}
|
282 |
+
} else {
|
283 |
+
$array1[ $key1 ] = $val1;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
return $array1;
|
287 |
+
} // End array_replace_recursive
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Applies stripcslashes to the array elements recursively.
|
291 |
+
*
|
292 |
+
* The method checks if parameter is an array a text. If it is an array the method is called recursively.
|
293 |
+
*
|
294 |
+
* @since 1.0.176
|
295 |
+
*
|
296 |
+
* @param mixed $v array or single value.
|
297 |
+
* @return mixed the array or value with the slashes stripped
|
298 |
+
*/
|
299 |
+
public static function stripcslashes_recursive( $v ) {
|
300 |
+
if ( is_array( $v ) ) {
|
301 |
+
foreach ( $v as $k => $s ) {
|
302 |
+
$v[ $k ] = self::stripcslashes_recursive( $s );
|
303 |
+
}
|
304 |
+
return $v;
|
305 |
+
} else {
|
306 |
+
return stripcslashes( $v );
|
307 |
+
}
|
308 |
+
} // End stripcslashes_recursive
|
309 |
+
|
310 |
+
public static function stripscript_recursive( $v ) {
|
311 |
+
if ( is_array( $v ) ) {
|
312 |
+
foreach ( $v as $k => $s ) {
|
313 |
+
$v[ $k ] = self::stripscript_recursive( $s );
|
314 |
+
}
|
315 |
+
return $v;
|
316 |
+
} else {
|
317 |
+
return preg_replace( array( '/<\s*script\b.*\bscript\s*>/i', '/<\s*script[^>]*>/i' ), '', $v );
|
318 |
+
}
|
319 |
+
} // End stripscript_recursive
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Checks if the website is being visited by a crawler.
|
323 |
+
*
|
324 |
+
* Returns true if the website is being visited by a search engine spider,
|
325 |
+
* and the plugin was configure for hidding the forms front them, else false.
|
326 |
+
*
|
327 |
+
* @since 1.0.169
|
328 |
+
*
|
329 |
+
* @return bool.
|
330 |
+
*/
|
331 |
+
public static function is_crawler() {
|
332 |
+
return ( isset( $_SERVER['HTTP_USER_AGENT'] ) &&
|
333 |
+
preg_match( '/bot|crawl|slurp|spider/i', sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ) &&
|
334 |
+
get_option( 'CP_CALCULATEDFIELDSF_EXCLUDE_CRAWLERS', false )
|
335 |
+
);
|
336 |
+
} // End is_crawler
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Adds the attribute: property="stylesheet" to the link tag to validate the link tags into the pages' bodies.
|
340 |
+
*
|
341 |
+
* Checks if it is an stylesheet and adds the property if has not been included previously.
|
342 |
+
*
|
343 |
+
* @since 1.0.178
|
344 |
+
*
|
345 |
+
* @param string $tag the link tag.
|
346 |
+
* @return string.
|
347 |
+
*/
|
348 |
+
public static function complete_link_tag( $tag ) {
|
349 |
+
if (
|
350 |
+
preg_match( '/stylesheet/i', $tag ) &&
|
351 |
+
! preg_match( '/property\s*=/i', $tag )
|
352 |
+
) {
|
353 |
+
return str_replace( '/>', ' property="stylesheet" />', $tag );
|
354 |
+
}
|
355 |
+
return $tag;
|
356 |
+
} // End complete_link_tag
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Creates a new entry in the PHP Error Logs.
|
360 |
+
*
|
361 |
+
* @since 1.0.167
|
362 |
+
*
|
363 |
+
* @param mixed $log Log message, as text, array or plain object.
|
364 |
+
* @return void.
|
365 |
+
*/
|
366 |
+
public static function write_log( $log ) {
|
367 |
+
try {
|
368 |
+
if (
|
369 |
+
defined( 'WP_DEBUG' ) &&
|
370 |
+
true == WP_DEBUG
|
371 |
+
) {
|
372 |
+
if (
|
373 |
+
is_array( $log ) ||
|
374 |
+
is_object( $log )
|
375 |
+
) {
|
376 |
+
error_log( print_r( $log, true ) );
|
377 |
+
} else {
|
378 |
+
error_log( $log );
|
379 |
+
}
|
380 |
+
}
|
381 |
+
} catch ( Exception $err ) {
|
382 |
+
error_log( $err->getMessage() );
|
383 |
+
}
|
384 |
+
} // End write_log
|
385 |
+
|
386 |
+
} // End CPCFF_AUXILIARY
|
387 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_banner.inc.php
CHANGED
@@ -1,107 +1,106 @@
|
|
1 |
-
<?php
|
2 |
-
global $codepeople_promote_banner_plugins; // Global variable shared by multiple plugins.
|
3 |
-
if(empty(
|
4 |
-
$codepeople_promote_banner_plugins
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
{
|
13 |
-
global $codepeople_promote_banner_plugins;
|
14 |
-
if(
|
15 |
-
empty($codepeople_promote_banner_plugins) ||
|
16 |
-
!is_admin() ||
|
17 |
-
!current_user_can( 'manage_options' )
|
18 |
-
)
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
{
|
29 |
-
|
30 |
-
if(
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
{
|
48 |
-
$value = $now;
|
49 |
-
set_transient( 'codepeople_promote_banner_'
|
50 |
-
}
|
51 |
-
|
52 |
-
if($minimum_days <= abs($now
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
#codepeople-review-banner{
|
57 |
-
#codepeople-review-banner
|
58 |
-
#codepeople-review-banner .codepeople-review-banner-
|
59 |
-
#codepeople-review-banner
|
60 |
-
#codepeople-review-banner .
|
61 |
-
#codepeople-review-banner .
|
62 |
-
#codepeople-review-banner .main-button{
|
63 |
-
#codepeople-review-banner .
|
64 |
-
#codepeople-review-banner .
|
65 |
-
#codepeople-review-banner .
|
66 |
-
#codepeople-review-banner .no-thank-button:
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
#codepeople-review-banner{
|
71 |
-
#codepeople-review-banner .codepeople-review-banner-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
<
|
86 |
-
<input type="hidden" name="
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
<
|
91 |
-
<input type="hidden" name="
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
?>
|
1 |
+
<?php
|
2 |
+
global $codepeople_promote_banner_plugins; // Global variable shared by multiple plugins.
|
3 |
+
if ( empty( $codepeople_promote_banner_plugins ) ) {
|
4 |
+
$codepeople_promote_banner_plugins = array();
|
5 |
+
}
|
6 |
+
$codepeople_promote_banner_plugins['codepeople-calculated-fields-form'] = array(
|
7 |
+
'plugin_name' => 'Calculated Fields Form',
|
8 |
+
'plugin_url' => 'https://wordpress.org/support/plugin/calculated-fields-form/reviews/#new-post',
|
9 |
+
);
|
10 |
+
|
11 |
+
if ( ! function_exists( 'codepeople_add_promote_banner' ) ) {
|
12 |
+
function codepeople_add_promote_banner( $wp_admin_bar ) {
|
13 |
+
global $codepeople_promote_banner_plugins;
|
14 |
+
if (
|
15 |
+
empty( $codepeople_promote_banner_plugins ) ||
|
16 |
+
! is_admin() ||
|
17 |
+
! current_user_can( 'manage_options' )
|
18 |
+
) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
|
22 |
+
$screen = get_current_screen();
|
23 |
+
if ( 'post' == $screen->post_type || 'page' == $screen->post_type ) {
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
|
27 |
+
// Take action over the banner
|
28 |
+
if ( ! empty( $_POST['codepeople_promote_banner_plugin'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
29 |
+
$_codepeople_promote_banner_plugin = sanitize_text_field( wp_unslash( $_POST['codepeople_promote_banner_plugin'] ) ); // phpcs:ignore WordPress.Security.NonceVerification
|
30 |
+
if ( ! empty( $codepeople_promote_banner_plugins[ $_codepeople_promote_banner_plugin ] ) ) {
|
31 |
+
set_transient( 'codepeople_promote_banner_' . $_codepeople_promote_banner_plugin, -1, 0 );
|
32 |
+
if (
|
33 |
+
! empty( $_POST['codepeople_promote_banner_action'] ) && // phpcs:ignore WordPress.Security.NonceVerification
|
34 |
+
'set-review' == $_POST['codepeople_promote_banner_action'] && // phpcs:ignore WordPress.Security.NonceVerification
|
35 |
+
! empty( $codepeople_promote_banner_plugins[ $_codepeople_promote_banner_plugin ]['plugin_url'] )
|
36 |
+
) {
|
37 |
+
print '<script>document.location.href="' . esc_url( $codepeople_promote_banner_plugins[ $_codepeople_promote_banner_plugin ]['plugin_url'] ) . '";</script>';
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
$minimum_days = 86400 * 7;
|
43 |
+
$now = time();
|
44 |
+
|
45 |
+
foreach ( $codepeople_promote_banner_plugins as $plugin_slug => $plugin_data ) {
|
46 |
+
$value = get_transient( 'codepeople_promote_banner_' . $plugin_slug );
|
47 |
+
if ( false === $value ) {
|
48 |
+
$value = $now;
|
49 |
+
set_transient( 'codepeople_promote_banner_' . $plugin_slug, $value, 0 );
|
50 |
+
}
|
51 |
+
|
52 |
+
if ( $minimum_days <= abs( $now - $value ) && 0 < $value * 1 ) {
|
53 |
+
?>
|
54 |
+
<style>
|
55 |
+
#codepeople-review-banner{width:calc( 100% - 20px );width:-webkit-calc( 100% - 20px );width:-moz-calc( 100% - 20px );width:-o-calc( 100% - 20px );border:10px solid #1582AB;background:#FFF;display:table;}
|
56 |
+
#codepeople-review-banner form{float:left; padding:0 5px;}
|
57 |
+
#codepeople-review-banner .codepeople-review-banner-picture{width:120px;padding:10px 10px 10px 10px;float:left;text-align:center;}
|
58 |
+
#codepeople-review-banner .codepeople-review-banner-content{float: left;padding:10px;width: calc( 100% - 160px );width: -webkit-calc( 100% - 160px );width: -moz-calc( 100% - 160px );width: -o-calc( 100% - 160px );}
|
59 |
+
#codepeople-review-banner .codepeople-review-banner-buttons{padding-top:20px;}
|
60 |
+
#codepeople-review-banner .no-thank-button,
|
61 |
+
#codepeople-review-banner .main-button{height: 28px;border-width:1px;border-style:solid;border-radius:5px;text-decoration: none;}
|
62 |
+
#codepeople-review-banner .main-button{background: #0085ba;border-color: #0073aa #006799 #006799;-webkit-box-shadow: 0 1px 0 #006799;box-shadow: 0 1px 0 #006799;color: #fff;text-decoration: none;text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799;}
|
63 |
+
#codepeople-review-banner .no-thank-button {color: #555;border-color: #cccccc;background: #f7f7f7;-webkit-box-shadow: 0 1px 0 #cccccc;box-shadow: 0 1px 0 #cccccc;vertical-align: top;}
|
64 |
+
#codepeople-review-banner .main-button:hover,#codepeople-review-banner .main-button:focus{background: #008ec2;border-color: #006799;color: #fff;}
|
65 |
+
#codepeople-review-banner .no-thank-button:hover,
|
66 |
+
#codepeople-review-banner .no-thank-button:focus{background: #fafafa;border-color: #999;color: #23282d;}
|
67 |
+
@media screen AND (max-width:760px)
|
68 |
+
{
|
69 |
+
#codepeople-review-banner{position:relative;top:50px;}
|
70 |
+
#codepeople-review-banner .codepeople-review-banner-picture{display:none;}
|
71 |
+
#codepeople-review-banner .codepeople-review-banner-content{width:calc( 100% - 20px );width:-webkit-calc( 100% - 20px );width:-moz-calc( 100% - 20px );width:-o-calc( 100% - 20px );}
|
72 |
+
}
|
73 |
+
</style>
|
74 |
+
<div id="codepeople-review-banner">
|
75 |
+
<div class="codepeople-review-banner-picture">
|
76 |
+
<img alt="" src="https://secure.gravatar.com/avatar/c0662edcefb5a4e2ab12803856ba2358?s=150&d=mm&r=g" style="width:80px;">
|
77 |
+
</div>
|
78 |
+
<div class="codepeople-review-banner-content">
|
79 |
+
<div class="codepeople-review-banner-text">
|
80 |
+
<p><strong>Want to help to the development of the "<?php print esc_html( $plugin_data['plugin_name'] ); ?>" plugin?</strong> The main features of this plugin are provided free of charge. We need your help to continue developing it and adding new features. If you want to help with the development please <span style="color:#1582AB;font-weight:bold;">add a review to support it</span>. Thank you!</p>
|
81 |
+
</div>
|
82 |
+
<div class="codepeople-review-banner-buttons">
|
83 |
+
<form method="post" target="_blank">
|
84 |
+
<button class="main-button" onclick="jQuery(this).closest('[id=\'codepeople-review-banner\']').hide();">Publish a Review</button>
|
85 |
+
<input type="hidden" name="codepeople_promote_banner_plugin" value="<?php echo esc_attr( $plugin_slug ); ?>" />
|
86 |
+
<input type="hidden" name="codepeople_promote_banner_action" value="set-review" />
|
87 |
+
</form>
|
88 |
+
<form method="post">
|
89 |
+
<button class="no-thank-button">No Thanks</button>
|
90 |
+
<input type="hidden" name="codepeople_promote_banner_plugin" value="<?php echo esc_attr( $plugin_slug ); ?>" />
|
91 |
+
<input type="hidden" name="codepeople_promote_banner_action" value="not-thanks" />
|
92 |
+
</form>
|
93 |
+
<div style="clear:both;display:block;"></div>
|
94 |
+
</div>
|
95 |
+
<div style="clear:both;"></div>
|
96 |
+
</div>
|
97 |
+
<div style="clear:both;"></div>
|
98 |
+
</div>
|
99 |
+
<?php
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
add_action( 'admin_bar_menu', 'codepeople_add_promote_banner' );
|
105 |
+
} // End codepeople_promote_banner block
|
106 |
+
?>
|
|
inc/cpcff_compatibility.inc.php
CHANGED
@@ -1,110 +1,100 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Operations for checking the compatibility with other plugins: CPCFF_COMPATIBILITY class
|
4 |
-
*
|
5 |
-
* @package CFF.
|
6 |
-
* @since 1.0.370
|
7 |
-
*/
|
8 |
-
|
9 |
-
if(!class_exists('CPCFF_COMPATIBILITY'))
|
10 |
-
{
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
'
|
18 |
-
'
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
'
|
24 |
-
'
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
'
|
30 |
-
'
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
'
|
36 |
-
'
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
'
|
42 |
-
'
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
'
|
48 |
-
'
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
'
|
54 |
-
'
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
'
|
60 |
-
'
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$warning_mssgs .= self::format_warning_mssg($plugin);
|
102 |
-
}
|
103 |
-
break;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
return $warning_mssgs;
|
107 |
-
} // End blog_id
|
108 |
-
|
109 |
-
} // End CPCFF_COMPATIBILITY
|
110 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Operations for checking the compatibility with other plugins: CPCFF_COMPATIBILITY class
|
4 |
+
*
|
5 |
+
* @package CFF.
|
6 |
+
* @since 1.0.370
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CPCFF_COMPATIBILITY' ) ) {
|
10 |
+
class CPCFF_COMPATIBILITY {
|
11 |
+
|
12 |
+
private static function init() {
|
13 |
+
return array(
|
14 |
+
array(
|
15 |
+
'plugin' => 'Breeze - WordPress Cache Plugin',
|
16 |
+
'check' => 'BREEZE_VERSION',
|
17 |
+
'type' => 'constant',
|
18 |
+
'mssg' => __( 'There is active the <b>Breeze - WordPress Cache Plugin</b> plugin. If the forms are not visible, please tick the <i>"There is active an optimization plugin in WordPress"</i> and Purge the Breeze cache.', 'calculated-fields-form' ),
|
19 |
+
),
|
20 |
+
array(
|
21 |
+
'plugin' => 'Fast Velocity Minify',
|
22 |
+
'check' => 'fvm_compat_checker',
|
23 |
+
'type' => 'function',
|
24 |
+
'mssg' => __( 'There is active the <b>Fast Velocity Minify</b> plugin. If the forms are not visible, please try disabling the <i>"Disable minification on JS files"</i> or <i>"Disable JavaScript processing"</i> options in the <b>Fast Velocity Minify</b> settings.', 'calculated-fields-form' ),
|
25 |
+
),
|
26 |
+
array(
|
27 |
+
'plugin' => 'W3 Total Cache',
|
28 |
+
'check' => 'W3TC',
|
29 |
+
'type' => 'constant',
|
30 |
+
'mssg' => __( 'There is active the <b>W3 Total Cache</b> plugin. If the forms are not visible, please tick the checkbox.', 'calculated-fields-form' ),
|
31 |
+
),
|
32 |
+
array(
|
33 |
+
'plugin' => 'Autoptimize',
|
34 |
+
'check' => 'autoptimize',
|
35 |
+
'type' => 'function',
|
36 |
+
'mssg' => __( 'There is active the <b>Autoptimize</b> plugin. If the forms are not visible, please try disabling the <i>"Force JavaScript in <head>"</i> option in the <b>Autoptimize</b> settings, or remove the jQuery file from the <i>"Exclude scripts from Autoptimize"</i> one.', 'calculated-fields-form' ),
|
37 |
+
),
|
38 |
+
array(
|
39 |
+
'plugin' => 'LiteSpeed Cache',
|
40 |
+
'check' => 'run_litespeed_cache',
|
41 |
+
'type' => 'function',
|
42 |
+
'mssg' => __( 'There is active the <b>LiteSpeed Cache</b> plugin. If the forms are not visible, please try disabling the <i>"JS Combine"</i> option in the <b>Optimize</b> tab of <b>LiteSpeed Cache</b> settings.', 'calculated-fields-form' ),
|
43 |
+
),
|
44 |
+
array(
|
45 |
+
'plugin' => 'WP Rocket',
|
46 |
+
'check' => 'WP_ROCKET_VERSION',
|
47 |
+
'type' => 'constant',
|
48 |
+
'mssg' => __( 'There is active the <b>WP Rocket</b> plugin. If the forms are not visible, please try disabling the <i>"Combine JavaScript files"</i> option in the <b>FILE OPTIMIZATION</b> tab of <b>WP Rocket</b> settings, and remember to clear the website cache.', 'calculated-fields-form' ),
|
49 |
+
),
|
50 |
+
array(
|
51 |
+
'plugin' => 'SG Optimizer',
|
52 |
+
'check' => 'siteground_optimizer_helper',
|
53 |
+
'type' => 'object',
|
54 |
+
'mssg' => __( 'There is active the <b>SG Optimizer</b> plugin. If the forms are not visible, please try disabling the options: <i>"Minify the HTML Output"</i> and <i>"Minify JavaScript Files"</i> in the <b>SG Optimizer</b> settings, and remember to purge the website cache.', 'calculated-fields-form' ),
|
55 |
+
),
|
56 |
+
array(
|
57 |
+
'plugin' => 'Hummingbird',
|
58 |
+
'check' => 'WPHB_VERSION',
|
59 |
+
'type' => 'constant',
|
60 |
+
'mssg' => __( 'There is active the <b>Hummingbird</b> plugin. If the forms are not visible, check the <i>"Hummingbird > Asset Optimization"</i> options. Make sure that jQuery or other required scripts are not configured to load after the page loads. Remember to purge the website cache, after edit the plugin settings.', 'calculated-fields-form' ),
|
61 |
+
),
|
62 |
+
);
|
63 |
+
} // End init
|
64 |
+
|
65 |
+
private static function format_warning_mssg( $plugin ) {
|
66 |
+
return '<div class="cff-compatibility-warning">' . $plugin['mssg'] . '</div>';
|
67 |
+
} // End format_warning_mssg
|
68 |
+
|
69 |
+
public static function warnings() {
|
70 |
+
$plugins = self::init();
|
71 |
+
$warning_mssgs = '';
|
72 |
+
foreach ( $plugins as $plugin ) {
|
73 |
+
switch ( $plugin['type'] ) {
|
74 |
+
case 'function':
|
75 |
+
if ( function_exists( $plugin['check'] ) ) {
|
76 |
+
$warning_mssgs .= self::format_warning_mssg( $plugin );
|
77 |
+
}
|
78 |
+
break;
|
79 |
+
case 'class':
|
80 |
+
if ( class_exists( $plugin['check'] ) ) {
|
81 |
+
$warning_mssgs .= self::format_warning_mssg( $plugin );
|
82 |
+
}
|
83 |
+
break;
|
84 |
+
case 'object':
|
85 |
+
if ( isset( $GLOBALS[ $plugin['check'] ] ) ) {
|
86 |
+
$warning_mssgs .= self::format_warning_mssg( $plugin );
|
87 |
+
}
|
88 |
+
break;
|
89 |
+
case 'constant':
|
90 |
+
if ( defined( $plugin['check'] ) ) {
|
91 |
+
$warning_mssgs .= self::format_warning_mssg( $plugin );
|
92 |
+
}
|
93 |
+
break;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
return $warning_mssgs;
|
97 |
+
} // End blog_id
|
98 |
+
|
99 |
+
} // End CPCFF_COMPATIBILITY
|
100 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_form.inc.php
CHANGED
@@ -1,479 +1,509 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Form class with database interaction, data, and methods.
|
4 |
-
*
|
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 |
-
|
12 |
-
|
13 |
-
*
|
14 |
-
*
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
*
|
21 |
-
*
|
22 |
-
*
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
*
|
51 |
-
*
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
$this->
|
57 |
-
$this->
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
*
|
64 |
-
*
|
65 |
-
*
|
66 |
-
* @
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
// Form
|
97 |
-
'
|
98 |
-
|
99 |
-
//
|
100 |
-
'
|
101 |
-
|
102 |
-
|
103 |
-
'
|
104 |
-
'
|
105 |
-
'
|
106 |
-
|
107 |
-
|
108 |
-
'
|
109 |
-
|
110 |
-
|
111 |
-
'
|
112 |
-
|
113 |
-
'
|
114 |
-
'
|
115 |
-
|
116 |
-
|
117 |
-
'
|
118 |
-
'
|
119 |
-
'
|
120 |
-
'
|
121 |
-
'
|
122 |
-
'
|
123 |
-
'
|
124 |
-
|
125 |
-
|
126 |
-
'
|
127 |
-
|
128 |
-
|
129 |
-
'
|
130 |
-
'
|
131 |
-
'
|
132 |
-
|
133 |
-
|
134 |
-
'
|
135 |
-
|
136 |
-
|
137 |
-
'
|
138 |
-
'
|
139 |
-
'
|
140 |
-
'
|
141 |
-
'
|
142 |
-
'
|
143 |
-
'
|
144 |
-
'
|
145 |
-
'
|
146 |
-
|
147 |
-
'
|
148 |
-
'
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
'%s',
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
*
|
234 |
-
*
|
235 |
-
|
236 |
-
|
237 |
-
{
|
238 |
-
|
239 |
-
|
240 |
-
$this->_get_settings();
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
'
|
348 |
-
|
349 |
-
|
350 |
-
'
|
351 |
-
'
|
352 |
-
'
|
353 |
-
'
|
354 |
-
'
|
355 |
-
'
|
356 |
-
'
|
357 |
-
|
358 |
-
//
|
359 |
-
'
|
360 |
-
'
|
361 |
-
'
|
362 |
-
'
|
363 |
-
'
|
364 |
-
|
365 |
-
|
366 |
-
'
|
367 |
-
'
|
368 |
-
'
|
369 |
-
'
|
370 |
-
'
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
)
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
$
|
387 |
-
(
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
{
|
451 |
-
|
452 |
-
$this->_revisions_obj->
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
*
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Form class with database interaction, data, and methods.
|
4 |
+
*
|
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 |
+
/**
|
12 |
+
* Class to create create, save, and read the forms data.
|
13 |
+
*
|
14 |
+
* @since 1.0.179
|
15 |
+
*/
|
16 |
+
class CPCFF_FORM {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Form's id
|
20 |
+
* Instance property.
|
21 |
+
*
|
22 |
+
* @var integer $_id
|
23 |
+
*/
|
24 |
+
private $_id;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Form's settings
|
28 |
+
* Instance property.
|
29 |
+
*
|
30 |
+
* @var array $_settings. Associative array with the form's settings.
|
31 |
+
*/
|
32 |
+
private $_settings;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Form's fields
|
36 |
+
* Instance property.
|
37 |
+
*
|
38 |
+
* @var array $_fields. Associative array with the form's fields.
|
39 |
+
*/
|
40 |
+
private $_fields;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Instance of the CPCFF_REVISIONS object to interact with the form's revisions.
|
44 |
+
*/
|
45 |
+
private $_revisions_obj;
|
46 |
+
/*********************************** PUBLIC METHODS ********************************************/
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Constructs a CPCFF_FORM object.
|
50 |
+
*
|
51 |
+
* @param integer $id the form's id.
|
52 |
+
*/
|
53 |
+
public function __construct( $id ) {
|
54 |
+
$this->_id = $id;
|
55 |
+
$this->_settings = array();
|
56 |
+
$this->_fields = array();
|
57 |
+
$this->_revisions_obj = new CPCFF_REVISIONS( $this );
|
58 |
+
} // End __construct
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Creates a new form with the default data, and the name passed as parameter,
|
62 |
+
* and returns an instance of the CPCFF_FORM class.
|
63 |
+
*
|
64 |
+
* @param string $form_name. The form's name displayed in the settings page of the plugin.
|
65 |
+
*
|
66 |
+
* @return object.
|
67 |
+
*/
|
68 |
+
public static function create_default( $form_name, $category_name = '', $form_template = 0 ) {
|
69 |
+
global $wpdb, $cpcff_default_texts_array;
|
70 |
+
|
71 |
+
$_form_structure = CP_CALCULATEDFIELDSF_DEFAULT_form_structure;
|
72 |
+
// Get form structure from server !!!
|
73 |
+
if ( ! empty( $form_template ) ) {
|
74 |
+
$response = wp_remote_get(
|
75 |
+
'https://cff.dwbooster.com/forms/forms/' . $form_template . '.cpfm',
|
76 |
+
array(
|
77 |
+
'sslverify' => false,
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
if ( ! is_wp_error( $response ) ) {
|
82 |
+
$_form_structure_tmp = wp_remote_retrieve_body( $response );
|
83 |
+
if ( ! empty( $_form_structure_tmp ) ) {
|
84 |
+
$_form_structure = $_form_structure_tmp;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
if (
|
90 |
+
$wpdb->insert(
|
91 |
+
$wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
92 |
+
array(
|
93 |
+
// Form name
|
94 |
+
'form_name' => stripcslashes( $form_name ),
|
95 |
+
|
96 |
+
// Form structure
|
97 |
+
'form_structure' => $_form_structure,
|
98 |
+
|
99 |
+
// Notification email
|
100 |
+
'fp_from_email' => CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email,
|
101 |
+
'fp_destination_emails' => CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails,
|
102 |
+
'fp_subject' => CP_CALCULATEDFIELDSF_DEFAULT_fp_subject,
|
103 |
+
'fp_inc_additional_info' => CP_CALCULATEDFIELDSF_DEFAULT_fp_inc_additional_info,
|
104 |
+
'fp_return_page' => CP_CALCULATEDFIELDSF_DEFAULT_fp_return_page,
|
105 |
+
'fp_message' => CP_CALCULATEDFIELDSF_DEFAULT_fp_message,
|
106 |
+
|
107 |
+
// Notification email copy to the user
|
108 |
+
'cu_enable_copy_to_user' => CP_CALCULATEDFIELDSF_DEFAULT_cu_enable_copy_to_user,
|
109 |
+
'cu_user_email_field' => CP_CALCULATEDFIELDSF_DEFAULT_cu_user_email_field,
|
110 |
+
'cu_subject' => CP_CALCULATEDFIELDSF_DEFAULT_cu_subject,
|
111 |
+
'cu_message' => CP_CALCULATEDFIELDSF_DEFAULT_cu_message,
|
112 |
+
|
113 |
+
// Activate validation and validation's texts
|
114 |
+
'vs_use_validation' => CP_CALCULATEDFIELDSF_DEFAULT_vs_use_validation,
|
115 |
+
'vs_text_is_required' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required,
|
116 |
+
'vs_text_is_email' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email,
|
117 |
+
'vs_text_datemmddyyyy' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy,
|
118 |
+
'vs_text_dateddmmyyyy' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy,
|
119 |
+
'vs_text_number' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number,
|
120 |
+
'vs_text_digits' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits,
|
121 |
+
'vs_text_max' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max,
|
122 |
+
'vs_text_min' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min,
|
123 |
+
'vs_all_texts' => serialize( $cpcff_default_texts_array ),
|
124 |
+
|
125 |
+
// Paypal settings
|
126 |
+
'enable_paypal' => CP_CALCULATEDFIELDSF_DEFAULT_ENABLE_PAYPAL,
|
127 |
+
'paypal_email' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_EMAIL,
|
128 |
+
'request_cost' => 'fieldname1',
|
129 |
+
'paypal_product_name' => CP_CALCULATEDFIELDSF_DEFAULT_PRODUCT_NAME,
|
130 |
+
'currency' => CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY,
|
131 |
+
'paypal_language' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE,
|
132 |
+
|
133 |
+
// Captcha settings
|
134 |
+
'cv_enable_captcha' => CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha,
|
135 |
+
'cv_width' => CP_CALCULATEDFIELDSF_DEFAULT_cv_width,
|
136 |
+
'cv_height' => CP_CALCULATEDFIELDSF_DEFAULT_cv_height,
|
137 |
+
'cv_chars' => CP_CALCULATEDFIELDSF_DEFAULT_cv_chars,
|
138 |
+
'cv_font' => CP_CALCULATEDFIELDSF_DEFAULT_cv_font,
|
139 |
+
'cv_min_font_size' => CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size,
|
140 |
+
'cv_max_font_size' => CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size,
|
141 |
+
'cv_noise' => CP_CALCULATEDFIELDSF_DEFAULT_cv_noise,
|
142 |
+
'cv_noise_length' => CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length,
|
143 |
+
'cv_background' => CP_CALCULATEDFIELDSF_DEFAULT_cv_background,
|
144 |
+
'cv_border' => CP_CALCULATEDFIELDSF_DEFAULT_cv_border,
|
145 |
+
'cv_text_enter_valid_captcha' => CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha,
|
146 |
+
|
147 |
+
'enable_submit' => CP_CALCULATEDFIELDSF_DEFAULT_display_submit_button,
|
148 |
+
'category' => $category_name,
|
149 |
+
),
|
150 |
+
array(
|
151 |
+
'%s',
|
152 |
+
'%s',
|
153 |
+
'%s',
|
154 |
+
'%s',
|
155 |
+
'%s',
|
156 |
+
'%s',
|
157 |
+
'%s',
|
158 |
+
'%s',
|
159 |
+
'%s',
|
160 |
+
'%s',
|
161 |
+
'%s',
|
162 |
+
'%s',
|
163 |
+
'%s',
|
164 |
+
'%s',
|
165 |
+
'%s',
|
166 |
+
'%s',
|
167 |
+
'%s',
|
168 |
+
'%s',
|
169 |
+
'%s',
|
170 |
+
'%s',
|
171 |
+
'%s',
|
172 |
+
'%s',
|
173 |
+
'%s',
|
174 |
+
'%s',
|
175 |
+
'%s',
|
176 |
+
'%s',
|
177 |
+
'%s',
|
178 |
+
'%s',
|
179 |
+
'%s',
|
180 |
+
'%s',
|
181 |
+
'%s',
|
182 |
+
'%s',
|
183 |
+
'%s',
|
184 |
+
'%s',
|
185 |
+
'%s',
|
186 |
+
'%s',
|
187 |
+
'%s',
|
188 |
+
'%s',
|
189 |
+
'%s',
|
190 |
+
'%s',
|
191 |
+
'%s',
|
192 |
+
'%s',
|
193 |
+
)
|
194 |
+
)
|
195 |
+
) {
|
196 |
+
return new self( $wpdb->insert_id );
|
197 |
+
}
|
198 |
+
return false;
|
199 |
+
} // End create_default
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Sanitize the form's structure. Fields titltes and instructions for users,
|
203 |
+
* form's title and description. etc.
|
204 |
+
*/
|
205 |
+
public static function sanitize_structure( $structure ) {
|
206 |
+
if ( is_array( $structure ) ) {
|
207 |
+
if ( is_array( $structure[0] ) ) {
|
208 |
+
foreach ( $structure[0] as $index => $obj ) {
|
209 |
+
if ( isset( $obj->title ) ) {
|
210 |
+
$structure[0][ $index ]->title = CPCFF_AUXILIARY::sanitize( $structure[0][ $index ]->title );
|
211 |
+
}
|
212 |
+
if ( isset( $obj->userhelp ) ) {
|
213 |
+
$structure[0][ $index ]->userhelp = CPCFF_AUXILIARY::sanitize( $structure[0][ $index ]->userhelp );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( is_array( $structure[1] ) && count( $structure[1] ) ) {
|
219 |
+
if ( is_object( $structure[1][0] ) ) {
|
220 |
+
if ( isset( $structure[1][0]->title ) ) {
|
221 |
+
$structure[1][0]->title = CPCFF_AUXILIARY::sanitize( $structure[1][0]->title );
|
222 |
+
}
|
223 |
+
if ( isset( $structure[1][0]->description ) ) {
|
224 |
+
$structure[1][0]->description = CPCFF_AUXILIARY::sanitize( $structure[1][0]->description );
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
return $structure;
|
230 |
+
} // End sanitize_structure
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Clones the current form.
|
234 |
+
*
|
235 |
+
* @return mixed, a new instance of the CPCFF_FORM or false.
|
236 |
+
*/
|
237 |
+
public function clone_form() {
|
238 |
+
global $wpdb;
|
239 |
+
|
240 |
+
$row = $this->_get_settings();
|
241 |
+
if ( ! empty( $row ) ) {
|
242 |
+
unset( $row['id'] );
|
243 |
+
$row['form_name'] = 'Cloned: ' . $row['form_name'];
|
244 |
+
if ( $wpdb->insert( $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE, $row ) ) {
|
245 |
+
return new self( $wpdb->insert_id );
|
246 |
+
}
|
247 |
+
}
|
248 |
+
return false;
|
249 |
+
} // End clone_form
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Returns the id of current form.
|
253 |
+
*
|
254 |
+
* @return integer
|
255 |
+
*/
|
256 |
+
public function get_id() {
|
257 |
+
return $this->_id;
|
258 |
+
} // end get_id
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Reads the corresponding attribute in the form's settings.
|
262 |
+
*
|
263 |
+
* Reads the attribute in the form's settings, and if it does not exists returns the default value.
|
264 |
+
* Applies the filter cpcff_get_option
|
265 |
+
*
|
266 |
+
* @param string, name of the attribute to read.
|
267 |
+
* @param mixes, default value of the attribute.
|
268 |
+
* @return mixed, it depends of the option to read.
|
269 |
+
*/
|
270 |
+
public function get_option( $option, $default ) {
|
271 |
+
// Initialize the value with the default values
|
272 |
+
$value = $default;
|
273 |
+
$this->_get_settings();
|
274 |
+
|
275 |
+
if ( isset( $this->_settings[ $option ] ) ) {
|
276 |
+
$value = @$this->_settings[ $option ];
|
277 |
+
}
|
278 |
+
|
279 |
+
// If the form's structure is a JSON text decodes it.
|
280 |
+
if (
|
281 |
+
'form_structure' == $option &&
|
282 |
+
! is_array( $value )
|
283 |
+
) {
|
284 |
+
$form_data = CPCFF_AUXILIARY::json_decode( $value, 'normal' );
|
285 |
+
if ( ! is_null( $form_data ) ) {
|
286 |
+
$value = $this->_settings['form_structure'] = $form_data; // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
287 |
+
}
|
288 |
+
} elseif ( // Adds to the thank you page URL a random attribute to prevent the page be cached
|
289 |
+
'fp_return_page' == $option &&
|
290 |
+
! is_admin() &&
|
291 |
+
get_option( 'CP_CALCULATEDFIELDSF_TYPC', CP_CALCULATEDFIELDSF_TYPC )
|
292 |
+
) {
|
293 |
+
if ( ! empty( $value ) ) {
|
294 |
+
$value .= ( strpos( $value, '?' ) === false ? '?' : '&' ) . 'cff_no_cache=' . time();
|
295 |
+
}
|
296 |
+
} elseif ( // If the texts where not defined previously or the thank you page is empty populate them with the default values
|
297 |
+
(
|
298 |
+
'vs_all_texts' == $option ||
|
299 |
+
'fp_return_page' == $option
|
300 |
+
) &&
|
301 |
+
empty( $value )
|
302 |
+
) {
|
303 |
+
$value = $default;
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Filters applied before returning a form option,
|
308 |
+
* use three parameters: The value of option, the name of option and the form's id
|
309 |
+
* returns the new option's value
|
310 |
+
*/
|
311 |
+
if ( ! is_admin() ) {
|
312 |
+
$value = apply_filters( 'cpcff_get_option', $value, $option, $this->_id );
|
313 |
+
}
|
314 |
+
|
315 |
+
return $value;
|
316 |
+
} // End get_option
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Returns the list of fields in the forms.
|
320 |
+
*
|
321 |
+
* @return array, associative array of objects where the fields' names are the indices and fields' structures the values.
|
322 |
+
*/
|
323 |
+
public function get_fields() {
|
324 |
+
if ( ! empty( $this->_fields ) ) {
|
325 |
+
return $this->_fields;
|
326 |
+
}
|
327 |
+
|
328 |
+
$form_structure = $this->get_option( 'form_structure', array() );
|
329 |
+
if ( ! empty( $form_structure[0] ) ) {
|
330 |
+
foreach ( $form_structure[0] as $field ) {
|
331 |
+
$this->_fields[ $field->name ] = $field;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
return $this->_fields;
|
335 |
+
} // End get_fields
|
336 |
+
|
337 |
+
public function save_settings( $params ) {
|
338 |
+
global $wpdb, $cpcff_default_texts_array;
|
339 |
+
|
340 |
+
foreach ( $params as $i => $v ) {
|
341 |
+
if ( 'form_structure' != $i ) {
|
342 |
+
$params[ $i ] = CPCFF_AUXILIARY::stripscript_recursive( $v );
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
$data = array(
|
347 |
+
'form_structure' => ( isset( $params['form_structure'] ) ) ? $params['form_structure'] : CP_CALCULATEDFIELDSF_DEFAULT_form_structure,
|
348 |
+
|
349 |
+
// Notification email
|
350 |
+
'fp_from_email' => ( isset( $params['fp_from_email'] ) ) ? trim( $params['fp_from_email'] ) : '',
|
351 |
+
'fp_destination_emails' => ( isset( $params['fp_destination_emails'] ) ) ? trim( $params['fp_destination_emails'] ) : '',
|
352 |
+
'fp_subject' => ( isset( $params['fp_subject'] ) ) ? $params['fp_subject'] : '',
|
353 |
+
'fp_inc_additional_info' => ( isset( $params['fp_inc_additional_info'] ) && 'true' == $params['fp_inc_additional_info'] ) ? 'true' : 'false',
|
354 |
+
'fp_return_page' => ( isset( $params['fp_return_page'] ) ) ? trim( $params['fp_return_page'] ) : '',
|
355 |
+
'fp_message' => ( isset( $params['fp_message'] ) ) ? $params['fp_message'] : '',
|
356 |
+
'fp_emailformat' => ( isset( $params['fp_emailformat'] ) && 'text' == $params['fp_emailformat'] ) ? 'text' : 'html',
|
357 |
+
|
358 |
+
// Notification email copy to the user
|
359 |
+
'cu_enable_copy_to_user' => ( isset( $params['cu_enable_copy_to_user'] ) && 'true' == $params['cu_enable_copy_to_user'] ) ? 'true' : 'false',
|
360 |
+
'cu_user_email_field' => ( ! empty( $params['cu_user_email_field'] ) ) ? $params['cu_user_email_field'] : '',
|
361 |
+
'cu_subject' => ( isset( $params['cu_subject'] ) ) ? $params['cu_subject'] : '',
|
362 |
+
'cu_message' => ( isset( $params['cu_message'] ) ) ? $params['cu_message'] : '',
|
363 |
+
'cu_emailformat' => ( isset( $params['cu_emailformat'] ) && 'text' == $params['cu_emailformat'] ) ? 'text' : 'html',
|
364 |
+
|
365 |
+
// PayPal settings
|
366 |
+
'enable_paypal' => ( isset( $params['enable_paypal'] ) ) ? $params['enable_paypal'] : 0,
|
367 |
+
'paypal_email' => ( isset( $params['paypal_email'] ) ) ? trim( $params['paypal_email'] ) : '',
|
368 |
+
'request_cost' => ( isset( $params['request_cost'] ) ) ? trim( $params['request_cost'] ) : '',
|
369 |
+
'paypal_product_name' => ( isset( $params['paypal_product_name'] ) ) ? $params['paypal_product_name'] : '',
|
370 |
+
'currency' => ( isset( $params['currency'] ) ) ? trim( $params['currency'] ) : 'USD',
|
371 |
+
'paypal_language' => ( isset( $params['paypal_language'] ) ) ? trim( $params['paypal_language'] ) : 'EN',
|
372 |
+
'paypal_mode' => ( isset( $params['paypal_mode'] ) ) ? $params['paypal_mode'] : 'production',
|
373 |
+
'paypal_recurrent' => ( isset( $params['paypal_recurrent'] ) ) ? $params['paypal_recurrent'] : 0,
|
374 |
+
'paypal_identify_prices' => ( isset( $params['paypal_identify_prices'] ) ) ? $params['paypal_identify_prices'] : '0',
|
375 |
+
'paypal_zero_payment' => ( isset( $params['paypal_zero_payment'] ) ) ? $params['paypal_zero_payment'] : 0,
|
376 |
+
|
377 |
+
// Texts
|
378 |
+
'vs_use_validation' => CP_CALCULATEDFIELDSF_DEFAULT_vs_use_validation,
|
379 |
+
'vs_text_is_required' => ( isset( $params['vs_text_is_required'] ) ) ? $params['vs_text_is_required'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required,
|
380 |
+
'vs_text_is_email' => ( isset( $params['vs_text_is_email'] ) ) ? $params['vs_text_is_email'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email,
|
381 |
+
'vs_text_datemmddyyyy' => ( isset( $params['vs_text_datemmddyyyy'] ) ) ? $params['vs_text_datemmddyyyy'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy,
|
382 |
+
'vs_text_dateddmmyyyy' => ( isset( $params['vs_text_dateddmmyyyy'] ) ) ? $params['vs_text_dateddmmyyyy'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy,
|
383 |
+
'vs_text_number' => ( isset( $params['vs_text_number'] ) ) ? $params['vs_text_number'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number,
|
384 |
+
'vs_text_digits' => ( isset( $params['vs_text_digits'] ) ) ? $params['vs_text_digits'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits,
|
385 |
+
'vs_text_max' => ( isset( $params['vs_text_max'] ) ) ? $params['vs_text_max'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max,
|
386 |
+
'vs_text_min' => ( isset( $params['vs_text_min'] ) ) ? $params['vs_text_min'] : CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min,
|
387 |
+
'vs_text_previousbtn' => ( isset( $params['vs_text_previousbtn'] ) ) ? $params['vs_text_previousbtn'] : 'Previous',
|
388 |
+
'vs_text_nextbtn' => ( isset( $params['vs_text_nextbtn'] ) ) ? $params['vs_text_nextbtn'] : 'Next',
|
389 |
+
'vs_all_texts' => ( isset( $params['vs_all_texts'] ) ) ? serialize( $params['vs_all_texts'] ) : serialize( $cpcff_default_texts_array ),
|
390 |
+
|
391 |
+
// Captcha settings
|
392 |
+
'cv_enable_captcha' => ( isset( $params['cv_enable_captcha'] ) ) ? $params['cv_enable_captcha'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha,
|
393 |
+
'cv_width' => ( isset( $params['cv_width'] ) ) ? $params['cv_width'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_width,
|
394 |
+
'cv_height' => ( isset( $params['cv_height'] ) ) ? $params['cv_height'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_height,
|
395 |
+
'cv_chars' => ( isset( $params['cv_chars'] ) ) ? $params['cv_chars'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_chars,
|
396 |
+
'cv_font' => ( isset( $params['cv_font'] ) ) ? $params['cv_font'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_font,
|
397 |
+
'cv_min_font_size' => ( isset( $params['cv_min_font_size'] ) ) ? $params['cv_min_font_size'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size,
|
398 |
+
'cv_max_font_size' => ( isset( $params['cv_max_font_size'] ) ) ? $params['cv_max_font_size'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size,
|
399 |
+
'cv_noise' => ( isset( $params['cv_noise'] ) ) ? $params['cv_noise'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_noise,
|
400 |
+
'cv_noise_length' => ( isset( $params['cv_noise_length'] ) ) ? $params['cv_noise_length'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length,
|
401 |
+
'cv_background' => ( isset( $params['cv_background'] ) ) ? $params['cv_background'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_background,
|
402 |
+
'cv_border' => ( isset( $params['cv_border'] ) ) ? $params['cv_border'] : CP_CALCULATEDFIELDSF_DEFAULT_cv_border,
|
403 |
+
'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,
|
404 |
+
'category' => trim( isset( $params['calculated-fields-form-category'] ) ? $params['calculated-fields-form-category'] : '' ),
|
405 |
+
);
|
406 |
+
|
407 |
+
$updated_rows = $wpdb->update(
|
408 |
+
$wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
409 |
+
$data,
|
410 |
+
array( 'id' => $this->_id ),
|
411 |
+
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', '%s' ),
|
412 |
+
array( '%d' )
|
413 |
+
);
|
414 |
+
|
415 |
+
// Revisions
|
416 |
+
update_option( 'CP_CALCULATEDFIELDSF_REVISIONS_IN_PREVIEW', isset( $params['cff-revisions-in-preview'] ) ? true : false );
|
417 |
+
|
418 |
+
if (
|
419 |
+
false !== $updated_rows &&
|
420 |
+
(
|
421 |
+
! isset( $params['preview'] ) ||
|
422 |
+
get_option( 'CP_CALCULATEDFIELDSF_REVISIONS_IN_PREVIEW' )
|
423 |
+
) &&
|
424 |
+
get_option( 'CP_CALCULATEDFIELDSF_DISABLE_REVISIONS', CP_CALCULATEDFIELDSF_DISABLE_REVISIONS ) == 0
|
425 |
+
) {
|
426 |
+
$this->_revisions_obj->create_revision();
|
427 |
+
}
|
428 |
+
return $updated_rows;
|
429 |
+
} // End save_settings
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Gets the correspond rown in the database
|
433 |
+
*/
|
434 |
+
public function get_raw_data() {
|
435 |
+
global $wpdb;
|
436 |
+
$row = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . ' WHERE id=%d', $this->_id ), ARRAY_A ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
437 |
+
return $row;
|
438 |
+
} // End get_raw_data
|
439 |
+
|
440 |
+
/**
|
441 |
+
* Returns an instance of the CPCFF_REVISIONS revisions object
|
442 |
+
*/
|
443 |
+
public function get_revisions() {
|
444 |
+
return $this->_revisions_obj;
|
445 |
+
} // End get_revisions
|
446 |
+
|
447 |
+
/**
|
448 |
+
* Creates or replace the property $this->_settings with the data stored in the revisions
|
449 |
+
*/
|
450 |
+
public function apply_revision( $revision_id ) {
|
451 |
+
$this->_get_settings();
|
452 |
+
$revision_data = $this->_revisions_obj->data( $revision_id );
|
453 |
+
$this->_fields = array();
|
454 |
+
$this->_settings = CPCFF_AUXILIARY::array_replace_recursive( $this->_settings, $revision_data );
|
455 |
+
} // End apply_revision
|
456 |
+
|
457 |
+
/**
|
458 |
+
* Updates the form's name
|
459 |
+
*
|
460 |
+
* @param string $form_name
|
461 |
+
*
|
462 |
+
* @return bool
|
463 |
+
*/
|
464 |
+
public function update_name( $form_name ) {
|
465 |
+
global $wpdb;
|
466 |
+
return $wpdb->update(
|
467 |
+
$wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
468 |
+
array( 'form_name' => $form_name ),
|
469 |
+
array( 'id' => $this->_id ),
|
470 |
+
array( '%s' ),
|
471 |
+
array( '%d' )
|
472 |
+
);
|
473 |
+
} // End update_name
|
474 |
+
|
475 |
+
/**
|
476 |
+
* Deletes the current form.
|
477 |
+
*
|
478 |
+
* @return mixed the number of deleted columns or false.
|
479 |
+
*/
|
480 |
+
public function delete_form() {
|
481 |
+
global $wpdb;
|
482 |
+
$this->_revisions_obj->delete_form();
|
483 |
+
return $wpdb->delete(
|
484 |
+
$wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE,
|
485 |
+
array( 'id' => $this->_id ),
|
486 |
+
array( '%d' )
|
487 |
+
);
|
488 |
+
}
|
489 |
+
/*********************************** PRIVATE METHODS ********************************************/
|
490 |
+
|
491 |
+
/**
|
492 |
+
* Returns the form's settings.
|
493 |
+
* Checks if the settings were read previously, before reading the data from database.
|
494 |
+
*
|
495 |
+
* @since 1.0.184
|
496 |
+
*
|
497 |
+
* @return array, associative array with the database row.
|
498 |
+
*/
|
499 |
+
private function _get_settings() {
|
500 |
+
if ( empty( $this->_settings ) ) {
|
501 |
+
$row = $this->get_raw_data();
|
502 |
+
if ( ! empty( $row ) ) {
|
503 |
+
$this->_settings = $row;
|
504 |
+
}
|
505 |
+
}
|
506 |
+
return $this->_settings;
|
507 |
+
} // End _get_settings
|
508 |
+
} // End CPCFF_FORM
|
509 |
+
}
|
inc/cpcff_install_uninstall.inc.php
CHANGED
@@ -1,337 +1,323 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Install/Uninstall plugin: CPCFF_INSTALLER class
|
4 |
-
*
|
5 |
-
* Contains the CPCFF_INSTALLER metaclass for install and uninstall the plugin.
|
6 |
-
*
|
7 |
-
* @package CFF
|
8 |
-
* @since 1.0.168
|
9 |
-
*/
|
10 |
-
|
11 |
-
if(!class_exists('CPCFF_INSTALLER'))
|
12 |
-
|
13 |
-
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
26 |
-
* @param int $
|
27 |
-
* @param
|
28 |
-
* @param string $
|
29 |
-
* @param
|
30 |
-
* @param
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
$old_blog
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
*
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
)
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
//
|
204 |
-
$
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
$values['
|
314 |
-
$
|
315 |
-
$values['
|
316 |
-
$
|
317 |
-
$values['
|
318 |
-
$
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
$wpdb->insert( $table_name, $values );
|
325 |
-
$values['id'] = 4;
|
326 |
-
$values['form_name'] = 'Pregnancy Calculator';
|
327 |
-
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure4;
|
328 |
-
$wpdb->insert( $table_name, $values );
|
329 |
-
$values['id'] = 5;
|
330 |
-
$values['form_name'] = 'Lease Calculator';
|
331 |
-
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure5;
|
332 |
-
$wpdb->insert( $table_name, $values );
|
333 |
-
}
|
334 |
-
} // End _predefined_forms
|
335 |
-
|
336 |
-
} // End class CPCFF_INSTALLER
|
337 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Install/Uninstall plugin: CPCFF_INSTALLER class
|
4 |
+
*
|
5 |
+
* Contains the CPCFF_INSTALLER metaclass for install and uninstall the plugin.
|
6 |
+
*
|
7 |
+
* @package CFF
|
8 |
+
* @since 1.0.168
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'CPCFF_INSTALLER' ) ) {
|
12 |
+
/**
|
13 |
+
* Installs/Uninstalls the plugin.
|
14 |
+
*
|
15 |
+
* Metaclass to creates the database's tables, with the predefined forms, and create the resource files.
|
16 |
+
*
|
17 |
+
* @since 1.0.168
|
18 |
+
*/
|
19 |
+
class CPCFF_INSTALLER {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Creates the database structure and resource files in every new blog.
|
23 |
+
* The method is called by the 'wpmu_new_blog' hook.
|
24 |
+
*
|
25 |
+
* @param int $blog_id Blog ID.
|
26 |
+
* @param int $user_id User ID.
|
27 |
+
* @param string $domain Site domain.
|
28 |
+
* @param string $path Site path.
|
29 |
+
* @param int $site_id Site ID. Only relevant on multi-network installs.
|
30 |
+
* @param array $meta Meta data. Used to set initial site options.
|
31 |
+
*/
|
32 |
+
public static function new_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
|
33 |
+
if ( is_plugin_active_for_network( 'calculated-fields-form/cp_calculatedfieldsf_free.php' ) ) {
|
34 |
+
global $wpdb;
|
35 |
+
$old_blog = $wpdb->blogid;
|
36 |
+
switch_to_blog( $blog_id );
|
37 |
+
self::_db_structure();
|
38 |
+
switch_to_blog( $old_blog );
|
39 |
+
}
|
40 |
+
} // End new_blog
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Creates the database tables and resources in every existent blog on website.
|
44 |
+
*
|
45 |
+
* @param bool $networkwide Multisite installation.
|
46 |
+
*/
|
47 |
+
public static function install( $networkwide ) {
|
48 |
+
// check if it is a network activation - if so, run the activation function for each blog id
|
49 |
+
if (
|
50 |
+
function_exists( 'is_multisite' ) &&
|
51 |
+
is_multisite() &&
|
52 |
+
$networkwide
|
53 |
+
) {
|
54 |
+
global $wpdb;
|
55 |
+
$old_blog = $wpdb->blogid;
|
56 |
+
|
57 |
+
// Get all blog ids
|
58 |
+
$blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
59 |
+
foreach ( $blogids as $blog_id ) {
|
60 |
+
switch_to_blog( $blog_id );
|
61 |
+
self::_db_structure();
|
62 |
+
}
|
63 |
+
switch_to_blog( $old_blog );
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
self::_db_structure();
|
67 |
+
} //End install
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Creates a backup of the insert_in_database file.
|
71 |
+
*/
|
72 |
+
public static function uninstall() { } // End uninstall
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Creates the database tables used by the plugin's core.
|
76 |
+
*
|
77 |
+
* Creates the database tables, alters the tables created by the free version of the plugin.
|
78 |
+
*
|
79 |
+
* @access private.
|
80 |
+
* @return void.
|
81 |
+
*/
|
82 |
+
private static function _db_structure() {
|
83 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
84 |
+
|
85 |
+
global $wpdb;
|
86 |
+
$charset_collate = $wpdb->get_charset_collate();
|
87 |
+
|
88 |
+
$db_queries = array();
|
89 |
+
|
90 |
+
// Posts table
|
91 |
+
$db_queries[] = 'CREATE TABLE ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_POSTS_TABLE_NAME_NO_PREFIX . " (
|
92 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
93 |
+
formid INT NOT NULL,
|
94 |
+
time datetime,
|
95 |
+
ipaddr VARCHAR(41) DEFAULT '' NOT NULL,
|
96 |
+
notifyto VARCHAR(250) DEFAULT '' NOT NULL,
|
97 |
+
data mediumtext,
|
98 |
+
paypal_post mediumtext,
|
99 |
+
paid INT DEFAULT 0 NOT NULL,
|
100 |
+
UNIQUE KEY id (id)
|
101 |
+
) $charset_collate;";
|
102 |
+
|
103 |
+
// Discounts table
|
104 |
+
$db_queries[] = 'CREATE TABLE ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_DISCOUNT_CODES_TABLE_NAME_NO_PREFIX . " (
|
105 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
106 |
+
form_id mediumint(9) NOT NULL DEFAULT 1,
|
107 |
+
code VARCHAR(250) DEFAULT '' NOT NULL,
|
108 |
+
discount VARCHAR(250) DEFAULT '' NOT NULL,
|
109 |
+
expires datetime,
|
110 |
+
availability int(10) unsigned NOT NULL DEFAULT 0,
|
111 |
+
used int(10) unsigned NOT NULL DEFAULT 0,
|
112 |
+
UNIQUE KEY id (id)
|
113 |
+
) $charset_collate;";
|
114 |
+
|
115 |
+
// CHANGE ROW_FORMAT ONLY ONCE
|
116 |
+
if ( get_option( $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . '_ROW_FORMAT', 0 ) == 0 ) {
|
117 |
+
update_option( $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . '_ROW_FORMAT', 1 );
|
118 |
+
$check_table_exists = $wpdb->get_results( 'SHOW TABLES LIKE "' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . '"' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
119 |
+
if ( count( $check_table_exists ) ) {
|
120 |
+
$wpdb->query( 'ALTER TABLE ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . ' ROW_FORMAT=DYNAMIC' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
// Forms structures table
|
125 |
+
$db_queries[] = 'CREATE TABLE ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . " (
|
126 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
127 |
+
form_name VARCHAR(250) DEFAULT '' NOT NULL,
|
128 |
+
form_structure mediumtext,
|
129 |
+
fp_from_email VARCHAR(250) DEFAULT '' NOT NULL,
|
130 |
+
fp_destination_emails TEXT,
|
131 |
+
fp_subject TEXT,
|
132 |
+
fp_inc_additional_info VARCHAR(10) DEFAULT '' NOT NULL,
|
133 |
+
fp_return_page VARCHAR(250) DEFAULT '' NOT NULL,
|
134 |
+
fp_message mediumtext,
|
135 |
+
fp_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
|
136 |
+
cu_enable_copy_to_user VARCHAR(10) DEFAULT '' NOT NULL,
|
137 |
+
cu_user_email_field TEXT DEFAULT '' NOT NULL,
|
138 |
+
cu_subject TEXT,
|
139 |
+
cu_message mediumtext,
|
140 |
+
cu_emailformat VARCHAR(10) DEFAULT '' NOT NULL,
|
141 |
+
fp_emailfrommethod VARCHAR(10) DEFAULT '' NOT NULL,
|
142 |
+
enable_paypal_option_yes VARCHAR(250) DEFAULT '' NOT NULL,
|
143 |
+
enable_paypal_option_no VARCHAR(250) DEFAULT '' NOT NULL,
|
144 |
+
vs_use_validation VARCHAR(10) DEFAULT '' NOT NULL,
|
145 |
+
vs_text_is_required VARCHAR(250) DEFAULT '' NOT NULL,
|
146 |
+
vs_text_is_email VARCHAR(250) DEFAULT '' NOT NULL,
|
147 |
+
vs_text_datemmddyyyy VARCHAR(250) DEFAULT '' NOT NULL,
|
148 |
+
vs_text_dateddmmyyyy VARCHAR(250) DEFAULT '' NOT NULL,
|
149 |
+
vs_text_number VARCHAR(250) DEFAULT '' NOT NULL,
|
150 |
+
vs_text_digits VARCHAR(250) DEFAULT '' NOT NULL,
|
151 |
+
vs_text_max VARCHAR(250) DEFAULT '' NOT NULL,
|
152 |
+
vs_text_min VARCHAR(250) DEFAULT '' NOT NULL,
|
153 |
+
vs_text_submitbtn VARCHAR(250) DEFAULT '' NOT NULL,
|
154 |
+
vs_text_previousbtn VARCHAR(250) DEFAULT '' NOT NULL,
|
155 |
+
vs_text_nextbtn VARCHAR(250) DEFAULT '' NOT NULL,
|
156 |
+
vs_all_texts text DEFAULT '' NOT NULL,
|
157 |
+
enable_paypal varchar(10) DEFAULT '' NOT NULL,
|
158 |
+
enable_submit varchar(10) DEFAULT '' NOT NULL,
|
159 |
+
paypal_notiemails varchar(10) DEFAULT '' NOT NULL,
|
160 |
+
paypal_email varchar(255) DEFAULT '' NOT NULL ,
|
161 |
+
request_cost varchar(255) DEFAULT '' NOT NULL ,
|
162 |
+
paypal_product_name varchar(255) DEFAULT '' NOT NULL,
|
163 |
+
currency varchar(10) DEFAULT '' NOT NULL,
|
164 |
+
paypal_language varchar(10) DEFAULT '' NOT NULL,
|
165 |
+
paypal_mode varchar(20) DEFAULT '' NOT NULL ,
|
166 |
+
paypal_recurrent varchar(20) DEFAULT '' NOT NULL ,
|
167 |
+
paypal_recurrent_setup varchar(20) DEFAULT '' NOT NULL ,
|
168 |
+
paypal_recurrent_setup_days varchar(20) DEFAULT '' NOT NULL ,
|
169 |
+
paypal_recurrent_times varchar(20) DEFAULT '' NOT NULL ,
|
170 |
+
paypal_recurrent_times_field varchar(20) DEFAULT '' NOT NULL ,
|
171 |
+
paypal_identify_prices varchar(20) DEFAULT '' NOT NULL ,
|
172 |
+
paypal_zero_payment varchar(10) DEFAULT '' NOT NULL ,
|
173 |
+
paypal_base_amount VARCHAR(250),
|
174 |
+
paypal_address TINYINT DEFAULT 1 NOT NULL,
|
175 |
+
cv_enable_captcha VARCHAR(20) DEFAULT '' NOT NULL,
|
176 |
+
cv_width VARCHAR(20) DEFAULT '' NOT NULL,
|
177 |
+
cv_height VARCHAR(20) DEFAULT '' NOT NULL,
|
178 |
+
cv_chars VARCHAR(20) DEFAULT '' NOT NULL,
|
179 |
+
cv_font VARCHAR(20) DEFAULT '' NOT NULL,
|
180 |
+
cv_min_font_size VARCHAR(20) DEFAULT '' NOT NULL,
|
181 |
+
cv_max_font_size VARCHAR(20) DEFAULT '' NOT NULL,
|
182 |
+
cv_noise VARCHAR(20) DEFAULT '' NOT NULL,
|
183 |
+
cv_noise_length VARCHAR(20) DEFAULT '' NOT NULL,
|
184 |
+
cv_background VARCHAR(20) DEFAULT '' NOT NULL,
|
185 |
+
cv_border VARCHAR(20) DEFAULT '' NOT NULL,
|
186 |
+
cv_text_enter_valid_captcha VARCHAR(200) DEFAULT '' NOT NULL,
|
187 |
+
category VARCHAR(250),
|
188 |
+
cache longtext DEFAULT '' NOT NULL,
|
189 |
+
UNIQUE KEY id (id)
|
190 |
+
) $charset_collate ROW_FORMAT=DYNAMIC;";
|
191 |
+
|
192 |
+
// Revisions table
|
193 |
+
$db_queries[] = 'CREATE TABLE ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE . " (
|
194 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
195 |
+
formid mediumint(9) NOT NULL,
|
196 |
+
time datetime,
|
197 |
+
revision longtext NOT NULL,
|
198 |
+
UNIQUE KEY id (id)
|
199 |
+
) $charset_collate;";
|
200 |
+
|
201 |
+
dbDelta( $db_queries ); // Running the queries
|
202 |
+
|
203 |
+
// Alter table
|
204 |
+
self::_alter_table( $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE, array( 'category' => 'VARCHAR(250)' ) );
|
205 |
+
|
206 |
+
// Insert the predefined forms into the forms table
|
207 |
+
self::_predefined_forms();
|
208 |
+
} // End _db_structure
|
209 |
+
|
210 |
+
private static function _alter_table( $table, $new_columns = array() ) {
|
211 |
+
try {
|
212 |
+
if ( count( $new_columns ) ) {
|
213 |
+
global $wpdb;
|
214 |
+
$current_columns = array();
|
215 |
+
|
216 |
+
$columns = $wpdb->get_results( 'SHOW columns FROM `' . $table . '`' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
217 |
+
foreach ( $columns as $column ) {
|
218 |
+
$current_columns[ $column->Field ] = $column->Field;
|
219 |
+
}
|
220 |
+
|
221 |
+
foreach ( $new_columns as $column_name => $column_settings ) {
|
222 |
+
if ( ! isset( $current_columns[ $column_name ] ) ) {
|
223 |
+
$sql = 'ALTER TABLE `' . $table . '` ADD `' . $column_name . '` ' . $column_settings;
|
224 |
+
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
} catch ( Exception $err ) {
|
229 |
+
error_log( $err->getMessage() );}
|
230 |
+
} // End _alter_table
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Inserts the predefined forms into the Forms table
|
234 |
+
*/
|
235 |
+
private static function _predefined_forms() {
|
236 |
+
global $wpdb;
|
237 |
+
$table_name = $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE;
|
238 |
+
$count = $wpdb->get_var( 'SELECT COUNT(id) FROM ' . $table_name ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
239 |
+
if ( ! $count ) {
|
240 |
+
cpcff_init_constants();
|
241 |
+
$values = array(
|
242 |
+
'fp_from_email' => CP_CALCULATEDFIELDSF_DEFAULT_fp_from_email,
|
243 |
+
'fp_destination_emails' => CP_CALCULATEDFIELDSF_DEFAULT_fp_destination_emails,
|
244 |
+
'fp_subject' => CP_CALCULATEDFIELDSF_DEFAULT_fp_subject,
|
245 |
+
'fp_inc_additional_info' => CP_CALCULATEDFIELDSF_DEFAULT_fp_inc_additional_info,
|
246 |
+
'fp_return_page' => CP_CALCULATEDFIELDSF_DEFAULT_fp_return_page,
|
247 |
+
'fp_message' => CP_CALCULATEDFIELDSF_DEFAULT_fp_message,
|
248 |
+
'fp_emailformat' => CP_CALCULATEDFIELDSF_DEFAULT_email_format,
|
249 |
+
|
250 |
+
'cu_enable_copy_to_user' => CP_CALCULATEDFIELDSF_DEFAULT_cu_enable_copy_to_user,
|
251 |
+
'cu_user_email_field' => CP_CALCULATEDFIELDSF_DEFAULT_cu_user_email_field,
|
252 |
+
'cu_subject' => CP_CALCULATEDFIELDSF_DEFAULT_cu_subject,
|
253 |
+
'cu_message' => CP_CALCULATEDFIELDSF_DEFAULT_cu_message,
|
254 |
+
'cu_emailformat' => CP_CALCULATEDFIELDSF_DEFAULT_email_format,
|
255 |
+
|
256 |
+
'vs_use_validation' => CP_CALCULATEDFIELDSF_DEFAULT_vs_use_validation,
|
257 |
+
'vs_text_is_required' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required,
|
258 |
+
'vs_text_is_email' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email,
|
259 |
+
'vs_text_datemmddyyyy' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy,
|
260 |
+
'vs_text_dateddmmyyyy' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy,
|
261 |
+
'vs_text_number' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number,
|
262 |
+
'vs_text_digits' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits,
|
263 |
+
'vs_text_max' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max,
|
264 |
+
'vs_text_min' => CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min,
|
265 |
+
'vs_text_submitbtn' => 'Submit',
|
266 |
+
'vs_text_previousbtn' => 'Previous',
|
267 |
+
'vs_text_nextbtn' => 'Next',
|
268 |
+
|
269 |
+
'enable_paypal' => CP_CALCULATEDFIELDSF_DEFAULT_ENABLE_PAYPAL,
|
270 |
+
'enable_submit' => '',
|
271 |
+
'paypal_notiemails' => '0',
|
272 |
+
'paypal_email' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_EMAIL,
|
273 |
+
'request_cost' => CP_CALCULATEDFIELDSF_DEFAULT_COST,
|
274 |
+
'paypal_product_name' => CP_CALCULATEDFIELDSF_DEFAULT_PRODUCT_NAME,
|
275 |
+
'currency' => CP_CALCULATEDFIELDSF_DEFAULT_CURRENCY,
|
276 |
+
'paypal_language' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_LANGUAGE,
|
277 |
+
'paypal_mode' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_MODE,
|
278 |
+
'paypal_recurrent' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_RECURRENT,
|
279 |
+
'paypal_recurrent_setup' => '',
|
280 |
+
'paypal_recurrent_setup_days' => '15',
|
281 |
+
'paypal_recurrent_times' => '0',
|
282 |
+
'paypal_recurrent_times_field' => '',
|
283 |
+
'paypal_identify_prices' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_IDENTIFY_PRICES,
|
284 |
+
'paypal_zero_payment' => CP_CALCULATEDFIELDSF_DEFAULT_PAYPAL_ZERO_PAYMENT,
|
285 |
+
|
286 |
+
'cv_enable_captcha' => CP_CALCULATEDFIELDSF_DEFAULT_cv_enable_captcha,
|
287 |
+
'cv_width' => CP_CALCULATEDFIELDSF_DEFAULT_cv_width,
|
288 |
+
'cv_height' => CP_CALCULATEDFIELDSF_DEFAULT_cv_height,
|
289 |
+
'cv_chars' => CP_CALCULATEDFIELDSF_DEFAULT_cv_chars,
|
290 |
+
'cv_font' => CP_CALCULATEDFIELDSF_DEFAULT_cv_font,
|
291 |
+
'cv_min_font_size' => CP_CALCULATEDFIELDSF_DEFAULT_cv_min_font_size,
|
292 |
+
'cv_max_font_size' => CP_CALCULATEDFIELDSF_DEFAULT_cv_max_font_size,
|
293 |
+
'cv_noise' => CP_CALCULATEDFIELDSF_DEFAULT_cv_noise,
|
294 |
+
'cv_noise_length' => CP_CALCULATEDFIELDSF_DEFAULT_cv_noise_length,
|
295 |
+
'cv_background' => CP_CALCULATEDFIELDSF_DEFAULT_cv_background,
|
296 |
+
'cv_border' => CP_CALCULATEDFIELDSF_DEFAULT_cv_border,
|
297 |
+
'cv_text_enter_valid_captcha' => CP_CALCULATEDFIELDSF_DEFAULT_cv_text_enter_valid_captcha,
|
298 |
+
);
|
299 |
+
$values['id'] = 1;
|
300 |
+
$values['form_name'] = 'Simple Operations';
|
301 |
+
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure1;
|
302 |
+
$wpdb->insert( $table_name, $values );
|
303 |
+
$values['id'] = 2;
|
304 |
+
$values['form_name'] = 'Calculation with Dates';
|
305 |
+
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure2;
|
306 |
+
$wpdb->insert( $table_name, $values );
|
307 |
+
$values['id'] = 3;
|
308 |
+
$values['form_name'] = 'Ideal Weight Calculator';
|
309 |
+
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure3;
|
310 |
+
$wpdb->insert( $table_name, $values );
|
311 |
+
$values['id'] = 4;
|
312 |
+
$values['form_name'] = 'Pregnancy Calculator';
|
313 |
+
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure4;
|
314 |
+
$wpdb->insert( $table_name, $values );
|
315 |
+
$values['id'] = 5;
|
316 |
+
$values['form_name'] = 'Lease Calculator';
|
317 |
+
$values['form_structure'] = CP_CALCULATEDFIELDSF_DEFAULT_form_structure5;
|
318 |
+
$wpdb->insert( $table_name, $values );
|
319 |
+
}
|
320 |
+
} // End _predefined_forms
|
321 |
+
|
322 |
+
} // End class CPCFF_INSTALLER
|
323 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_main.inc.php
CHANGED
@@ -1,1093 +1,1074 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class with main actions and filters: CPCFF_MAIN class
|
4 |
-
*
|
5 |
-
* @package CFF.
|
6 |
-
* @since 1.0.170
|
7 |
-
*/
|
8 |
-
|
9 |
-
if(!class_exists('CPCFF_MAIN'))
|
10 |
-
|
11 |
-
|
12 |
-
*
|
13 |
-
*
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
*
|
20 |
-
*
|
21 |
-
*
|
22 |
-
* @
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
*
|
29 |
-
*
|
30 |
-
*
|
31 |
-
* @
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
* @
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
*
|
47 |
-
*
|
48 |
-
*
|
49 |
-
* @
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
*
|
56 |
-
*
|
57 |
-
*
|
58 |
-
* @
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
*
|
65 |
-
*
|
66 |
-
*
|
67 |
-
*
|
68 |
-
* @
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
* Instance
|
75 |
-
*
|
76 |
-
*
|
77 |
-
* @
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
*
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
$
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
*
|
120 |
-
*
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
*
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
//
|
175 |
-
$this
|
176 |
-
|
177 |
-
//
|
178 |
-
|
179 |
-
|
180 |
-
//
|
181 |
-
add_action( '
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
*
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
*
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
*
|
231 |
-
*
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
wp_enqueue_script(
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
'
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
'
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
$
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
if(!empty($
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
if(
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
*
|
658 |
-
*
|
659 |
-
*
|
660 |
-
*
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
*
|
675 |
-
*
|
676 |
-
* @
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
*
|
690 |
-
*
|
691 |
-
*
|
692 |
-
* @
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
$
|
699 |
-
if($
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
*
|
712 |
-
*
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
$
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
if(
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
$excluded_js[]
|
1052 |
-
$excluded_js[]
|
1053 |
-
|
1054 |
-
$excluded_js
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
$
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
{
|
1066 |
-
$
|
1067 |
-
$
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
$
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
public static function breeze_check_content( $content ) {
|
1077 |
-
if ( strpos( $content, 'form_structure_' ) !== false ) {
|
1078 |
-
global $cff_breeze_content_bk;
|
1079 |
-
$cff_breeze_content_bk = $content;
|
1080 |
-
}
|
1081 |
-
return $content;
|
1082 |
-
} // End breeze_check_content
|
1083 |
-
|
1084 |
-
public static function breeze_return_content( $content ) {
|
1085 |
-
global $cff_breeze_content_bk;
|
1086 |
-
if( ! empty( $cff_breeze_content_bk ) ) {
|
1087 |
-
$content = $cff_breeze_content_bk;
|
1088 |
-
unset( $cff_breeze_content_bk );
|
1089 |
-
}
|
1090 |
-
return $content;
|
1091 |
-
} // End breeze_return_content
|
1092 |
-
} // End CPCFF_MAIN
|
1093 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class with main actions and filters: CPCFF_MAIN class
|
4 |
+
*
|
5 |
+
* @package CFF.
|
6 |
+
* @since 1.0.170
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CPCFF_MAIN' ) ) {
|
10 |
+
/**
|
11 |
+
* Class that defines the main actions and filters, and plugin's functionalities.
|
12 |
+
*
|
13 |
+
* @since 1.0.170
|
14 |
+
*/
|
15 |
+
class CPCFF_MAIN {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Counter of forms in a same page
|
19 |
+
* Metaclass property.
|
20 |
+
*
|
21 |
+
* @since 1.0.170
|
22 |
+
* @var int $form_counter
|
23 |
+
*/
|
24 |
+
public static $form_counter = 0;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Instance of the CPCFF_MAIN class
|
28 |
+
* Metaclass property to implement a singleton.
|
29 |
+
*
|
30 |
+
* @since 1.0.179
|
31 |
+
* @var object $_instance
|
32 |
+
*/
|
33 |
+
private static $_instance;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Identifies if the class was instanciated from the public website or WordPress
|
37 |
+
* Instance property.
|
38 |
+
*
|
39 |
+
* @sinze 1.0.170
|
40 |
+
* @var bool $_is_admin
|
41 |
+
*/
|
42 |
+
private $_is_admin = false;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Plugin URL
|
46 |
+
* Instance property.
|
47 |
+
*
|
48 |
+
* @sinze 1.0.170
|
49 |
+
* @var string $_plugin_url
|
50 |
+
*/
|
51 |
+
private $_plugin_url;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Flag to know if the public resources were included
|
55 |
+
* Instance property.
|
56 |
+
*
|
57 |
+
* @sinze 1.0.170
|
58 |
+
* @var bool $_are_resources_loaded default false
|
59 |
+
*/
|
60 |
+
private $_are_resources_loaded = false;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Forms list.
|
64 |
+
* List of instances of the CPCFF_FORM class.
|
65 |
+
* Instance property.
|
66 |
+
*
|
67 |
+
* @sinze 1.0.179
|
68 |
+
* @var object $_active_form
|
69 |
+
*/
|
70 |
+
private $_forms = array();
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Instance of the CPCFF_AMP class to manage the forms in AMP pages
|
74 |
+
* Instance property.
|
75 |
+
*
|
76 |
+
* @sinze 1.0.230
|
77 |
+
* @var object $_amp
|
78 |
+
*/
|
79 |
+
private $_amp;
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Constructs a CPCFF_MAIN object, and define the hooks to the filters and actions.
|
83 |
+
* The constructor is private because this class is a singleton
|
84 |
+
*/
|
85 |
+
private function __construct() {
|
86 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_form.inc.php';
|
87 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_amp.inc.php';
|
88 |
+
|
89 |
+
// Initializes the $_is_admin property
|
90 |
+
$this->_is_admin = is_admin();
|
91 |
+
|
92 |
+
// Initializes the $_plugin_url property
|
93 |
+
$this->_plugin_url = plugin_dir_url( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH );
|
94 |
+
|
95 |
+
// Plugin activation/deactivation
|
96 |
+
$this->_activate_deactivate();
|
97 |
+
|
98 |
+
// Load the language file
|
99 |
+
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
100 |
+
|
101 |
+
// Instanciate the AMP object
|
102 |
+
$this->_amp = new CPCFF_AMP( $this );
|
103 |
+
|
104 |
+
// Run the initialization code
|
105 |
+
add_action( 'init', array( $this, 'init' ), 1 );
|
106 |
+
|
107 |
+
// Run the initialization code of widgets
|
108 |
+
add_action( 'widgets_init', array( $this, 'widgets_init' ), 1 );
|
109 |
+
|
110 |
+
// Integration with Page Builders
|
111 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_page_builders.inc.php';
|
112 |
+
CPCFF_PAGE_BUILDERS::run();
|
113 |
+
|
114 |
+
} // End __construct
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Returns the instance of the singleton.
|
118 |
+
*
|
119 |
+
* @since 1.0.179
|
120 |
+
* @return object self::$_instance
|
121 |
+
*/
|
122 |
+
public static function instance() {
|
123 |
+
if ( ! isset( self::$_instance ) ) {
|
124 |
+
self::$_instance = new self();
|
125 |
+
}
|
126 |
+
return self::$_instance;
|
127 |
+
} // End instance
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Loads the primary resources, previous to the plugin's initialization
|
131 |
+
*
|
132 |
+
* Loads resources like the laguages files, etc.
|
133 |
+
*
|
134 |
+
* @return void.
|
135 |
+
*/
|
136 |
+
public function plugins_loaded() {
|
137 |
+
// Fix different troubleshoots
|
138 |
+
$this->troubleshoots();
|
139 |
+
|
140 |
+
// Load the language file
|
141 |
+
$this->_textdomain();
|
142 |
+
|
143 |
+
// Load controls scripts
|
144 |
+
$this->_load_controls_scrips();
|
145 |
+
} // End plugins_loaded
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Initializes the plugin, runs as soon as possible.
|
149 |
+
*
|
150 |
+
* Initilize the plugin's sections, intercepts the submissions, generates the resources etc.
|
151 |
+
*
|
152 |
+
* @return void.
|
153 |
+
*/
|
154 |
+
public function init() {
|
155 |
+
CPCFF_AUXILIARY::clean_transients_hook(); // Set the hook for clearing the expired transients
|
156 |
+
|
157 |
+
if ( $this->_is_admin ) {
|
158 |
+
if (
|
159 |
+
false === ( $CP_CALCULATEDFIELDSF_VERSION = get_option( 'CP_CALCULATEDFIELDSF_VERSION' ) ) || // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
160 |
+
CP_CALCULATEDFIELDSF_VERSION != $CP_CALCULATEDFIELDSF_VERSION
|
161 |
+
) {
|
162 |
+
if ( class_exists( 'CPCFF_INSTALLER' ) ) {
|
163 |
+
CPCFF_INSTALLER::install( is_multisite() );
|
164 |
+
}
|
165 |
+
update_option( 'CP_CALCULATEDFIELDSF_VERSION', CP_CALCULATEDFIELDSF_VERSION );
|
166 |
+
}
|
167 |
+
|
168 |
+
// Update metabox status if corresponds
|
169 |
+
$this->update_metabox_status();
|
170 |
+
|
171 |
+
// Adds the plugin links in the plugins sections
|
172 |
+
add_filter( 'plugin_action_links_' . CP_CALCULATEDFIELDSF_BASE_NAME, array( $this, 'links' ) );
|
173 |
+
|
174 |
+
// Creates the menu entries in the WordPress menu.
|
175 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
176 |
+
|
177 |
+
// Displays the shortcode insertion buttons.
|
178 |
+
add_action( 'media_buttons', array( $this, 'media_buttons' ) );
|
179 |
+
|
180 |
+
// Loads the admin resources
|
181 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_resources' ), 1 );
|
182 |
+
}
|
183 |
+
$this->_define_shortcodes();
|
184 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_loader' ) );
|
185 |
+
} // End init
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Registers the widgets.
|
189 |
+
*
|
190 |
+
* Registers the widget to include the forms on sidebars, and for loading the data collected by the forms in the dashboard.
|
191 |
+
*
|
192 |
+
* @since 1.0.178
|
193 |
+
*
|
194 |
+
* @return void.
|
195 |
+
*/
|
196 |
+
public function widgets_init() {
|
197 |
+
// Replace the shortcodes into the text widgets.
|
198 |
+
if ( ! $this->_is_admin ) {
|
199 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
200 |
+
}
|
201 |
+
} // End widgets_init
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Adds the plugin's links in the plugins section.
|
205 |
+
*
|
206 |
+
* Links for accessing to the help, settings, developers website, etc.
|
207 |
+
*
|
208 |
+
* @param array $links.
|
209 |
+
*
|
210 |
+
* @return array.
|
211 |
+
*/
|
212 |
+
public function links( $links ) {
|
213 |
+
array_unshift(
|
214 |
+
$links,
|
215 |
+
'<a href="https://cff.dwbooster.com/customization" target="_blank">' . __( 'Request custom changes' ) . '</a>',
|
216 |
+
'<a href="admin.php?page=cp_calculated_fields_form">' . __( 'Settings' ) . '</a>',
|
217 |
+
'<a href="https://cff.dwbooster.com/download" target="_blank">' . __( 'Upgrade' ) . '</a>',
|
218 |
+
'<a href="https://wordpress.org/support/plugin/calculated-fields-form#new-post" target="_blank">' . __( 'Help' ) . '</a>'
|
219 |
+
);
|
220 |
+
return $links;
|
221 |
+
} // End links
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Prints the buttons for inserting the different shortcodes into the pages/posts contents.
|
225 |
+
*
|
226 |
+
* Prints the HTML code that appears beside the media button with the icons and code to insert the shortcodes:
|
227 |
+
*
|
228 |
+
* - CP_CALCULATED_FIELDS
|
229 |
+
* - CP_CALCULATED_FIELDS_VAR
|
230 |
+
*
|
231 |
+
* @return void.
|
232 |
+
*/
|
233 |
+
public function media_buttons() {
|
234 |
+
print '<a href="javascript:cp_calculatedfieldsf_insertForm();" title="' . esc_attr__( 'Insert Calculated Fields Form', 'calculated-fields-form' ) . '"><img src="' . esc_attr( $this->_plugin_url ) . 'images/cp_form.gif" alt="' . esc_attr__( 'Insert Calculated Fields Form', 'calculated-fields-form' ) . '" /></a><a href="javascript:cp_calculatedfieldsf_insertVar();" title="' . esc_attr__( 'Create a JavaScript var from POST, GET, SESSION, or COOKIE var', 'calculated-fields-form' ) . '"><img src="' . esc_attr( $this->_plugin_url ) . 'images/cp_var.gif" alt="' . esc_attr__( 'Create a JavaScript var from POST, GET, SESSION, or COOKIE var', 'calculated-fields-form' ) . '" /></a>';
|
235 |
+
} // End media_buttons
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Generates the entries in the WordPress menu.
|
239 |
+
*
|
240 |
+
* @return void.
|
241 |
+
*/
|
242 |
+
public function admin_menu() {
|
243 |
+
// Settings page
|
244 |
+
add_options_page( 'Calculated Fields Form Options', 'Calculated Fields Form', 'manage_options', 'cp_calculated_fields_form', array( $this, 'admin_pages' ) );
|
245 |
+
|
246 |
+
// Menu option
|
247 |
+
add_menu_page( 'Calculated Fields Form Options', 'Calculated Fields Form', 'manage_options', 'cp_calculated_fields_form', array( $this, 'admin_pages' ) );
|
248 |
+
|
249 |
+
// Submenu options
|
250 |
+
add_submenu_page( 'cp_calculated_fields_form', 'Upgrade', 'Upgrade', 'manage_options', 'cp_calculated_fields_form_sub3', array( $this, 'admin_pages' ) );
|
251 |
+
|
252 |
+
add_submenu_page( 'cp_calculated_fields_form', 'Marketplace', 'Marketplace', 'manage_options', 'cp_calculated_fields_form_sub5', array( $this, 'admin_pages' ) );
|
253 |
+
|
254 |
+
add_submenu_page( 'cp_calculated_fields_form', 'Documentation', 'Documentation', 'manage_options', 'cp_calculated_fields_form_sub2', array( $this, 'admin_pages' ) );
|
255 |
+
|
256 |
+
add_submenu_page( 'cp_calculated_fields_form', 'Online Help', 'Online Help', 'manage_options', 'cp_calculated_fields_form_sub4', array( $this, 'admin_pages' ) );
|
257 |
+
} // End admin_menu
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Loads the corresponding pages in the WordPress or redirects the user to the external URLs.
|
261 |
+
*
|
262 |
+
* Loads the webpage with the list of forms, addons activation, general settings, etc.
|
263 |
+
* or redirects to external webpages like plugin's documentation
|
264 |
+
*
|
265 |
+
* @since 1.0.181
|
266 |
+
*/
|
267 |
+
public function admin_pages() {
|
268 |
+
// Settings page of the plugin
|
269 |
+
if ( isset( $_GET['cal'] ) && '' != $_GET['cal'] ) {
|
270 |
+
@include_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_admin_int.inc.php';
|
271 |
+
} else {
|
272 |
+
// Redirecting outer website
|
273 |
+
if ( isset( $_GET['page'] ) && 'cp_calculated_fields_form_sub3' == $_GET['page'] ) {
|
274 |
+
if ( @wp_redirect( 'https://cff.dwbooster.com/download' ) ) {
|
275 |
+
exit;
|
276 |
+
}
|
277 |
+
} elseif ( isset( $_GET['page'] ) && 'cp_calculated_fields_form_sub2' == $_GET['page'] ) {
|
278 |
+
if ( @wp_redirect( 'https://cff.dwbooster.com/documentation' ) ) {
|
279 |
+
exit;
|
280 |
+
}
|
281 |
+
} elseif ( isset( $_GET['page'] ) && 'cp_calculated_fields_form_sub4' == $_GET['page'] ) {
|
282 |
+
if ( @wp_redirect( 'https://wordpress.org/support/plugin/calculated-fields-form#new-post' ) ) {
|
283 |
+
exit;
|
284 |
+
}
|
285 |
+
} else {
|
286 |
+
@include_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_admin_int_list.inc.php';
|
287 |
+
}
|
288 |
+
}
|
289 |
+
} // End admin_pages
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Loads the javascript and style files.
|
293 |
+
*
|
294 |
+
* Checks if there is the settings page of the plugin for loading the corresponding JS and CSS files,
|
295 |
+
* or if it is a post or page the script for inserting the shortcodes in the content's editor.
|
296 |
+
*
|
297 |
+
* @since 1.0.171
|
298 |
+
*
|
299 |
+
* @param string $hook.
|
300 |
+
* @return void.
|
301 |
+
*/
|
302 |
+
public function admin_resources( $hook ) {
|
303 |
+
// Checks if it is the plugin's page
|
304 |
+
if ( isset( $_GET['page'] ) ) {
|
305 |
+
if ( 'cp_calculated_fields_form' == $_GET['page'] ) {
|
306 |
+
wp_deregister_script( 'tribe-events-bootstrap-datepicker' );
|
307 |
+
wp_register_script( 'tribe-events-bootstrap-datepicker', plugins_url( '/js/nope.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
308 |
+
|
309 |
+
wp_enqueue_script( 'jquery' );
|
310 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
311 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
312 |
+
wp_enqueue_script( 'jquery-ui-tabs' );
|
313 |
+
wp_enqueue_script( 'jquery-ui-droppable' );
|
314 |
+
wp_enqueue_script( 'jquery-ui-button' );
|
315 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
316 |
+
wp_deregister_script( 'query-stringify' );
|
317 |
+
wp_register_script( 'query-stringify', plugins_url( '/vendors/jQuery.stringify.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
318 |
+
wp_enqueue_script( 'query-stringify' );
|
319 |
+
|
320 |
+
// ULR to the admin resources
|
321 |
+
$admin_resources = admin_url( 'admin.php?page=cp_calculated_fields_form&cp_cff_resources=admin' );
|
322 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_builder_script', $admin_resources, array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-tabs', 'jquery-ui-droppable', 'jquery-ui-button', 'jquery-ui-accordion', 'jquery-ui-datepicker', 'query-stringify' ), CP_CALCULATEDFIELDSF_VERSION );
|
323 |
+
|
324 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_builder_library_script', plugins_url( '/js/library.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'cp_calculatedfieldsf_builder_script' ), CP_CALCULATEDFIELDSF_VERSION );
|
325 |
+
|
326 |
+
wp_localize_script(
|
327 |
+
'cp_calculatedfieldsf_builder_library_script',
|
328 |
+
'cpcff_forms_library_config',
|
329 |
+
array(
|
330 |
+
'version' => 'free',
|
331 |
+
'website_url' => 'admin.php?page=cp_calculated_fields_form&a=1&_cpcff_nonce=' . wp_create_nonce( 'cff-add-form' ),
|
332 |
+
)
|
333 |
+
);
|
334 |
+
|
335 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_builder_script_caret', plugins_url( '/vendors/jquery.caret.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'jquery' ), CP_CALCULATEDFIELDSF_VERSION );
|
336 |
+
wp_enqueue_style( 'cp_calculatedfieldsf_builder_style', plugins_url( '/css/style.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
337 |
+
wp_enqueue_style( 'cp_calculatedfieldsf_builder_library_style', plugins_url( '/css/stylelibrary.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'cp_calculatedfieldsf_builder_style' ), CP_CALCULATEDFIELDSF_VERSION );
|
338 |
+
wp_enqueue_style( 'jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css', array(), CP_CALCULATEDFIELDSF_VERSION );
|
339 |
+
} elseif (
|
340 |
+
in_array(
|
341 |
+
$_GET['page'],
|
342 |
+
array(
|
343 |
+
'cp_calculated_fields_form_sub2',
|
344 |
+
'cp_calculated_fields_form_sub3',
|
345 |
+
'cp_calculated_fields_form_sub4',
|
346 |
+
'cp_calculated_fields_form_sub5',
|
347 |
+
)
|
348 |
+
)
|
349 |
+
) {
|
350 |
+
$cpcff_redirect = array();
|
351 |
+
switch ( $_GET['page'] ) {
|
352 |
+
case 'cp_calculated_fields_form_sub2':
|
353 |
+
$cpcff_redirect['url'] = 'https://cff.dwbooster.com/documentation';
|
354 |
+
break;
|
355 |
+
case 'cp_calculated_fields_form_sub3':
|
356 |
+
$cpcff_redirect['url'] = 'https://cff.dwbooster.com/download';
|
357 |
+
break;
|
358 |
+
case 'cp_calculated_fields_form_sub4':
|
359 |
+
$cpcff_redirect['url'] = 'https://wordpress.org/support/plugin/calculated-fields-form#new-post';
|
360 |
+
break;
|
361 |
+
case 'cp_calculated_fields_form_sub5':
|
362 |
+
$cpcff_redirect['url'] = 'https://cff-bundles.dwbooster.com';
|
363 |
+
break;
|
364 |
+
}
|
365 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_redirect_script', plugins_url( '/js/redirect_script.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
366 |
+
wp_localize_script(
|
367 |
+
'cp_calculatedfieldsf_redirect_script',
|
368 |
+
'cpcff_redirect',
|
369 |
+
$cpcff_redirect
|
370 |
+
);
|
371 |
+
}
|
372 |
+
}
|
373 |
+
|
374 |
+
// Checks if it is a page or post
|
375 |
+
if ( 'post.php' == $hook || 'post-new.php' == $hook ) {
|
376 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_script', plugins_url( '/js/cp_calculatedfieldsf_scripts.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
377 |
+
}
|
378 |
+
} // End admin_resources
|
379 |
+
|
380 |
+
public function metabox_status( $metabox_id ) {
|
381 |
+
$statuses = get_option( 'cff-metaboxes-statuses', array() );
|
382 |
+
return ( ! empty( $statuses ) && is_array( $statuses ) && isset( $statuses[ $metabox_id ] ) && 0 == $statuses[ $metabox_id ] ) ? 'cff-metabox-closed' : 'cff-metabox-opened';
|
383 |
+
} // End metabox_status
|
384 |
+
|
385 |
+
private function update_metabox_status() {
|
386 |
+
if (
|
387 |
+
! empty( $_POST['cff-metabox-nonce'] ) &&
|
388 |
+
wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cff-metabox-nonce'] ) ), 'cff-metabox-status' ) &&
|
389 |
+
isset( $_POST['cff-metabox-id'] ) &&
|
390 |
+
isset( $_POST['cff-metabox-action'] )
|
391 |
+
) {
|
392 |
+
$metabox_id = sanitize_text_field( wp_unslash( $_POST['cff-metabox-id'] ) );
|
393 |
+
$metabox_action = sanitize_text_field( wp_unslash( $_POST['cff-metabox-action'] ) );
|
394 |
+
|
395 |
+
if ( ! empty( $metabox_id ) ) {
|
396 |
+
$statuses = get_option( 'cff-metaboxes-statuses', array() );
|
397 |
+
if ( empty( $statuses ) || ! is_array( $statuses ) ) {
|
398 |
+
$statuses = array();
|
399 |
+
}
|
400 |
+
$statuses[ $metabox_id ] = $metabox_action == 'open' ? 1 : 0; // phpcs:ignore WordPress.PHP.YodaConditions
|
401 |
+
update_option( 'cff-metaboxes-statuses', $statuses );
|
402 |
+
}
|
403 |
+
}
|
404 |
+
} // End update_metabox_status
|
405 |
+
|
406 |
+
public function form_preview( $atts ) {
|
407 |
+
if ( isset( $atts['shortcode_atts'] ) ) {
|
408 |
+
error_reporting( E_ERROR | E_PARSE );
|
409 |
+
global $wp_styles, $wp_scripts;
|
410 |
+
if ( ! empty( $wp_scripts ) ) {
|
411 |
+
$wp_scripts->reset();
|
412 |
+
}
|
413 |
+
$message = $this->public_form( $atts['shortcode_atts'] );
|
414 |
+
ob_start();
|
415 |
+
if ( ! empty( $wp_styles ) ) {
|
416 |
+
$wp_styles->do_items();
|
417 |
+
}
|
418 |
+
if ( ! empty( $wp_scripts ) ) {
|
419 |
+
$wp_scripts->do_items();
|
420 |
+
}
|
421 |
+
if ( class_exists( 'Error' ) ) {
|
422 |
+
try {
|
423 |
+
wp_footer(); } catch ( Error $err ) {
|
424 |
+
error_log( $err->getMessage() );
|
425 |
+
}
|
426 |
+
}
|
427 |
+
$message .= ob_get_contents();
|
428 |
+
ob_end_clean();
|
429 |
+
$page_title = ( ! empty( $atts['page_title'] ) ) ? $atts['page_title'] : '';
|
430 |
+
remove_all_actions( 'shutdown' );
|
431 |
+
if ( ! empty( $atts['wp_die'] ) ) {
|
432 |
+
wp_die( $message . '<style>body{margin:2em !important;max-width:100% !important;box-shadow:none !important;background:white !important}html{background:white !important;}.wp-die-message>*:not(form){visibility: hidden;} .pac-container, .ui-tooltip, .ui-tooltip *,.ui-datepicker,.ui-datepicker *{visibility: visible;}</style>' . apply_filters( 'cpcff_form_preview_resources', '' ), esc_html( $page_title ), 200 ); // phpcs:ignore WordPress.Security.EscapeOutput
|
433 |
+
} elseif ( ! empty( $atts['page'] ) ) {
|
434 |
+
print '<!DOCTYPE html><html><head profile="http://gmpg.org/xfn/11"><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1"></head><body>';
|
435 |
+
print $message; // phpcs:ignore WordPress.Security.EscapeOutput
|
436 |
+
print '<style>body>*:not(form){visibility: hidden;} .pac-container, .ui-tooltip, .ui-tooltip *,.ui-datepicker,.ui-datepicker *{visibility: visible;}</style>' . apply_filters( 'cpcff_form_preview_resources', '' ) . '</body></html>'; // phpcs:ignore WordPress.Security.EscapeOutput
|
437 |
+
exit;
|
438 |
+
} else {
|
439 |
+
print $message; // phpcs:ignore WordPress.Security.EscapeOutput
|
440 |
+
exit;
|
441 |
+
}
|
442 |
+
}
|
443 |
+
} // End form_preview
|
444 |
+
|
445 |
+
public function enqueue_loader() {
|
446 |
+
global $post;
|
447 |
+
|
448 |
+
if ( ! empty( $post ) && has_shortcode( $post->post_content, 'CP_CALCULATED_FIELDS' ) ) {
|
449 |
+
wp_enqueue_style( 'cpcff_loader', plugins_url( '/css/loader.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
450 |
+
}
|
451 |
+
} // End enqueue_loader
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Returns the public version of the form wih its resources.
|
455 |
+
*
|
456 |
+
* The method calls the filters: cpcff_pre_form, and cpcff_the_form
|
457 |
+
*
|
458 |
+
* @since 1.0.171
|
459 |
+
* @param array $atts includes the attributes required to identify the form, and create the variables.
|
460 |
+
* @return string $content a text with the public version of the form and resources.
|
461 |
+
*/
|
462 |
+
public function public_form( $atts ) {
|
463 |
+
// If the website is being visited by crawler, display empty text.
|
464 |
+
if ( CPCFF_AUXILIARY::is_crawler() ) {
|
465 |
+
return '';
|
466 |
+
}
|
467 |
+
if ( empty( $atts ) ) {
|
468 |
+
$atts = array();
|
469 |
+
}
|
470 |
+
if ( ! $this->_is_admin && $this->_amp->is_amp() ) {
|
471 |
+
$content = $this->_amp->get_iframe( $atts );
|
472 |
+
} else {
|
473 |
+
global $wpdb, $cpcff_default_texts_array;
|
474 |
+
|
475 |
+
if ( empty( $atts['id'] ) ) {
|
476 |
+
$myrow = $wpdb->get_row( 'SELECT * FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
477 |
+
} else {
|
478 |
+
$myrow = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . ' WHERE id=%d', $atts['id'] ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
479 |
+
}
|
480 |
+
|
481 |
+
if ( empty( $myrow ) ) {
|
482 |
+
return ''; // The form does not exists, or there are no forms.
|
483 |
+
}
|
484 |
+
$atts['id'] = $myrow->id; // If was not passed the form's id, uses the if of first form.
|
485 |
+
$id = $atts['id']; // Alias for the $atts[ 'id' ] variable.
|
486 |
+
|
487 |
+
// Initializing the $form_counter
|
488 |
+
if ( ! isset( $GLOBALS['codepeople_form_sequence_number'] ) ) {
|
489 |
+
$GLOBALS['codepeople_form_sequence_number'] = 0;
|
490 |
+
}
|
491 |
+
$GLOBALS['codepeople_form_sequence_number']++;
|
492 |
+
self::$form_counter = $GLOBALS['codepeople_form_sequence_number']; // Current form
|
493 |
+
|
494 |
+
/**
|
495 |
+
* Filters applied before generate the form,
|
496 |
+
* is passed as parameter an array with the forms attributes, and return the list of attributes
|
497 |
+
*/
|
498 |
+
$atts = apply_filters( 'cpcff_pre_form', $atts );
|
499 |
+
|
500 |
+
ob_start();
|
501 |
+
|
502 |
+
// Constant defined to protect the "inc/cpcff_public_int.inc.php" file against direct accesses.
|
503 |
+
if ( ! defined( 'CP_AUTH_INCLUDE' ) ) {
|
504 |
+
define( 'CP_AUTH_INCLUDE', true );
|
505 |
+
}
|
506 |
+
|
507 |
+
$this->_public_resources( $id ); // Load form scripts and other resources
|
508 |
+
|
509 |
+
/* TO-DO: This method should be analyzed after moving other functions to the main class . */
|
510 |
+
@include CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_public_int.inc.php';
|
511 |
+
|
512 |
+
$content = ob_get_contents();
|
513 |
+
|
514 |
+
// The attributes excepting "id" are converted in javascript variables with a global scope
|
515 |
+
if ( count( $atts ) > 1 ) {
|
516 |
+
$content .= '<script>';
|
517 |
+
foreach ( $atts as $i => $v ) {
|
518 |
+
if ( 'id' != $i && 'class' != $i && ! is_numeric( $i ) ) {
|
519 |
+
$nV = ( is_numeric( $v ) ) ? $v : json_encode( $v ); // Sanitizing the attribute's value
|
520 |
+
$content .= $i . '=' . $nV . ';';
|
521 |
+
$content .= 'if(typeof ' . $i . '_arr == "undefined") ' . $i . '_arr={}; ' . $i . '_arr["_' . self::$form_counter . '"]=' . $nV . ';';
|
522 |
+
}
|
523 |
+
}
|
524 |
+
$content .= '</script>';
|
525 |
+
}
|
526 |
+
ob_end_clean();
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Filters applied after generate the form,
|
530 |
+
* is passed as parameter the HTML code of the form with the corresponding <LINK> and <SCRIPT> tags,
|
531 |
+
* and returns the HTML code to includes in the webpage
|
532 |
+
*/
|
533 |
+
$content = apply_filters( 'cpcff_the_form', $content, $atts['id'] );
|
534 |
+
}
|
535 |
+
|
536 |
+
return $content;
|
537 |
+
} // End public_form
|
538 |
+
|
539 |
+
/**
|
540 |
+
* Creates a javascript variable, from: Post, Get, Session or Cookie or directly.
|
541 |
+
*
|
542 |
+
* If the webpage is visited from a crawler or search engine spider, the shortcode is replaced by an empty text.
|
543 |
+
*
|
544 |
+
* @since 1.0.175
|
545 |
+
* @param array $atts includes the records:
|
546 |
+
* - name, the variable's name.
|
547 |
+
* - value, to create a variable splicitly with the value passed as attribute.
|
548 |
+
* - from, identifies the variable source (POST, GET, SESSION or COOKIE), it is optional.
|
549 |
+
* - default_value, used in combination with the from attribute to populate the variable
|
550 |
+
* with the default value of the source does not exist.
|
551 |
+
*
|
552 |
+
* @return string <script> tag with the variable's definition.
|
553 |
+
*/
|
554 |
+
public function create_variable_shortcode( $atts ) {
|
555 |
+
if (
|
556 |
+
! CPCFF_AUXILIARY::is_crawler() && // Checks for crawlers or search engine spiders
|
557 |
+
! empty( $atts['name'] ) &&
|
558 |
+
( $var = trim( $atts['name'] ) ) != '' // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
559 |
+
) {
|
560 |
+
if ( isset( $atts['value'] ) ) {
|
561 |
+
$value = json_encode( $atts['value'] );
|
562 |
+
} else {
|
563 |
+
$from = '_';
|
564 |
+
if ( isset( $atts['from'] ) ) {
|
565 |
+
$from .= strtoupper( trim( $atts['from'] ) );
|
566 |
+
}
|
567 |
+
if ( in_array( $from, array( '_POST', '_GET', '_SESSION', '_COOKIE' ) ) ) {
|
568 |
+
if ( isset( $GLOBALS[ $from ][ $var ] ) ) {
|
569 |
+
$value = json_encode( $GLOBALS[ $from ][ $var ] );
|
570 |
+
} elseif ( isset( $atts['default_value'] ) ) {
|
571 |
+
$value = json_encode( $atts['default_value'] );
|
572 |
+
}
|
573 |
+
} else {
|
574 |
+
if ( isset( $_POST[ $var ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
|
575 |
+
$value = json_encode( $_POST[ $var ] ); // @codingStandardsIgnoreLine.
|
576 |
+
} elseif ( isset( $_GET[ $var ] ) ) {
|
577 |
+
$value = json_encode( $_GET[ $var ] ); // @codingStandardsIgnoreLine.
|
578 |
+
} elseif ( isset( $_SESSION[ $var ] ) ) {
|
579 |
+
$value = json_encode( $_SESSION[ $var ] );
|
580 |
+
} elseif ( isset( $_COOKIE[ $var ] ) ) {
|
581 |
+
$value = json_encode( sanitize_text_field( wp_unslash( $_COOKIE[ $var ] ) ) );
|
582 |
+
} elseif ( isset( $atts['default_value'] ) ) {
|
583 |
+
$value = json_encode( $atts['default_value'] );
|
584 |
+
}
|
585 |
+
}
|
586 |
+
}
|
587 |
+
if ( isset( $value ) ) {
|
588 |
+
return '
|
589 |
+
<script>
|
590 |
+
try{
|
591 |
+
window["' . esc_js( $var ) . '"]=' . $value . ';
|
592 |
+
}catch( err ){}
|
593 |
+
</script>
|
594 |
+
';
|
595 |
+
}
|
596 |
+
}
|
597 |
+
return '';
|
598 |
+
} // End create_variable_shortcode
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Return the list of categories associted with the forms
|
602 |
+
*/
|
603 |
+
public function get_categories( $html = '', &$current = null ) {
|
604 |
+
global $wpdb;
|
605 |
+
$categories = $wpdb->get_results( 'SELECT DISTINCT category FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . ' WHERE category IS NOT NULL AND category <> ""', ARRAY_A ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
606 |
+
|
607 |
+
if ( empty( $html ) ) {
|
608 |
+
return $categories;
|
609 |
+
}
|
610 |
+
|
611 |
+
$output = '';
|
612 |
+
$flag = false;
|
613 |
+
|
614 |
+
if ( ! empty( $categories ) ) {
|
615 |
+
foreach ( $categories as $category ) {
|
616 |
+
$selected = '';
|
617 |
+
|
618 |
+
if ( $current === $category['category'] ) {
|
619 |
+
$selected = 'SELECTED';
|
620 |
+
$flag = true;
|
621 |
+
}
|
622 |
+
|
623 |
+
if ( 'SELECT' == $html ) {
|
624 |
+
$output .= '<option value="' . esc_attr( $category['category'] ) . '" ' . $selected . ' >' . esc_html( $category['category'] ) . '</option>';
|
625 |
+
} else // DATALIST
|
626 |
+
{
|
627 |
+
$output .= '<option value="' . esc_attr( $category['category'] ) . '">';
|
628 |
+
}
|
629 |
+
}
|
630 |
+
}
|
631 |
+
|
632 |
+
if ( ! $flag ) {
|
633 |
+
$current = '';
|
634 |
+
}
|
635 |
+
|
636 |
+
return $output;
|
637 |
+
} // End get_categories
|
638 |
+
|
639 |
+
/**
|
640 |
+
* Returns an instance of the active form
|
641 |
+
*
|
642 |
+
* If there is not an active form generates the instance.
|
643 |
+
*
|
644 |
+
* @since 1.0.179
|
645 |
+
* @return object
|
646 |
+
*/
|
647 |
+
public function get_form( $id ) {
|
648 |
+
if ( ! isset( $this->_forms[ $id ] ) ) {
|
649 |
+
$this->_forms[ $id ] = new CPCFF_FORM( $id );
|
650 |
+
}
|
651 |
+
return $this->_forms[ $id ];
|
652 |
+
} // End get_active_form
|
653 |
+
|
654 |
+
/**
|
655 |
+
* Creates a new form calling the static method CPCFF_FORM::create_default
|
656 |
+
*
|
657 |
+
* @since 1.0.179
|
658 |
+
*
|
659 |
+
* @param string $form_name, the name of form.
|
660 |
+
* @return mixed, an instance of the created form or false.
|
661 |
+
*/
|
662 |
+
public function create_form( $form_name, $category_name = '', $form_template = 0 ) {
|
663 |
+
$form = CPCFF_FORM::create_default( $form_name, $category_name, $form_template );
|
664 |
+
if ( $form ) {
|
665 |
+
$this->_forms[ $form->get_id() ] = $form;
|
666 |
+
}
|
667 |
+
return $form;
|
668 |
+
} // End create_form
|
669 |
+
|
670 |
+
/**
|
671 |
+
* Deletes the form.
|
672 |
+
* The methods throw the cpcff_delete_form hook after delete the form.
|
673 |
+
*
|
674 |
+
* @since 1.0.179
|
675 |
+
* @param integer $id, the form's id.
|
676 |
+
* @return mixed, the number of delete rows or false.
|
677 |
+
*/
|
678 |
+
public function delete_form( $id ) {
|
679 |
+
$deleted = $this->get_form( $id )->delete_form();
|
680 |
+
if ( $deleted ) {
|
681 |
+
do_action( 'cpcff_delete_form', $id );
|
682 |
+
unset( $this->_forms[ $id ] );
|
683 |
+
}
|
684 |
+
return $deleted;
|
685 |
+
} // End delete_form
|
686 |
+
|
687 |
+
/**
|
688 |
+
* Clones a form.
|
689 |
+
*
|
690 |
+
* @since 1.0.179
|
691 |
+
* @param integer $id, the form's id.
|
692 |
+
* @return mixed, an instance of cloned form or false.
|
693 |
+
*/
|
694 |
+
public function clone_form( $id ) {
|
695 |
+
if ( ! isset( $this->_forms[ $id ] ) ) {
|
696 |
+
$this->_forms[ $id ] = new CPCFF_FORM( $id );
|
697 |
+
}
|
698 |
+
$cloned_form = $this->_forms[ $id ]->clone_form();
|
699 |
+
if ( $cloned_form ) {
|
700 |
+
/**
|
701 |
+
* Passes as parameter the original form's id, and the new form's id
|
702 |
+
*/
|
703 |
+
do_action( 'cpcff_clone_form', $id, $cloned_form->get_id() );
|
704 |
+
}
|
705 |
+
return $cloned_form;
|
706 |
+
} // End clone_form
|
707 |
+
|
708 |
+
/*********************************** PRIVATE METHODS ********************************************/
|
709 |
+
|
710 |
+
/**
|
711 |
+
* Defines the activativation/deactivation hooks, and new blog hook.
|
712 |
+
*
|
713 |
+
* Requires the cpcff_install_uninstall.inc.php file with the activate/deactivate code, and the code to run with new blogs.
|
714 |
+
*
|
715 |
+
* @sinze 1.0.171
|
716 |
+
* @return void.
|
717 |
+
*/
|
718 |
+
private function _activate_deactivate() {
|
719 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_install_uninstall.inc.php';
|
720 |
+
register_activation_hook( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH, array( 'CPCFF_INSTALLER', 'install' ) );
|
721 |
+
register_deactivation_hook( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH, array( 'CPCFF_INSTALLER', 'uninstall' ) );
|
722 |
+
add_action( 'wpmu_new_blog', array( 'CPCFF_INSTALLER', 'new_blog' ), 10, 6 );
|
723 |
+
} // End _activate_deactivate
|
724 |
+
|
725 |
+
/**
|
726 |
+
* Loads the language file.
|
727 |
+
*
|
728 |
+
* Loads the language file associated to the plugin, and creates the textdomain.
|
729 |
+
*
|
730 |
+
* @return void.
|
731 |
+
*/
|
732 |
+
private function _textdomain() {
|
733 |
+
load_plugin_textdomain( 'calculated-fields-form', false, dirname( CP_CALCULATEDFIELDSF_BASE_NAME ) . '/languages/' );
|
734 |
+
} // End _textdomain
|
735 |
+
|
736 |
+
/**
|
737 |
+
* Loads the controls scripts.
|
738 |
+
*
|
739 |
+
* Checks if there is defined the "cp_cff_resources" parameter, and loads the public or admin scripsts for the controls.
|
740 |
+
* If the scripsts are loaded the plugin exits the PHP execution.
|
741 |
+
*
|
742 |
+
* @return void.
|
743 |
+
*/
|
744 |
+
private function _load_controls_scrips() {
|
745 |
+
if ( isset( $_REQUEST['cp_cff_resources'] ) ) {
|
746 |
+
if ( ! defined( 'WP_DEBUG' ) || true != WP_DEBUG ) {
|
747 |
+
error_reporting( E_ERROR | E_PARSE );
|
748 |
+
}
|
749 |
+
// Set the corresponding header
|
750 |
+
if ( ! headers_sent() ) {
|
751 |
+
header( 'Content-type: application/javascript' );
|
752 |
+
}
|
753 |
+
|
754 |
+
if ( ! $this->_is_admin || 'public' == $_REQUEST['cp_cff_resources'] ) {
|
755 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/js/fbuilder-loader-public.php';
|
756 |
+
} else {
|
757 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/js/fbuilder-loader-admin.php';
|
758 |
+
}
|
759 |
+
remove_all_actions( 'shutdown' );
|
760 |
+
exit;
|
761 |
+
}
|
762 |
+
} // End _load_controls_scrips
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Defines the shortcodes used by the plugin's code:
|
766 |
+
*
|
767 |
+
* - CP_CALCULATED_FIELDS
|
768 |
+
* - CP_CALCULATED_FIELDS_VAR
|
769 |
+
*
|
770 |
+
* @return void.
|
771 |
+
*/
|
772 |
+
private function _define_shortcodes() {
|
773 |
+
add_shortcode( 'CP_CALCULATED_FIELDS', array( $this, 'public_form' ) );
|
774 |
+
add_shortcode( 'CP_CALCULATED_FIELDS_VAR', array( $this, 'create_variable_shortcode' ) );
|
775 |
+
} // End _define_shortcodes
|
776 |
+
/**
|
777 |
+
* Returns a JSON object with the configuration object.
|
778 |
+
*
|
779 |
+
* Uses the global variable $cpcff_default_texts_array, defined in the "config/cpcff_config.cfg.php"
|
780 |
+
*
|
781 |
+
* @sinze 1.0.171
|
782 |
+
* @param int $formid the form's id.
|
783 |
+
* @return string $json
|
784 |
+
*/
|
785 |
+
private function _get_form_configuration( $formid ) {
|
786 |
+
global $cpcff_default_texts_array;
|
787 |
+
$form_obj = $this->get_form( $formid );
|
788 |
+
$previous_label = $form_obj->get_option( 'vs_text_previousbtn', 'Previous' );
|
789 |
+
$previous_label = ( '' == $previous_label ? 'Previous' : $previous_label );
|
790 |
+
$next_label = $form_obj->get_option( 'vs_text_nextbtn', 'Next' );
|
791 |
+
$next_label = ( '' == $next_label ? 'Next' : $next_label );
|
792 |
+
|
793 |
+
$cpcff_texts_array = $form_obj->get_option( 'vs_all_texts', $cpcff_default_texts_array );
|
794 |
+
$cpcff_texts_array = CPCFF_AUXILIARY::array_replace_recursive(
|
795 |
+
$cpcff_default_texts_array,
|
796 |
+
( is_string( $cpcff_texts_array ) && is_array( unserialize( $cpcff_texts_array ) ) )
|
797 |
+
? unserialize( $cpcff_texts_array )
|
798 |
+
: ( ( is_array( $cpcff_texts_array ) ) ? $cpcff_texts_array : array() )
|
799 |
+
);
|
800 |
+
|
801 |
+
$obj = array(
|
802 |
+
'pub' => true,
|
803 |
+
'identifier' => '_' . self::$form_counter,
|
804 |
+
'messages' => array(
|
805 |
+
'required' => $form_obj->get_option( 'vs_text_is_required', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_required ),
|
806 |
+
'email' => $form_obj->get_option( 'vs_text_is_email', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_is_email ),
|
807 |
+
'datemmddyyyy' => $form_obj->get_option( 'vs_text_datemmddyyyy', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_datemmddyyyy ),
|
808 |
+
'dateddmmyyyy' => $form_obj->get_option( 'vs_text_dateddmmyyyy', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_dateddmmyyyy ),
|
809 |
+
'number' => $form_obj->get_option( 'vs_text_number', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_number ),
|
810 |
+
'digits' => $form_obj->get_option( 'vs_text_digits', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_digits ),
|
811 |
+
'max' => $form_obj->get_option( 'vs_text_max', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_max ),
|
812 |
+
'min' => $form_obj->get_option( 'vs_text_min', CP_CALCULATEDFIELDSF_DEFAULT_vs_text_min ),
|
813 |
+
'previous' => $previous_label,
|
814 |
+
'next' => $next_label,
|
815 |
+
'pageof' => $cpcff_texts_array['page_of_text']['text'],
|
816 |
+
'audio_tutorial' => $cpcff_texts_array['audio_tutorial_text']['text'],
|
817 |
+
'minlength' => $cpcff_texts_array['errors']['minlength']['text'],
|
818 |
+
'maxlength' => $cpcff_texts_array['errors']['maxlength']['text'],
|
819 |
+
'equalTo' => $cpcff_texts_array['errors']['equalTo']['text'],
|
820 |
+
'accept' => $cpcff_texts_array['errors']['accept']['text'],
|
821 |
+
'upload_size' => $cpcff_texts_array['errors']['upload_size']['text'],
|
822 |
+
'phone' => $cpcff_texts_array['errors']['phone']['text'],
|
823 |
+
'currency' => $cpcff_texts_array['errors']['currency']['text'],
|
824 |
+
),
|
825 |
+
);
|
826 |
+
return json_encode( $obj );
|
827 |
+
} // End _get_form_configuration
|
828 |
+
|
829 |
+
/**
|
830 |
+
* Loads the javascript and style files used by the public forms.
|
831 |
+
*
|
832 |
+
* Checks if the plugin was configured for loading HTML tags directly, or to use the WordPress functions.
|
833 |
+
*
|
834 |
+
* @since 1.0.171
|
835 |
+
* @param int $formid the form's id.
|
836 |
+
* @return void.
|
837 |
+
*/
|
838 |
+
private function _public_resources( $formid ) {
|
839 |
+
if (
|
840 |
+
get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE ) &&
|
841 |
+
file_exists( CP_CALCULATEDFIELDSF_BASE_PATH . '/js/cache/all.js' )
|
842 |
+
) {
|
843 |
+
$public_js_path = plugins_url( '/js/cache/all.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH );
|
844 |
+
}
|
845 |
+
|
846 |
+
if ( empty( $public_js_path ) ) {
|
847 |
+
global $cff_backend_script_generator, $cff_script_generator_min;
|
848 |
+
|
849 |
+
$cff_backend_script_generator = 1;
|
850 |
+
$cff_script_generator_min = get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE );
|
851 |
+
include_once CP_CALCULATEDFIELDSF_BASE_PATH . '/js/fbuilder-loader-public.php';
|
852 |
+
}
|
853 |
+
|
854 |
+
if (
|
855 |
+
file_exists( CP_CALCULATEDFIELDSF_BASE_PATH . '/js/cache/all.js' )
|
856 |
+
) {
|
857 |
+
$public_js_path = plugins_url( '/js/cache/all.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH );
|
858 |
+
} else {
|
859 |
+
$public_js_path = CPCFF_AUXILIARY::wp_current_url() . ( ( strpos( CPCFF_AUXILIARY::wp_current_url(), '?' ) === false ) ? '?' : '&' ) . 'cp_cff_resources=public&min=' . get_option( 'CP_CALCULATEDFIELDSF_USE_CACHE', CP_CALCULATEDFIELDSF_USE_CACHE );
|
860 |
+
}
|
861 |
+
|
862 |
+
$config_json = $this->_get_form_configuration( $formid );
|
863 |
+
|
864 |
+
if ( $GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'] ) {
|
865 |
+
wp_enqueue_script( 'jquery' );
|
866 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
867 |
+
wp_enqueue_script( 'jquery-ui-button' );
|
868 |
+
wp_enqueue_script( 'jquery-ui-widget' );
|
869 |
+
wp_enqueue_script( 'jquery-ui-position' );
|
870 |
+
wp_enqueue_script( 'jquery-ui-tooltip' );
|
871 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
872 |
+
wp_enqueue_script( 'jquery-ui-slider' );
|
873 |
+
|
874 |
+
wp_deregister_script( 'query-stringify' );
|
875 |
+
wp_register_script( 'query-stringify', plugins_url( '/vendors/jQuery.stringify.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'jquery' ), 'pro' );
|
876 |
+
|
877 |
+
wp_deregister_script( 'cp_calculatedfieldsf_validate_script' );
|
878 |
+
wp_register_script( 'cp_calculatedfieldsf_validate_script', plugins_url( '/vendors/jquery.validate.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'jquery' ), 'pro' );
|
879 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_builder_script', $public_js_path, array( 'jquery', 'jquery-ui-core', 'jquery-ui-button', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-tooltip', 'query-stringify', 'cp_calculatedfieldsf_validate_script', 'jquery-ui-datepicker', 'jquery-ui-slider' ), CP_CALCULATEDFIELDSF_VERSION, true );
|
880 |
+
|
881 |
+
wp_localize_script( 'cp_calculatedfieldsf_builder_script', 'cp_calculatedfieldsf_fbuilder_config_' . self::$form_counter, array( 'obj' => $config_json ) );
|
882 |
+
} else {
|
883 |
+
// This code won't be used in most cases. This code is for preventing problems in wrong WP themes and conflicts with third party plugins.
|
884 |
+
if ( ! $this->_are_resources_loaded ) {
|
885 |
+
global $wp_version;
|
886 |
+
$this->_are_resources_loaded = true; // Resources loaded
|
887 |
+
|
888 |
+
$includes_url = includes_url();
|
889 |
+
|
890 |
+
// Used for compatibility with old versions of WordPress
|
891 |
+
$prefix_ui = ( @file_exists( CP_CALCULATEDFIELDSF_BASE_PATH . '/../../../wp-includes/js/jquery/ui/jquery.ui.core.min.js' ) ) ? 'jquery.ui.' : '';
|
892 |
+
|
893 |
+
if ( ! wp_script_is( 'jquery', 'done' ) ) {
|
894 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/jquery.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
895 |
+
}
|
896 |
+
if ( ! wp_script_is( 'jquery-ui-core', 'done' ) ) {
|
897 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'core.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
898 |
+
}
|
899 |
+
if ( ! wp_script_is( 'jquery-ui-datepicker', 'done' ) ) {
|
900 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'datepicker.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
901 |
+
}
|
902 |
+
|
903 |
+
if ( version_compare( $wp_version, '5.5.4', '<' ) ) {
|
904 |
+
if ( ! wp_script_is( 'jquery-ui-widget', 'done' ) ) {
|
905 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'widget.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
906 |
+
}
|
907 |
+
if ( ! wp_script_is( 'jquery-ui-position', 'done' ) ) {
|
908 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'position.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
909 |
+
}
|
910 |
+
}
|
911 |
+
|
912 |
+
if ( ! wp_script_is( 'jquery-ui-tooltip', 'done' ) ) {
|
913 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'tooltip.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
914 |
+
}
|
915 |
+
if ( ! wp_script_is( 'jquery-ui-mouse', 'done' ) ) {
|
916 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'mouse.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
917 |
+
}
|
918 |
+
if ( ! wp_script_is( 'jquery-ui-slider', 'done' ) ) {
|
919 |
+
print '<script type="text/javascript" src="' . esc_attr( $includes_url ) . 'js/jquery/ui/' . esc_attr( $prefix_ui ) . 'slider.min.js"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
920 |
+
}
|
921 |
+
?>
|
922 |
+
<script>if( typeof fbuilderjQuery == 'undefined') var fbuilderjQuery = jQuery.noConflict( );</script>
|
923 |
+
<script type='text/javascript' src='<?php echo esc_attr( plugins_url( 'vendors/jquery.validate.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>'></script>
|
924 |
+
<script type='text/javascript' src='<?php echo esc_attr( plugins_url( 'vendors/jQuery.stringify.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>'></script>
|
925 |
+
<script type='text/javascript' src='<?php echo esc_attr( $public_js_path . ( ( strpos( $public_js_path, '?' ) == false ) ? '?' : '&' ) . 'ver=' . CP_CALCULATEDFIELDSF_VERSION ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>'></script>
|
926 |
+
<?php
|
927 |
+
}
|
928 |
+
?>
|
929 |
+
<pre style="display:none !important;"><script type='text/javascript'>
|
930 |
+
/* <![CDATA[ */
|
931 |
+
<?php
|
932 |
+
print 'var cp_calculatedfieldsf_fbuilder_config_' . esc_js( self::$form_counter ) . '={"obj":' . $config_json . '};'; // phpcs:ignore WordPress.Security.EscapeOutput
|
933 |
+
?>
|
934 |
+
/* ]]> */
|
935 |
+
</script></pre>
|
936 |
+
<?php
|
937 |
+
}
|
938 |
+
} // End _public_resources
|
939 |
+
|
940 |
+
/** TROUBLESHOOTS SECTION **/
|
941 |
+
public function compatibility_warnings() {
|
942 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_compatibility.inc.php';
|
943 |
+
return CPCFF_COMPATIBILITY::warnings();
|
944 |
+
} // End compatibility_warnings
|
945 |
+
|
946 |
+
private function troubleshoots() {
|
947 |
+
if ( ! $this->_is_admin ) {
|
948 |
+
if ( get_option( 'CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN', CP_CALCULATEDFIELDSF_OPTIMIZATION_PLUGIN ) * 1 ) {
|
949 |
+
// Solves a conflict caused by the "Speed Booster Pack" plugin
|
950 |
+
add_filter( 'option_sbp_settings', 'CPCFF_MAIN::speed_booster_pack_troubleshoot' );
|
951 |
+
|
952 |
+
// Solves a conflict caused by the "Autoptimize" plugin
|
953 |
+
if ( class_exists( 'autoptimizeOptionWrapper' ) ) {
|
954 |
+
$GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'] = true;
|
955 |
+
add_filter(
|
956 |
+
'cpcff_pre_form',
|
957 |
+
function( $atts ) {
|
958 |
+
add_filter(
|
959 |
+
'autoptimize_js_include_inline',
|
960 |
+
function( $p ) {
|
961 |
+
return false;
|
962 |
+
}
|
963 |
+
);
|
964 |
+
add_filter(
|
965 |
+
'autoptimize_filter_js_noptimize',
|
966 |
+
function( $p1, $p2 ) {
|
967 |
+
return true;
|
968 |
+
},
|
969 |
+
10,
|
970 |
+
2
|
971 |
+
);
|
972 |
+
add_filter(
|
973 |
+
'autoptimize_filter_html_noptimize',
|
974 |
+
function( $p1, $p2 ) {
|
975 |
+
return true;
|
976 |
+
},
|
977 |
+
10,
|
978 |
+
2
|
979 |
+
);
|
980 |
+
return $atts;
|
981 |
+
}
|
982 |
+
);
|
983 |
+
}
|
984 |
+
|
985 |
+
// Solves conflicts with "LiteSpeed Cache" plugin
|
986 |
+
if ( function_exists( 'run_litespeed_cache' ) ) {
|
987 |
+
add_action( 'the_post', 'CPCFF_MAIN::litespeed_control_set_nocache' );
|
988 |
+
}
|
989 |
+
|
990 |
+
// Solves a conflict caused by the "WP Rocket" plugin
|
991 |
+
add_filter( 'rocket_exclude_js', 'CPCFF_MAIN::rocket_exclude_js' );
|
992 |
+
add_filter( 'rocket_exclude_defer_js', 'CPCFF_MAIN::rocket_exclude_js' );
|
993 |
+
add_filter( 'rocket_delay_js_exclusions', 'CPCFF_MAIN::rocket_exclude_js' );
|
994 |
+
|
995 |
+
// Some "WP Rocket" functions can be use with "WP-Optimize"
|
996 |
+
add_filter( 'wp-optimize-minify-blacklist', 'CPCFF_MAIN::rocket_exclude_js' );
|
997 |
+
add_filter( 'wp-optimize-minify-default-exclusions', 'CPCFF_MAIN::rocket_exclude_js' );
|
998 |
+
}
|
999 |
+
add_filter( 'rocket_excluded_inline_js_content', 'CPCFF_MAIN::rocket_exclude_inline_js' );
|
1000 |
+
add_filter( 'rocket_defer_inline_exclusions', 'CPCFF_MAIN::rocket_exclude_inline_js' );
|
1001 |
+
add_filter( 'rocket_delay_js_exclusions', 'CPCFF_MAIN::rocket_exclude_inline_js' );
|
1002 |
+
|
1003 |
+
// For Breeze conflicts
|
1004 |
+
if ( defined( 'BREEZE_VERSION' ) ) {
|
1005 |
+
add_filter( 'breeze_filter_html_before_minify', 'CPCFF_MAIN::breeze_check_content', 10 );
|
1006 |
+
add_filter( 'breeze_html_after_minify', 'CPCFF_MAIN::breeze_return_content', 10 );
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
+
} // End troubleshoots
|
1010 |
+
|
1011 |
+
public static function litespeed_control_set_nocache( &$post ) {
|
1012 |
+
try {
|
1013 |
+
if (
|
1014 |
+
is_object( $post ) &&
|
1015 |
+
isset( $post->post_content ) &&
|
1016 |
+
stripos( $post->post_content, '[CP_CALCULATED_FIELDS' ) !== false
|
1017 |
+
) {
|
1018 |
+
do_action( 'litespeed_control_set_nocache', 'nocache CFF Form' );
|
1019 |
+
}
|
1020 |
+
} catch ( Exception $err ) {
|
1021 |
+
error_log( $err->getMessage() );}
|
1022 |
+
return $post;
|
1023 |
+
} // End litespeed_control_set_nocache
|
1024 |
+
|
1025 |
+
public static function speed_booster_pack_troubleshoot( $option ) {
|
1026 |
+
if ( is_array( $option ) && isset( $option['jquery_to_footer'] ) ) {
|
1027 |
+
unset( $option['jquery_to_footer'] );
|
1028 |
+
}
|
1029 |
+
return $option;
|
1030 |
+
} // End speed_booster_pack_troubleshoot
|
1031 |
+
|
1032 |
+
public static function rocket_exclude_js( $excluded_js ) {
|
1033 |
+
$excluded_js[] = '/jquery.js';
|
1034 |
+
$excluded_js[] = '/jquery.min.js';
|
1035 |
+
$excluded_js[] = '/jquery/';
|
1036 |
+
$excluded_js[] = '/calculated-fields-form/';
|
1037 |
+
|
1038 |
+
$excluded_js[] = '/jquery/(.*)';
|
1039 |
+
$excluded_js[] = '(.*)/jquery.js';
|
1040 |
+
$excluded_js[] = '(.*)/jquery.min.js';
|
1041 |
+
$excluded_js[] = '(.*)/jquery/(.*)';
|
1042 |
+
$excluded_js[] = '(.*)/calculated-fields-form/(.*)';
|
1043 |
+
return $excluded_js;
|
1044 |
+
} // End rocket_exclude_js
|
1045 |
+
|
1046 |
+
public static function rocket_exclude_inline_js( $excluded_js = array() ) {
|
1047 |
+
$excluded_js[] = 'form_structure_';
|
1048 |
+
$excluded_js[] = 'doValidate_';
|
1049 |
+
$excluded_js[] = 'cpcff_default';
|
1050 |
+
$excluded_js[] = 'cp_calculatedfieldsf_fbuilder_config_';
|
1051 |
+
$excluded_js[] = 'form_structure(.*)';
|
1052 |
+
$excluded_js[] = 'doValidate(.*)';
|
1053 |
+
$excluded_js[] = 'cp_calculatedfieldsf_fbuilder_config(.*)';
|
1054 |
+
return $excluded_js;
|
1055 |
+
} // End rocket_exclude_inline_js
|
1056 |
+
|
1057 |
+
public static function breeze_check_content( $content ) {
|
1058 |
+
if ( strpos( $content, 'form_structure_' ) !== false ) {
|
1059 |
+
global $cff_breeze_content_bk;
|
1060 |
+
$cff_breeze_content_bk = $content;
|
1061 |
+
}
|
1062 |
+
return $content;
|
1063 |
+
} // End breeze_check_content
|
1064 |
+
|
1065 |
+
public static function breeze_return_content( $content ) {
|
1066 |
+
global $cff_breeze_content_bk;
|
1067 |
+
if ( ! empty( $cff_breeze_content_bk ) ) {
|
1068 |
+
$content = $cff_breeze_content_bk;
|
1069 |
+
unset( $cff_breeze_content_bk );
|
1070 |
+
}
|
1071 |
+
return $content;
|
1072 |
+
} // End breeze_return_content
|
1073 |
+
} // End CPCFF_MAIN
|
1074 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_page_builders.inc.php
CHANGED
@@ -1,210 +1,187 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Main class to interace with the different Content Editors: CPCFF_PAGE_BUILDERS class
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
private
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
$instance
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
//
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
$
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
)
|
189 |
-
);
|
190 |
-
|
191 |
-
return $tabs;
|
192 |
-
} // End siteorigin_panels_widget_dialog_tabs
|
193 |
-
|
194 |
-
/**************************** VISUAL COMPOSER ****************************/
|
195 |
-
|
196 |
-
public function visualcomposer_editor($api)
|
197 |
-
{
|
198 |
-
$elementsToRegister = array('CFFForm');
|
199 |
-
$pluginBaseUrl = rtrim(plugins_url('/pagebuilders/visualcomposer/', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH), '\\/');
|
200 |
-
$elementsApi = $api->elements;
|
201 |
-
foreach ($elementsToRegister as $tag)
|
202 |
-
{
|
203 |
-
$manifestPath = CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/visualcomposer/' . $tag . '/manifest.json';
|
204 |
-
$elementBaseUrl = $pluginBaseUrl . '/' . $tag;
|
205 |
-
$elementsApi->add($manifestPath, $elementBaseUrl);
|
206 |
-
}
|
207 |
-
} // End visualcomposer_editor
|
208 |
-
|
209 |
-
} // End CPCFF_PAGE_BUILDERS
|
210 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Main class to interace with the different Content Editors: CPCFF_PAGE_BUILDERS class
|
4 |
+
*/
|
5 |
+
if ( ! class_exists( 'CPCFF_PAGE_BUILDERS' ) ) {
|
6 |
+
class CPCFF_PAGE_BUILDERS {
|
7 |
+
|
8 |
+
private static $_instance;
|
9 |
+
private $wptexturize_flag = false;
|
10 |
+
|
11 |
+
private function __construct(){}
|
12 |
+
private static function instance() {
|
13 |
+
if ( ! isset( self::$_instance ) ) {
|
14 |
+
self::$_instance = new self();
|
15 |
+
}
|
16 |
+
return self::$_instance;
|
17 |
+
} // End instance
|
18 |
+
|
19 |
+
public static function run() {
|
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 |
+
$instance = $instance = self::instance(); // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
27 |
+
|
28 |
+
// Gutenberg editor
|
29 |
+
add_action( 'enqueue_block_editor_assets', array( $instance, 'gutenberg_editor' ) );
|
30 |
+
add_filter( 'render_block', array( $instance, 'gutenberg_dissable_wptexturize' ), 10, 2 );
|
31 |
+
if (
|
32 |
+
isset( $_REQUEST['cff-action'] ) &&
|
33 |
+
'cff-gutenberg-editor-config' == $_REQUEST['cff-action'] &&
|
34 |
+
current_user_can( 'edit_posts' )
|
35 |
+
) {
|
36 |
+
remove_all_actions( 'shutdown' );
|
37 |
+
die( json_encode( $this->gutenberg_editor_config() ) );
|
38 |
+
}
|
39 |
+
|
40 |
+
// Elementor
|
41 |
+
add_action( 'elementor/widgets/widgets_registered', array( $instance, 'elementor_editor' ) );
|
42 |
+
add_action( 'elementor/elements/categories_registered', array( $instance, 'elementor_editor_category' ) );
|
43 |
+
|
44 |
+
// Beaver builder
|
45 |
+
if ( class_exists( 'FLBuilder' ) ) {
|
46 |
+
include_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/beaverbuilder/cff/cff.inc.php';
|
47 |
+
include_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/beaverbuilder/cffvar/cffvar.inc.php';
|
48 |
+
}
|
49 |
+
|
50 |
+
// DIVI
|
51 |
+
add_action( 'et_builder_ready', array( $instance, 'divi_editor' ) );
|
52 |
+
|
53 |
+
} // End init
|
54 |
+
|
55 |
+
public function after_setup_theme() {
|
56 |
+
$instance = $instance = self::instance(); // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
57 |
+
|
58 |
+
// SiteOrigin
|
59 |
+
add_filter( 'siteorigin_widgets_widget_folders', array( $instance, 'siteorigin_widgets_collection' ) );
|
60 |
+
add_filter( 'siteorigin_panels_widget_dialog_tabs', array( $instance, 'siteorigin_panels_widget_dialog_tabs' ) );
|
61 |
+
|
62 |
+
// Visual Composer
|
63 |
+
add_action( 'vcv:api', array( $instance, 'visualcomposer_editor' ) );
|
64 |
+
} // End after_setup_theme
|
65 |
+
|
66 |
+
/**************************** DIVI ****************************/
|
67 |
+
|
68 |
+
public function divi_editor() {
|
69 |
+
if ( class_exists( 'ET_Builder_Module' ) ) {
|
70 |
+
if ( isset( $_GET['et_fb'] ) ) {
|
71 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_divi_editor', plugins_url( '/pagebuilders/divi/cff.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array( 'react' ), CP_CALCULATEDFIELDSF_VERSION, true );
|
72 |
+
}
|
73 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/divi/cff.pb.php';
|
74 |
+
}
|
75 |
+
} // End divi_editor
|
76 |
+
|
77 |
+
/**************************** GUTENBERG ****************************/
|
78 |
+
private function gutenberg_editor_config() {
|
79 |
+
global $wpdb;
|
80 |
+
|
81 |
+
$url = CPCFF_AUXILIARY::site_url();
|
82 |
+
$url .= ( ( strpos( $url, '?' ) === false ) ? '?' : '&' ) . 'cff-editor-preview=1&cff-amp-redirected=1&cff-amp-form=';
|
83 |
+
$config = array(
|
84 |
+
'url' => $url,
|
85 |
+
'is_admin' => current_user_can( 'manage_options' ),
|
86 |
+
'editor' => CPCFF_AUXILIARY::editor_url(),
|
87 |
+
'forms' => array(),
|
88 |
+
'labels' => array(
|
89 |
+
'required_form' => __( 'Select a form', 'calculated-fields-form' ),
|
90 |
+
'forms' => __( 'Forms', 'calculated-fields-form' ),
|
91 |
+
'attributes' => __( 'Additional attributes', 'calculated-fields-form' ),
|
92 |
+
'edit_form' => __( 'Edit form', 'calculated-fields-form' ),
|
93 |
+
),
|
94 |
+
);
|
95 |
+
|
96 |
+
$forms = $wpdb->get_results( 'SELECT id, form_name FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
97 |
+
|
98 |
+
foreach ( $forms as $form ) {
|
99 |
+
$config['forms'][ $form->id ] = esc_attr( '(' . $form->id . ') ' . $form->form_name );
|
100 |
+
}
|
101 |
+
|
102 |
+
return $config;
|
103 |
+
} // End gutenberg_integration_config
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Loads the javascript resources to integrate the plugin with the Gutenberg editor
|
107 |
+
*/
|
108 |
+
public function gutenberg_editor() {
|
109 |
+
wp_enqueue_style( 'cp_calculatedfieldsf_gutenberg_editor_css', plugins_url( '/pagebuilders/gutenberg/assets/css/gutenberg.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
110 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_gutenberg_editor', plugins_url( '/pagebuilders/gutenberg/assets/js/gutenberg.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
111 |
+
|
112 |
+
wp_localize_script( 'cp_calculatedfieldsf_gutenberg_editor', 'cpcff_gutenberg_editor_config', $this->gutenberg_editor_config() );
|
113 |
+
} // End gutenberg_editor
|
114 |
+
|
115 |
+
public function gutenberg_dissable_wptexturize( $block_content, $block ) {
|
116 |
+
if (
|
117 |
+
'cpcff/form-summary-shortcode' === $block['blockName'] ||
|
118 |
+
'cpcff/form-summary-list-shortcode' === $block['blockName']
|
119 |
+
) {
|
120 |
+
if ( has_filter( 'the_content', 'wptexturize' ) ) {
|
121 |
+
$this->wptexturize_flag = true;
|
122 |
+
remove_filter( 'the_content', 'wptexturize' );
|
123 |
+
}
|
124 |
+
} elseif ( $this->wptexturize_flag && ! has_filter( 'the_content', 'wptexturize' ) ) {
|
125 |
+
add_filter( 'the_content', 'wpautop' );
|
126 |
+
}
|
127 |
+
|
128 |
+
return $block_content;
|
129 |
+
} // End gutenberg_dissable_wptexturize
|
130 |
+
|
131 |
+
/**************************** ELEMENTOR ****************************/
|
132 |
+
|
133 |
+
public function elementor_editor_category() {
|
134 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/elementor/elementor_category.pb.php';
|
135 |
+
} // End elementor_editor
|
136 |
+
|
137 |
+
public function elementor_editor() {
|
138 |
+
if ( is_admin() ) {
|
139 |
+
wp_enqueue_script( 'cp_calculatedfieldsf_elementor_editor_js', plugins_url( '/pagebuilders/elementor/assets/elementor.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
140 |
+
wp_enqueue_style( 'cp_calculatedfieldsf_elementor_editor_css', plugins_url( '/pagebuilders/elementor/assets/elementor.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
141 |
+
|
142 |
+
if ( current_user_can( 'manage_options' ) ) {
|
143 |
+
wp_localize_script(
|
144 |
+
'cp_calculatedfieldsf_elementor_editor_js',
|
145 |
+
'cp_calculatedfieldsf_elementor',
|
146 |
+
array(
|
147 |
+
'url' => CPCFF_AUXILIARY::editor_url(),
|
148 |
+
)
|
149 |
+
);
|
150 |
+
}
|
151 |
+
}
|
152 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/elementor/elementor.pb.php';
|
153 |
+
} // End elementor_editor
|
154 |
+
|
155 |
+
/**************************** SITEORIGIN ****************************/
|
156 |
+
|
157 |
+
public function siteorigin_widgets_collection( $folders ) {
|
158 |
+
$folders[] = CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/siteorigin/';
|
159 |
+
return $folders;
|
160 |
+
} // End siteorigin_widgets_collection
|
161 |
+
|
162 |
+
public function siteorigin_panels_widget_dialog_tabs( $tabs ) {
|
163 |
+
$tabs[] = array(
|
164 |
+
'title' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
165 |
+
'filter' => array(
|
166 |
+
'groups' => array( 'calculated-fields-form' ),
|
167 |
+
),
|
168 |
+
);
|
169 |
+
|
170 |
+
return $tabs;
|
171 |
+
} // End siteorigin_panels_widget_dialog_tabs
|
172 |
+
|
173 |
+
/**************************** VISUAL COMPOSER ****************************/
|
174 |
+
|
175 |
+
public function visualcomposer_editor( $api ) {
|
176 |
+
$elementsToRegister = array( 'CFFForm' );
|
177 |
+
$pluginBaseUrl = rtrim( plugins_url( '/pagebuilders/visualcomposer/', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), '\\/' );
|
178 |
+
$elementsApi = $api->elements;
|
179 |
+
foreach ( $elementsToRegister as $tag ) {
|
180 |
+
$manifestPath = CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/visualcomposer/' . $tag . '/manifest.json';
|
181 |
+
$elementBaseUrl = $pluginBaseUrl . '/' . $tag;
|
182 |
+
$elementsApi->add( $manifestPath, $elementBaseUrl );
|
183 |
+
}
|
184 |
+
} // End visualcomposer_editor
|
185 |
+
|
186 |
+
} // End CPCFF_PAGE_BUILDERS
|
187 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_public_int.inc.php
CHANGED
@@ -1,86 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
if ( !defined('CP_AUTH_INCLUDE') )
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
{
|
16 |
-
$
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
if(!
|
36 |
-
{
|
37 |
-
|
38 |
-
|
39 |
-
}
|
40 |
-
|
41 |
-
if( !empty( $form_data ) )
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
if(!empty($form_data[ 1 ][ 0 ]->customstyles))
|
51 |
-
{
|
52 |
-
print '<style>'.$form_data[ 1 ][ 0 ]->customstyles.'</style>';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
if(isset($form_data[ 1 ]) && is_object($form_data[ 1 ])) $form_data[ 1 ] = (array) $form_data[ 1 ];
|
56 |
-
$form_data[ 1 ][ 'formid' ]="cp_calculatedfieldsf_pform_".CPCFF_MAIN::$form_counter;
|
57 |
-
?>
|
58 |
-
<form name="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" id="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" action="?" method="post" enctype="multipart/form-data" class="cff-form <?php
|
59 |
-
if(!empty($form_data[1][0]) && !empty($form_data[1][0]->persistence)) echo ' persist-form';
|
60 |
-
if(!empty($atts) && !empty($atts['class'])) echo ' '.esc_attr($atts['class']);
|
61 |
-
?>">
|
62 |
-
<input type="hidden" name="cp_calculatedfieldsf_pform_psequence" value="_<?php echo CPCFF_MAIN::$form_counter; ?>" />
|
63 |
-
<input type="hidden" name="cp_calculatedfieldsf_id" value="<?php echo $id; ?>" /><pre style="display:none !important;"><script type="text/javascript">form_structure_<?php echo CPCFF_MAIN::$form_counter; ?>=<?php print str_replace( array( "\n", "\r" ), " ", ((version_compare(CP_CFF_PHPVERSION,"5.3.0")>=0)?json_encode($form_data, JSON_HEX_QUOT|JSON_HEX_TAG):json_encode($form_data)) ); ?>;</script></pre>
|
64 |
-
<div id="fbuilder">
|
65 |
-
<?php
|
66 |
-
if(
|
67 |
-
!empty($form_data) &&
|
68 |
-
!empty($form_data[1]) &&
|
69 |
-
!empty($form_data[1][0]) &&
|
70 |
-
!empty($form_data[1][0]->loading_animation)
|
71 |
-
)
|
72 |
-
{
|
73 |
-
print '<div class="cff-processing-form"></div>';
|
74 |
-
}
|
75 |
?>
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
<?php
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'CP_AUTH_INCLUDE' ) ) {
|
3 |
+
print 'Direct access not allowed.';
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
// Required scripts
|
8 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/inc/cpcff_templates.inc.php';
|
9 |
+
|
10 |
+
// Corrects a conflict with W3 Total Cache
|
11 |
+
if ( function_exists( 'w3_instance' ) ) {
|
12 |
+
try {
|
13 |
+
$w3_config = w3_instance( 'W3_Config' );
|
14 |
+
$w3_config->set( 'minify.html.enable', false );
|
15 |
+
} catch ( Exception $err ) {
|
16 |
+
error_log( $err->getMessage() );
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
add_filter( 'style_loader_tag', array( 'CPCFF_AUXILIARY', 'complete_link_tag' ) );
|
21 |
+
|
22 |
+
wp_enqueue_style( 'cpcff_stylepublic', plugins_url( '/css/stylepublic.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
23 |
+
wp_enqueue_style( 'cpcff_jquery_ui', plugins_url( '/vendors/jquery-ui/jquery-ui.min.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
24 |
+
|
25 |
+
$cpcff_main = CPCFF_MAIN::instance();
|
26 |
+
$form_obj = $cpcff_main->get_form( $id );
|
27 |
+
|
28 |
+
$form_data = $form_obj->get_option( 'form_structure', CP_CALCULATEDFIELDSF_DEFAULT_form_structure );
|
29 |
+
|
30 |
+
if ( ! wp_script_is( 'select2' ) ) {
|
31 |
+
wp_enqueue_style( 'cpcff_select2_css', plugins_url( '/vendors/select2/select2.min.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION );
|
32 |
+
wp_enqueue_script( 'cpcff_select2_js', plugins_url( '/vendors/select2/select2.min.js', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ), array(), CP_CALCULATEDFIELDSF_VERSION, true );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( ! empty( $form_data ) ) {
|
36 |
+
if ( isset( $form_data[1] ) && isset( $form_data[1][0] ) ) {
|
37 |
+
if ( ! empty( $form_data[1][0]->formtemplate ) ) {
|
38 |
+
CPCFF_TEMPLATES::enqueue_template_resources( $form_data[1][0]->formtemplate );
|
39 |
+
}
|
40 |
+
|
41 |
+
if ( ! empty( $form_data[1][0]->customstyles ) ) {
|
42 |
+
print '<style>' . wp_strip_all_tags( $form_data[1][0]->customstyles ) . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput
|
43 |
+
}
|
44 |
+
}
|
45 |
+
if ( isset( $form_data[1] ) && is_object( $form_data[1] ) ) {
|
46 |
+
$form_data[1] = (array) $form_data[1];
|
47 |
+
}
|
48 |
+
$form_data[1]['formid'] = 'cp_calculatedfieldsf_pform_' . CPCFF_MAIN::$form_counter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
?>
|
50 |
+
<form name="<?php echo esc_attr( $form_data[1]['formid'] ); ?>" id="<?php echo esc_attr( $form_data[1]['formid'] ); ?>" action="?" method="post" enctype="multipart/form-data" class="cff-form <?php
|
51 |
+
if ( ! empty( $form_data[1][0] ) && ! empty( $form_data[1][0]->persistence ) ) {
|
52 |
+
echo ' persist-form';
|
53 |
+
}
|
54 |
+
if ( ! empty( $atts ) && ! empty( $atts['class'] ) ) {
|
55 |
+
echo ' ' . esc_attr( $atts['class'] );
|
56 |
+
}
|
57 |
+
?>">
|
58 |
+
<input type="hidden" name="cp_calculatedfieldsf_pform_psequence" value="_<?php echo esc_attr( CPCFF_MAIN::$form_counter ); ?>" />
|
59 |
+
<input type="hidden" name="cp_calculatedfieldsf_id" value="<?php echo esc_attr( $id ); ?>" /><pre style="display:none !important;"><script type="text/javascript">form_structure_<?php echo esc_js( CPCFF_MAIN::$form_counter ); ?>=<?php print str_replace( array( "\n", "\r" ), ' ', ( ( version_compare( CP_CFF_PHPVERSION, '5.3.0' ) >= 0 ) ? json_encode( $form_data, JSON_HEX_QUOT | JSON_HEX_TAG ) : json_encode( $form_data ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput ?>;</script></pre>
|
60 |
+
<div id="fbuilder">
|
61 |
+
<?php
|
62 |
+
if (
|
63 |
+
! empty( $form_data ) &&
|
64 |
+
! empty( $form_data[1] ) &&
|
65 |
+
! empty( $form_data[1][0] ) &&
|
66 |
+
! empty( $form_data[1][0]->loading_animation )
|
67 |
+
) {
|
68 |
+
print '<div class="cff-processing-form"></div>';
|
69 |
+
}
|
70 |
+
?>
|
71 |
+
<div id="fbuilder_<?php echo esc_attr( CPCFF_MAIN::$form_counter ); ?>">
|
72 |
+
<div id="formheader_<?php echo esc_attr( CPCFF_MAIN::$form_counter ); ?>"></div>
|
73 |
+
<div id="fieldlist_<?php echo esc_attr( CPCFF_MAIN::$form_counter ); ?>"></div>
|
74 |
+
<div class="clearer"></div>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<div class="clearer"></div>
|
78 |
+
</form>
|
79 |
+
<?php
|
80 |
+
}
|
81 |
+
?>
|
inc/cpcff_revisions.inc.php
CHANGED
@@ -1,158 +1,148 @@
|
|
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 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
*
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$this->
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
$this->
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
)
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
$data['id']
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
);
|
138 |
-
$this->
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
$formid = $this->_form_obj->get_id();
|
150 |
-
$this->_db->query(
|
151 |
-
$this->_db->prepare(
|
152 |
-
'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)',
|
153 |
-
$formid,$formid,$this->_max
|
154 |
-
)
|
155 |
-
);
|
156 |
-
} // End _delete_older
|
157 |
-
} // End CPCFF_REVISIONS
|
158 |
-
}
|
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 |
+
class CPCFF_REVISIONS {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* CPCFF_FORM instance
|
14 |
+
*/
|
15 |
+
private $_form_obj;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* List of revisions rows corresponding to the form
|
19 |
+
*/
|
20 |
+
private $_revisions;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Instance of the $wpdb object
|
24 |
+
*/
|
25 |
+
private $_db;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Name of revisions table
|
29 |
+
*/
|
30 |
+
private $_table;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The number of revisions per form
|
34 |
+
*/
|
35 |
+
private $_max = 20;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Constructs a CPCFF_REVISIONS object.
|
39 |
+
*
|
40 |
+
* @param integer $form_obj instance of CPCFF_FORM
|
41 |
+
*/
|
42 |
+
public function __construct( $form_obj ) {
|
43 |
+
global $wpdb;
|
44 |
+
$this->_db = $wpdb;
|
45 |
+
$this->_table = $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_REVISIONS_TABLE;
|
46 |
+
$this->_form_obj = $form_obj;
|
47 |
+
} // End construct
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Returns the list of revisions rows in the database as array
|
51 |
+
*/
|
52 |
+
public function revisions_list() {
|
53 |
+
if ( empty( $this->_revisions ) ) {
|
54 |
+
$results = $this->_db->get_results(
|
55 |
+
$this->_db->prepare(
|
56 |
+
'SELECT * FROM ' . $this->_table . ' WHERE formid=%d ORDER BY time DESC',
|
57 |
+
$this->_form_obj->get_id()
|
58 |
+
),
|
59 |
+
ARRAY_A
|
60 |
+
);
|
61 |
+
$this->_revisions = array();
|
62 |
+
foreach ( $results as $revision ) {
|
63 |
+
$this->_revisions[ $revision['id'] ] = $revision;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
return $this->_revisions;
|
67 |
+
|
68 |
+
} // End revisions_list
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Creates a new entry in the revisions table, if there are more than _max revisions remove the older.
|
72 |
+
*
|
73 |
+
* @return int returns the revision's id or false if fails.
|
74 |
+
*/
|
75 |
+
public function create_revision() {
|
76 |
+
$form_data = $this->_form_obj->get_raw_data();
|
77 |
+
|
78 |
+
$data = array(
|
79 |
+
'formid' => $this->_form_obj->get_id(),
|
80 |
+
'time' => current_time( 'mysql' ),
|
81 |
+
'revision' => serialize( $form_data ),
|
82 |
+
);
|
83 |
+
|
84 |
+
if (
|
85 |
+
$this->_db->insert(
|
86 |
+
$this->_table,
|
87 |
+
$data,
|
88 |
+
array( '%d', '%s', '%s' )
|
89 |
+
)
|
90 |
+
) {
|
91 |
+
$this->revisions_list();
|
92 |
+
$data['id'] = $this->_db->insert_id;
|
93 |
+
$this->_revisions[ $data['id'] ] = $data;
|
94 |
+
krsort( $this->_revisions );
|
95 |
+
if ( $this->_max < count( $this->_revisions ) ) {
|
96 |
+
array_splice( $this->_revisions, $this->_max );
|
97 |
+
$this->_delete_older();
|
98 |
+
}
|
99 |
+
return $data['id'];
|
100 |
+
}
|
101 |
+
return false;
|
102 |
+
} // End create_revision
|
103 |
+
|
104 |
+
/**
|
105 |
+
* returns the form data unserialized or an empty array
|
106 |
+
*/
|
107 |
+
public function data( $revision_id ) {
|
108 |
+
$this->revisions_list();
|
109 |
+
if (
|
110 |
+
! empty( $this->_revisions ) &&
|
111 |
+
isset( $this->_revisions[ $revision_id ] )
|
112 |
+
) {
|
113 |
+
return unserialize( $this->_revisions[ $revision_id ]['revision'] );
|
114 |
+
}
|
115 |
+
return array();
|
116 |
+
} // End data
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Deletes the list of revisions belonging to the form
|
120 |
+
*/
|
121 |
+
public function delete_form() {
|
122 |
+
$this->_db->delete(
|
123 |
+
$this->_table,
|
124 |
+
array( 'formid' => $this->_form_obj->get_id() ),
|
125 |
+
array( '%d' )
|
126 |
+
);
|
127 |
+
$this->_revisions = array();
|
128 |
+
} // End delete_form
|
129 |
+
|
130 |
+
|
131 |
+
/*********************************** PRIVATE METHODS ********************************************/
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Deletes the older revisions, leaving only the _max
|
135 |
+
*/
|
136 |
+
private function _delete_older() {
|
137 |
+
$formid = $this->_form_obj->get_id();
|
138 |
+
$this->_db->query(
|
139 |
+
$this->_db->prepare(
|
140 |
+
'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)',
|
141 |
+
$formid,
|
142 |
+
$formid,
|
143 |
+
$this->_max
|
144 |
+
)
|
145 |
+
);
|
146 |
+
} // End _delete_older
|
147 |
+
} // End CPCFF_REVISIONS
|
148 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_session.inc.php
CHANGED
@@ -1,195 +1,185 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* CodePeople Session.
|
4 |
-
*
|
5 |
-
* Standardizes WordPress session data using database-backed options for storage.
|
6 |
-
* for storing user session information.
|
7 |
-
*/
|
8 |
-
|
9 |
-
if( !defined( 'CP_COOKIE_NAME' ) )
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
private $
|
24 |
-
private $
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
if(!
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
{
|
37 |
-
$cookie =
|
38 |
-
|
39 |
-
$cookie_crumbs = explode( '||', $cookie );
|
40 |
-
|
41 |
-
$this->session_id = $cookie_crumbs[0];
|
42 |
-
$this->expiration = $cookie_crumbs[1];
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
$this->
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
{
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
{
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
$
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
)
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
$
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
self::set_var('cp_cff_form_data', $cp_cff_form_data);
|
187 |
-
}
|
188 |
-
|
189 |
-
public static function registered_events()
|
190 |
-
{
|
191 |
-
return self::get_var('cp_cff_form_data');
|
192 |
-
}
|
193 |
-
} // End clss
|
194 |
-
}
|
195 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CodePeople Session.
|
4 |
+
*
|
5 |
+
* Standardizes WordPress session data using database-backed options for storage.
|
6 |
+
* for storing user session information.
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'CP_COOKIE_NAME' ) ) {
|
10 |
+
define( 'CP_COOKIE_NAME', 'CP5XKN6QLDFWUC' );
|
11 |
+
}
|
12 |
+
|
13 |
+
if ( ! class_exists( 'CP_SESSION' ) ) {
|
14 |
+
class CP_SESSION {
|
15 |
+
|
16 |
+
|
17 |
+
/************** STATIC PROPERTIES **************/
|
18 |
+
private static $instance = false;
|
19 |
+
|
20 |
+
/************** INSTANCE PROPERTIES **************/
|
21 |
+
private $session_id;
|
22 |
+
private $expiration;
|
23 |
+
private $cleaned_expired_vars = false;
|
24 |
+
private $expiration_interval = 86400; // 24 Hours
|
25 |
+
|
26 |
+
/************** CONSTRUCT **************/
|
27 |
+
|
28 |
+
private function __construct() {
|
29 |
+
if ( ! is_admin() ) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
if ( session_id() == '' && ! headers_sent() ) {
|
33 |
+
@session_start();
|
34 |
+
}
|
35 |
+
|
36 |
+
if ( isset( $_SESSION[ CP_COOKIE_NAME ] ) || isset( $_COOKIE[ CP_COOKIE_NAME ] ) ) {
|
37 |
+
$cookie = sanitize_text_field( wp_unslash( ( isset( $_SESSION[ CP_COOKIE_NAME ] ) ) ? $_SESSION[ CP_COOKIE_NAME ] : $_COOKIE[ CP_COOKIE_NAME ] ) );
|
38 |
+
|
39 |
+
$cookie_crumbs = explode( '||', $cookie );
|
40 |
+
|
41 |
+
$this->session_id = $cookie_crumbs[0];
|
42 |
+
$this->expiration = $cookie_crumbs[1];
|
43 |
+
} else {
|
44 |
+
$this->session_id = $this->_generate_session_id();
|
45 |
+
$this->expiration = $this->expiration_interval;
|
46 |
+
$this->_set_cookie();
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
/************** PRIVATE INSTANCE METHODS **************/
|
52 |
+
private function _generate_session_id() {
|
53 |
+
require_once ABSPATH . 'wp-includes/class-phpass.php';
|
54 |
+
$hash = new PasswordHash( 8, false );
|
55 |
+
|
56 |
+
return md5( $hash->get_random_bytes( 32 ) );
|
57 |
+
}
|
58 |
+
|
59 |
+
private function _set_cookie() {
|
60 |
+
try {
|
61 |
+
$_SESSION[ CP_COOKIE_NAME ] = $this->session_id . '||' . $this->expiration;
|
62 |
+
if ( ! headers_sent() ) {
|
63 |
+
@setcookie( CP_COOKIE_NAME, $this->session_id . '||' . $this->expiration, 0, '/' );
|
64 |
+
}
|
65 |
+
} catch ( Exception $err ) {
|
66 |
+
error_log( $err->getMessage() );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
private function _get_var_name( $name ) {
|
71 |
+
return CP_COOKIE_NAME . '_' . $this->session_id . '_' . $name;
|
72 |
+
}
|
73 |
+
|
74 |
+
private function _set_var( $name, $value ) {
|
75 |
+
$_SESSION[ $name ] = $value;
|
76 |
+
$transient = $this->_get_var_name( $name );
|
77 |
+
set_transient( $transient, $value, $this->expiration );
|
78 |
+
}
|
79 |
+
|
80 |
+
private function _get_var( $name ) {
|
81 |
+
if ( isset( $_SESSION[ $name ] ) ) {
|
82 |
+
return $_SESSION[ $name ];
|
83 |
+
}
|
84 |
+
$transient = $this->_get_var_name( $name );
|
85 |
+
return get_transient( $transient );
|
86 |
+
}
|
87 |
+
|
88 |
+
private function _unset_var( $name ) {
|
89 |
+
if ( isset( $_SESSION[ $name ] ) ) {
|
90 |
+
unset( $_SESSION[ $name ] );
|
91 |
+
}
|
92 |
+
$transient = $this->_get_var_name( $name );
|
93 |
+
delete_transient( $transient );
|
94 |
+
}
|
95 |
+
|
96 |
+
private function _clean_expired_vars() {
|
97 |
+
if ( $this->cleaned_expired_vars ) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
$this->cleaned_expired_vars = true;
|
101 |
+
|
102 |
+
global $wpdb;
|
103 |
+
|
104 |
+
$expiration = time() - $this->expiration_interval;
|
105 |
+
try {
|
106 |
+
$transients = $wpdb->get_col(
|
107 |
+
$wpdb->prepare( "SELECT REPLACE(option_name, '_transient_timeout_', '') AS transient_name FROM {$wpdb->options} WHERE option_name LIKE %s AND option_value < %s", '_transient_timeout_' . $wpdb->esc_like( CP_COOKIE_NAME ) . '%', $expiration )
|
108 |
+
);
|
109 |
+
|
110 |
+
$options_names = array();
|
111 |
+
foreach ( $transients as $transient ) {
|
112 |
+
if ( strpos( $transient, $this->session_id ) === false ) {
|
113 |
+
$options_names[] = '_transient_' . $transient;
|
114 |
+
$options_names[] = '_transient_timeout_' . $transient;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
if ( ! empty( $options_names ) ) {
|
119 |
+
$options_names = array_map( 'esc_sql', $options_names );
|
120 |
+
$options_names = "'" . implode( "','", $options_names ) . "'";
|
121 |
+
$result = $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name IN ({$options_names})" ); // @codingStandardsIgnoreLine.
|
122 |
+
|
123 |
+
}
|
124 |
+
} catch ( Exception $err ) {
|
125 |
+
error_log( $err->getMassage() );
|
126 |
+
}
|
127 |
+
}
|
128 |
+
/************** PUBLIC INSTANCE METHODS **************/
|
129 |
+
|
130 |
+
/************** PRIVATE STATIC METHODS **************/
|
131 |
+
|
132 |
+
private static function _get_instance() {
|
133 |
+
if ( ! self::$instance ) {
|
134 |
+
self::$instance = new self();
|
135 |
+
}
|
136 |
+
self::$instance->_clean_expired_vars();
|
137 |
+
return self::$instance;
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
/************** PUBLIC STATIC METHODS **************/
|
142 |
+
|
143 |
+
public static function session_start() {
|
144 |
+
$instance = self::_get_instance();
|
145 |
+
}
|
146 |
+
|
147 |
+
public static function session_id() {
|
148 |
+
$instance = self::_get_instance();
|
149 |
+
return $instance->session_id;
|
150 |
+
}
|
151 |
+
|
152 |
+
public static function set_var( $name, $value ) {
|
153 |
+
$instance = self::_get_instance();
|
154 |
+
$instance->_set_var( $name, $value );
|
155 |
+
}
|
156 |
+
|
157 |
+
public static function get_var( $name ) {
|
158 |
+
$instance = self::_get_instance();
|
159 |
+
return $instance->_get_var( $name );
|
160 |
+
}
|
161 |
+
|
162 |
+
public static function unset_var( $name ) {
|
163 |
+
$instance = self::_get_instance();
|
164 |
+
$instance->_unset_var( $name );
|
165 |
+
}
|
166 |
+
|
167 |
+
// Special methods for registering and recovering the forms submissions
|
168 |
+
public static function register_event( $eventid, $formid ) {
|
169 |
+
$cp_cff_form_data = self::get_var( 'cp_cff_form_data' );
|
170 |
+
if ( empty( $cp_cff_form_data ) ) {
|
171 |
+
$cp_cff_form_data = array();
|
172 |
+
}
|
173 |
+
|
174 |
+
$cp_cff_form_data[ $formid ] = $eventid;
|
175 |
+
$cp_cff_form_data['latest'] = $formid;
|
176 |
+
|
177 |
+
self::set_var( 'cp_cff_form_data', $cp_cff_form_data );
|
178 |
+
}
|
179 |
+
|
180 |
+
public static function registered_events() {
|
181 |
+
return self::get_var( 'cp_cff_form_data' );
|
182 |
+
}
|
183 |
+
} // End clss
|
184 |
+
}
|
185 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_templates.inc.php
CHANGED
@@ -1,175 +1,154 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Templates operations: CPCFF_TEMPLATES class
|
4 |
-
*
|
5 |
-
* Implements the access to forms templates.
|
6 |
-
*
|
7 |
-
* @package CFF.
|
8 |
-
* @since 1.0.175
|
9 |
-
*/
|
10 |
-
|
11 |
-
if(!class_exists('CPCFF_TEMPLATES'))
|
12 |
-
{
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
*
|
25 |
-
*
|
26 |
-
*
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
*
|
33 |
-
*
|
34 |
-
*
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
*
|
41 |
-
*
|
42 |
-
*
|
43 |
-
*
|
44 |
-
*
|
45 |
-
*
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
}
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
if(
|
156 |
-
!empty($template_info['js']) &&
|
157 |
-
($js = trim($template_info['js'])) != ''
|
158 |
-
)
|
159 |
-
{
|
160 |
-
if($GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'])
|
161 |
-
{
|
162 |
-
wp_enqueue_script( 'cpcff_template_js'.$template, $js, array(), CP_CALCULATEDFIELDSF_VERSION );
|
163 |
-
}
|
164 |
-
else
|
165 |
-
{
|
166 |
-
$js .= (strpos($js,'?') === false) ? '?' : '&';
|
167 |
-
print '<script src="'.esc_attr(esc_url($js)).'ver='.CP_CALCULATEDFIELDSF_VERSION.'"></script>';
|
168 |
-
}
|
169 |
-
}
|
170 |
-
}
|
171 |
-
} // End enqueue_template_resources
|
172 |
-
|
173 |
-
} // End CPCFF_TEMPLATES
|
174 |
-
}
|
175 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Templates operations: CPCFF_TEMPLATES class
|
4 |
+
*
|
5 |
+
* Implements the access to forms templates.
|
6 |
+
*
|
7 |
+
* @package CFF.
|
8 |
+
* @since 1.0.175
|
9 |
+
*/
|
10 |
+
|
11 |
+
if ( ! class_exists( 'CPCFF_TEMPLATES' ) ) {
|
12 |
+
class CPCFF_TEMPLATES {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Flag to know if the templates directory was checked and the templates loaded
|
16 |
+
* Metaclass property.
|
17 |
+
*
|
18 |
+
* @var bool $_are_templates_loaded default false
|
19 |
+
*/
|
20 |
+
private static $_are_templates_loaded = false;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Templates list
|
24 |
+
* Metaclass property.
|
25 |
+
*
|
26 |
+
* @var array $_templates_list default empty array
|
27 |
+
*/
|
28 |
+
private static $_templates_list = array();
|
29 |
+
|
30 |
+
/**
|
31 |
+
* List of templates whose resources were enqueued or sent to the browser
|
32 |
+
* Metaclass property.
|
33 |
+
*
|
34 |
+
* @var array $_enqueued_list default empty array
|
35 |
+
*/
|
36 |
+
private static $_enqueued_list = array();
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Loads the templates list
|
40 |
+
*
|
41 |
+
* Walks through the "templates" directory for reading and parsing the corresponding config.ini files to identify the
|
42 |
+
* the styles files, the javascript files, the templates' thumbnails, and the prefixes to identify the templates
|
43 |
+
* and grouping the CSS rules to apply for the templates.
|
44 |
+
*
|
45 |
+
* @return array of associative arrays with the templates attributess.
|
46 |
+
*/
|
47 |
+
public static function load_templates() {
|
48 |
+
if ( ! self::$_are_templates_loaded ) {
|
49 |
+
self::$_are_templates_loaded = true;
|
50 |
+
$tpls_dir_paths = array(
|
51 |
+
array(
|
52 |
+
'path' => CP_CALCULATEDFIELDSF_BASE_PATH . '/templates',
|
53 |
+
'url' => plugins_url( 'templates', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ),
|
54 |
+
),
|
55 |
+
);
|
56 |
+
|
57 |
+
$upload_dir = wp_upload_dir();
|
58 |
+
|
59 |
+
if (
|
60 |
+
! $upload_dir['error'] &&
|
61 |
+
file_exists( $upload_dir['basedir'] . '/calculated-fields-form/templates' ) &&
|
62 |
+
is_dir( $upload_dir['basedir'] . '/calculated-fields-form/templates' )
|
63 |
+
) {
|
64 |
+
$tpls_dir_paths[] = array(
|
65 |
+
'path' => $upload_dir['basedir'] . '/calculated-fields-form/templates',
|
66 |
+
'url' => $upload_dir['baseurl'] . '/calculated-fields-form/templates',
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
foreach ( $tpls_dir_paths as $path ) {
|
71 |
+
$tpls_dir = dir( $path['path'] );
|
72 |
+
while ( false !== ( $entry = $tpls_dir->read() ) ) {
|
73 |
+
if (
|
74 |
+
'.' != $entry &&
|
75 |
+
'..' != $entry &&
|
76 |
+
is_dir( $tpls_dir->path . '/' . $entry ) &&
|
77 |
+
file_exists( $tpls_dir->path . '/' . $entry . '/config.ini' )
|
78 |
+
) {
|
79 |
+
if (
|
80 |
+
( function_exists( 'parse_ini_file' ) && ( $ini_array = parse_ini_file( $tpls_dir->path . '/' . $entry . '/config.ini' ) ) != false ) || ( function_exists( 'parse_ini_string' ) && ( $ini_array = parse_ini_string( file_get_contents( $tpls_dir->path . '/' . $entry . '/config.ini' ) ) ) != false ) // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
81 |
+
) {
|
82 |
+
if ( isset( $ini_array['prefix'] ) && ( $prefix = trim( $ini_array['prefix'] ) ) != '' ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
83 |
+
// Url to the CSS file
|
84 |
+
if ( ! empty( $ini_array['file'] ) ) {
|
85 |
+
$ini_array['file'] = $path['url'] . '/' . $entry . '/' . $ini_array['file'];
|
86 |
+
}
|
87 |
+
|
88 |
+
// Url to the JS file
|
89 |
+
if ( ! empty( $ini_array['js'] ) ) {
|
90 |
+
$ini_array['js'] = $path['url'] . '/' . $entry . '/' . $ini_array['js'];
|
91 |
+
}
|
92 |
+
|
93 |
+
// Url to the thumbnail file
|
94 |
+
if ( ! empty( $ini_array['thumbnail'] ) ) {
|
95 |
+
$ini_array['thumbnail'] = $path['url'] . '/' . $entry . '/' . $ini_array['thumbnail'];
|
96 |
+
}
|
97 |
+
|
98 |
+
// Required attribute to identify the template
|
99 |
+
// and it is used as super-class-name for grouping styles to apply for the template
|
100 |
+
self::$_templates_list[ $prefix ] = $ini_array;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
return self::$_templates_list;
|
109 |
+
} // End load_templates
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Enqueues or sends to the browser the template's resources (CSS and JS files)
|
113 |
+
*
|
114 |
+
* Loads the templates if they have not been loaded previously.
|
115 |
+
* Checks if the resources of current template were enqueued previously to prevent to load the resources by duplicated.
|
116 |
+
* Checks if the resources should be enqueued, or sent to the browser directly.
|
117 |
+
*
|
118 |
+
* @return void.
|
119 |
+
*/
|
120 |
+
public static function enqueue_template_resources( $template ) {
|
121 |
+
$template = trim( $template );
|
122 |
+
$templates = self::load_templates();
|
123 |
+
|
124 |
+
if ( in_array( $template, self::$_enqueued_list ) ) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
self::$_enqueued_list[] = $template; // The template's resources were enqueued
|
128 |
+
|
129 |
+
if ( ! empty( $templates[ $template ] ) ) {
|
130 |
+
$template_info = $templates[ $template ];
|
131 |
+
|
132 |
+
if ( ! empty( $template_info['file'] ) && ( $css = trim( $template_info['file'] ) ) != '' ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
133 |
+
if ( $GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'] ) {
|
134 |
+
wp_enqueue_style( 'cpcff_template_css' . $template, $css, array(), CP_CALCULATEDFIELDSF_VERSION );
|
135 |
+
} else {
|
136 |
+
$css .= ( strpos( $css, '?' ) === false ) ? '?' : '&';
|
137 |
+
print '<link href="' . esc_attr( esc_url( $css ) ) . 'ver=' . esc_attr( CP_CALCULATEDFIELDSF_VERSION ) . '" type="text/css" rel="stylesheet" property="stylesheet" />'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( ! empty( $template_info['js'] ) && ( $js = trim( $template_info['js'] ) ) != '' ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments
|
142 |
+
if ( $GLOBALS['CP_CALCULATEDFIELDSF_DEFAULT_DEFER_SCRIPTS_LOADING'] ) {
|
143 |
+
wp_enqueue_script( 'cpcff_template_js' . $template, $js, array(), CP_CALCULATEDFIELDSF_VERSION );
|
144 |
+
} else {
|
145 |
+
$js .= ( strpos( $js, '?' ) === false ) ? '?' : '&';
|
146 |
+
print '<script src="' . esc_attr( esc_url( $js ) ) . 'ver=' . esc_attr( CP_CALCULATEDFIELDSF_VERSION ) . '"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
} // End enqueue_template_resources
|
151 |
+
|
152 |
+
} // End CPCFF_TEMPLATES
|
153 |
+
}
|
154 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/cpcff_trial.php
CHANGED
@@ -1,61 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Allows to install the trial version of Professional distribution: CPCFF_TRIAL class
|
4 |
-
*
|
5 |
-
* @
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
{
|
10 |
-
class CPCFF_TRIAL
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Main plugin object
|
14 |
-
*/
|
15 |
-
private $_main_obj;
|
16 |
-
|
17 |
-
|
18 |
-
public function __construct()
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
*
|
25 |
-
* @return void.
|
26 |
-
*/
|
27 |
-
public function init()
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
{
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Allows to install the trial version of Professional distribution: CPCFF_TRIAL class
|
4 |
+
*
|
5 |
+
* @package CFF.
|
6 |
+
* @since 1.1.14
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! class_exists( 'CPCFF_TRIAL' ) ) {
|
10 |
+
class CPCFF_TRIAL {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Main plugin object
|
14 |
+
*/
|
15 |
+
private $_main_obj;
|
16 |
+
private $_url = 'https://wordpress.dwbooster.com/trial/get.php';
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
add_action( 'admin_init', array( $this, 'init' ) );
|
20 |
+
} // End __construct
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Install TRIAL
|
24 |
+
*
|
25 |
+
* @return void.
|
26 |
+
*/
|
27 |
+
public function init() {
|
28 |
+
if ( ! empty( $_GET['cff-install-trial'] ) && current_user_can( 'manage_options' ) ) {
|
29 |
+
$this->_install_plugin();
|
30 |
+
}
|
31 |
+
} // End init
|
32 |
+
|
33 |
+
private function _install_plugin() {
|
34 |
+
try {
|
35 |
+
$response = wp_remote_get(
|
36 |
+
$this->_url . '?action=check',
|
37 |
+
array(
|
38 |
+
'body' => array( 'u' => CPCFF_AUXILIARY::site_url() ),
|
39 |
+
'sslverify' => false,
|
40 |
+
)
|
41 |
+
);
|
42 |
+
if ( ! is_wp_error( $response ) ) {
|
43 |
+
$body = wp_remote_retrieve_body( $response );
|
44 |
+
if ( 'ok' != $body ) {
|
45 |
+
update_option( 'cff-t-t', $body );
|
46 |
+
} else {
|
47 |
+
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
48 |
+
wp_cache_flush();
|
49 |
+
$installer = new Plugin_Upgrader();
|
50 |
+
$installed = $installer->install( $this->_url, array( 'overwrite_package' => true ) );
|
51 |
+
if ( $installed ) {
|
52 |
+
update_option( 'cff-t-d', time() );
|
53 |
+
print '<script>document.location.href="' . esc_js( remove_query_arg( 'cff-install-trial', false ) ) . '#cff-upgrade-frame";</script>';
|
54 |
+
exit;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
} catch ( Exception $err ) {
|
59 |
+
print esc_html( $err->getMessage() );
|
60 |
+
exit;
|
61 |
+
}
|
62 |
+
} // End _install_plugin
|
63 |
+
} // End Class CPCFF_TRIAL
|
64 |
+
|
65 |
+
new CPCFF_TRIAL();
|
66 |
+
}
|
js/JSMin.php
CHANGED
@@ -55,374 +55,365 @@
|
|
55 |
*/
|
56 |
|
57 |
class JSMin {
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
}
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
}
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
|
110 |
-
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$this->output = trim($this->output);
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
}
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
|
180 |
-
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
239 |
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
|
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
}
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
}
|
315 |
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
}
|
326 |
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
}
|
337 |
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
}
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
}
|
368 |
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
}
|
426 |
}
|
427 |
|
428 |
class JSMin_UnterminatedStringException extends Exception {}
|
55 |
*/
|
56 |
|
57 |
class JSMin {
|
58 |
+
const ORD_LF = 10;
|
59 |
+
const ORD_SPACE = 32;
|
60 |
+
const ACTION_KEEP_A = 1;
|
61 |
+
const ACTION_DELETE_A = 2;
|
62 |
+
const ACTION_DELETE_A_B = 3;
|
63 |
|
64 |
+
protected $a = "\n";
|
65 |
+
protected $b = '';
|
66 |
+
protected $input = '';
|
67 |
+
protected $inputIndex = 0;
|
68 |
+
protected $inputLength = 0;
|
69 |
+
protected $lookAhead = null;
|
70 |
+
protected $output = '';
|
71 |
+
protected $lastByteOut = '';
|
72 |
+
protected $keptComment = '';
|
73 |
|
74 |
+
/**
|
75 |
+
* Minify Javascript.
|
76 |
+
*
|
77 |
+
* @param string $js Javascript to be minified
|
78 |
+
*
|
79 |
+
* @return string
|
80 |
+
*/
|
81 |
+
public static function minify( $js ) {
|
82 |
+
$jsmin = new JSMin( $js );
|
83 |
+
return $jsmin->min();
|
84 |
+
}
|
|
|
85 |
|
86 |
+
/**
|
87 |
+
* @param string $input
|
88 |
+
*/
|
89 |
+
public function __construct( $input ) {
|
90 |
+
$this->input = $input;
|
91 |
+
}
|
|
|
92 |
|
93 |
+
/**
|
94 |
+
* Perform minification, return result
|
95 |
+
*
|
96 |
+
* @return string
|
97 |
+
*/
|
98 |
+
public function min() {
|
99 |
+
if ( '' !== $this->output ) { // min already run
|
100 |
+
return $this->output;
|
101 |
+
}
|
|
|
102 |
|
103 |
+
$mbIntEnc = null;
|
104 |
+
$this->input = str_replace( "\r\n", "\n", $this->input );
|
105 |
+
$this->inputLength = strlen( $this->input );
|
106 |
|
107 |
+
$this->action( self::ACTION_DELETE_A_B );
|
108 |
|
109 |
+
while ( null !== $this->a ) {
|
110 |
+
// determine next command
|
111 |
+
$command = self::ACTION_KEEP_A; // default
|
112 |
+
if ( ' ' === $this->a ) {
|
113 |
+
if ( ( '+' === $this->lastByteOut || '-' === $this->lastByteOut ) && $this->b === $this->lastByteOut ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement
|
114 |
+
// Don't delete this space. If we do, the addition/subtraction
|
115 |
+
// could be parsed as a post-increment
|
116 |
+
} elseif ( ! $this->isAlphaNum( $this->b ) ) {
|
117 |
+
$command = self::ACTION_DELETE_A;
|
118 |
+
}
|
119 |
+
} elseif ( "\n" === $this->a ) {
|
120 |
+
if ( ' ' === $this->b ) {
|
121 |
+
$command = self::ACTION_DELETE_A_B;
|
122 |
+
} elseif ( null === $this->b
|
123 |
+
|| ( false === strpos( '{[(+-!~', $this->b )
|
124 |
+
&& ! $this->isAlphaNum( $this->b ) ) ) {
|
125 |
+
$command = self::ACTION_DELETE_A;
|
126 |
+
}
|
127 |
+
} elseif ( ! $this->isAlphaNum( $this->a ) ) {
|
128 |
+
if ( ' ' === $this->b
|
129 |
+
|| ( "\n" === $this->b
|
130 |
+
&& ( false === strpos( '}])+-"\'', $this->a ) ) ) ) {
|
131 |
+
$command = self::ACTION_DELETE_A_B;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
$this->action( $command );
|
135 |
+
}
|
136 |
+
$this->output = trim( $this->output );
|
|
|
137 |
|
138 |
+
if ( null !== $mbIntEnc ) {
|
139 |
+
mb_internal_encoding( $mbIntEnc );
|
140 |
+
}
|
141 |
+
return $this->output;
|
142 |
+
}
|
143 |
|
144 |
+
/**
|
145 |
+
* ACTION_KEEP_A = Output A. Copy B to A. Get the next B.
|
146 |
+
* ACTION_DELETE_A = Copy B to A. Get the next B.
|
147 |
+
* ACTION_DELETE_A_B = Get the next B.
|
148 |
+
*
|
149 |
+
* @param int $command
|
150 |
+
* @throws JSMin_UnterminatedRegExpException|JSMin_UnterminatedStringException
|
151 |
+
*/
|
152 |
+
protected function action( $command ) {
|
153 |
+
// make sure we don't compress "a + ++b" to "a+++b", etc.
|
154 |
+
if ( self::ACTION_DELETE_A_B === $command
|
155 |
+
&& ' ' === $this->b
|
156 |
+
&& ( '+' === $this->a || '-' === $this->a ) ) {
|
157 |
+
// Note: we're at an addition/substraction operator; the inputIndex
|
158 |
+
// will certainly be a valid index
|
159 |
+
if ( $this->input[ $this->inputIndex ] === $this->a ) {
|
160 |
+
// This is "+ +" or "- -". Don't delete the space.
|
161 |
+
$command = self::ACTION_KEEP_A;
|
162 |
+
}
|
163 |
+
}
|
|
|
164 |
|
165 |
+
switch ( $command ) {
|
166 |
+
case self::ACTION_KEEP_A: // 1
|
167 |
+
$this->output .= $this->a;
|
168 |
|
169 |
+
if ( $this->keptComment ) {
|
170 |
+
$this->output = rtrim( $this->output, "\n" );
|
171 |
+
$this->output .= $this->keptComment;
|
172 |
+
$this->keptComment = '';
|
173 |
+
}
|
174 |
|
175 |
+
$this->lastByteOut = $this->a;
|
176 |
|
177 |
+
// fallthrough intentional
|
178 |
+
case self::ACTION_DELETE_A: // 2
|
179 |
+
$this->a = $this->b;
|
180 |
+
if ( "'" === $this->a || '"' === $this->a ) { // string literal
|
181 |
+
$str = $this->a; // in case needed for exception
|
182 |
+
for ( ;; ) {
|
183 |
+
$this->output .= $this->a;
|
184 |
+
$this->lastByteOut = $this->a;
|
185 |
|
186 |
+
$this->a = $this->get();
|
187 |
+
if ( $this->a === $this->b ) { // end quote
|
188 |
+
break;
|
189 |
+
}
|
190 |
+
if ( $this->isEOF( $this->a ) ) {
|
191 |
+
throw new JSMin_UnterminatedStringException(
|
192 |
+
"JSMin: Unterminated String at byte {$this->inputIndex}: {$str}"
|
193 |
+
);
|
194 |
+
}
|
195 |
+
$str .= $this->a;
|
196 |
+
if ( '\\' === $this->a ) {
|
197 |
+
$this->output .= $this->a;
|
198 |
+
$this->lastByteOut = $this->a;
|
199 |
|
200 |
+
$this->a = $this->get();
|
201 |
+
$str .= $this->a;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}
|
205 |
|
206 |
+
// fallthrough intentional
|
207 |
+
case self::ACTION_DELETE_A_B: // 3
|
208 |
+
$this->b = $this->next();
|
209 |
+
if ( '/' === $this->b && $this->isRegexpLiteral() ) {
|
210 |
+
$this->output .= $this->a . $this->b;
|
211 |
+
$pattern = '/'; // keep entire pattern in case we need to report it in the exception
|
212 |
+
for ( ;; ) {
|
213 |
+
$this->a = $this->get();
|
214 |
+
$pattern .= $this->a;
|
215 |
+
if ( '[' === $this->a ) {
|
216 |
+
for ( ;; ) {
|
217 |
+
$this->output .= $this->a;
|
218 |
+
$this->a = $this->get();
|
219 |
+
$pattern .= $this->a;
|
220 |
+
if ( ']' === $this->a ) {
|
221 |
+
break;
|
222 |
+
}
|
223 |
+
if ( '\\' === $this->a ) {
|
224 |
+
$this->output .= $this->a;
|
225 |
+
$this->a = $this->get();
|
226 |
+
$pattern .= $this->a;
|
227 |
+
}
|
228 |
+
if ( $this->isEOF( $this->a ) ) {
|
229 |
+
throw new JSMin_UnterminatedRegExpException(
|
230 |
+
'JSMin: Unterminated set in RegExp at byte '
|
231 |
+
. $this->inputIndex . ": {$pattern}"
|
232 |
+
);
|
233 |
+
}
|
234 |
+
}
|
235 |
+
}
|
236 |
|
237 |
+
if ( '/' === $this->a ) { // end pattern
|
238 |
+
break; // while (true)
|
239 |
+
} elseif ( '\\' === $this->a ) {
|
240 |
+
$this->output .= $this->a;
|
241 |
+
$this->a = $this->get();
|
242 |
+
$pattern .= $this->a;
|
243 |
+
} elseif ( $this->isEOF( $this->a ) ) {
|
244 |
+
throw new JSMin_UnterminatedRegExpException(
|
245 |
+
"JSMin: Unterminated RegExp at byte {$this->inputIndex}: {$pattern}"
|
246 |
+
);
|
247 |
+
}
|
248 |
+
$this->output .= $this->a;
|
249 |
+
$this->lastByteOut = $this->a;
|
250 |
+
}
|
251 |
+
$this->b = $this->next();
|
252 |
+
}
|
253 |
+
// end case ACTION_DELETE_A_B
|
254 |
+
}
|
255 |
+
}
|
256 |
|
257 |
+
/**
|
258 |
+
* @return bool
|
259 |
+
*/
|
260 |
+
protected function isRegexpLiteral() {
|
261 |
+
if ( false !== strpos( '(,=:[!&|?+-~*{;', $this->a ) ) {
|
262 |
+
// we obviously aren't dividing
|
263 |
+
return true;
|
264 |
+
}
|
265 |
+
if ( ' ' === $this->a || "\n" === $this->a ) {
|
266 |
+
$length = strlen( $this->output );
|
267 |
+
if ( $length < 2 ) { // weird edge case
|
268 |
+
return true;
|
269 |
+
}
|
270 |
+
// you can't divide a keyword
|
271 |
+
if ( preg_match( '/(?:case|else|in|return|typeof)$/', $this->output, $m ) ) {
|
272 |
+
if ( $this->output === $m[0] ) { // odd but could happen
|
273 |
+
return true;
|
274 |
+
}
|
275 |
+
// make sure it's a keyword, not end of an identifier
|
276 |
+
$charBeforeKeyword = substr( $this->output, $length - strlen( $m[0] ) - 1, 1 );
|
277 |
+
if ( ! $this->isAlphaNum( $charBeforeKeyword ) ) {
|
278 |
+
return true;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
return false;
|
283 |
+
}
|
|
|
284 |
|
285 |
+
/**
|
286 |
+
* Return the next character from stdin. Watch out for lookahead. If the character is a control character,
|
287 |
+
* translate it to a space or linefeed.
|
288 |
+
*
|
289 |
+
* @return string
|
290 |
+
*/
|
291 |
+
protected function get() {
|
292 |
+
$c = $this->lookAhead;
|
293 |
+
$this->lookAhead = null;
|
294 |
+
if ( null === $c ) {
|
295 |
+
// getc(stdin)
|
296 |
+
if ( $this->inputIndex < $this->inputLength ) {
|
297 |
+
$c = $this->input[ $this->inputIndex ];
|
298 |
+
$this->inputIndex += 1;
|
299 |
+
} else {
|
300 |
+
$c = null;
|
301 |
+
}
|
302 |
+
}
|
303 |
+
if ( ord( $c ) >= self::ORD_SPACE || "\n" === $c || null === $c ) {
|
304 |
+
return $c;
|
305 |
+
}
|
306 |
+
if ( "\r" === $c ) {
|
307 |
+
return "\n";
|
308 |
+
}
|
309 |
+
return ' ';
|
310 |
+
}
|
|
|
311 |
|
312 |
+
/**
|
313 |
+
* Does $a indicate end of input?
|
314 |
+
*
|
315 |
+
* @param string $a
|
316 |
+
* @return bool
|
317 |
+
*/
|
318 |
+
protected function isEOF( $a ) {
|
319 |
+
return ord( $a ) <= self::ORD_LF;
|
320 |
+
}
|
|
|
321 |
|
322 |
+
/**
|
323 |
+
* Get next char (without getting it). If is ctrl character, translate to a space or newline.
|
324 |
+
*
|
325 |
+
* @return string
|
326 |
+
*/
|
327 |
+
protected function peek() {
|
328 |
+
$this->lookAhead = $this->get();
|
329 |
+
return $this->lookAhead;
|
330 |
+
}
|
|
|
331 |
|
332 |
+
/**
|
333 |
+
* Return true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character.
|
334 |
+
*
|
335 |
+
* @param string $c
|
336 |
+
*
|
337 |
+
* @return bool
|
338 |
+
*/
|
339 |
+
protected function isAlphaNum( $c ) {
|
340 |
+
return ( preg_match( '/^[a-z0-9A-Z_\\$\\\\]$/', $c ) || ord( $c ) > 126 );
|
341 |
+
}
|
|
|
342 |
|
343 |
+
/**
|
344 |
+
* Consume a single line comment from input (possibly retaining it)
|
345 |
+
*/
|
346 |
+
protected function consumeSingleLineComment() {
|
347 |
+
$comment = '';
|
348 |
+
while ( true ) {
|
349 |
+
$get = $this->get();
|
350 |
+
$comment .= $get;
|
351 |
+
if ( ord( $get ) <= self::ORD_LF ) { // end of line reached
|
352 |
+
// if IE conditional comment
|
353 |
+
if ( preg_match( '/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment ) ) {
|
354 |
+
$this->keptComment .= "/{$comment}";
|
355 |
+
}
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
|
|
360 |
|
361 |
+
/**
|
362 |
+
* Consume a multiple line comment from input (possibly retaining it)
|
363 |
+
*
|
364 |
+
* @throws JSMin_UnterminatedCommentException
|
365 |
+
*/
|
366 |
+
protected function consumeMultipleLineComment() {
|
367 |
+
$this->get();
|
368 |
+
$comment = '';
|
369 |
+
for ( ;; ) {
|
370 |
+
$get = $this->get();
|
371 |
+
if ( '*' === $get ) {
|
372 |
+
if ( '/' === $this->peek() ) { // end of comment reached
|
373 |
+
$this->get();
|
374 |
+
if ( 0 === strpos( $comment, '!' ) ) {
|
375 |
+
// preserved by YUI Compressor
|
376 |
+
if ( ! $this->keptComment ) {
|
377 |
+
// don't prepend a newline if two comments right after one another
|
378 |
+
$this->keptComment = "\n";
|
379 |
+
}
|
380 |
+
$this->keptComment .= '/*!' . substr( $comment, 1 ) . "*/\n";
|
381 |
+
} elseif ( preg_match( '/^@(?:cc_on|if|elif|else|end)\\b/', $comment ) ) {
|
382 |
+
// IE conditional
|
383 |
+
$this->keptComment .= "/*{$comment}*/";
|
384 |
+
}
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
} elseif ( null === $get ) {
|
388 |
+
throw new JSMin_UnterminatedCommentException(
|
389 |
+
"JSMin: Unterminated comment at byte {$this->inputIndex}: /*{$comment}"
|
390 |
+
);
|
391 |
+
}
|
392 |
+
$comment .= $get;
|
393 |
+
}
|
394 |
+
}
|
395 |
|
396 |
+
/**
|
397 |
+
* Get the next character, skipping over comments. Some comments may be preserved.
|
398 |
+
*
|
399 |
+
* @return string
|
400 |
+
*/
|
401 |
+
protected function next() {
|
402 |
+
$get = $this->get();
|
403 |
+
if ( '/' === $get ) {
|
404 |
+
switch ( $this->peek() ) {
|
405 |
+
case '/':
|
406 |
+
$this->consumeSingleLineComment();
|
407 |
+
$get = "\n";
|
408 |
+
break;
|
409 |
+
case '*':
|
410 |
+
$this->consumeMultipleLineComment();
|
411 |
+
$get = ' ';
|
412 |
+
break;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
return $get;
|
416 |
+
}
|
|
|
417 |
}
|
418 |
|
419 |
class JSMin_UnterminatedStringException extends Exception {}
|
js/fbuilder-loader-admin.php
CHANGED
@@ -1,91 +1,74 @@
|
|
1 |
-
<?php
|
2 |
-
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 |
-
fbuilderjQuery.fbuilderjQueryGenerator = function(){
|
7 |
-
if('fbuilderGeneratorFlag' in fbuilderjQuery) return;
|
8 |
-
(function($) {
|
9 |
-
// Namespace of fbuilder
|
10 |
-
$.fbuilder = $.fbuilder || {};
|
11 |
-
|
12 |
-
$.fbuilder[ 'objName' ] = 'fbuilderjQuery';
|
13 |
-
<?php
|
14 |
-
// Load Module files
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
{
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
{
|
21 |
-
if ( strlen( $entry ) > 3 && is_dir( $md->path.'/'.$entry ) )
|
22 |
-
{
|
23 |
-
if ( file_exists( $md->path.'/'.$entry.'/admin' ) )
|
24 |
-
{
|
25 |
-
$m = dir( $md->path.'/'.$entry.'/admin' );
|
26 |
-
while( false !== ( $mentry = $m->read() ) )
|
27 |
-
{
|
28 |
-
if( strlen( $mentry ) > 3 && strtolower( substr( $mentry, strlen( $mentry ) - 3 ) ) == '.js' )
|
29 |
-
{
|
30 |
-
$modules_files[] = $m->path.'/'.$mentry;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
}
|
36 |
-
}
|
37 |
-
sort( $modules_files );
|
38 |
-
foreach( $modules_files as $file )
|
39 |
-
{
|
40 |
-
require $file;
|
41 |
-
}
|
42 |
}
|
43 |
-
|
44 |
-
{
|
45 |
-
// ignore the error
|
46 |
-
}
|
47 |
-
|
48 |
-
// Load Control files
|
49 |
-
require 'fbuilder-pro-admin.jquery.js';
|
50 |
-
try
|
51 |
-
{
|
52 |
-
$d = dir( dirname( __FILE__ )."/fields-admin" );
|
53 |
-
$controls_files = array();
|
54 |
-
while (false !== ($entry = $d->read()))
|
55 |
-
{
|
56 |
-
if (strlen($entry) > 3 && strtolower(substr($entry,strlen($entry)-3)) == '.js')
|
57 |
-
{
|
58 |
-
if (file_exists( $d->path.'/'.$entry ) )
|
59 |
-
{
|
60 |
-
$controls_files[] = $d->path.'/'.$entry;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
64 |
-
sort( $controls_files );
|
65 |
-
foreach( $controls_files as $file )
|
66 |
-
{
|
67 |
-
require $file;
|
68 |
-
}
|
69 |
-
|
70 |
-
do_action('cpcff_load_controls_admin');
|
71 |
-
}
|
72 |
-
catch (Exception $e)
|
73 |
-
{
|
74 |
-
// ignore the error
|
75 |
-
}
|
76 |
-
|
77 |
-
do_action( 'cpcff_additional_admin_scripts' );
|
78 |
-
?>
|
79 |
-
})(fbuilderjQuery);
|
80 |
-
fbuilderjQuery.fbuilderGeneratorFlag = 1;
|
81 |
-
};
|
82 |
-
fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);
|
83 |
-
fbuilderjQuery(window).on('load',function(){
|
84 |
-
fbuilderjQuery.fbuilderjQueryGenerator();
|
85 |
-
if(!fbuilderjQuery('[href*="jquery-ui"]').length)
|
86 |
-
{
|
87 |
-
fbuilderjQuery('body').append(
|
88 |
-
'<link href="<?php print esc_attr(plugins_url('/vendors/jquery-ui/jquery-ui.min.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH)); ?>" type="text/css" rel="stylesheet" property="stylesheet" />'
|
89 |
-
);
|
90 |
-
}
|
91 |
-
});
|
1 |
+
<?php
|
2 |
+
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 |
+
fbuilderjQuery.fbuilderjQueryGenerator = function(){
|
7 |
+
if('fbuilderGeneratorFlag' in fbuilderjQuery) return;
|
8 |
+
(function($) {
|
9 |
+
// Namespace of fbuilder
|
10 |
+
$.fbuilder = $.fbuilder || {};
|
11 |
+
$.fbuilder.default_template = '<?php print esc_js( CP_CALCULATEDFIELDSF_DEFAULT_template ); ?>';
|
12 |
+
$.fbuilder[ 'objName' ] = 'fbuilderjQuery';
|
13 |
+
<?php
|
14 |
+
// Load Module files
|
15 |
+
try {
|
16 |
+
$md = dir( dirname( __FILE__ ) . '/modules' );
|
17 |
+
$modules_files = array();
|
18 |
+
while ( false !== ( $entry = $md->read() ) ) {
|
19 |
+
if ( strlen( $entry ) > 3 && is_dir( $md->path . '/' . $entry ) ) {
|
20 |
+
if ( file_exists( $md->path . '/' . $entry . '/admin' ) ) {
|
21 |
+
$m = dir( $md->path . '/' . $entry . '/admin' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
|
22 |
+
while ( false !== ( $mentry = $m->read() ) ) {
|
23 |
+
if ( strlen( $mentry ) > 3 && strtolower( substr( $mentry, strlen( $mentry ) - 3 ) ) == '.js' ) {
|
24 |
+
$modules_files[] = $m->path . '/' . $mentry;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
sort( $modules_files );
|
31 |
+
foreach ( $modules_files as $file ) {
|
32 |
+
require $file;
|
33 |
+
}
|
34 |
+
} catch ( Exception $e ) {
|
35 |
+
error_log( $e->getMessage() );
|
36 |
+
}
|
37 |
+
|
38 |
+
// Load Control files
|
39 |
+
require 'fbuilder-pro-admin.jquery.js';
|
40 |
+
try {
|
41 |
+
$d = dir( dirname( __FILE__ ) . '/fields-admin' );
|
42 |
+
$controls_files = array();
|
43 |
+
while ( false !== ( $entry = $d->read() ) ) {
|
44 |
+
if ( strlen( $entry ) > 3 && strtolower( substr( $entry, strlen( $entry ) - 3 ) ) == '.js' ) {
|
45 |
+
if ( file_exists( $d->path . '/' . $entry ) ) {
|
46 |
+
$controls_files[] = $d->path . '/' . $entry;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
sort( $controls_files );
|
51 |
+
foreach ( $controls_files as $file ) {
|
52 |
+
require $file;
|
53 |
+
}
|
54 |
+
|
55 |
+
do_action( 'cpcff_load_controls_admin' );
|
56 |
+
} catch ( Exception $e ) {
|
57 |
+
error_log( $e->getMessage() );
|
58 |
+
}
|
59 |
+
|
60 |
+
do_action( 'cpcff_additional_admin_scripts' );
|
61 |
+
?>
|
62 |
+
})(fbuilderjQuery);
|
63 |
+
fbuilderjQuery.fbuilderGeneratorFlag = 1;
|
64 |
+
};
|
65 |
+
fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);
|
66 |
+
fbuilderjQuery(window).on('load',function(){
|
67 |
+
fbuilderjQuery.fbuilderjQueryGenerator();
|
68 |
+
if(!fbuilderjQuery('[href*="jquery-ui"]').length)
|
69 |
{
|
70 |
+
fbuilderjQuery('body').append(
|
71 |
+
'<link href="<?php print esc_attr( plugins_url( '/vendors/jquery-ui/jquery-ui.min.css', CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) ); // phpcs:ignore WordPress.WP.EnqueuedResources ?>" type="text/css" rel="stylesheet" property="stylesheet" />'
|
72 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/fbuilder-loader-public.php
CHANGED
@@ -1,158 +1,155 @@
|
|
1 |
-
<?php
|
2 |
-
global $cff_backend_script_generator, $cff_script_generator_min;
|
3 |
-
|
4 |
-
error_reporting(E_ERROR|E_PARSE);
|
5 |
-
|
6 |
-
if(empty($cff_backend_script_generator))
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
fbuilderjQuery
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
$.fbuilder[ 'objName' ] = 'fbuilderjQuery';
|
19 |
-
|
20 |
-
<?php
|
21 |
-
// Load Module files
|
22 |
-
try
|
23 |
-
{
|
24 |
-
$md = dir( dirname( __FILE__ )."/modules" );
|
25 |
-
$modules_files = array();
|
26 |
-
while( false !== ( $entry = $md->read() ) )
|
27 |
{
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
{
|
35 |
-
if(
|
36 |
{
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
require $file;
|
69 |
-
}
|
70 |
-
|
71 |
-
do_action('cpcff_load_controls_public');
|
72 |
-
} catch (Exception $e) {
|
73 |
-
// ignore the error
|
74 |
-
}
|
75 |
-
?>
|
76 |
-
$.fbuilder.generate_form = function(fnum){
|
77 |
-
try {
|
78 |
-
var cp_calculatedfieldsf_fbuilder_config = window["cp_calculatedfieldsf_fbuilder_config"+fnum];
|
79 |
-
if(
|
80 |
-
cp_calculatedfieldsf_fbuilder_config &&
|
81 |
-
$("#fbuilder"+fnum).length &&
|
82 |
-
$("#fbuilder"+fnum).attr('data-processed') == undefined
|
83 |
-
)
|
84 |
-
{
|
85 |
-
if($("#fbuilder"+fnum).is(':visible'))
|
86 |
-
{
|
87 |
-
var f = $("#fbuilder"+fnum).fbuilder(( typeof cp_calculatedfieldsf_fbuilder_config.obj == 'string' ) ? $.parseJSON(cp_calculatedfieldsf_fbuilder_config.obj) : cp_calculatedfieldsf_fbuilder_config.obj );
|
88 |
-
f.attr('data-processed', 1);
|
89 |
-
f.fBuild.loadData("form_structure"+fnum);
|
90 |
-
}
|
91 |
-
else
|
92 |
-
{
|
93 |
-
$.fbuilder.form_become_visible(
|
94 |
-
"#fbuilder"+fnum,
|
95 |
-
(function(n){ return function(){
|
96 |
-
$.fbuilder.generate_form(n);};
|
97 |
-
})(fnum)
|
98 |
-
);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
} catch (e) {if(typeof console != 'undefined') console.log(e);}
|
102 |
-
}; // End generate_form
|
103 |
-
|
104 |
-
$.fbuilder.form_become_visible = function(element, callback){
|
105 |
-
if(!('hidden_forms' in $.fbuilder)) $.fbuilder.hidden_forms = [];
|
106 |
-
$.fbuilder.hidden_forms.push({'element':element, 'callback':callback});
|
107 |
-
|
108 |
-
if('form_become_visible_interval' in $.fbuilder) clearInterval($.fbuilder['form_become_visible_interval']);
|
109 |
-
|
110 |
-
$.fbuilder['form_become_visible_interval'] = setInterval(function(){
|
111 |
-
for(var i = $.fbuilder.hidden_forms.length - 1; 0<=i; i--)
|
112 |
-
{
|
113 |
-
if($($.fbuilder.hidden_forms[i]['element']).is(':visible'))
|
114 |
-
{
|
115 |
-
$.fbuilder.hidden_forms[i]['callback'].call();
|
116 |
-
$.fbuilder.hidden_forms.splice(i,1);
|
117 |
-
}
|
118 |
-
}
|
119 |
-
if($.fbuilder.hidden_forms.length == 0) clearInterval($.fbuilder['form_become_visible_interval']);
|
120 |
-
}, 500);
|
121 |
-
}; // End form_become_visible
|
122 |
-
|
123 |
-
} // End if(!('fbuilder' in $))
|
124 |
-
|
125 |
-
var fcount = 1;
|
126 |
-
var fnum = "_"+fcount;
|
127 |
-
|
128 |
-
while(typeof window["cp_calculatedfieldsf_fbuilder_config"+fnum] != 'undefined' || fcount < 10 )
|
129 |
-
{
|
130 |
-
$.fbuilder.generate_form(fnum);
|
131 |
-
fcount++;
|
132 |
-
fnum = "_"+fcount;
|
133 |
-
}
|
134 |
-
})(fbuilderjQuery);
|
135 |
-
};
|
136 |
-
fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);
|
137 |
-
fbuilderjQuery(window).on('load',fbuilderjQuery.fbuilderjQueryGenerator);
|
138 |
-
<?php
|
139 |
-
$buffered_contents = ob_get_contents();
|
140 |
-
ob_end_clean(); // Clean the output buffer and turn off output buffering
|
141 |
-
if(!empty($_REQUEST['min']) || !empty($cff_script_generator_min))
|
142 |
-
{
|
143 |
-
if( !class_exists( 'JSMin' ) )
|
144 |
{
|
145 |
-
|
|
|
|
|
146 |
}
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
global $cff_backend_script_generator, $cff_script_generator_min;
|
3 |
+
|
4 |
+
error_reporting( E_ERROR | E_PARSE );
|
5 |
+
|
6 |
+
if ( empty( $cff_backend_script_generator ) ) {
|
7 |
+
header( 'Content-Type: application/x-javascript; charset=UTF-8' );
|
8 |
+
}
|
9 |
+
|
10 |
+
ob_start(); // Turn on output buffering
|
11 |
+
?>
|
12 |
+
fbuilderjQuery = (typeof fbuilderjQuery != 'undefined' ) ? fbuilderjQuery : jQuery;
|
13 |
+
fbuilderjQuery(window).bind( 'pageshow', function( event ){ if( typeof event.originalEvent[ 'persisted' ] != 'undefined' && event.originalEvent[ 'persisted' ] ) location.reload(); } );
|
14 |
+
fbuilderjQuery.fbuilderjQueryGenerator = function(){
|
15 |
+
(function($) {
|
16 |
+
// Namespace of fbuilder
|
17 |
+
if(!('fbuilder' in $))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
{
|
19 |
+
$.fbuilder = $.fbuilder || {};
|
20 |
+
$.fbuilder[ 'objName' ] = 'fbuilderjQuery';
|
21 |
+
|
22 |
+
<?php
|
23 |
+
// Load Module files
|
24 |
+
try {
|
25 |
+
$md = dir( dirname( __FILE__ ) . '/modules' );
|
26 |
+
$modules_files = array();
|
27 |
+
while ( false !== ( $entry = $md->read() ) ) {
|
28 |
+
if ( strlen( $entry ) > 3 && is_dir( $md->path . '/' . $entry ) ) {
|
29 |
+
if ( file_exists( $md->path . '/' . $entry . '/public' ) ) {
|
30 |
+
$m = dir( $md->path . '/' . $entry . '/public' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride
|
31 |
+
while ( false !== ( $mentry = $m->read() ) ) {
|
32 |
+
if ( strlen( $mentry ) > 3 && strtolower( substr( $mentry, strlen( $mentry ) - 3 ) ) == '.js' ) {
|
33 |
+
$modules_files[] = $m->path . '/' . $mentry;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
sort( $modules_files );
|
40 |
+
foreach ( $modules_files as $file ) {
|
41 |
+
require $file;
|
42 |
+
}
|
43 |
+
} catch ( Exception $e ) {
|
44 |
+
error_log( $e->getMessage() );
|
45 |
+
}
|
46 |
+
|
47 |
+
// Load Control files
|
48 |
+
require 'fbuilder-pro-public.jquery.js';
|
49 |
+
try {
|
50 |
+
$d = dir( dirname( __FILE__ ) . '/fields-public' );
|
51 |
+
$controls_files = array();
|
52 |
+
while ( false !== ( $entry = $d->read() ) ) {
|
53 |
+
if ( strlen( $entry ) > 3 && strtolower( substr( $entry, strlen( $entry ) - 3 ) ) == '.js' ) {
|
54 |
+
if ( file_exists( $d->path . '/' . $entry ) ) {
|
55 |
+
$controls_files[] = $d->path . '/' . $entry;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
sort( $controls_files );
|
60 |
+
foreach ( $controls_files as $file ) {
|
61 |
+
require $file;
|
62 |
+
}
|
63 |
+
|
64 |
+
do_action( 'cpcff_load_controls_public' );
|
65 |
+
} catch ( Exception $e ) {
|
66 |
+
error_log( $e->getMessage() );
|
67 |
+
}
|
68 |
+
?>
|
69 |
+
$.fbuilder.generate_form = function(fnum){
|
70 |
+
try {
|
71 |
+
var cp_calculatedfieldsf_fbuilder_config = window["cp_calculatedfieldsf_fbuilder_config"+fnum];
|
72 |
+
if(
|
73 |
+
cp_calculatedfieldsf_fbuilder_config &&
|
74 |
+
$("#fbuilder"+fnum).length &&
|
75 |
+
$("#fbuilder"+fnum).attr('data-processed') == undefined
|
76 |
+
)
|
77 |
{
|
78 |
+
if($("#fbuilder"+fnum).is(':visible'))
|
79 |
{
|
80 |
+
var f = $("#fbuilder"+fnum).fbuilder(( typeof cp_calculatedfieldsf_fbuilder_config.obj == 'string' ) ? $.parseJSON(cp_calculatedfieldsf_fbuilder_config.obj) : cp_calculatedfieldsf_fbuilder_config.obj );
|
81 |
+
f.attr('data-processed', 1);
|
82 |
+
f.fBuild.loadData("form_structure"+fnum);
|
83 |
+
}
|
84 |
+
else
|
85 |
+
{
|
86 |
+
$.fbuilder.form_become_visible(
|
87 |
+
"#fbuilder"+fnum,
|
88 |
+
(function(n){ return function(){
|
89 |
+
$.fbuilder.generate_form(n);};
|
90 |
+
})(fnum)
|
91 |
+
);
|
92 |
}
|
93 |
}
|
94 |
+
} catch (e) {if(typeof console != 'undefined') console.log(e);}
|
95 |
+
}; // End generate_form
|
96 |
+
|
97 |
+
$.fbuilder.form_become_visible = function(element, callback){
|
98 |
+
if(!('hidden_forms' in $.fbuilder)) $.fbuilder.hidden_forms = [];
|
99 |
+
$.fbuilder.hidden_forms.push({'element':element, 'callback':callback});
|
100 |
+
|
101 |
+
if('form_become_visible_interval' in $.fbuilder) clearInterval($.fbuilder['form_become_visible_interval']);
|
102 |
+
|
103 |
+
$.fbuilder['form_become_visible_interval'] = setInterval(function(){
|
104 |
+
for(var i = $.fbuilder.hidden_forms.length - 1; 0<=i; i--)
|
105 |
+
{
|
106 |
+
if($($.fbuilder.hidden_forms[i]['element']).is(':visible'))
|
107 |
+
{
|
108 |
+
$.fbuilder.hidden_forms[i]['callback'].call();
|
109 |
+
$.fbuilder.hidden_forms.splice(i,1);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
if($.fbuilder.hidden_forms.length == 0) clearInterval($.fbuilder['form_become_visible_interval']);
|
113 |
+
}, 500);
|
114 |
+
}; // End form_become_visible
|
115 |
+
|
116 |
+
} // End if(!('fbuilder' in $))
|
117 |
+
|
118 |
+
var fcount = 1;
|
119 |
+
var fnum = "_"+fcount;
|
120 |
+
|
121 |
+
while(typeof window["cp_calculatedfieldsf_fbuilder_config"+fnum] != 'undefined' || fcount < 10 )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
{
|
123 |
+
$.fbuilder.generate_form(fnum);
|
124 |
+
fcount++;
|
125 |
+
fnum = "_"+fcount;
|
126 |
}
|
127 |
+
})(fbuilderjQuery);
|
128 |
+
};
|
129 |
+
fbuilderjQuery(fbuilderjQuery.fbuilderjQueryGenerator);
|
130 |
+
fbuilderjQuery(window).on('load',fbuilderjQuery.fbuilderjQueryGenerator);
|
131 |
+
<?php
|
132 |
+
$buffered_contents = ob_get_contents();
|
133 |
+
ob_end_clean(); // Clean the output buffer and turn off output buffering
|
134 |
+
if ( ! empty( $_REQUEST['min'] ) || ! empty( $cff_script_generator_min ) ) {
|
135 |
+
if ( ! class_exists( 'JSMin' ) ) {
|
136 |
+
require_once rtrim( dirname( __FILE__ ), '/' ) . '/JSMin.php';
|
137 |
+
}
|
138 |
+
|
139 |
+
try {
|
140 |
+
$buffered_contents = JSMin::minify( $buffered_contents );
|
141 |
+
} catch ( Exception $err ) {
|
142 |
+
error_log( $err->getMessage() );
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
try {
|
147 |
+
$all_js_path = rtrim( dirname( __FILE__ ), '/' ) . '/cache/all.js';
|
148 |
+
@file_put_contents( $all_js_path, $buffered_contents );
|
149 |
+
} catch ( Exception $err ) {
|
150 |
+
error_log( $err->getMessage() );
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( empty( $cff_backend_script_generator ) ) {
|
154 |
+
print $buffered_contents; // phpcs:ignore WordPress.Security.EscapeOutput
|
155 |
+
}
|
languages/calculated-fields-form-en_US.mo
CHANGED
Binary file
|
languages/calculated-fields-form-en_US.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: \n"
|
4 |
-
"POT-Creation-Date: 2022-
|
5 |
-
"PO-Revision-Date: 2022-
|
6 |
"Last-Translator: CodePeople\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: en_US\n"
|
@@ -12,14 +12,14 @@ msgstr ""
|
|
12 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
"X-Generator: Poedit 3.1.1\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
-
"X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e\n"
|
16 |
"X-Poedit-SearchPath-0: .\n"
|
17 |
|
18 |
-
#: cp_calculatedfieldsf_free.php:
|
19 |
msgid "Form Preview"
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: cp_calculatedfieldsf_free.php:
|
23 |
msgid ""
|
24 |
"<div class=\"error-text\">The data cannot be stored in database because has "
|
25 |
"occurred an error with the database structure. Please, go to the plugins "
|
@@ -28,7 +28,7 @@ msgid ""
|
|
28 |
"please <a href=\"https://cff.dwbooster.com/contact-us\">contact us</a></div>"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: cp_calculatedfieldsf_free.php:
|
32 |
msgid ""
|
33 |
"<div class=\"error-text\">The data cannot be stored in database because has "
|
34 |
"occurred an error with the form structure. Please, try to save the data "
|
@@ -41,18 +41,18 @@ msgstr ""
|
|
41 |
msgid "Settings saved"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: inc/cpcff_admin_int.inc.php:
|
45 |
-
#: inc/cpcff_page_builders.inc.php:
|
46 |
#: pagebuilders/beaverbuilder/cff/cff/cff.php:9
|
47 |
#: pagebuilders/beaverbuilder/cff/cff/cff.php:11
|
48 |
#: pagebuilders/beaverbuilder/cff/cff/cff.php:12
|
49 |
#: pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php:11
|
50 |
#: pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php:12
|
51 |
-
#: pagebuilders/elementor/elementor.pb.php:
|
52 |
msgid "Calculated Fields Form"
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: inc/cpcff_admin_int.inc.php:
|
56 |
msgid "Form"
|
57 |
msgstr ""
|
58 |
|
@@ -64,7 +64,7 @@ msgstr ""
|
|
64 |
msgid "Back to items list..."
|
65 |
msgstr ""
|
66 |
|
67 |
-
#: inc/cpcff_admin_int.inc.php:70 inc/cpcff_admin_int.inc.php:
|
68 |
msgid "Form Settings"
|
69 |
msgstr ""
|
70 |
|
@@ -90,20 +90,20 @@ msgstr ""
|
|
90 |
msgid "Select a revision"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: inc/cpcff_admin_int.inc.php:
|
94 |
-
#: inc/cpcff_admin_int.inc.php:
|
95 |
msgid "Preview"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: inc/cpcff_admin_int.inc.php:
|
99 |
msgid "Saves the form's structure only, and opens a preview windows"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: inc/cpcff_admin_int.inc.php:
|
103 |
msgid "Fields List"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: inc/cpcff_admin_int.inc.php:
|
107 |
msgid ""
|
108 |
"If the form is not loading in the public website, go to the settings page of "
|
109 |
"the plugin through the menu option: \"Settings/Calculated Fields Form\", "
|
@@ -111,7 +111,7 @@ msgid ""
|
|
111 |
"press the \"Update\" button."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: inc/cpcff_admin_int.inc.php:
|
115 |
msgid ""
|
116 |
"If you need also the form to be sent to the server side for processing (for "
|
117 |
"example to deliver emails) then the <a href=\"https://cff.dwbooster.com/"
|
@@ -119,68 +119,68 @@ msgid ""
|
|
119 |
"required."
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: inc/cpcff_admin_int.inc.php:
|
123 |
msgid ""
|
124 |
"The action will load the revision selected, the data are not stored will be "
|
125 |
"lose. Do you want continue?"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: inc/cpcff_admin_int.inc.php:
|
129 |
msgid ""
|
130 |
"These features aren't available in this version. Do you want to open the "
|
131 |
"plugin's page to check other versions?"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: inc/cpcff_admin_int.inc.php:
|
135 |
msgid "Add a Field"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: inc/cpcff_admin_int.inc.php:
|
139 |
msgid "Field Settings"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: inc/cpcff_admin_int.inc.php:
|
143 |
-
#: inc/cpcff_admin_int.inc.php:
|
144 |
msgid "Save Changes"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: inc/cpcff_admin_int.inc.php:
|
148 |
msgid "Generate revisions in the form preview as well"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: inc/cpcff_admin_int.inc.php:
|
152 |
msgid "Texts definition"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: inc/cpcff_admin_int.inc.php:
|
156 |
msgid "Error texts"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: inc/cpcff_admin_int.inc.php:
|
160 |
msgid "General payment settings"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: inc/cpcff_admin_int.inc.php:
|
164 |
msgid "PayPal integration"
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: inc/cpcff_admin_int.inc.php:
|
168 |
msgid "Notification email"
|
169 |
msgstr ""
|
170 |
|
171 |
-
#: inc/cpcff_admin_int.inc.php:
|
172 |
msgid "Email copy to user"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: inc/cpcff_admin_int.inc.php:
|
176 |
msgid "Captcha settings"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: inc/cpcff_admin_int.inc.php:
|
180 |
msgid "Define Texts"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: inc/cpcff_admin_int.inc.php:
|
184 |
msgid "Previous button label (text)"
|
185 |
msgstr ""
|
186 |
|
@@ -188,76 +188,76 @@ msgstr ""
|
|
188 |
msgid "Next button label (text)"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: inc/cpcff_admin_int.inc.php:
|
192 |
msgid ""
|
193 |
"- The styles can be applied into any of the CSS files of your theme or into "
|
194 |
"the CSS file <em>\"calculated-fields-form\\css\\stylepublic.css\"</em>."
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: inc/cpcff_admin_int.inc.php:
|
198 |
msgid ""
|
199 |
"- For general CSS styles modifications to the form and samples <a href="
|
200 |
"\"https://cff.dwbooster.com/faq#q82\" target=\"_blank\">check this FAQ</a>."
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: inc/cpcff_admin_int.inc.php:
|
204 |
-
#: inc/cpcff_admin_int.inc.php:
|
205 |
-
#: inc/cpcff_admin_int.inc.php:
|
206 |
-
#: inc/cpcff_admin_int.inc.php:
|
207 |
msgid "Up to form structure"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: inc/cpcff_admin_int.inc.php:
|
211 |
msgid "Validation Settings"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: inc/cpcff_admin_int.inc.php:
|
215 |
msgid "\"is required\" text"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: inc/cpcff_admin_int.inc.php:
|
219 |
msgid "\"is email\" text"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: inc/cpcff_admin_int.inc.php:
|
223 |
msgid "\"is valid captcha\" text"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: inc/cpcff_admin_int.inc.php:
|
227 |
msgid "\"is valid date (mm/dd/yyyy)\" text"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: inc/cpcff_admin_int.inc.php:
|
231 |
msgid "\"is valid date (dd/mm/yyyy)\" text"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: inc/cpcff_admin_int.inc.php:
|
235 |
msgid "\"is number\" text"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: inc/cpcff_admin_int.inc.php:
|
239 |
msgid "\"only digits\" text"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: inc/cpcff_admin_int.inc.php:
|
243 |
msgid "\"under maximum\" text"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: inc/cpcff_admin_int.inc.php:
|
247 |
msgid "\"over minimum\" text"
|
248 |
msgstr ""
|
249 |
|
250 |
-
#: inc/cpcff_admin_int.inc.php:
|
251 |
msgid "Note"
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: inc/cpcff_admin_int.inc.php:
|
255 |
msgid ""
|
256 |
"To display the form in a post/page, enter your shortcode in the post/page "
|
257 |
"content:"
|
258 |
msgstr ""
|
259 |
|
260 |
-
#: inc/cpcff_admin_int.inc.php:
|
261 |
msgid ""
|
262 |
"The CFF plugin implements widgets and blocks to allow inserting the form "
|
263 |
"visually with the most popular page builders such as Gutenberg Editor, "
|
@@ -265,141 +265,153 @@ msgid ""
|
|
265 |
"Divi, and for the other page builders insert the shortcode directly."
|
266 |
msgstr ""
|
267 |
|
268 |
-
#: inc/cpcff_admin_int.inc.php:
|
269 |
#: inc/cpcff_admin_int_list.inc.php:436
|
270 |
msgid "Request Custom Modifications"
|
271 |
msgstr ""
|
272 |
|
273 |
-
#: inc/cpcff_admin_int.inc.php:
|
274 |
-
#: inc/cpcff_admin_int_list.inc.php:436 inc/cpcff_main.inc.php:
|
275 |
msgid "Help"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: inc/cpcff_admin_int.inc.php:
|
279 |
msgid ""
|
280 |
"The following features are available in the commercial version of the <a "
|
281 |
"href=\"https://cff.dwbooster.com/download\" target=\"_blank\" style=\"text-"
|
282 |
"decoration:none;\">\"Calculated Fields Form\"</a>"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: inc/cpcff_admin_int.inc.php:
|
286 |
msgid "Pay only ONCE, use it FOREVER"
|
287 |
msgstr ""
|
288 |
|
289 |
-
#: inc/cpcff_admin_int.inc.php:
|
290 |
msgid "Form Processing and Payment Settings"
|
291 |
msgstr ""
|
292 |
|
293 |
-
#: inc/cpcff_admin_int.inc.php:
|
294 |
msgid "Payment Settings"
|
295 |
msgstr ""
|
296 |
|
297 |
-
#: inc/cpcff_admin_int.inc.php:
|
298 |
msgid "Request cost"
|
299 |
msgstr ""
|
300 |
|
301 |
-
#: inc/cpcff_admin_int.inc.php:
|
302 |
msgid "Currency"
|
303 |
msgstr ""
|
304 |
|
305 |
-
#: inc/cpcff_admin_int.inc.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
msgid "Base amount"
|
307 |
msgstr ""
|
308 |
|
309 |
-
#: inc/cpcff_admin_int.inc.php:
|
310 |
msgid ""
|
311 |
"Minimum amount to charge. If the final price is lesser than this number, the "
|
312 |
"base amount will be applied."
|
313 |
msgstr ""
|
314 |
|
315 |
-
#: inc/cpcff_admin_int.inc.php:
|
316 |
msgid "Paypal product name"
|
317 |
msgstr ""
|
318 |
|
319 |
-
#: inc/cpcff_admin_int.inc.php:
|
320 |
msgid "Discount Codes"
|
321 |
msgstr ""
|
322 |
|
323 |
-
#: inc/cpcff_admin_int.inc.php:
|
324 |
msgid "This feature isn't available in this version."
|
325 |
msgstr ""
|
326 |
|
327 |
-
#: inc/cpcff_admin_int.inc.php:
|
328 |
msgid "Add new discount code"
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: inc/cpcff_admin_int.inc.php:
|
332 |
msgid "Code"
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: inc/cpcff_admin_int.inc.php:
|
336 |
msgid "Discount"
|
337 |
msgstr ""
|
338 |
|
339 |
-
#: inc/cpcff_admin_int.inc.php:
|
340 |
msgid "Percent"
|
341 |
msgstr ""
|
342 |
|
343 |
-
#: inc/cpcff_admin_int.inc.php:
|
344 |
msgid "Fixed Value"
|
345 |
msgstr ""
|
346 |
|
347 |
-
#: inc/cpcff_admin_int.inc.php:
|
348 |
msgid "Valid until"
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: inc/cpcff_admin_int.inc.php:
|
352 |
msgid "Add"
|
353 |
msgstr ""
|
354 |
|
355 |
-
#: inc/cpcff_admin_int.inc.php:
|
356 |
msgid "Note: Expiration date based in server time. Server time now is"
|
357 |
msgstr ""
|
358 |
|
359 |
-
#: inc/cpcff_admin_int.inc.php:
|
360 |
msgid "Paypal Payment Configuration"
|
361 |
msgstr ""
|
362 |
|
363 |
-
#: inc/cpcff_admin_int.inc.php:
|
364 |
msgid "Enable Paypal Payments?"
|
365 |
msgstr ""
|
366 |
|
367 |
-
#: inc/cpcff_admin_int.inc.php:
|
368 |
-
#: inc/cpcff_admin_int.inc.php:
|
369 |
msgid "No"
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: inc/cpcff_admin_int.inc.php:
|
373 |
msgid ""
|
374 |
"Note: If \"Optional\" is selected, a radiobutton will appear in the form to "
|
375 |
"select if the payment will be made with PayPal or not."
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: inc/cpcff_admin_int.inc.php:
|
379 |
msgid "Label for the \"<strong>Pay with PayPal</strong>\" option"
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: inc/cpcff_admin_int.inc.php:
|
383 |
msgid "Paypal Mode"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: inc/cpcff_admin_int.inc.php:
|
387 |
msgid "Production - real payments processed"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: inc/cpcff_admin_int.inc.php:
|
391 |
msgid "SandBox - PayPal testing sandbox area"
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: inc/cpcff_admin_int.inc.php:
|
395 |
msgid "Paypal email"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: inc/cpcff_admin_int.inc.php:
|
399 |
msgid "A $0 amount to pay means"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#: inc/cpcff_admin_int.inc.php:
|
403 |
msgid "Let the user enter any amount at PayPal (ex: for a donation)"
|
404 |
msgstr ""
|
405 |
|
@@ -415,202 +427,202 @@ msgstr ""
|
|
415 |
msgid "Payment frequency"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: inc/cpcff_admin_int.inc.php:
|
419 |
msgid "One time payment (default option, user is billed only once)"
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: inc/cpcff_admin_int.inc.php:
|
423 |
msgid "Bill the user every 1 month"
|
424 |
msgstr ""
|
425 |
|
426 |
-
#: inc/cpcff_admin_int.inc.php:
|
427 |
msgid "Bill the user every 3 months"
|
428 |
msgstr ""
|
429 |
|
430 |
-
#: inc/cpcff_admin_int.inc.php:
|
431 |
msgid "Bill the user every 6 months"
|
432 |
msgstr ""
|
433 |
|
434 |
-
#: inc/cpcff_admin_int.inc.php:
|
435 |
msgid "Bill the user every 12 months"
|
436 |
msgstr ""
|
437 |
|
438 |
-
#: inc/cpcff_admin_int.inc.php:
|
439 |
msgid "Paypal prompt buyers for shipping address"
|
440 |
msgstr ""
|
441 |
|
442 |
-
#: inc/cpcff_admin_int.inc.php:
|
443 |
msgid "Do not prompt for an address"
|
444 |
msgstr ""
|
445 |
|
446 |
-
#: inc/cpcff_admin_int.inc.php:
|
447 |
msgid "Prompt for an address, but do not require one"
|
448 |
msgstr ""
|
449 |
|
450 |
-
#: inc/cpcff_admin_int.inc.php:
|
451 |
msgid "Prompt for an address and require one"
|
452 |
msgstr ""
|
453 |
|
454 |
-
#: inc/cpcff_admin_int.inc.php:
|
455 |
msgid "Form Processing / Email Settings"
|
456 |
msgstr ""
|
457 |
|
458 |
-
#: inc/cpcff_admin_int.inc.php:
|
459 |
msgid "\"From\" email"
|
460 |
msgstr ""
|
461 |
|
462 |
-
#: inc/cpcff_admin_int.inc.php:
|
463 |
msgid ""
|
464 |
"This email is required if the \"From fixed email address\" option is "
|
465 |
"selected, or it is enabled the email copy to the user."
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: inc/cpcff_admin_int.inc.php:
|
469 |
msgid "Destination emails (comma separated)"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: inc/cpcff_admin_int.inc.php:
|
473 |
msgid "Email subject"
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: inc/cpcff_admin_int.inc.php:
|
477 |
msgid "Include additional information?"
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: inc/cpcff_admin_int.inc.php:
|
481 |
-
#: inc/cpcff_admin_int.inc.php:
|
482 |
msgid "Yes"
|
483 |
msgstr ""
|
484 |
|
485 |
-
#: inc/cpcff_admin_int.inc.php:
|
486 |
msgid ""
|
487 |
"If the \"No\" option is selected the plugin won't capture the IP address of "
|
488 |
"users."
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: inc/cpcff_admin_int.inc.php:
|
492 |
msgid "Thank you page (after sending the message)"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: inc/cpcff_admin_int.inc.php:
|
496 |
msgid "Email format?"
|
497 |
msgstr ""
|
498 |
|
499 |
-
#: inc/cpcff_admin_int.inc.php:
|
500 |
msgid "Plain Text (default)"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#: inc/cpcff_admin_int.inc.php:
|
504 |
msgid "HTML (use html in the textarea below)"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: inc/cpcff_admin_int.inc.php:
|
508 |
msgid "Message"
|
509 |
msgstr ""
|
510 |
|
511 |
-
#: inc/cpcff_admin_int.inc.php:
|
512 |
msgid "Email Copy to User"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: inc/cpcff_admin_int.inc.php:
|
516 |
msgid "Send confirmation/thank you message to user?"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: inc/cpcff_admin_int.inc.php:
|
520 |
msgid "Email field on the form"
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: inc/cpcff_admin_int.inc.php:
|
524 |
msgid "Captcha Verification"
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: inc/cpcff_admin_int.inc.php:
|
528 |
msgid "Use Captcha Verification?"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: inc/cpcff_admin_int.inc.php:
|
532 |
msgid "Width"
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: inc/cpcff_admin_int.inc.php:
|
536 |
msgid "Height"
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: inc/cpcff_admin_int.inc.php:
|
540 |
msgid "Chars"
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: inc/cpcff_admin_int.inc.php:
|
544 |
msgid "Min font size"
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: inc/cpcff_admin_int.inc.php:
|
548 |
msgid "Max font size"
|
549 |
msgstr ""
|
550 |
|
551 |
-
#: inc/cpcff_admin_int.inc.php:
|
552 |
msgid "security code"
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: inc/cpcff_admin_int.inc.php:
|
556 |
msgid "Noise"
|
557 |
msgstr ""
|
558 |
|
559 |
-
#: inc/cpcff_admin_int.inc.php:
|
560 |
msgid "Noise Length"
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: inc/cpcff_admin_int.inc.php:
|
564 |
msgid "Background"
|
565 |
msgstr ""
|
566 |
|
567 |
-
#: inc/cpcff_admin_int.inc.php:
|
568 |
msgid "Font"
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
572 |
msgid "Default settings updated"
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
576 |
msgid "Item added"
|
577 |
msgstr ""
|
578 |
|
579 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
580 |
msgid "Item updated"
|
581 |
msgstr ""
|
582 |
|
583 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
584 |
msgid "Item deleted"
|
585 |
msgstr ""
|
586 |
|
587 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
588 |
msgid "Item duplicated/cloned"
|
589 |
msgstr ""
|
590 |
|
591 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
592 |
msgid "Duplicate/Clone Error, the form cannot be cloned"
|
593 |
msgstr ""
|
594 |
|
595 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
596 |
msgid "Troubleshoot settings updated"
|
597 |
msgstr ""
|
598 |
|
599 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
600 |
msgid "Are you sure you want to delete this item?"
|
601 |
msgstr ""
|
602 |
|
603 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
604 |
msgid "Are you sure you want to update these settings?"
|
605 |
msgstr ""
|
606 |
|
607 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
608 |
msgid ""
|
609 |
"Are you sure you want to modify existing forms?\\nWe recommend modifying the "
|
610 |
"forms one by one."
|
611 |
msgstr ""
|
612 |
|
613 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
614 |
msgid "Forms and Settings"
|
615 |
msgstr ""
|
616 |
|
@@ -618,27 +630,27 @@ msgstr ""
|
|
618 |
msgid "Marketplace"
|
619 |
msgstr ""
|
620 |
|
621 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
622 |
msgid "Form Categories"
|
623 |
msgstr ""
|
624 |
|
625 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
626 |
msgid "All forms"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
630 |
msgid "Form List / Items List"
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
634 |
msgid "in"
|
635 |
msgstr ""
|
636 |
|
637 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
638 |
msgid "category"
|
639 |
msgstr ""
|
640 |
|
641 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
642 |
msgid "ID"
|
643 |
msgstr ""
|
644 |
|
@@ -654,23 +666,23 @@ msgstr ""
|
|
654 |
msgid "Category/Shortcode"
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
658 |
msgid "Update"
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
662 |
msgid "Settings"
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
666 |
msgid "Messages"
|
667 |
msgstr ""
|
668 |
|
669 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
670 |
msgid "Clone"
|
671 |
msgstr ""
|
672 |
|
673 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
674 |
msgid "Delete"
|
675 |
msgstr ""
|
676 |
|
@@ -686,7 +698,7 @@ msgstr ""
|
|
686 |
msgid "Item Name"
|
687 |
msgstr ""
|
688 |
|
689 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
690 |
msgid "Category"
|
691 |
msgstr ""
|
692 |
|
@@ -694,15 +706,19 @@ msgstr ""
|
|
694 |
msgid "Create Form"
|
695 |
msgstr ""
|
696 |
|
697 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
|
|
|
|
|
|
|
|
698 |
msgid "Default Settings"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
702 |
msgid "Applies the default settings to new forms."
|
703 |
msgstr ""
|
704 |
|
705 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
706 |
msgid "Default Template"
|
707 |
msgstr ""
|
708 |
|
@@ -733,48 +749,48 @@ msgstr ""
|
|
733 |
msgid "Script load method"
|
734 |
msgstr ""
|
735 |
|
736 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
737 |
msgid "Classic (Recommended)"
|
738 |
msgstr ""
|
739 |
|
740 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
741 |
msgid "Direct"
|
742 |
msgstr ""
|
743 |
|
744 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
745 |
msgid ""
|
746 |
"* Change the script load method if the form doesn't appear in the public "
|
747 |
"website."
|
748 |
msgstr ""
|
749 |
|
750 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
751 |
msgid "Character encoding"
|
752 |
msgstr ""
|
753 |
|
754 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
755 |
msgid "Keep current charset (Recommended)"
|
756 |
msgstr ""
|
757 |
|
758 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
759 |
msgid "try this first"
|
760 |
msgstr ""
|
761 |
|
762 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
763 |
msgid "Only from MySQL 5.5"
|
764 |
msgstr ""
|
765 |
|
766 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
767 |
msgid ""
|
768 |
"* Update the charset if you are getting problems displaying special/non-"
|
769 |
"latin characters. After updated you need to edit the special characters "
|
770 |
"again."
|
771 |
msgstr ""
|
772 |
|
773 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
774 |
msgid "There is active an optimization plugin in WordPress"
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: inc/cpcff_admin_int_list.inc.php:
|
778 |
msgid ""
|
779 |
"* Tick the checkbox if there is an optimization plugin active on the "
|
780 |
"website, and the forms are not visible."
|
@@ -812,22 +828,22 @@ msgstr ""
|
|
812 |
msgid "Calculated Fields Form Marketplace"
|
813 |
msgstr ""
|
814 |
|
815 |
-
#: inc/cpcff_admin_int_list.inc.php:436 inc/cpcff_main.inc.php:
|
816 |
msgid "Upgrade"
|
817 |
msgstr ""
|
818 |
|
819 |
-
#: inc/cpcff_amp.inc.php:
|
820 |
msgid "Click to expand"
|
821 |
msgstr ""
|
822 |
|
823 |
-
#: inc/cpcff_compatibility.inc.php:
|
824 |
msgid ""
|
825 |
"There is active the <b>Breeze - WordPress Cache Plugin</b> plugin. If the "
|
826 |
"forms are not visible, please tick the <i>\"There is active an optimization "
|
827 |
"plugin in WordPress\"</i> and Purge the Breeze cache."
|
828 |
msgstr ""
|
829 |
|
830 |
-
#: inc/cpcff_compatibility.inc.php:
|
831 |
msgid ""
|
832 |
"There is active the <b>Fast Velocity Minify</b> plugin. If the forms are not "
|
833 |
"visible, please try disabling the <i>\"Disable minification on JS files\"</"
|
@@ -835,13 +851,13 @@ msgid ""
|
|
835 |
"Velocity Minify</b> settings."
|
836 |
msgstr ""
|
837 |
|
838 |
-
#: inc/cpcff_compatibility.inc.php:
|
839 |
msgid ""
|
840 |
"There is active the <b>W3 Total Cache</b> plugin. If the forms are not "
|
841 |
"visible, please tick the checkbox."
|
842 |
msgstr ""
|
843 |
|
844 |
-
#: inc/cpcff_compatibility.inc.php:
|
845 |
msgid ""
|
846 |
"There is active the <b>Autoptimize</b> plugin. If the forms are not visible, "
|
847 |
"please try disabling the <i>\"Force JavaScript in <head>\"</i> option "
|
@@ -849,14 +865,14 @@ msgid ""
|
|
849 |
"\"Exclude scripts from Autoptimize\"</i> one."
|
850 |
msgstr ""
|
851 |
|
852 |
-
#: inc/cpcff_compatibility.inc.php:
|
853 |
msgid ""
|
854 |
"There is active the <b>LiteSpeed Cache</b> plugin. If the forms are not "
|
855 |
"visible, please try disabling the <i>\"JS Combine\"</i> option in the "
|
856 |
"<b>Optimize</b> tab of <b>LiteSpeed Cache</b> settings."
|
857 |
msgstr ""
|
858 |
|
859 |
-
#: inc/cpcff_compatibility.inc.php:
|
860 |
msgid ""
|
861 |
"There is active the <b>WP Rocket</b> plugin. If the forms are not visible, "
|
862 |
"please try disabling the <i>\"Combine JavaScript files\"</i> option in the "
|
@@ -864,7 +880,7 @@ msgid ""
|
|
864 |
"clear the website cache."
|
865 |
msgstr ""
|
866 |
|
867 |
-
#: inc/cpcff_compatibility.inc.php:
|
868 |
msgid ""
|
869 |
"There is active the <b>SG Optimizer</b> plugin. If the forms are not "
|
870 |
"visible, please try disabling the options: <i>\"Minify the HTML Output\"</i> "
|
@@ -872,7 +888,7 @@ msgid ""
|
|
872 |
"and remember to purge the website cache."
|
873 |
msgstr ""
|
874 |
|
875 |
-
#: inc/cpcff_compatibility.inc.php:
|
876 |
msgid ""
|
877 |
"There is active the <b>Hummingbird</b> plugin. If the forms are not visible, "
|
878 |
"check the <i>\"Hummingbird > Asset Optimization\"</i> options. Make sure "
|
@@ -881,53 +897,55 @@ msgid ""
|
|
881 |
"settings."
|
882 |
msgstr ""
|
883 |
|
884 |
-
#: inc/cpcff_main.inc.php:
|
885 |
msgid "Request custom changes"
|
886 |
msgstr ""
|
887 |
|
888 |
-
#: inc/cpcff_main.inc.php:
|
889 |
msgid "Insert Calculated Fields Form"
|
890 |
msgstr ""
|
891 |
|
892 |
-
#: inc/cpcff_main.inc.php:
|
893 |
msgid "Create a JavaScript var from POST, GET, SESSION, or COOKIE var"
|
894 |
msgstr ""
|
895 |
|
896 |
-
#: inc/cpcff_page_builders.inc.php:
|
897 |
-
#: pagebuilders/elementor/elementor.pb.php:
|
898 |
msgid "Select a form"
|
899 |
msgstr ""
|
900 |
|
901 |
-
#: inc/cpcff_page_builders.inc.php:
|
902 |
msgid "Forms"
|
903 |
msgstr ""
|
904 |
|
905 |
-
#: inc/cpcff_page_builders.inc.php:
|
906 |
-
#: pagebuilders/beaverbuilder/cff/cff.inc.php:
|
907 |
-
#: pagebuilders/elementor/elementor.pb.php:
|
908 |
msgid "Additional attributes"
|
909 |
msgstr ""
|
910 |
|
911 |
-
#: inc/cpcff_page_builders.inc.php:
|
912 |
-
#: pagebuilders/beaverbuilder/cff/cff.inc.php:
|
913 |
-
#: pagebuilders/elementor/elementor.pb.php:
|
914 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff/fields/cff-button.class.php:
|
915 |
msgid "Edit form"
|
916 |
msgstr ""
|
917 |
|
918 |
-
#: pagebuilders/beaverbuilder/cff/cff.inc.php:
|
919 |
msgid "Select the form and enter the additional attributes"
|
920 |
msgstr ""
|
921 |
|
922 |
-
#: pagebuilders/beaverbuilder/cff/cff.inc.php:
|
923 |
msgid "Form information"
|
924 |
msgstr ""
|
925 |
|
926 |
-
#: pagebuilders/beaverbuilder/cff/cff.inc.php:
|
|
|
927 |
msgid "Select form"
|
928 |
msgstr ""
|
929 |
|
930 |
-
#: pagebuilders/beaverbuilder/cff/cff.inc.php:
|
|
|
931 |
msgid "Class name"
|
932 |
msgstr ""
|
933 |
|
@@ -952,7 +970,7 @@ msgid "Enter the default value"
|
|
952 |
msgstr ""
|
953 |
|
954 |
#: pagebuilders/beaverbuilder/cffvar/cffvar.inc.php:24
|
955 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
956 |
msgid "Generate variable from"
|
957 |
msgstr ""
|
958 |
|
@@ -984,57 +1002,61 @@ msgstr ""
|
|
984 |
msgid "Create javascript variable"
|
985 |
msgstr ""
|
986 |
|
987 |
-
#: pagebuilders/
|
|
|
|
|
|
|
|
|
988 |
msgid "Variable Shortcode"
|
989 |
msgstr ""
|
990 |
|
991 |
-
#: pagebuilders/elementor/elementor.pb.php:
|
992 |
msgid "Variable shortcode"
|
993 |
msgstr ""
|
994 |
|
995 |
-
#: pagebuilders/elementor/elementor.pb.php:
|
996 |
msgid "I need help [+]"
|
997 |
msgstr ""
|
998 |
|
999 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1000 |
msgid "Calculated Fields Form, Variable Shortcode"
|
1001 |
msgstr ""
|
1002 |
|
1003 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1004 |
msgid ""
|
1005 |
"Shortcode to generate a javascript variable from the url parameters (GET or "
|
1006 |
"POST), session variables, cookies, or define it directly"
|
1007 |
msgstr ""
|
1008 |
|
1009 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1010 |
msgid "Variable name"
|
1011 |
msgstr ""
|
1012 |
|
1013 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1014 |
msgid "Any source"
|
1015 |
msgstr ""
|
1016 |
|
1017 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1018 |
msgid "GET parameter"
|
1019 |
msgstr ""
|
1020 |
|
1021 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1022 |
msgid "POST parameter"
|
1023 |
msgstr ""
|
1024 |
|
1025 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1026 |
msgid "Session variable"
|
1027 |
msgstr ""
|
1028 |
|
1029 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1030 |
msgid "Cookie"
|
1031 |
msgstr ""
|
1032 |
|
1033 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1034 |
msgid "Default value (used when variables are generated from a source)"
|
1035 |
msgstr ""
|
1036 |
|
1037 |
-
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:
|
1038 |
msgid "Value (value of the variable when it is generated directly)"
|
1039 |
msgstr ""
|
1040 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: \n"
|
4 |
+
"POT-Creation-Date: 2022-09-12 12:19+0200\n"
|
5 |
+
"PO-Revision-Date: 2022-09-12 12:19+0200\n"
|
6 |
"Last-Translator: CodePeople\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: en_US\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
"X-Generator: Poedit 3.1.1\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e\n"
|
16 |
"X-Poedit-SearchPath-0: .\n"
|
17 |
|
18 |
+
#: cp_calculatedfieldsf_free.php:78
|
19 |
msgid "Form Preview"
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: cp_calculatedfieldsf_free.php:119
|
23 |
msgid ""
|
24 |
"<div class=\"error-text\">The data cannot be stored in database because has "
|
25 |
"occurred an error with the database structure. Please, go to the plugins "
|
28 |
"please <a href=\"https://cff.dwbooster.com/contact-us\">contact us</a></div>"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: cp_calculatedfieldsf_free.php:130
|
32 |
msgid ""
|
33 |
"<div class=\"error-text\">The data cannot be stored in database because has "
|
34 |
"occurred an error with the form structure. Please, try to save the data "
|
41 |
msgid "Settings saved"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: inc/cpcff_admin_int.inc.php:51 inc/cpcff_admin_int_list.inc.php:148
|
45 |
+
#: inc/cpcff_page_builders.inc.php:164
|
46 |
#: pagebuilders/beaverbuilder/cff/cff/cff.php:9
|
47 |
#: pagebuilders/beaverbuilder/cff/cff/cff.php:11
|
48 |
#: pagebuilders/beaverbuilder/cff/cff/cff.php:12
|
49 |
#: pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php:11
|
50 |
#: pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php:12
|
51 |
+
#: pagebuilders/divi/cff.pb.php:9 pagebuilders/elementor/elementor.pb.php:36
|
52 |
msgid "Calculated Fields Form"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: inc/cpcff_admin_int.inc.php:51 pagebuilders/divi/cff.pb.php:13
|
56 |
msgid "Form"
|
57 |
msgstr ""
|
58 |
|
64 |
msgid "Back to items list..."
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: inc/cpcff_admin_int.inc.php:70 inc/cpcff_admin_int.inc.php:230
|
68 |
msgid "Form Settings"
|
69 |
msgstr ""
|
70 |
|
90 |
msgid "Select a revision"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: inc/cpcff_admin_int.inc.php:108 inc/cpcff_admin_int.inc.php:250
|
94 |
+
#: inc/cpcff_admin_int.inc.php:672
|
95 |
msgid "Preview"
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: inc/cpcff_admin_int.inc.php:108
|
99 |
msgid "Saves the form's structure only, and opens a preview windows"
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: inc/cpcff_admin_int.inc.php:109
|
103 |
msgid "Fields List"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: inc/cpcff_admin_int.inc.php:119
|
107 |
msgid ""
|
108 |
"If the form is not loading in the public website, go to the settings page of "
|
109 |
"the plugin through the menu option: \"Settings/Calculated Fields Form\", "
|
111 |
"press the \"Update\" button."
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: inc/cpcff_admin_int.inc.php:119
|
115 |
msgid ""
|
116 |
"If you need also the form to be sent to the server side for processing (for "
|
117 |
"example to deliver emails) then the <a href=\"https://cff.dwbooster.com/"
|
119 |
"required."
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: inc/cpcff_admin_int.inc.php:136
|
123 |
msgid ""
|
124 |
"The action will load the revision selected, the data are not stored will be "
|
125 |
"lose. Do you want continue?"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: inc/cpcff_admin_int.inc.php:193
|
129 |
msgid ""
|
130 |
"These features aren't available in this version. Do you want to open the "
|
131 |
"plugin's page to check other versions?"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: inc/cpcff_admin_int.inc.php:228
|
135 |
msgid "Add a Field"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: inc/cpcff_admin_int.inc.php:229
|
139 |
msgid "Field Settings"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: inc/cpcff_admin_int.inc.php:249 inc/cpcff_admin_int.inc.php:379
|
143 |
+
#: inc/cpcff_admin_int.inc.php:720
|
144 |
msgid "Save Changes"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: inc/cpcff_admin_int.inc.php:257
|
148 |
msgid "Generate revisions in the form preview as well"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: inc/cpcff_admin_int.inc.php:262
|
152 |
msgid "Texts definition"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: inc/cpcff_admin_int.inc.php:263
|
156 |
msgid "Error texts"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: inc/cpcff_admin_int.inc.php:264
|
160 |
msgid "General payment settings"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: inc/cpcff_admin_int.inc.php:265
|
164 |
msgid "PayPal integration"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: inc/cpcff_admin_int.inc.php:266
|
168 |
msgid "Notification email"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: inc/cpcff_admin_int.inc.php:267
|
172 |
msgid "Email copy to user"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: inc/cpcff_admin_int.inc.php:268
|
176 |
msgid "Captcha settings"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: inc/cpcff_admin_int.inc.php:271
|
180 |
msgid "Define Texts"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: inc/cpcff_admin_int.inc.php:275
|
184 |
msgid "Previous button label (text)"
|
185 |
msgstr ""
|
186 |
|
188 |
msgid "Next button label (text)"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: inc/cpcff_admin_int.inc.php:286
|
192 |
msgid ""
|
193 |
"- The styles can be applied into any of the CSS files of your theme or into "
|
194 |
"the CSS file <em>\"calculated-fields-form\\css\\stylepublic.css\"</em>."
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: inc/cpcff_admin_int.inc.php:287
|
198 |
msgid ""
|
199 |
"- For general CSS styles modifications to the form and samples <a href="
|
200 |
"\"https://cff.dwbooster.com/faq#q82\" target=\"_blank\">check this FAQ</a>."
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: inc/cpcff_admin_int.inc.php:303 inc/cpcff_admin_int.inc.php:364
|
204 |
+
#: inc/cpcff_admin_int.inc.php:451 inc/cpcff_admin_int.inc.php:537
|
205 |
+
#: inc/cpcff_admin_int.inc.php:590 inc/cpcff_admin_int.inc.php:636
|
206 |
+
#: inc/cpcff_admin_int.inc.php:709
|
207 |
msgid "Up to form structure"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: inc/cpcff_admin_int.inc.php:308
|
211 |
msgid "Validation Settings"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: inc/cpcff_admin_int.inc.php:312
|
215 |
msgid "\"is required\" text"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: inc/cpcff_admin_int.inc.php:316
|
219 |
msgid "\"is email\" text"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: inc/cpcff_admin_int.inc.php:320
|
223 |
msgid "\"is valid captcha\" text"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: inc/cpcff_admin_int.inc.php:325
|
227 |
msgid "\"is valid date (mm/dd/yyyy)\" text"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: inc/cpcff_admin_int.inc.php:329
|
231 |
msgid "\"is valid date (dd/mm/yyyy)\" text"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: inc/cpcff_admin_int.inc.php:333
|
235 |
msgid "\"is number\" text"
|
236 |
msgstr ""
|
237 |
|
238 |
+
#: inc/cpcff_admin_int.inc.php:337
|
239 |
msgid "\"only digits\" text"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: inc/cpcff_admin_int.inc.php:341
|
243 |
msgid "\"under maximum\" text"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: inc/cpcff_admin_int.inc.php:345
|
247 |
msgid "\"over minimum\" text"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: inc/cpcff_admin_int.inc.php:369
|
251 |
msgid "Note"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: inc/cpcff_admin_int.inc.php:371
|
255 |
msgid ""
|
256 |
"To display the form in a post/page, enter your shortcode in the post/page "
|
257 |
"content:"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: inc/cpcff_admin_int.inc.php:373
|
261 |
msgid ""
|
262 |
"The CFF plugin implements widgets and blocks to allow inserting the form "
|
263 |
"visually with the most popular page builders such as Gutenberg Editor, "
|
265 |
"Divi, and for the other page builders insert the shortcode directly."
|
266 |
msgstr ""
|
267 |
|
268 |
+
#: inc/cpcff_admin_int.inc.php:382 inc/cpcff_admin_int.inc.php:723
|
269 |
#: inc/cpcff_admin_int_list.inc.php:436
|
270 |
msgid "Request Custom Modifications"
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: inc/cpcff_admin_int.inc.php:382 inc/cpcff_admin_int.inc.php:723
|
274 |
+
#: inc/cpcff_admin_int_list.inc.php:436 inc/cpcff_main.inc.php:218
|
275 |
msgid "Help"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: inc/cpcff_admin_int.inc.php:389
|
279 |
msgid ""
|
280 |
"The following features are available in the commercial version of the <a "
|
281 |
"href=\"https://cff.dwbooster.com/download\" target=\"_blank\" style=\"text-"
|
282 |
"decoration:none;\">\"Calculated Fields Form\"</a>"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: inc/cpcff_admin_int.inc.php:390
|
286 |
msgid "Pay only ONCE, use it FOREVER"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: inc/cpcff_admin_int.inc.php:399
|
290 |
msgid "Form Processing and Payment Settings"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: inc/cpcff_admin_int.inc.php:403
|
294 |
msgid "Payment Settings"
|
295 |
msgstr ""
|
296 |
|
297 |
+
#: inc/cpcff_admin_int.inc.php:408
|
298 |
msgid "Request cost"
|
299 |
msgstr ""
|
300 |
|
301 |
+
#: inc/cpcff_admin_int.inc.php:413
|
302 |
msgid "Currency"
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: inc/cpcff_admin_int.inc.php:415
|
306 |
+
msgid "United States dollar"
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: inc/cpcff_admin_int.inc.php:415
|
310 |
+
msgid "Pound sterling"
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#: inc/cpcff_admin_int.inc.php:415
|
314 |
+
msgid "PayPal Currency Codes"
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: inc/cpcff_admin_int.inc.php:420
|
318 |
msgid "Base amount"
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: inc/cpcff_admin_int.inc.php:421
|
322 |
msgid ""
|
323 |
"Minimum amount to charge. If the final price is lesser than this number, the "
|
324 |
"base amount will be applied."
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: inc/cpcff_admin_int.inc.php:426
|
328 |
msgid "Paypal product name"
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: inc/cpcff_admin_int.inc.php:431
|
332 |
msgid "Discount Codes"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: inc/cpcff_admin_int.inc.php:433
|
336 |
msgid "This feature isn't available in this version."
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: inc/cpcff_admin_int.inc.php:436
|
340 |
msgid "Add new discount code"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: inc/cpcff_admin_int.inc.php:438
|
344 |
msgid "Code"
|
345 |
msgstr ""
|
346 |
|
347 |
+
#: inc/cpcff_admin_int.inc.php:439
|
348 |
msgid "Discount"
|
349 |
msgstr ""
|
350 |
|
351 |
+
#: inc/cpcff_admin_int.inc.php:440
|
352 |
msgid "Percent"
|
353 |
msgstr ""
|
354 |
|
355 |
+
#: inc/cpcff_admin_int.inc.php:441
|
356 |
msgid "Fixed Value"
|
357 |
msgstr ""
|
358 |
|
359 |
+
#: inc/cpcff_admin_int.inc.php:444
|
360 |
msgid "Valid until"
|
361 |
msgstr ""
|
362 |
|
363 |
+
#: inc/cpcff_admin_int.inc.php:445
|
364 |
msgid "Add"
|
365 |
msgstr ""
|
366 |
|
367 |
+
#: inc/cpcff_admin_int.inc.php:447
|
368 |
msgid "Note: Expiration date based in server time. Server time now is"
|
369 |
msgstr ""
|
370 |
|
371 |
+
#: inc/cpcff_admin_int.inc.php:456
|
372 |
msgid "Paypal Payment Configuration"
|
373 |
msgstr ""
|
374 |
|
375 |
+
#: inc/cpcff_admin_int.inc.php:461
|
376 |
msgid "Enable Paypal Payments?"
|
377 |
msgstr ""
|
378 |
|
379 |
+
#: inc/cpcff_admin_int.inc.php:463 inc/cpcff_admin_int.inc.php:565
|
380 |
+
#: inc/cpcff_admin_int.inc.php:607 inc/cpcff_admin_int.inc.php:652
|
381 |
msgid "No"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: inc/cpcff_admin_int.inc.php:465
|
385 |
msgid ""
|
386 |
"Note: If \"Optional\" is selected, a radiobutton will appear in the form to "
|
387 |
"select if the payment will be made with PayPal or not."
|
388 |
msgstr ""
|
389 |
|
390 |
+
#: inc/cpcff_admin_int.inc.php:467
|
391 |
msgid "Label for the \"<strong>Pay with PayPal</strong>\" option"
|
392 |
msgstr ""
|
393 |
|
394 |
+
#: inc/cpcff_admin_int.inc.php:473
|
395 |
msgid "Paypal Mode"
|
396 |
msgstr ""
|
397 |
|
398 |
+
#: inc/cpcff_admin_int.inc.php:476
|
399 |
msgid "Production - real payments processed"
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: inc/cpcff_admin_int.inc.php:478
|
403 |
msgid "SandBox - PayPal testing sandbox area"
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: inc/cpcff_admin_int.inc.php:484
|
407 |
msgid "Paypal email"
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: inc/cpcff_admin_int.inc.php:489
|
411 |
msgid "A $0 amount to pay means"
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: inc/cpcff_admin_int.inc.php:492
|
415 |
msgid "Let the user enter any amount at PayPal (ex: for a donation)"
|
416 |
msgstr ""
|
417 |
|
427 |
msgid "Payment frequency"
|
428 |
msgstr ""
|
429 |
|
430 |
+
#: inc/cpcff_admin_int.inc.php:510
|
431 |
msgid "One time payment (default option, user is billed only once)"
|
432 |
msgstr ""
|
433 |
|
434 |
+
#: inc/cpcff_admin_int.inc.php:512
|
435 |
msgid "Bill the user every 1 month"
|
436 |
msgstr ""
|
437 |
|
438 |
+
#: inc/cpcff_admin_int.inc.php:514
|
439 |
msgid "Bill the user every 3 months"
|
440 |
msgstr ""
|
441 |
|
442 |
+
#: inc/cpcff_admin_int.inc.php:516
|
443 |
msgid "Bill the user every 6 months"
|
444 |
msgstr ""
|
445 |
|
446 |
+
#: inc/cpcff_admin_int.inc.php:518
|
447 |
msgid "Bill the user every 12 months"
|
448 |
msgstr ""
|
449 |
|
450 |
+
#: inc/cpcff_admin_int.inc.php:523
|
451 |
msgid "Paypal prompt buyers for shipping address"
|
452 |
msgstr ""
|
453 |
|
454 |
+
#: inc/cpcff_admin_int.inc.php:528
|
455 |
msgid "Do not prompt for an address"
|
456 |
msgstr ""
|
457 |
|
458 |
+
#: inc/cpcff_admin_int.inc.php:530
|
459 |
msgid "Prompt for an address, but do not require one"
|
460 |
msgstr ""
|
461 |
|
462 |
+
#: inc/cpcff_admin_int.inc.php:532
|
463 |
msgid "Prompt for an address and require one"
|
464 |
msgstr ""
|
465 |
|
466 |
+
#: inc/cpcff_admin_int.inc.php:542
|
467 |
msgid "Form Processing / Email Settings"
|
468 |
msgstr ""
|
469 |
|
470 |
+
#: inc/cpcff_admin_int.inc.php:546
|
471 |
msgid "\"From\" email"
|
472 |
msgstr ""
|
473 |
|
474 |
+
#: inc/cpcff_admin_int.inc.php:547
|
475 |
msgid ""
|
476 |
"This email is required if the \"From fixed email address\" option is "
|
477 |
"selected, or it is enabled the email copy to the user."
|
478 |
msgstr ""
|
479 |
|
480 |
+
#: inc/cpcff_admin_int.inc.php:550
|
481 |
msgid "Destination emails (comma separated)"
|
482 |
msgstr ""
|
483 |
|
484 |
+
#: inc/cpcff_admin_int.inc.php:554 inc/cpcff_admin_int.inc.php:616
|
485 |
msgid "Email subject"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: inc/cpcff_admin_int.inc.php:558
|
489 |
msgid "Include additional information?"
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: inc/cpcff_admin_int.inc.php:563 inc/cpcff_admin_int.inc.php:605
|
493 |
+
#: inc/cpcff_admin_int.inc.php:650
|
494 |
msgid "Yes"
|
495 |
msgstr ""
|
496 |
|
497 |
+
#: inc/cpcff_admin_int.inc.php:566
|
498 |
msgid ""
|
499 |
"If the \"No\" option is selected the plugin won't capture the IP address of "
|
500 |
"users."
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: inc/cpcff_admin_int.inc.php:570
|
504 |
msgid "Thank you page (after sending the message)"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: inc/cpcff_admin_int.inc.php:574 inc/cpcff_admin_int.inc.php:620
|
508 |
msgid "Email format?"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: inc/cpcff_admin_int.inc.php:579 inc/cpcff_admin_int.inc.php:625
|
512 |
msgid "Plain Text (default)"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: inc/cpcff_admin_int.inc.php:581 inc/cpcff_admin_int.inc.php:627
|
516 |
msgid "HTML (use html in the textarea below)"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: inc/cpcff_admin_int.inc.php:586 inc/cpcff_admin_int.inc.php:632
|
520 |
msgid "Message"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: inc/cpcff_admin_int.inc.php:596
|
524 |
msgid "Email Copy to User"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: inc/cpcff_admin_int.inc.php:600
|
528 |
msgid "Send confirmation/thank you message to user?"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: inc/cpcff_admin_int.inc.php:612
|
532 |
msgid "Email field on the form"
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: inc/cpcff_admin_int.inc.php:641
|
536 |
msgid "Captcha Verification"
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: inc/cpcff_admin_int.inc.php:645
|
540 |
msgid "Use Captcha Verification?"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: inc/cpcff_admin_int.inc.php:658
|
544 |
msgid "Width"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: inc/cpcff_admin_int.inc.php:660
|
548 |
msgid "Height"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: inc/cpcff_admin_int.inc.php:662
|
552 |
msgid "Chars"
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: inc/cpcff_admin_int.inc.php:667
|
556 |
msgid "Min font size"
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: inc/cpcff_admin_int.inc.php:669
|
560 |
msgid "Max font size"
|
561 |
msgstr ""
|
562 |
|
563 |
+
#: inc/cpcff_admin_int.inc.php:674
|
564 |
msgid "security code"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: inc/cpcff_admin_int.inc.php:680
|
568 |
msgid "Noise"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: inc/cpcff_admin_int.inc.php:682
|
572 |
msgid "Noise Length"
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: inc/cpcff_admin_int.inc.php:687
|
576 |
msgid "Background"
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: inc/cpcff_admin_int.inc.php:694
|
580 |
msgid "Font"
|
581 |
msgstr ""
|
582 |
|
583 |
+
#: inc/cpcff_admin_int_list.inc.php:48
|
584 |
msgid "Default settings updated"
|
585 |
msgstr ""
|
586 |
|
587 |
+
#: inc/cpcff_admin_int_list.inc.php:65
|
588 |
msgid "Item added"
|
589 |
msgstr ""
|
590 |
|
591 |
+
#: inc/cpcff_admin_int_list.inc.php:72
|
592 |
msgid "Item updated"
|
593 |
msgstr ""
|
594 |
|
595 |
+
#: inc/cpcff_admin_int_list.inc.php:76
|
596 |
msgid "Item deleted"
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: inc/cpcff_admin_int_list.inc.php:80
|
600 |
msgid "Item duplicated/cloned"
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: inc/cpcff_admin_int_list.inc.php:82
|
604 |
msgid "Duplicate/Clone Error, the form cannot be cloned"
|
605 |
msgstr ""
|
606 |
|
607 |
+
#: inc/cpcff_admin_int_list.inc.php:127
|
608 |
msgid "Troubleshoot settings updated"
|
609 |
msgstr ""
|
610 |
|
611 |
+
#: inc/cpcff_admin_int_list.inc.php:200
|
612 |
msgid "Are you sure you want to delete this item?"
|
613 |
msgstr ""
|
614 |
|
615 |
+
#: inc/cpcff_admin_int_list.inc.php:208
|
616 |
msgid "Are you sure you want to update these settings?"
|
617 |
msgstr ""
|
618 |
|
619 |
+
#: inc/cpcff_admin_int_list.inc.php:233
|
620 |
msgid ""
|
621 |
"Are you sure you want to modify existing forms?\\nWe recommend modifying the "
|
622 |
"forms one by one."
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: inc/cpcff_admin_int_list.inc.php:243
|
626 |
msgid "Forms and Settings"
|
627 |
msgstr ""
|
628 |
|
630 |
msgid "Marketplace"
|
631 |
msgstr ""
|
632 |
|
633 |
+
#: inc/cpcff_admin_int_list.inc.php:262
|
634 |
msgid "Form Categories"
|
635 |
msgstr ""
|
636 |
|
637 |
+
#: inc/cpcff_admin_int_list.inc.php:264
|
638 |
msgid "All forms"
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: inc/cpcff_admin_int_list.inc.php:276
|
642 |
msgid "Form List / Items List"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: inc/cpcff_admin_int_list.inc.php:279
|
646 |
msgid "in"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: inc/cpcff_admin_int_list.inc.php:279
|
650 |
msgid "category"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: inc/cpcff_admin_int_list.inc.php:287
|
654 |
msgid "ID"
|
655 |
msgstr ""
|
656 |
|
666 |
msgid "Category/Shortcode"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: inc/cpcff_admin_int_list.inc.php:303 inc/cpcff_admin_int_list.inc.php:363
|
670 |
msgid "Update"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: inc/cpcff_admin_int_list.inc.php:304 inc/cpcff_main.inc.php:216
|
674 |
msgid "Settings"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: inc/cpcff_admin_int_list.inc.php:305
|
678 |
msgid "Messages"
|
679 |
msgstr ""
|
680 |
|
681 |
+
#: inc/cpcff_admin_int_list.inc.php:306
|
682 |
msgid "Clone"
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: inc/cpcff_admin_int_list.inc.php:307
|
686 |
msgid "Delete"
|
687 |
msgstr ""
|
688 |
|
698 |
msgid "Item Name"
|
699 |
msgstr ""
|
700 |
|
701 |
+
#: inc/cpcff_admin_int_list.inc.php:327
|
702 |
msgid "Category"
|
703 |
msgstr ""
|
704 |
|
706 |
msgid "Create Form"
|
707 |
msgstr ""
|
708 |
|
709 |
+
#: inc/cpcff_admin_int_list.inc.php:334
|
710 |
+
msgid "From Template"
|
711 |
+
msgstr ""
|
712 |
+
|
713 |
+
#: inc/cpcff_admin_int_list.inc.php:341
|
714 |
msgid "Default Settings"
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: inc/cpcff_admin_int_list.inc.php:343
|
718 |
msgid "Applies the default settings to new forms."
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: inc/cpcff_admin_int_list.inc.php:345
|
722 |
msgid "Default Template"
|
723 |
msgstr ""
|
724 |
|
749 |
msgid "Script load method"
|
750 |
msgstr ""
|
751 |
|
752 |
+
#: inc/cpcff_admin_int_list.inc.php:381
|
753 |
msgid "Classic (Recommended)"
|
754 |
msgstr ""
|
755 |
|
756 |
+
#: inc/cpcff_admin_int_list.inc.php:383
|
757 |
msgid "Direct"
|
758 |
msgstr ""
|
759 |
|
760 |
+
#: inc/cpcff_admin_int_list.inc.php:385
|
761 |
msgid ""
|
762 |
"* Change the script load method if the form doesn't appear in the public "
|
763 |
"website."
|
764 |
msgstr ""
|
765 |
|
766 |
+
#: inc/cpcff_admin_int_list.inc.php:387
|
767 |
msgid "Character encoding"
|
768 |
msgstr ""
|
769 |
|
770 |
+
#: inc/cpcff_admin_int_list.inc.php:389
|
771 |
msgid "Keep current charset (Recommended)"
|
772 |
msgstr ""
|
773 |
|
774 |
+
#: inc/cpcff_admin_int_list.inc.php:390
|
775 |
msgid "try this first"
|
776 |
msgstr ""
|
777 |
|
778 |
+
#: inc/cpcff_admin_int_list.inc.php:391
|
779 |
msgid "Only from MySQL 5.5"
|
780 |
msgstr ""
|
781 |
|
782 |
+
#: inc/cpcff_admin_int_list.inc.php:394
|
783 |
msgid ""
|
784 |
"* Update the charset if you are getting problems displaying special/non-"
|
785 |
"latin characters. After updated you need to edit the special characters "
|
786 |
"again."
|
787 |
msgstr ""
|
788 |
|
789 |
+
#: inc/cpcff_admin_int_list.inc.php:401
|
790 |
msgid "There is active an optimization plugin in WordPress"
|
791 |
msgstr ""
|
792 |
|
793 |
+
#: inc/cpcff_admin_int_list.inc.php:402
|
794 |
msgid ""
|
795 |
"* Tick the checkbox if there is an optimization plugin active on the "
|
796 |
"website, and the forms are not visible."
|
828 |
msgid "Calculated Fields Form Marketplace"
|
829 |
msgstr ""
|
830 |
|
831 |
+
#: inc/cpcff_admin_int_list.inc.php:436 inc/cpcff_main.inc.php:217
|
832 |
msgid "Upgrade"
|
833 |
msgstr ""
|
834 |
|
835 |
+
#: inc/cpcff_amp.inc.php:171
|
836 |
msgid "Click to expand"
|
837 |
msgstr ""
|
838 |
|
839 |
+
#: inc/cpcff_compatibility.inc.php:18
|
840 |
msgid ""
|
841 |
"There is active the <b>Breeze - WordPress Cache Plugin</b> plugin. If the "
|
842 |
"forms are not visible, please tick the <i>\"There is active an optimization "
|
843 |
"plugin in WordPress\"</i> and Purge the Breeze cache."
|
844 |
msgstr ""
|
845 |
|
846 |
+
#: inc/cpcff_compatibility.inc.php:24
|
847 |
msgid ""
|
848 |
"There is active the <b>Fast Velocity Minify</b> plugin. If the forms are not "
|
849 |
"visible, please try disabling the <i>\"Disable minification on JS files\"</"
|
851 |
"Velocity Minify</b> settings."
|
852 |
msgstr ""
|
853 |
|
854 |
+
#: inc/cpcff_compatibility.inc.php:30
|
855 |
msgid ""
|
856 |
"There is active the <b>W3 Total Cache</b> plugin. If the forms are not "
|
857 |
"visible, please tick the checkbox."
|
858 |
msgstr ""
|
859 |
|
860 |
+
#: inc/cpcff_compatibility.inc.php:36
|
861 |
msgid ""
|
862 |
"There is active the <b>Autoptimize</b> plugin. If the forms are not visible, "
|
863 |
"please try disabling the <i>\"Force JavaScript in <head>\"</i> option "
|
865 |
"\"Exclude scripts from Autoptimize\"</i> one."
|
866 |
msgstr ""
|
867 |
|
868 |
+
#: inc/cpcff_compatibility.inc.php:42
|
869 |
msgid ""
|
870 |
"There is active the <b>LiteSpeed Cache</b> plugin. If the forms are not "
|
871 |
"visible, please try disabling the <i>\"JS Combine\"</i> option in the "
|
872 |
"<b>Optimize</b> tab of <b>LiteSpeed Cache</b> settings."
|
873 |
msgstr ""
|
874 |
|
875 |
+
#: inc/cpcff_compatibility.inc.php:48
|
876 |
msgid ""
|
877 |
"There is active the <b>WP Rocket</b> plugin. If the forms are not visible, "
|
878 |
"please try disabling the <i>\"Combine JavaScript files\"</i> option in the "
|
880 |
"clear the website cache."
|
881 |
msgstr ""
|
882 |
|
883 |
+
#: inc/cpcff_compatibility.inc.php:54
|
884 |
msgid ""
|
885 |
"There is active the <b>SG Optimizer</b> plugin. If the forms are not "
|
886 |
"visible, please try disabling the options: <i>\"Minify the HTML Output\"</i> "
|
888 |
"and remember to purge the website cache."
|
889 |
msgstr ""
|
890 |
|
891 |
+
#: inc/cpcff_compatibility.inc.php:60
|
892 |
msgid ""
|
893 |
"There is active the <b>Hummingbird</b> plugin. If the forms are not visible, "
|
894 |
"check the <i>\"Hummingbird > Asset Optimization\"</i> options. Make sure "
|
897 |
"settings."
|
898 |
msgstr ""
|
899 |
|
900 |
+
#: inc/cpcff_main.inc.php:215
|
901 |
msgid "Request custom changes"
|
902 |
msgstr ""
|
903 |
|
904 |
+
#: inc/cpcff_main.inc.php:234
|
905 |
msgid "Insert Calculated Fields Form"
|
906 |
msgstr ""
|
907 |
|
908 |
+
#: inc/cpcff_main.inc.php:234
|
909 |
msgid "Create a JavaScript var from POST, GET, SESSION, or COOKIE var"
|
910 |
msgstr ""
|
911 |
|
912 |
+
#: inc/cpcff_page_builders.inc.php:89
|
913 |
+
#: pagebuilders/elementor/elementor.pb.php:54
|
914 |
msgid "Select a form"
|
915 |
msgstr ""
|
916 |
|
917 |
+
#: inc/cpcff_page_builders.inc.php:90
|
918 |
msgid "Forms"
|
919 |
msgstr ""
|
920 |
|
921 |
+
#: inc/cpcff_page_builders.inc.php:91
|
922 |
+
#: pagebuilders/beaverbuilder/cff/cff.inc.php:39
|
923 |
+
#: pagebuilders/divi/cff.pb.php:49 pagebuilders/elementor/elementor.pb.php:65
|
924 |
msgid "Additional attributes"
|
925 |
msgstr ""
|
926 |
|
927 |
+
#: inc/cpcff_page_builders.inc.php:92
|
928 |
+
#: pagebuilders/beaverbuilder/cff/cff.inc.php:44
|
929 |
+
#: pagebuilders/elementor/elementor.pb.php:79
|
930 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff/fields/cff-button.class.php:11
|
931 |
msgid "Edit form"
|
932 |
msgstr ""
|
933 |
|
934 |
+
#: pagebuilders/beaverbuilder/cff/cff.inc.php:22
|
935 |
msgid "Select the form and enter the additional attributes"
|
936 |
msgstr ""
|
937 |
|
938 |
+
#: pagebuilders/beaverbuilder/cff/cff.inc.php:25
|
939 |
msgid "Form information"
|
940 |
msgstr ""
|
941 |
|
942 |
+
#: pagebuilders/beaverbuilder/cff/cff.inc.php:29
|
943 |
+
#: pagebuilders/divi/cff.pb.php:34
|
944 |
msgid "Select form"
|
945 |
msgstr ""
|
946 |
|
947 |
+
#: pagebuilders/beaverbuilder/cff/cff.inc.php:35
|
948 |
+
#: pagebuilders/divi/cff.pb.php:43
|
949 |
msgid "Class name"
|
950 |
msgstr ""
|
951 |
|
970 |
msgstr ""
|
971 |
|
972 |
#: pagebuilders/beaverbuilder/cffvar/cffvar.inc.php:24
|
973 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:28
|
974 |
msgid "Generate variable from"
|
975 |
msgstr ""
|
976 |
|
1002 |
msgid "Create javascript variable"
|
1003 |
msgstr ""
|
1004 |
|
1005 |
+
#: pagebuilders/divi/cff.pb.php:39
|
1006 |
+
msgid "Select the form."
|
1007 |
+
msgstr ""
|
1008 |
+
|
1009 |
+
#: pagebuilders/elementor/elementor.pb.php:168
|
1010 |
msgid "Variable Shortcode"
|
1011 |
msgstr ""
|
1012 |
|
1013 |
+
#: pagebuilders/elementor/elementor.pb.php:175
|
1014 |
msgid "Variable shortcode"
|
1015 |
msgstr ""
|
1016 |
|
1017 |
+
#: pagebuilders/elementor/elementor.pb.php:180
|
1018 |
msgid "I need help [+]"
|
1019 |
msgstr ""
|
1020 |
|
1021 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:13
|
1022 |
msgid "Calculated Fields Form, Variable Shortcode"
|
1023 |
msgstr ""
|
1024 |
|
1025 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:15
|
1026 |
msgid ""
|
1027 |
"Shortcode to generate a javascript variable from the url parameters (GET or "
|
1028 |
"POST), session variables, cookies, or define it directly"
|
1029 |
msgstr ""
|
1030 |
|
1031 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:23
|
1032 |
msgid "Variable name"
|
1033 |
msgstr ""
|
1034 |
|
1035 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:31
|
1036 |
msgid "Any source"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:32
|
1040 |
msgid "GET parameter"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:33
|
1044 |
msgid "POST parameter"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:34
|
1048 |
msgid "Session variable"
|
1049 |
msgstr ""
|
1050 |
|
1051 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:35
|
1052 |
msgid "Cookie"
|
1053 |
msgstr ""
|
1054 |
|
1055 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:40
|
1056 |
msgid "Default value (used when variables are generated from a source)"
|
1057 |
msgstr ""
|
1058 |
|
1059 |
+
#: pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php:45
|
1060 |
msgid "Value (value of the variable when it is generated directly)"
|
1061 |
msgstr ""
|
1062 |
|
pagebuilders/beaverbuilder/cff/cff.inc.php
CHANGED
@@ -1,50 +1,51 @@
|
|
1 |
-
<?php
|
2 |
-
require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cff/cff/cff.php';
|
3 |
-
|
4 |
-
// Get the forms list
|
5 |
-
global $wpdb;
|
6 |
-
$options = array();
|
7 |
-
$default = '';
|
8 |
-
|
9 |
-
$rows = $wpdb->get_results(
|
10 |
-
$url = CPCFF_AUXILIARY::editor_url();
|
11 |
-
foreach ($rows as $item)
|
12 |
-
|
13 |
-
$
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
'
|
23 |
-
|
24 |
-
|
25 |
-
'
|
26 |
-
|
27 |
-
|
28 |
-
'
|
29 |
-
'
|
30 |
-
'
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
'
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
'
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
'
|
43 |
-
'
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
)
|
|
1 |
+
<?php
|
2 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/beaverbuilder/cff/cff/cff.php';
|
3 |
+
|
4 |
+
// Get the forms list
|
5 |
+
global $wpdb;
|
6 |
+
$options = array();
|
7 |
+
$default = '';
|
8 |
+
|
9 |
+
$rows = $wpdb->get_results( 'SELECT id, form_name FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
10 |
+
$url = CPCFF_AUXILIARY::editor_url();
|
11 |
+
foreach ( $rows as $item ) {
|
12 |
+
$options[ $item->id ] = $item->form_name;
|
13 |
+
if ( empty( $default ) ) {
|
14 |
+
$default = $item->id;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
FLBuilder::register_module(
|
19 |
+
'CFFBeaver',
|
20 |
+
array(
|
21 |
+
'cff-form-tab' => array(
|
22 |
+
'title' => __( 'Select the form and enter the additional attributes', 'calculated-fields-form' ),
|
23 |
+
'sections' => array(
|
24 |
+
'cff-form-section' => array(
|
25 |
+
'title' => __( 'Form information', 'calculated-fields-form' ),
|
26 |
+
'fields' => array(
|
27 |
+
'form_id' => array(
|
28 |
+
'type' => 'select',
|
29 |
+
'label' => __( 'Select form', 'calculated-fields-form' ),
|
30 |
+
'options' => $options,
|
31 |
+
'default' => $default,
|
32 |
+
),
|
33 |
+
'class_name' => array(
|
34 |
+
'type' => 'text',
|
35 |
+
'label' => __( 'Class name', 'calculated-fields-form' ),
|
36 |
+
),
|
37 |
+
'attributes' => array(
|
38 |
+
'type' => 'text',
|
39 |
+
'label' => __( 'Additional attributes', 'calculated-fields-form' ),
|
40 |
+
),
|
41 |
+
'form_editor' => array(
|
42 |
+
'type' => 'raw',
|
43 |
+
'preview' => 'none',
|
44 |
+
'content' => '<button style="float:right;" class="fl-builder-button fl-builder-button-small" title="' . esc_attr( __( 'Edit form', 'calculated-fields-form' ) ) . '" onclick="window.open(\'' . esc_attr( $url ) . '\'+document.getElementsByName(\'form_id\')[0].value);">' . esc_attr( __( 'Edit form', 'calculated-fields-form' ) ) . '</button>',
|
45 |
+
),
|
46 |
+
),
|
47 |
+
),
|
48 |
+
),
|
49 |
+
),
|
50 |
+
)
|
51 |
+
);
|
pagebuilders/beaverbuilder/cff/cff/cff.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
class CFFBeaver extends FLBuilderModule {
|
3 |
-
|
4 |
-
|
5 |
-
$
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
|
1 |
+
<?php
|
2 |
+
class CFFBeaver extends FLBuilderModule {
|
3 |
+
public function __construct() {
|
4 |
+
$modules_dir = dirname( __FILE__ ) . '/';
|
5 |
+
$modules_url = plugins_url( '/', __FILE__ ) . '/';
|
6 |
+
|
7 |
+
parent::__construct(
|
8 |
+
array(
|
9 |
+
'name' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
10 |
+
'description' => __( 'Inserts a form', 'fl-builder' ),
|
11 |
+
'group' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
12 |
+
'category' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
13 |
+
'dir' => $modules_dir,
|
14 |
+
'url' => $modules_url,
|
15 |
+
'partial_refresh' => true,
|
16 |
+
)
|
17 |
+
);
|
18 |
+
|
19 |
+
$this->add_js( 'cff-beaver-form', $this->url . 'js/settings.js', array( 'jquery' ) );
|
20 |
+
}
|
21 |
+
}
|
pagebuilders/beaverbuilder/cff/cff/includes/frontend.php
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
$form = @intval($settings->form_id);
|
3 |
-
if(!empty($form))
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$form = @intval( $settings->form_id );
|
3 |
+
if ( ! empty( $form ) ) {
|
4 |
+
$output = '[CP_CALCULATED_FIELDS id="' . $form . '"';
|
5 |
+
|
6 |
+
$class_name = sanitize_text_field( $settings->class_name );
|
7 |
+
if ( ! empty( $class_name ) ) {
|
8 |
+
$output .= ' class="' . esc_attr( $class_name ) . '"';
|
9 |
+
}
|
10 |
+
|
11 |
+
$attributes = sanitize_text_field( $settings->attributes );
|
12 |
+
if ( ! empty( $attributes ) ) {
|
13 |
+
$output .= ' ' . $attributes;
|
14 |
+
}
|
15 |
+
|
16 |
+
$output .= ']';
|
17 |
+
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput
|
18 |
+
}
|
pagebuilders/beaverbuilder/cffvar/cffvar.inc.php
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
require_once CP_CALCULATEDFIELDSF_BASE_PATH.'/pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php';
|
3 |
-
|
4 |
-
FLBuilder::register_module(
|
5 |
-
'CFFVarBeaver',
|
6 |
-
array(
|
7 |
-
'cff-var-tab' => array(
|
8 |
-
'title'
|
9 |
-
'sections' => array(
|
10 |
-
'cff-var-section' => array(
|
11 |
-
'title'
|
12 |
-
'fields'
|
13 |
-
'var_name'
|
14 |
-
'type'
|
15 |
-
'label'
|
16 |
-
'required' => true,
|
17 |
-
),
|
18 |
-
'default_value' => array(
|
19 |
-
'type'
|
20 |
-
'label' => __('Enter the default value', 'calculated-fields-form')
|
21 |
-
),
|
22 |
-
'from'
|
23 |
-
'type'
|
24 |
-
'label'
|
25 |
-
'options' => array(
|
26 |
-
'directly' => __('Directly', 'calculated-fields-form'),
|
27 |
-
'get'
|
28 |
-
'post'
|
29 |
-
'session'
|
30 |
-
'cookies'
|
31 |
-
)
|
32 |
-
),
|
33 |
-
)
|
34 |
-
)
|
35 |
-
)
|
36 |
-
)
|
37 |
-
)
|
38 |
-
);
|
1 |
+
<?php
|
2 |
+
require_once CP_CALCULATEDFIELDSF_BASE_PATH . '/pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php';
|
3 |
+
|
4 |
+
FLBuilder::register_module(
|
5 |
+
'CFFVarBeaver',
|
6 |
+
array(
|
7 |
+
'cff-var-tab' => array(
|
8 |
+
'title' => __( 'Generate variable', 'calculated-fields-form' ),
|
9 |
+
'sections' => array(
|
10 |
+
'cff-var-section' => array(
|
11 |
+
'title' => __( 'Variable attributes', 'calculated-fields-form' ),
|
12 |
+
'fields' => array(
|
13 |
+
'var_name' => array(
|
14 |
+
'type' => 'text',
|
15 |
+
'label' => __( 'Enter the variable name', 'calculated-fields-form' ),
|
16 |
+
'required' => true,
|
17 |
+
),
|
18 |
+
'default_value' => array(
|
19 |
+
'type' => 'text',
|
20 |
+
'label' => __( 'Enter the default value', 'calculated-fields-form' ),
|
21 |
+
),
|
22 |
+
'from' => array(
|
23 |
+
'type' => 'select',
|
24 |
+
'label' => __( 'Generate variable from', 'calculated-fields-form' ),
|
25 |
+
'options' => array(
|
26 |
+
'directly' => __( 'Directly', 'calculated-fields-form' ),
|
27 |
+
'get' => __( 'GET parameters', 'calculated-fields-form' ),
|
28 |
+
'post' => __( 'POST parameters', 'calculated-fields-form' ),
|
29 |
+
'session' => __( 'SESSION variables', 'calculated-fields-form' ),
|
30 |
+
'cookies' => __( 'COOKIES variables', 'calculated-fields-form' ),
|
31 |
+
),
|
32 |
+
),
|
33 |
+
),
|
34 |
+
),
|
35 |
+
),
|
36 |
+
),
|
37 |
+
)
|
38 |
+
);
|
pagebuilders/beaverbuilder/cffvar/cffvar/cffvar.php
CHANGED
@@ -1,20 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
class CFFVarBeaver extends FLBuilderModule {
|
3 |
-
|
4 |
-
|
5 |
-
$
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
}
|
|
1 |
+
<?php
|
2 |
+
class CFFVarBeaver extends FLBuilderModule {
|
3 |
+
public function __construct() {
|
4 |
+
$modules_dir = dirname( __FILE__ ) . '/';
|
5 |
+
$modules_url = plugins_url( '/', __FILE__ ) . '/';
|
6 |
+
|
7 |
+
parent::__construct(
|
8 |
+
array(
|
9 |
+
'name' => __( 'Create variable', 'calculated-fields-form' ),
|
10 |
+
'description' => __( 'Create javascript variable', 'fl-builder' ),
|
11 |
+
'group' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
12 |
+
'category' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
13 |
+
'dir' => $modules_dir,
|
14 |
+
'url' => $modules_url,
|
15 |
+
'partial_refresh' => true,
|
16 |
+
)
|
17 |
+
);
|
18 |
+
|
19 |
+
$this->add_css( 'cff-var', $this->url . 'css/cffvar.css' );
|
20 |
+
}
|
21 |
+
}
|
pagebuilders/beaverbuilder/cffvar/cffvar/includes/frontend.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
$var_name
|
3 |
-
$default_value = sanitize_text_field($settings->default_value);
|
4 |
-
$from
|
5 |
-
|
6 |
-
if(!empty($var_name))
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
$output .= ']';
|
16 |
-
echo $output;
|
17 |
-
}
|
1 |
+
<?php
|
2 |
+
$var_name = sanitize_text_field( $settings->var_name );
|
3 |
+
$default_value = sanitize_text_field( $settings->default_value );
|
4 |
+
$from = sanitize_text_field( $settings->from );
|
5 |
+
|
6 |
+
if ( ! empty( $var_name ) ) {
|
7 |
+
$output = '[CP_CALCULATED_FIELDS_VAR name="' . esc_attr( $var_name ) . '"';
|
8 |
+
|
9 |
+
if ( ! empty( $from ) && 'directly' !== $from ) {
|
10 |
+
$output .= ' from="' . esc_attr( $from ) . '" default_value="' . esc_attr( $default_value ) . '"';
|
11 |
+
} elseif ( 'directly' === $from ) {
|
12 |
+
$output .= ' value="' . esc_attr( $default_value ) . '"';
|
13 |
+
}
|
14 |
+
|
15 |
+
$output .= ']';
|
16 |
+
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput
|
17 |
+
}
|
pagebuilders/divi/cff.pb.php
CHANGED
@@ -1,78 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
class CFF_DIVI extends ET_Builder_Module
|
3 |
-
|
4 |
-
|
5 |
-
public $slug
|
6 |
-
public $vb_support = 'on';
|
7 |
-
|
8 |
-
public function init()
|
9 |
-
|
10 |
-
$this->
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
$
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
'
|
51 |
-
'
|
52 |
-
'
|
53 |
-
'
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
$
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
}
|
77 |
-
|
78 |
-
|
|
1 |
+
<?php
|
2 |
+
class CFF_DIVI extends ET_Builder_Module {
|
3 |
+
|
4 |
+
|
5 |
+
public $slug = 'cff_divi';
|
6 |
+
public $vb_support = 'on';
|
7 |
+
|
8 |
+
public function init() {
|
9 |
+
$this->name = esc_html__( 'Calculated Fields Form', 'calculated-fields-form' );
|
10 |
+
$this->settings_modal_toggles = array(
|
11 |
+
'general' => array(
|
12 |
+
'toggles' => array(
|
13 |
+
'main_content' => esc_html__( 'Form', 'calculated-fields-form' ),
|
14 |
+
),
|
15 |
+
),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
|
19 |
+
public function get_fields() {
|
20 |
+
global $wpdb;
|
21 |
+
$options = array();
|
22 |
+
$default = '';
|
23 |
+
|
24 |
+
$rows = $wpdb->get_results( 'SELECT id, form_name FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
25 |
+
foreach ( $rows as $item ) {
|
26 |
+
$options[ $item->id ] = $item->form_name;
|
27 |
+
if ( empty( $default ) ) {
|
28 |
+
$default = $item->id;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
return array(
|
33 |
+
'cff_form_id' => array(
|
34 |
+
'label' => esc_html__( 'Select form', 'calculated-fields-form' ),
|
35 |
+
'type' => 'select',
|
36 |
+
'options' => $options,
|
37 |
+
'default' => $default,
|
38 |
+
'option_category' => 'basic_option',
|
39 |
+
'description' => esc_html__( 'Select the form.', 'calculated-fields-form' ),
|
40 |
+
'toggle_slug' => 'main_content',
|
41 |
+
),
|
42 |
+
'cff_class_name' => array(
|
43 |
+
'label' => esc_html__( 'Class name', 'calculated-fields-form' ),
|
44 |
+
'type' => 'text',
|
45 |
+
'option_category' => 'basic_option',
|
46 |
+
'toggle_slug' => 'main_content',
|
47 |
+
),
|
48 |
+
'cff_attributes' => array(
|
49 |
+
'label' => esc_html__( 'Additional attributes', 'calculated-fields-form' ),
|
50 |
+
'type' => 'text',
|
51 |
+
'option_category' => 'basic_option',
|
52 |
+
'description' => 'attr1="value attr1" attr1="value attr1"',
|
53 |
+
'toggle_slug' => 'main_content',
|
54 |
+
),
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
public function render( $unprocessed_props, $content = null, $render_slug = '' ) {
|
59 |
+
$output = '';
|
60 |
+
$form = @intval( $this->props['cff_form_id'] );
|
61 |
+
if ( ! empty( $form ) ) {
|
62 |
+
$output = '[CP_CALCULATED_FIELDS id="' . $form . '"';
|
63 |
+
$class_name = sanitize_text_field( $this->props['cff_class_name'] );
|
64 |
+
if ( ! empty( $class_name ) ) {
|
65 |
+
$output .= ' class="' . esc_attr( $class_name ) . '"';
|
66 |
+
}
|
67 |
+
|
68 |
+
$attributes = sanitize_text_field( $this->props['cff_attributes'] );
|
69 |
+
if ( ! empty( $attributes ) ) {
|
70 |
+
$output .= ' ' . $attributes;
|
71 |
+
}
|
72 |
+
|
73 |
+
$output .= ']';
|
74 |
+
}
|
75 |
+
return do_shortcode( $output );
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
new CFF_DIVI();
|
pagebuilders/elementor/elementor.pb.php
CHANGED
@@ -1,210 +1,197 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Elementor;
|
3 |
-
|
4 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
-
exit; // Exit if accessed directly.
|
6 |
-
}
|
7 |
-
|
8 |
-
class Elementor_CFF_Widget extends Widget_Base
|
9 |
-
|
10 |
-
public function get_name()
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
{
|
27 |
-
return
|
28 |
-
} // End
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
)
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
$
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
(
|
110 |
-
|
111 |
-
|
112 |
-
)
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
} // End
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
{
|
157 |
-
return '
|
158 |
-
} // End
|
159 |
-
|
160 |
-
public function
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
'
|
181 |
-
)
|
182 |
-
);
|
183 |
-
|
184 |
-
$this->
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
protected function render()
|
200 |
-
{
|
201 |
-
$cff_main = \CPCFF_MAIN::instance();
|
202 |
-
add_shortcode( 'CP_CALCULATED_FIELDS_VAR', array($cff_main,'create_variable_shortcode') );
|
203 |
-
parent::render();
|
204 |
-
} // End render
|
205 |
-
|
206 |
-
} // End ClassElementor_CFFV_Widget
|
207 |
-
|
208 |
-
// Register the widgets
|
209 |
-
Plugin::instance()->widgets_manager->register_widget_type( new Elementor_CFF_Widget );
|
210 |
-
Plugin::instance()->widgets_manager->register_widget_type( new Elementor_CFFV_Widget );
|
1 |
+
<?php
|
2 |
+
namespace Elementor;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit; // Exit if accessed directly.
|
6 |
+
}
|
7 |
+
|
8 |
+
class Elementor_CFF_Widget extends Widget_Base {
|
9 |
+
|
10 |
+
public function get_name() {
|
11 |
+
return 'calculated-fields-form';
|
12 |
+
} // End get_name
|
13 |
+
|
14 |
+
public function get_title() {
|
15 |
+
return 'Calculated Fields Form';
|
16 |
+
} // End get_title
|
17 |
+
|
18 |
+
public function get_icon() {
|
19 |
+
return 'eicon-apps';
|
20 |
+
} // End get_icon
|
21 |
+
|
22 |
+
public function get_categories() {
|
23 |
+
return array( 'calculated-fields-form-cat' );
|
24 |
+
} // End get_categories
|
25 |
+
|
26 |
+
public function is_reload_preview_required() {
|
27 |
+
return true;
|
28 |
+
} // End is_reload_preview_required
|
29 |
+
|
30 |
+
protected function register_controls() {
|
31 |
+
global $wpdb;
|
32 |
+
|
33 |
+
$this->start_controls_section(
|
34 |
+
'cff_section',
|
35 |
+
array(
|
36 |
+
'label' => __( 'Calculated Fields Form', 'calculated-fields-form' ),
|
37 |
+
)
|
38 |
+
);
|
39 |
+
|
40 |
+
$options = array();
|
41 |
+
$default = '';
|
42 |
+
|
43 |
+
$rows = $wpdb->get_results( 'SELECT id, form_name FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
44 |
+
foreach ( $rows as $item ) {
|
45 |
+
$options[ $item->id ] = $item->form_name;
|
46 |
+
if ( empty( $default ) ) {
|
47 |
+
$default = $item->id;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->add_control(
|
52 |
+
'form',
|
53 |
+
array(
|
54 |
+
'label' => __( 'Select a form', 'calculated-fields-form' ),
|
55 |
+
'type' => Controls_Manager::SELECT,
|
56 |
+
'classes' => 'cff-widefat',
|
57 |
+
'options' => $options,
|
58 |
+
'default' => $default,
|
59 |
+
)
|
60 |
+
);
|
61 |
+
|
62 |
+
$this->add_control(
|
63 |
+
'attrs',
|
64 |
+
array(
|
65 |
+
'label' => __( 'Additional attributes', 'calculated-fields-form' ),
|
66 |
+
'type' => Controls_Manager::TEXT,
|
67 |
+
'classes' => 'cff-widefat',
|
68 |
+
'input_type' => 'text',
|
69 |
+
'placeholder' => 'attr="value"',
|
70 |
+
)
|
71 |
+
);
|
72 |
+
|
73 |
+
if ( current_user_can( 'manage_options' ) ) {
|
74 |
+
$this->add_control(
|
75 |
+
'open-editor',
|
76 |
+
array(
|
77 |
+
'type' => Controls_Manager::BUTTON,
|
78 |
+
'separator' => 'before',
|
79 |
+
'text' => __( 'Edit form', 'calculated-fields-form' ),
|
80 |
+
'classes' => 'cff-edit-form-btn',
|
81 |
+
'button_type' => 'success',
|
82 |
+
'event' => 'cff_open_form_editor',
|
83 |
+
)
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->end_controls_section();
|
88 |
+
} // End register_controls
|
89 |
+
|
90 |
+
private function _get_shortcode() {
|
91 |
+
$settings = $this->get_settings_for_display();
|
92 |
+
$attrs = sanitize_text_field( $settings['attrs'] );
|
93 |
+
if ( ! empty( $attrs ) ) {
|
94 |
+
$attrs = ' ' . $attrs;
|
95 |
+
}
|
96 |
+
return '[CP_CALCULATED_FIELDS id="' . @intval( $settings['form'] ) . '"' . $attrs . ']';
|
97 |
+
} // End _get_shortcode
|
98 |
+
|
99 |
+
protected function render() {
|
100 |
+
$shortcode = $this->_get_shortcode();
|
101 |
+
if (
|
102 |
+
isset( $_REQUEST['action'] ) &&
|
103 |
+
(
|
104 |
+
'elementor' == $_REQUEST['action'] ||
|
105 |
+
'elementor_ajax' == $_REQUEST['action']
|
106 |
+
)
|
107 |
+
) {
|
108 |
+
$atts = preg_replace( array( '/\[\s*cp_calculated_fields\s*/i', '/\s*\]$/' ), '', $shortcode );
|
109 |
+
$atts = shortcode_parse_atts( $atts );
|
110 |
+
$url = \CPCFF_AUXILIARY::site_url();
|
111 |
+
$url .= ( ( strpos( $url, '?' ) === false ) ? '?' : '&' ) . 'cff-editor-preview=1&cff-amp-redirected=1';
|
112 |
+
foreach ( $atts as $i => $v ) {
|
113 |
+
if ( is_numeric( $i ) ) {
|
114 |
+
continue;
|
115 |
+
}
|
116 |
+
if ( 'id' == $i ) {
|
117 |
+
$url .= '&cff-amp-form';
|
118 |
+
} else {
|
119 |
+
$url .= '&' . urlencode( sanitize_text_field( $i ) );
|
120 |
+
}
|
121 |
+
$url .= '=' . urlencode( sanitize_text_field( $v ) );
|
122 |
+
}
|
123 |
+
|
124 |
+
?>
|
125 |
+
<div class="cff-iframe-container" style="position:relative;">
|
126 |
+
<div class="cff-iframe-overlay" style="position:absolute;top:0;right:0;bottom:0;left:0;"></div>
|
127 |
+
<iframe height="0" width="100%" src="<?php print esc_attr( $url ); ?>">
|
128 |
+
</div>
|
129 |
+
<?php
|
130 |
+
} else {
|
131 |
+
print do_shortcode( shortcode_unautop( $shortcode ) );
|
132 |
+
}
|
133 |
+
|
134 |
+
} // End render
|
135 |
+
|
136 |
+
public function render_plain_content() {
|
137 |
+
echo esc_html( $this->_get_shortcode() );
|
138 |
+
} // End render_plain_content
|
139 |
+
|
140 |
+
} // End ClassElementor_CFF_Widget
|
141 |
+
|
142 |
+
class Elementor_CFFV_Widget extends Widget_Shortcode {
|
143 |
+
|
144 |
+
public function get_name() {
|
145 |
+
return 'calculated-fields-form-variable';
|
146 |
+
} // End get_name
|
147 |
+
|
148 |
+
public function get_title() {
|
149 |
+
return 'Define Variable';
|
150 |
+
} // End get_title
|
151 |
+
|
152 |
+
public function get_icon() {
|
153 |
+
return 'eicon-shortcode';
|
154 |
+
} // End get_icon
|
155 |
+
|
156 |
+
public function get_categories() {
|
157 |
+
return array( 'calculated-fields-form-cat' );
|
158 |
+
} // End get_categories
|
159 |
+
|
160 |
+
public function is_reload_preview_required() {
|
161 |
+
return true;
|
162 |
+
} // End is_reload_preview_required
|
163 |
+
|
164 |
+
protected function register_controls() {
|
165 |
+
$this->start_controls_section(
|
166 |
+
'section_shortcode',
|
167 |
+
array(
|
168 |
+
'label' => __( 'Variable Shortcode', 'calculated-fields-form' ),
|
169 |
+
)
|
170 |
+
);
|
171 |
+
|
172 |
+
$this->add_control(
|
173 |
+
'shortcode',
|
174 |
+
array(
|
175 |
+
'label' => __( 'Variable shortcode', 'calculated-fields-form' ),
|
176 |
+
'type' => Controls_Manager::TEXT,
|
177 |
+
'classes' => 'cff-widefat',
|
178 |
+
'input_type' => 'text',
|
179 |
+
'default' => '[CP_CALCULATED_FIELDS_VAR name="varname"]',
|
180 |
+
'description' => '<a href="https://cff.dwbooster.com/documentation#javascript-variables" target="_blank">' . __( 'I need help [+]', 'calculated-fields-form' ) . '</a>',
|
181 |
+
)
|
182 |
+
);
|
183 |
+
|
184 |
+
$this->end_controls_section();
|
185 |
+
} // End register_controls
|
186 |
+
|
187 |
+
protected function render() {
|
188 |
+
$cff_main = \CPCFF_MAIN::instance();
|
189 |
+
add_shortcode( 'CP_CALCULATED_FIELDS_VAR', array( $cff_main, 'create_variable_shortcode' ) );
|
190 |
+
parent::render();
|
191 |
+
} // End render
|
192 |
+
|
193 |
+
} // End ClassElementor_CFFV_Widget
|
194 |
+
|
195 |
+
// Register the widgets
|
196 |
+
Plugin::instance()->widgets_manager->register_widget_type( new Elementor_CFF_Widget() );
|
197 |
+
Plugin::instance()->widgets_manager->register_widget_type( new Elementor_CFFV_Widget() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pagebuilders/elementor/elementor_category.pb.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
namespace Elementor;
|
3 |
-
|
4 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
-
exit; // Exit if accessed directly.
|
6 |
-
}
|
7 |
-
|
8 |
-
// Register the categories
|
9 |
-
Plugin::$instance->elements_manager->add_category(
|
10 |
-
'calculated-fields-form-cat',
|
11 |
-
array(
|
12 |
-
'title'=>'Calculated Fields Form',
|
13 |
-
'icon'
|
14 |
-
),
|
15 |
-
2 // position
|
16 |
-
);
|
1 |
+
<?php
|
2 |
+
namespace Elementor;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit; // Exit if accessed directly.
|
6 |
+
}
|
7 |
+
|
8 |
+
// Register the categories
|
9 |
+
Plugin::$instance->elements_manager->add_category(
|
10 |
+
'calculated-fields-form-cat',
|
11 |
+
array(
|
12 |
+
'title' => 'Calculated Fields Form',
|
13 |
+
'icon' => 'fa fa-plug',
|
14 |
+
),
|
15 |
+
2 // position
|
16 |
+
);
|
pagebuilders/siteorigin/siteorigin-cpcff-variable/siteorigin-cpcff-variable.php
CHANGED
@@ -1,67 +1,64 @@
|
|
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 |
-
|
13 |
-
'
|
14 |
-
|
15 |
-
|
16 |
-
'
|
17 |
-
'
|
18 |
-
|
19 |
-
),
|
20 |
-
array(
|
21 |
-
|
22 |
-
|
23 |
-
'
|
24 |
-
'
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
'
|
29 |
-
'
|
30 |
-
'
|
31 |
-
|
32 |
-
''
|
33 |
-
'from="
|
34 |
-
'from="
|
35 |
-
'from="
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
'
|
41 |
-
'
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'
|
46 |
-
'
|
47 |
-
|
48 |
-
|
49 |
-
)
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
// Registering the widget
|
67 |
-
siteorigin_widget_register('siteorigin-cff-variable-shortcode', __FILE__, 'SiteOrigin_CFF_Variable_Shortcode');
|
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 |
+
public function __construct() {
|
11 |
+
parent::__construct(
|
12 |
+
'siteorigin-cff-variable-shortcode',
|
13 |
+
__( 'Calculated Fields Form, Variable Shortcode', 'calculated-fields-form' ),
|
14 |
+
array(
|
15 |
+
'description' => __( 'Shortcode to generate a javascript variable from the url parameters (GET or POST), session variables, cookies, or define it directly', 'calculated-fields-form' ),
|
16 |
+
'panels_groups' => array( 'calculated-fields-form' ),
|
17 |
+
'help' => 'https://cff.dwbooster.com/documentation#javascript-variables',
|
18 |
+
),
|
19 |
+
array(),
|
20 |
+
array(
|
21 |
+
'name' => array(
|
22 |
+
'type' => 'text',
|
23 |
+
'label' => __( 'Variable name', 'calculated-fields-form' ),
|
24 |
+
'default' => '',
|
25 |
+
),
|
26 |
+
'from' => array(
|
27 |
+
'type' => 'select',
|
28 |
+
'label' => __( 'Generate variable from', 'calculated-fields-form' ),
|
29 |
+
'default' => '',
|
30 |
+
'options' => array(
|
31 |
+
'' => __( 'Any source', 'calculated-fields-form' ),
|
32 |
+
'from="get"' => __( 'GET parameter', 'calculated-fields-form' ),
|
33 |
+
'from="post"' => __( 'POST parameter', 'calculated-fields-form' ),
|
34 |
+
'from="session"' => __( 'Session variable', 'calculated-fields-form' ),
|
35 |
+
'from="cookie"' => __( 'Cookie', 'calculated-fields-form' ),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
'default_value' => array(
|
39 |
+
'type' => 'text',
|
40 |
+
'label' => __( 'Default value (used when variables are generated from a source)', 'calculated-fields-form' ),
|
41 |
+
'default' => '',
|
42 |
+
),
|
43 |
+
'value' => array(
|
44 |
+
'type' => 'text',
|
45 |
+
'label' => __( 'Value (value of the variable when it is generated directly)', 'calculated-fields-form' ),
|
46 |
+
'default' => '',
|
47 |
+
),
|
48 |
+
),
|
49 |
+
plugin_dir_path( __FILE__ )
|
50 |
+
);
|
51 |
+
} // End __construct
|
52 |
+
|
53 |
+
public function get_template_name( $instance ) {
|
54 |
+
return 'siteorigin-cff-variable-shortcode';
|
55 |
+
} // End get_template_name
|
56 |
+
|
57 |
+
public function get_style_name( $instance ) {
|
58 |
+
return '';
|
59 |
+
} // End get_style_name
|
60 |
+
|
61 |
+
} // End Class SiteOrigin_CFF_Variable_Shortcode
|
62 |
+
|
63 |
+
// Registering the widget
|
64 |
+
siteorigin_widget_register( 'siteorigin-cff-variable-shortcode', __FILE__, 'SiteOrigin_CFF_Variable_Shortcode' );
|
|
|
|
|
|
pagebuilders/siteorigin/siteorigin-cpcff-variable/tpl/siteorigin-cff-variable-shortcode.php
CHANGED
@@ -1,15 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
$name
|
3 |
-
$from
|
4 |
-
$default_value
|
5 |
-
$value
|
6 |
-
$shortcode
|
7 |
-
if(!empty($name))
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
if(!empty(
|
13 |
-
|
14 |
-
}
|
15 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$name = sanitize_text_field( $instance['name'] );
|
3 |
+
$from = sanitize_text_field( $instance['from'] );
|
4 |
+
$default_value = sanitize_text_field( $instance['default_value'] );
|
5 |
+
$value = sanitize_text_field( $instance['value'] );
|
6 |
+
$shortcode = '';
|
7 |
+
if ( ! empty( $name ) ) {
|
8 |
+
$shortcode .= '[CP_CALCULATED_FIELDS_VAR name="' . esc_attr( $name ) . '"';
|
9 |
+
if ( ! empty( $from ) ) {
|
10 |
+
$shortcode .= ' ' . $from;
|
11 |
+
}
|
12 |
+
if ( ! empty( $default_value ) ) {
|
13 |
+
$shortcode .= ' default_value="' . esc_attr( $default_value ) . '"';
|
14 |
+
}
|
15 |
+
if ( ! empty( $value ) ) {
|
16 |
+
$shortcode .= ' value="' . esc_attr( $value ) . '"';
|
17 |
+
}
|
18 |
+
$shortcode .= ']';
|
19 |
+
}
|
20 |
+
print $shortcode; // phpcs:ignore WordPress.Security.EscapeOutput
|
pagebuilders/siteorigin/siteorigin-cpcff/fields/cff-button.class.php
CHANGED
@@ -5,17 +5,16 @@
|
|
5 |
class SiteOrigin_Widget_Field_CFF_Button extends SiteOrigin_Widget_Field_Base {
|
6 |
|
7 |
protected function render_field( $value, $instance ) {
|
8 |
-
if ( current_user_can( 'manage_options' ) )
|
9 |
-
{
|
10 |
$url = CPCFF_AUXILIARY::editor_url();
|
11 |
?>
|
12 |
-
<input type="button" name="cff-button-edit-form" class="button-primary" value="<?php echo esc_attr( __('Edit form', 'calculated-fields-form') ); ?>" />
|
13 |
<script>
|
14 |
if(typeof jQuery != 'undefined')
|
15 |
{
|
16 |
jQuery(document).on('click', '[name="cff-button-edit-form"]', function(){
|
17 |
window.open(
|
18 |
-
'<?php print $url; ?>'+jQuery('select[id*="widget-siteorigin-cff-shortcode"]:visible').val(),
|
19 |
'_blank'
|
20 |
);
|
21 |
});
|
@@ -25,9 +24,9 @@ class SiteOrigin_Widget_Field_CFF_Button extends SiteOrigin_Widget_Field_Base {
|
|
25 |
}
|
26 |
}
|
27 |
|
28 |
-
protected function sanitize_field_input($value, $instance) {}
|
29 |
protected function add_label_classes( $label_classes ) {}
|
30 |
-
protected function render_field_label($value, $instance) {}
|
31 |
protected function render_before_field( $value, $instance ) {}
|
32 |
protected function render_after_field( $value, $instance ) {}
|
33 |
}
|
5 |
class SiteOrigin_Widget_Field_CFF_Button extends SiteOrigin_Widget_Field_Base {
|
6 |
|
7 |
protected function render_field( $value, $instance ) {
|
8 |
+
if ( current_user_can( 'manage_options' ) ) {
|
|
|
9 |
$url = CPCFF_AUXILIARY::editor_url();
|
10 |
?>
|
11 |
+
<input type="button" name="cff-button-edit-form" class="button-primary" value="<?php echo esc_attr( __( 'Edit form', 'calculated-fields-form' ) ); ?>" />
|
12 |
<script>
|
13 |
if(typeof jQuery != 'undefined')
|
14 |
{
|
15 |
jQuery(document).on('click', '[name="cff-button-edit-form"]', function(){
|
16 |
window.open(
|
17 |
+
'<?php print esc_url( $url ); ?>'+jQuery('select[id*="widget-siteorigin-cff-shortcode"]:visible').val(),
|
18 |
'_blank'
|
19 |
);
|
20 |
});
|
24 |
}
|
25 |
}
|
26 |
|
27 |
+
protected function sanitize_field_input( $value, $instance ) {}
|
28 |
protected function add_label_classes( $label_classes ) {}
|
29 |
+
protected function render_field_label( $value, $instance ) {}
|
30 |
protected function render_before_field( $value, $instance ) {}
|
31 |
protected function render_after_field( $value, $instance ) {}
|
32 |
}
|
pagebuilders/siteorigin/siteorigin-cpcff/siteorigin-cpcff.php
CHANGED
@@ -1,75 +1,72 @@
|
|
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 |
-
|
13 |
-
$
|
14 |
-
$
|
15 |
-
$forms
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
$options[$form->id] = esc_html('('
|
20 |
-
}
|
21 |
-
|
22 |
-
parent::__construct(
|
23 |
-
'siteorigin-cff-shortcode',
|
24 |
-
__('Calculated Fields Form Shortcode', 'calculated-fields-form'),
|
25 |
-
array(
|
26 |
-
'description'
|
27 |
-
'panels_groups' => array('calculated-fields-form'),
|
28 |
-
'help'
|
29 |
-
),
|
30 |
-
array(),
|
31 |
-
array(
|
32 |
-
'form'
|
33 |
-
'type'
|
34 |
-
'label'
|
35 |
-
'default'
|
36 |
-
'options'
|
37 |
-
),
|
38 |
-
'class_name' => array(
|
39 |
-
'type'
|
40 |
-
'label'
|
41 |
-
),
|
42 |
-
'attrs'
|
43 |
-
'type'
|
44 |
-
'label'
|
45 |
-
),
|
46 |
-
'btn'
|
47 |
-
'type'
|
48 |
-
),
|
49 |
-
),
|
50 |
-
plugin_dir_path(__FILE__)
|
51 |
-
);
|
52 |
-
|
53 |
-
add_filter( 'siteorigin_widgets_field_class_paths', array( $this, 'add_location_field_path' ) );
|
54 |
-
} // End __construct
|
55 |
-
|
56 |
-
function add_location_field_path($class_paths)
|
57 |
-
|
58 |
-
$class_paths
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
// Registering the widget
|
75 |
-
siteorigin_widget_register('siteorigin-cff-shortcode', __FILE__, 'SiteOrigin_CFF_Shortcode');
|
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 |
+
public function __construct() {
|
11 |
+
global $wpdb;
|
12 |
+
$options = array();
|
13 |
+
$default = '';
|
14 |
+
$forms = $wpdb->get_results( 'SELECT id, form_name FROM ' . $wpdb->prefix . CP_CALCULATEDFIELDSF_FORMS_TABLE . ' ORDER BY id ASC' ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
15 |
+
foreach ( $forms as $form ) {
|
16 |
+
if ( empty( $default ) ) {
|
17 |
+
$default = $form->id;
|
18 |
+
}
|
19 |
+
$options[ $form->id ] = esc_html( '(' . $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 |
+
'btn' => array(
|
47 |
+
'type' => 'CFF_Button',
|
48 |
+
),
|
49 |
+
),
|
50 |
+
plugin_dir_path( __FILE__ )
|
51 |
+
);
|
52 |
+
|
53 |
+
add_filter( 'siteorigin_widgets_field_class_paths', array( $this, 'add_location_field_path' ) );
|
54 |
+
} // End __construct
|
55 |
+
|
56 |
+
public function add_location_field_path( $class_paths ) {
|
57 |
+
$class_paths[] = plugin_dir_path( __FILE__ ) . 'fields/';
|
58 |
+
return $class_paths;
|
59 |
+
} // End add_location_field_path
|
60 |
+
|
61 |
+
public function get_template_name( $instance ) {
|
62 |
+
return 'siteorigin-cff-shortcode';
|
63 |
+
} // End get_template_name
|
64 |
+
|
65 |
+
public function get_style_name( $instance ) {
|
66 |
+
return '';
|
67 |
+
} // End get_style_name
|
68 |
+
|
69 |
+
} // End Class SiteOrigin_CFF_Shortcode
|
70 |
+
|
71 |
+
// Registering the widget
|
72 |
+
siteorigin_widget_register( 'siteorigin-cff-shortcode', __FILE__, 'SiteOrigin_CFF_Shortcode' );
|
|
|
|
|
|
pagebuilders/siteorigin/siteorigin-cpcff/tpl/siteorigin-cff-shortcode.php
CHANGED
@@ -1,13 +1,16 @@
|
|
1 |
-
<?php
|
2 |
-
$form
|
3 |
-
$class_name
|
4 |
-
$attrs
|
5 |
-
$shortcode
|
6 |
-
if(@intval($form))
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
$
|
12 |
-
|
13 |
-
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$form = trim( $instance['form'] );
|
3 |
+
$class_name = sanitize_text_field( $instance['class_name'] );
|
4 |
+
$attrs = sanitize_text_field( $instance['attrs'] );
|
5 |
+
$shortcode = '';
|
6 |
+
if ( @intval( $form ) ) {
|
7 |
+
$shortcode .= '[CP_CALCULATED_FIELDS id="' . esc_attr( $form ) . '"';
|
8 |
+
if ( ! empty( $class_name ) ) {
|
9 |
+
$shortcode .= ' class="' . esc_attr( $class_name ) . '"';
|
10 |
+
}
|
11 |
+
if ( ! empty( $attrs ) ) {
|
12 |
+
$shortcode .= ' ' . $attrs;
|
13 |
+
}
|
14 |
+
$shortcode .= ']';
|
15 |
+
}
|
16 |
+
print $shortcode; // phpcs:ignore WordPress.Security.EscapeOutput
|
vendors/forms.js
CHANGED
@@ -39,6 +39,21 @@ cff_forms_templates = {
|
|
39 |
"category": "Basic Operations",
|
40 |
"description": "An order form that allows you to add new products or delete existing ones.",
|
41 |
"id": 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}, {
|
43 |
"title": "Simple Accommodation Booking",
|
44 |
"category": "Dates Operations",
|
39 |
"category": "Basic Operations",
|
40 |
"description": "An order form that allows you to add new products or delete existing ones.",
|
41 |
"id": 20
|
42 |
+
}, {
|
43 |
+
"title": "Print Form Button",
|
44 |
+
"category": "Basic Operations",
|
45 |
+
"description": "The print form button allows you to print only the form, excluding the rest of the page. Assigning the class name cff-no-print to the fields allows you to exclude them from the printed form.",
|
46 |
+
"id": 26
|
47 |
+
}, {
|
48 |
+
"title": "Decimal Places",
|
49 |
+
"category": "Basic Operations",
|
50 |
+
"description": "Determine the number of decimal places in the result of the equation using the PREC operation.",
|
51 |
+
"id": 27
|
52 |
+
}, {
|
53 |
+
"title": "Recording User Audio and Video",
|
54 |
+
"category": "Basic Operations",
|
55 |
+
"description": "Allows you to record an audio or video of the user that you can use as proof of acceptance of a contract or terms of service.",
|
56 |
+
"id": 28
|
57 |
}, {
|
58 |
"title": "Simple Accommodation Booking",
|
59 |
"category": "Dates Operations",
|