Version Description
- New Gutemberg Block
Download this release
Release Info
Developer | codepeople |
Plugin | Contact Form Email |
Version | 1.2.72 |
Comparing to | |
See all releases |
Code changes from version 1.2.71 to 1.2.72
- README.txt +6 -2
- cp-main-class.inc.php +40 -1
- form-to-email.php +18 -1
- js/block.js +56 -21
README.txt
CHANGED
@@ -454,6 +454,10 @@ When you click a field already added into the contact form builder area, you can
|
|
454 |
|
455 |
== Changelog ==
|
456 |
|
|
|
|
|
|
|
|
|
457 |
= 1.2.71 =
|
458 |
* Fixes to form builder area
|
459 |
|
@@ -974,5 +978,5 @@ When you click a field already added into the contact form builder area, you can
|
|
974 |
|
975 |
== Upgrade Notice ==
|
976 |
|
977 |
-
= 1.2.
|
978 |
-
*
|
454 |
|
455 |
== Changelog ==
|
456 |
|
457 |
+
|
458 |
+
= 1.2.72 =
|
459 |
+
* New Gutemberg Block
|
460 |
+
|
461 |
= 1.2.71 =
|
462 |
* Fixes to form builder area
|
463 |
|
978 |
|
979 |
== Upgrade Notice ==
|
980 |
|
981 |
+
= 1.2.72 =
|
982 |
+
* New Gutemberg Block
|
cp-main-class.inc.php
CHANGED
@@ -453,7 +453,46 @@ class CP_ContactFormToEmail extends CP_CFTEMAIL_BaseClass {
|
|
453 |
}
|
454 |
|
455 |
function gutenberg_block() {
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
}
|
458 |
|
459 |
|
453 |
}
|
454 |
|
455 |
function gutenberg_block() {
|
456 |
+
global $wpdb;
|
457 |
+
|
458 |
+
wp_enqueue_script( 'cfte_gutenberg_editor', plugins_url('/js/block.js', __FILE__));
|
459 |
+
|
460 |
+
wp_enqueue_style('cfte-publicstyle', plugins_url('css/stylepublic.css', __FILE__));
|
461 |
+
|
462 |
+
wp_deregister_script('query-stringify');
|
463 |
+
wp_register_script('query-stringify', plugins_url('/js/jQuery.stringify.js', __FILE__));
|
464 |
+
|
465 |
+
wp_deregister_script($this->prefix.'_validate_script');
|
466 |
+
wp_register_script($this->prefix.'_validate_script', plugins_url('/js/jquery.validate.js', __FILE__));
|
467 |
+
wp_enqueue_script( $this->prefix.'_builder_script',
|
468 |
+
plugins_url('/js/fbuilderf.jquery.js', __FILE__),array("jquery","jquery-ui-core","jquery-ui-datepicker","jquery-ui-widget","jquery-ui-position","jquery-ui-tooltip","query-stringify",$this->prefix."_validate_script"), false, true );
|
469 |
+
|
470 |
+
$forms = array();
|
471 |
+
$rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$this->table_items." ORDER BY form_name");
|
472 |
+
foreach ($rows as $item)
|
473 |
+
$forms[] = array (
|
474 |
+
'value' => $item->id,
|
475 |
+
'label' => $item->form_name,
|
476 |
+
);
|
477 |
+
|
478 |
+
wp_localize_script( 'cfte_gutenberg_editor', 'apphourbk_forms', array(
|
479 |
+
'forms' => $forms,
|
480 |
+
'siteUrl' => get_site_url()
|
481 |
+
) );
|
482 |
+
}
|
483 |
+
|
484 |
+
|
485 |
+
public function render_form_admin ($atts) {
|
486 |
+
$is_gutemberg_editor = defined( 'REST_REQUEST' ) && REST_REQUEST && ! empty( $_REQUEST['context'] ) && 'edit' === $_REQUEST['context'];
|
487 |
+
if (!$is_gutemberg_editor)
|
488 |
+
return $this->filter_content (array('id' => $atts["formId"]));
|
489 |
+
else if ($atts["formId"])
|
490 |
+
{
|
491 |
+
$this->setId($atts["formId"]);
|
492 |
+
return '<input type="hidden" name="form_structure'.$atts["instanceId"].'" id="form_structure'.$atts["instanceId"].'" value="'.esc_attr($this->get_option('form_structure')).'" /><fieldset class="ahbgutenberg_editor" disabled><div id="fbuilder"><div id="fbuilder_'.$atts["instanceId"].'"><div id="formheader_'.$atts["instanceId"].'"></div><div id="fieldlist_'.$atts["instanceId"].'"></div></div></div></fieldset>';
|
493 |
+
}
|
494 |
+
else
|
495 |
+
return '';
|
496 |
}
|
497 |
|
498 |
|
form-to-email.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Contact Form Email
|
4 |
Plugin URI: https://form2email.dwbooster.com/download
|
5 |
Description: Contact form that sends the data to email and also to a database list and CSV file.
|
6 |
-
Version: 1.2.
|
7 |
Author: CodePeople
|
8 |
Author URI: https://form2email.dwbooster.com
|
9 |
Text Domain: contact-form-to-email
|
@@ -94,6 +94,23 @@ if ( is_admin() ) {
|
|
94 |
add_shortcode( $cp_cfte_plugin->shorttag, array($cp_cfte_plugin, 'filter_content') );
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
$codepeople_promote_banner_plugins[ 'contact-form-to-email' ] = array( 'plugin_name' => 'Contact Form Email', 'plugin_url' => 'https://wordpress.org/support/plugin/contact-form-to-email/reviews/#new-post');
|
98 |
require_once 'banner.php';
|
99 |
|
3 |
Plugin Name: Contact Form Email
|
4 |
Plugin URI: https://form2email.dwbooster.com/download
|
5 |
Description: Contact form that sends the data to email and also to a database list and CSV file.
|
6 |
+
Version: 1.2.72
|
7 |
Author: CodePeople
|
8 |
Author URI: https://form2email.dwbooster.com
|
9 |
Text Domain: contact-form-to-email
|
94 |
add_shortcode( $cp_cfte_plugin->shorttag, array($cp_cfte_plugin, 'filter_content') );
|
95 |
}
|
96 |
|
97 |
+
|
98 |
+
// register gutemberg block
|
99 |
+
if (function_exists('register_block_type'))
|
100 |
+
{
|
101 |
+
register_block_type('cfte/form-rendering', array(
|
102 |
+
'attributes' => array(
|
103 |
+
'formId' => array(
|
104 |
+
'type' => 'string'
|
105 |
+
),
|
106 |
+
'instanceId' => array(
|
107 |
+
'type' => 'string'
|
108 |
+
),
|
109 |
+
),
|
110 |
+
'render_callback' => array($cp_cfte_plugin, 'render_form_admin')
|
111 |
+
));
|
112 |
+
}
|
113 |
+
|
114 |
$codepeople_promote_banner_plugins[ 'contact-form-to-email' ] = array( 'plugin_name' => 'Contact Form Email', 'plugin_url' => 'https://wordpress.org/support/plugin/contact-form-to-email/reviews/#new-post');
|
115 |
require_once 'banner.php';
|
116 |
|
js/block.js
CHANGED
@@ -1,3 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(function()
|
2 |
{
|
3 |
(function( blocks, element ) {
|
@@ -5,6 +19,11 @@ jQuery(function()
|
|
5 |
source = blocks.source,
|
6 |
InspectorControls = wp.editor.InspectorControls,
|
7 |
category = {slug:'contact-form-to-email', title : 'Contact Form to Email'};
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
/* Plugin Category */
|
10 |
blocks.getCategories().push({slug: 'cpcfte', title: 'Contact Form to Email'}) ;
|
@@ -14,7 +33,7 @@ jQuery(function()
|
|
14 |
const iconCPCFTE = el('img', { width: 20, height: 20, src: "data:image/gif;base64,R0lGODlhFAAQAOYAAP//////AP8A//8AAAD//wD/AAAA/wAAAPH2+/T4/Ofw+Mne79Pk8t3q9d/r9ePu9wxrtQxstQ1stg1rtQ1stQ5ttg9ttg9uthBtthButhFuthhzuRl0uRx1uh11uh12uh52ux53ux93uyF4uyF5uyJ5uyN6vCR6vCd8vid7vSh9vSp+vi6AvzOEwTeFwjmHwz2JxECLxUCMxUSNxkSOxkWPxlOXy1SXy12czl6ezl+ezmCezmKfz2Kgz2Sh0Gai0Wai0Gei0Wej0Wij0Wum0mym02ym0nmt1nuv132w2H6x2ICx2ICy2IGz2YS02oa12oa22om424q424y53I+73Y663JG83pG83ZvC4ZrC4JzD4Z/F4qbJ5KjK5afJ5KjK5L3X68HZ7MTb7cne7uHt9uDs9evz+fL3+9Lk8eLu9uny+PD2+vj7/fP4+/b6/P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAG8ALAAAAAAUABAAAAfhgACCg4SFhl84QUNDQoxCjY+MQztUAEpkPREQEZybnhCeNA5XGjBqWJqfoJucSAk3FSQRJgtiHxSaFJ8YXQ4uESEjoBlcZS66mhEUJ2NhHbogI8qgR2Y2uJovDlnYECAlERKrVgBJmzoAYMqcESCyFLg5DkxnWk1sT2hLuLjRrDxuYkRg0aBNDQgoFDgBRUGEsAhCEAgEtQEcPBUPpkCYEIIEBCFrZqiCgC3CijRSIniwAMSNDFDJSKbSlEJNlAtQ0rRAVhLeKlAcGGwB4MUHkSJIixgxohTp0iI/qhiaSjUQADs=" } );
|
15 |
|
16 |
/* Form's shortcode */
|
17 |
-
blocks.registerBlockType( '
|
18 |
title: 'Contact Form to Email',
|
19 |
icon: iconCPCFTE,
|
20 |
category: 'cpcfte',
|
@@ -23,15 +42,27 @@ jQuery(function()
|
|
23 |
className: false
|
24 |
},
|
25 |
attributes: {
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
return [
|
36 |
!!focus && el(
|
37 |
InspectorControls,
|
@@ -58,21 +89,25 @@ jQuery(function()
|
|
58 |
)
|
59 |
]
|
60 |
),
|
61 |
-
el(
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
71 |
];
|
72 |
},
|
73 |
|
74 |
save: function( props ) {
|
75 |
-
|
76 |
}
|
77 |
});
|
78 |
|
1 |
+
function cfte_renderForm(id) {
|
2 |
+
if ($("#form_structure"+id).length)
|
3 |
+
{
|
4 |
+
try {
|
5 |
+
var cp_appbooking_fbuilder_myconfig = {"obj":"{\"pub\":true,\"identifier\":\"_"+id+"\",\"messages\": {}}"};
|
6 |
+
var f = $("#fbuilder_"+id).fbuilder($.parseJSON(cp_appbooking_fbuilder_myconfig.obj));
|
7 |
+
f.fBuild.loadData("form_structure"+id);
|
8 |
+
} catch (e) { setTimeout ('cfte_renderForm('+id+')',500); }
|
9 |
+
}
|
10 |
+
else
|
11 |
+
{
|
12 |
+
setTimeout ('cfte_renderForm('+id+')',50);
|
13 |
+
}
|
14 |
+
}
|
15 |
jQuery(function()
|
16 |
{
|
17 |
(function( blocks, element ) {
|
19 |
source = blocks.source,
|
20 |
InspectorControls = wp.editor.InspectorControls,
|
21 |
category = {slug:'contact-form-to-email', title : 'Contact Form to Email'};
|
22 |
+
|
23 |
+
|
24 |
+
var _wp$components = wp.components,
|
25 |
+
SelectControl = _wp$components.SelectControl,
|
26 |
+
ServerSideRender = _wp$components.ServerSideRender;
|
27 |
|
28 |
/* Plugin Category */
|
29 |
blocks.getCategories().push({slug: 'cpcfte', title: 'Contact Form to Email'}) ;
|
33 |
const iconCPCFTE = el('img', { width: 20, height: 20, src: "data:image/gif;base64,R0lGODlhFAAQAOYAAP//////AP8A//8AAAD//wD/AAAA/wAAAPH2+/T4/Ofw+Mne79Pk8t3q9d/r9ePu9wxrtQxstQ1stg1rtQ1stQ5ttg9ttg9uthBtthButhFuthhzuRl0uRx1uh11uh12uh52ux53ux93uyF4uyF5uyJ5uyN6vCR6vCd8vid7vSh9vSp+vi6AvzOEwTeFwjmHwz2JxECLxUCMxUSNxkSOxkWPxlOXy1SXy12czl6ezl+ezmCezmKfz2Kgz2Sh0Gai0Wai0Gei0Wej0Wij0Wum0mym02ym0nmt1nuv132w2H6x2ICx2ICy2IGz2YS02oa12oa22om424q424y53I+73Y663JG83pG83ZvC4ZrC4JzD4Z/F4qbJ5KjK5afJ5KjK5L3X68HZ7MTb7cne7uHt9uDs9evz+fL3+9Lk8eLu9uny+PD2+vj7/fP4+/b6/P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAG8ALAAAAAAUABAAAAfhgACCg4SFhl84QUNDQoxCjY+MQztUAEpkPREQEZybnhCeNA5XGjBqWJqfoJucSAk3FSQRJgtiHxSaFJ8YXQ4uESEjoBlcZS66mhEUJ2NhHbogI8qgR2Y2uJovDlnYECAlERKrVgBJmzoAYMqcESCyFLg5DkxnWk1sT2hLuLjRrDxuYkRg0aBNDQgoFDgBRUGEsAhCEAgEtQEcPBUPpkCYEIIEBCFrZqiCgC3CijRSIniwAMSNDFDJSKbSlEJNlAtQ0rRAVhLeKlAcGGwB4MUHkSJIixgxohTp0iI/qhiaSjUQADs=" } );
|
34 |
|
35 |
/* Form's shortcode */
|
36 |
+
blocks.registerBlockType( 'cfte/form-rendering', {
|
37 |
title: 'Contact Form to Email',
|
38 |
icon: iconCPCFTE,
|
39 |
category: 'cpcfte',
|
42 |
className: false
|
43 |
},
|
44 |
attributes: {
|
45 |
+
formId: {
|
46 |
+
type: 'string'
|
47 |
+
},
|
48 |
+
instanceId: {
|
49 |
+
type: 'string'
|
50 |
+
}
|
51 |
+
},
|
52 |
+
edit: function( { attributes, className, isSelected, setAttributes } ) {
|
53 |
+
const formOptions = apphourbk_forms.forms;
|
54 |
+
if (!formOptions.length)
|
55 |
+
return el("div", null, 'Please create a booking form first.' );
|
56 |
+
var iId = attributes.instanceId;
|
57 |
+
if (!iId)
|
58 |
+
{
|
59 |
+
iId = formOptions[0].value+parseInt(Math.random()*100000);
|
60 |
+
setAttributes({instanceId: iId });
|
61 |
+
}
|
62 |
+
if (!attributes.formId)
|
63 |
+
setAttributes({formId: formOptions[0].value });
|
64 |
+
cfte_renderForm(iId);
|
65 |
+
var focus = isSelected;
|
66 |
return [
|
67 |
!!focus && el(
|
68 |
InspectorControls,
|
89 |
)
|
90 |
]
|
91 |
),
|
92 |
+
el(SelectControl, {
|
93 |
+
value: attributes.formId,
|
94 |
+
options: formOptions,
|
95 |
+
onChange: function(evt){
|
96 |
+
setAttributes({formId: evt});
|
97 |
+
iId = evt+parseInt(Math.random()*100000);
|
98 |
+
setAttributes({instanceId: iId });
|
99 |
+
cfte_renderForm(iId);
|
100 |
+
},
|
101 |
+
}),
|
102 |
+
el(ServerSideRender, {
|
103 |
+
block: "cfte/form-rendering",
|
104 |
+
attributes: attributes
|
105 |
+
})
|
106 |
];
|
107 |
},
|
108 |
|
109 |
save: function( props ) {
|
110 |
+
return null;
|
111 |
}
|
112 |
});
|
113 |
|