Version Description
Download this release
Release Info
Developer | ataurr |
Plugin | Metform Elementor Contact Form Builder – Flexible and Design-Friendly Contact Form builder plugin for WordPress |
Version | 1.1.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.5 to 1.1.7
- controls/assets/js/form-picker-editor.js +177 -1
- controls/assets/js/form-picker-inspactor.js +68 -1
- core/entries/action.php +238 -197
- core/entries/map-el.php +1 -1
- core/forms/views/modal-editor.php +3 -3
- core/integrations/rest-api.php +0 -30
- libs/assets/js/admin-entry-script.js +0 -8
- libs/assets/js/admin-script.js +0 -389
- libs/assets/js/inputs.js +0 -188
- libs/assets/js/submission.js +0 -106
- metform.php +1 -2
- plugin.php +97 -71
- {libs → public}/assets/css/admin-style.css +0 -0
- {libs → public}/assets/css/asRange.min.css +0 -0
- {libs → public}/assets/css/flatpickr.min.css +0 -0
- {libs → public}/assets/css/font-awesome.min.css +0 -0
- {libs → public}/assets/css/metform-ui.css +0 -0
- {libs → public}/assets/css/select2.min.css +0 -0
- {libs → public}/assets/css/style.css +455 -453
- {libs → public}/assets/fonts/FontAwesome.otf +0 -0
- {libs → public}/assets/fonts/fontawesome-webfont.eot +0 -0
- {libs → public}/assets/fonts/fontawesome-webfont.svg +0 -0
- {libs → public}/assets/fonts/fontawesome-webfont.ttf +0 -0
- {libs → public}/assets/fonts/fontawesome-webfont.woff +0 -0
- {libs → public}/assets/fonts/fontawesome-webfont.woff2 +0 -0
- {libs → public}/assets/img/edit_icon.svg +0 -0
- {libs → public}/assets/img/elementor-edit-logo.png +0 -0
- {libs → public}/assets/img/flags.png +0 -0
- {libs → public}/assets/img/flags@2x.png +0 -0
- public/assets/js/admin-entry-script.js +1 -0
- public/assets/js/admin-script.js +1 -0
- {libs → public}/assets/js/flatpickr.js +0 -0
- public/assets/js/inputs.js +1 -0
- {libs → public}/assets/js/jquery-asRange.min.js +0 -0
- {libs → public}/assets/js/select2.min.js +0 -0
- public/assets/js/submission.js +1 -0
- {libs → public}/assets/js/ui.min.js +0 -0
- readme.txt +14 -1
- traits/common-controls.php +17 -4
- utils/banner.php +118 -0
- utils/notice.php +5 -7
- widgets/email/email.php +3 -2
- widgets/listing-fname/listing-fname.php +3 -2
- widgets/listing-lname/listing-lname.php +3 -2
- widgets/number/number.php +1 -1
- widgets/password/password.php +3 -2
- widgets/text/text.php +2 -12
- widgets/textarea/textarea.php +3 -2
- widgets/url/url.php +2 -2
controls/assets/js/form-picker-editor.js
CHANGED
@@ -1 +1,177 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
( function (jQuery, elementor) {
|
2 |
+
"use strict";
|
3 |
+
|
4 |
+
var ElementsKit_WidgetArea = {
|
5 |
+
init: function () {
|
6 |
+
elementor.hooks.addAction('frontend/element_ready/metform.default', function (scope) {
|
7 |
+
|
8 |
+
if(typeof window.parent.jQuery === 'undefined'){
|
9 |
+
return;
|
10 |
+
}
|
11 |
+
|
12 |
+
var formTemplateSelectorOpenButton = scope.find('.formpicker_warper_edit');
|
13 |
+
|
14 |
+
formTemplateSelectorOpenButton.off('click.metform').on('click.metform', function(){
|
15 |
+
var formTemplateSelector = window.parent.jQuery('#metform-open-content-editor'),
|
16 |
+
key = formTemplateSelectorOpenButton.attr('data-metform-formpicker-key');
|
17 |
+
var nonce = jQuery(this).attr('data-nonce');
|
18 |
+
formTemplateSelector.find('.metform-error').remove();
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
var popupTab = formTemplateSelector.find('.metform-content-editor-radio');
|
23 |
+
popupTab.on('click', function(e){
|
24 |
+
var self = jQuery(this),
|
25 |
+
dataTarget = self.closest('li').data('target');
|
26 |
+
|
27 |
+
formTemplateSelector.find('#'+ dataTarget).fadeIn().siblings().hide();
|
28 |
+
});
|
29 |
+
|
30 |
+
|
31 |
+
jQuery.ajax({
|
32 |
+
url: jQuery(this).attr('resturl') + (key || 0),
|
33 |
+
type: 'get',
|
34 |
+
headers: {
|
35 |
+
'X-WP-Nonce': nonce
|
36 |
+
},
|
37 |
+
dataType: 'html',
|
38 |
+
success: function (output) {
|
39 |
+
if(output){
|
40 |
+
|
41 |
+
formTemplateSelector.find('.metform-content-editor-radio').first().trigger('click');
|
42 |
+
formTemplateSelector.find('.metform-open-content-editor-templates').html(output);
|
43 |
+
} else {
|
44 |
+
formTemplateSelector.find('.metform-content-editor-radio').last().trigger('click');
|
45 |
+
formTemplateSelector.find('.metform-open-content-editor-templates').parent().append("<p class='metform-error'>No forms were created yet!</p>")
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
});
|
50 |
+
|
51 |
+
formTemplateSelector.show();
|
52 |
+
});
|
53 |
+
|
54 |
+
window.parent.jQuery('#metform-open-content-editor').off('click.metform').on('click.metform', '.metform-open-content-editor-button', function() {
|
55 |
+
|
56 |
+
var iframeModal = window.parent.jQuery('.metform-dynamic-content-modal'),
|
57 |
+
iframe = iframeModal.find('#formpicker-control-iframe'),
|
58 |
+
iframeLoading = iframeModal.find('.dialog-lightbox-loading'),
|
59 |
+
modalContainer = iframeModal.find('.dialog-type-lightbox');
|
60 |
+
|
61 |
+
|
62 |
+
var conParent = jQuery(this).parents('.metform-open-content-inner'),
|
63 |
+
content_key = conParent.find('.metform-open-content-editor-templates').val(),
|
64 |
+
editorTabInput = conParent.find('.metform-content-editor-radio:checked').val(),
|
65 |
+
editorTamplateInput = conParent.find('.metform-template-radio:checked').val(),
|
66 |
+
editorTemplateName = conParent.find('.metform-template-input-con input').val();
|
67 |
+
var nonce = window.parent.jQuery('#metform-form-modalinput-settings').data('nonce');
|
68 |
+
|
69 |
+
if(editorTabInput == 'saved'){
|
70 |
+
window.parent.jQuery('body').attr('data-metform-template-key', content_key);
|
71 |
+
}else{
|
72 |
+
jQuery.ajax({
|
73 |
+
url: jQuery(this).attr('resturl') + 'builder_form_id/' + editorTamplateInput +'?title=' + editorTemplateName,
|
74 |
+
type: 'GET',
|
75 |
+
headers: {
|
76 |
+
'X-WP-Nonce': nonce
|
77 |
+
},
|
78 |
+
success: function (output) {
|
79 |
+
window.parent.jQuery('body').attr('data-metform-template-key', output);
|
80 |
+
conParent.find('.metform-template-input-con input').val('');
|
81 |
+
conParent.find('.metform-template-radio').removeAttr('checked').first().attr('checked', 'checked');
|
82 |
+
content_key = output;
|
83 |
+
},
|
84 |
+
async: false
|
85 |
+
});
|
86 |
+
}
|
87 |
+
|
88 |
+
var url = jQuery(this).attr('resturl') + 'builder/' + content_key;
|
89 |
+
|
90 |
+
window.parent.jQuery('body').attr('data-metform-template-load', 'false');
|
91 |
+
|
92 |
+
modalContainer.show();
|
93 |
+
iframeModal.show();
|
94 |
+
iframeLoading.show();
|
95 |
+
iframe.contents().find('#elementor-loading').show();
|
96 |
+
iframe.css('z-index', '-1');
|
97 |
+
iframe.attr('src', url);
|
98 |
+
|
99 |
+
iframe.on('load', function() {
|
100 |
+
iframeLoading.hide();
|
101 |
+
iframe.show();
|
102 |
+
iframe.contents().find('#elementor-loading').hide();
|
103 |
+
iframe.css('z-index', '1');
|
104 |
+
});
|
105 |
+
});
|
106 |
+
|
107 |
+
window.parent.jQuery('#elementor-editor-wrapper').on('click', '#metform-inspactor-edit-button', function(){
|
108 |
+
console.log('dom found');
|
109 |
+
// trigger click.metform', '.metform-open-content-editor-button'
|
110 |
+
});
|
111 |
+
|
112 |
+
|
113 |
+
function metformClosingPopup(windowLoc){
|
114 |
+
windowLoc.jQuery('body').attr('data-metform-template-load', 'true');
|
115 |
+
windowLoc.jQuery('.metform-dynamic-content-modal').hide();
|
116 |
+
windowLoc.jQuery('#metform-open-content-editor').hide();
|
117 |
+
}
|
118 |
+
|
119 |
+
if(typeof window.parent.jQuery !== 'undefined'){
|
120 |
+
var iframeCloseButton = window.parent.jQuery('.metform-close-editor-modals');
|
121 |
+
iframeCloseButton.off('click.metform').on('click.metform', function() {
|
122 |
+
|
123 |
+
if(jQuery(this).hasClass('metform-editor-close')) {
|
124 |
+
|
125 |
+
var iframeModal = window.parent.jQuery('.metform-dynamic-content-modal'),
|
126 |
+
iframe = iframeModal.find('#formpicker-control-iframe'),
|
127 |
+
iframeWindow = (iframe[0].contentWindow || iframe[0].contentDocument),
|
128 |
+
saved = iframeWindow.jQuery('#elementor-panel-saver-button-publish').hasClass('elementor-disabled');
|
129 |
+
|
130 |
+
if(!saved){
|
131 |
+
|
132 |
+
if(confirm("Leaving? Changes you made may not be saved.")) {
|
133 |
+
|
134 |
+
iframeWindow.jQuery(iframeWindow).off('beforeunload');
|
135 |
+
|
136 |
+
metformClosingPopup(window.parent);
|
137 |
+
} else {
|
138 |
+
iframeWindow.jQuery(iframeWindow).off('beforeunload');
|
139 |
+
}
|
140 |
+
|
141 |
+
} else {
|
142 |
+
metformClosingPopup(window.parent);
|
143 |
+
}
|
144 |
+
} else if(jQuery(this).hasClass('metform-picker-close')){
|
145 |
+
|
146 |
+
metformClosingPopup(window.parent);
|
147 |
+
|
148 |
+
var pickerContainer = window.parent.jQuery('#metform-open-content-editor'),
|
149 |
+
tabValue = pickerContainer.find('.metform-content-editor-radio:checked').val(),
|
150 |
+
templateValue = pickerContainer.find('.metform-open-content-editor-templates').val();
|
151 |
+
|
152 |
+
|
153 |
+
if(tabValue == 'saved'){
|
154 |
+
window.parent.jQuery('body').attr('data-metform-template-key', templateValue);
|
155 |
+
}
|
156 |
+
metformClosingPopup(window.parent);
|
157 |
+
}
|
158 |
+
else {
|
159 |
+
metformClosingPopup(window.parent);
|
160 |
+
}
|
161 |
+
|
162 |
+
window.parent.jQuery('#metform-open-content-editor').find('.metform-picker-close').hide();
|
163 |
+
window.parent.jQuery('#metform-open-content-editor').find('.metform-template-radio').removeAttr('checked').first().attr('checked', 'checked');
|
164 |
+
|
165 |
+
});
|
166 |
+
}
|
167 |
+
|
168 |
+
window.parent.jQuery('#metform-open-content-editor').find('.metform-open-content-editor-templates').on('change', function(){
|
169 |
+
window.parent.jQuery('#metform-open-content-editor').find('.metform-picker-close').fadeIn();
|
170 |
+
});
|
171 |
+
});
|
172 |
+
},
|
173 |
+
};
|
174 |
+
|
175 |
+
jQuery(window).on('elementor/frontend/init', ElementsKit_WidgetArea.init);
|
176 |
+
|
177 |
+
}(jQuery, window.elementorFrontend) );
|
controls/assets/js/form-picker-inspactor.js
CHANGED
@@ -1 +1,68 @@
|
|
1 |
-
jQuery(window).on(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(window).on('elementor:init', function () {
|
2 |
+
"use strict";
|
3 |
+
|
4 |
+
var ControlBaseDataView = elementor.modules.controls.BaseData;
|
5 |
+
var ControlFormPickerItemView = ControlBaseDataView.extend({
|
6 |
+
interval : null,
|
7 |
+
|
8 |
+
ui: function ui() {
|
9 |
+
var ui = ControlBaseDataView.prototype.ui.apply(this, arguments);
|
10 |
+
ui.inputs = '[type="text"]';
|
11 |
+
return ui;
|
12 |
+
},
|
13 |
+
|
14 |
+
events: function events() {
|
15 |
+
return _.extend(ControlBaseDataView.prototype.events.apply(this, arguments), {
|
16 |
+
'change @ui.inputs': 'onBaseInputChange'
|
17 |
+
});
|
18 |
+
},
|
19 |
+
|
20 |
+
onBaseInputChange: function onBaseInputChange(event) {
|
21 |
+
clearTimeout(this.correctionTimeout);
|
22 |
+
|
23 |
+
var input = event.currentTarget,
|
24 |
+
value = this.getInputValue(input),
|
25 |
+
validators = this.validators.slice(0),
|
26 |
+
settingsValidators = this.elementSettingsModel.validators[this.model.get('name')];
|
27 |
+
|
28 |
+
//console.log(event.currentTarget);
|
29 |
+
//console.log(value);
|
30 |
+
|
31 |
+
this.updateElementModel(value, input);
|
32 |
+
|
33 |
+
//this.triggerMethod('input:change', event);
|
34 |
+
},
|
35 |
+
|
36 |
+
onDestroy: function onRender() {
|
37 |
+
// console.log('boo');
|
38 |
+
clearInterval(window.metFormPickerInterval2555);
|
39 |
+
},
|
40 |
+
onRender: function onRender() {
|
41 |
+
ControlBaseDataView.prototype.onRender.apply(this, arguments);
|
42 |
+
var self = this;
|
43 |
+
|
44 |
+
window.metFormPickerInterval2555 = setInterval(function(){
|
45 |
+
|
46 |
+
var formpicker_load = jQuery('body').attr('data-metform-template-load'),
|
47 |
+
formpicker_key = jQuery('body').attr('data-metform-template-key');
|
48 |
+
|
49 |
+
if(formpicker_load == 'true' && self.isRendered == true && formpicker_key !== undefined){
|
50 |
+
// console.log([formpicker_key, formpicker_load, self.isRendered, self.isDestroyed]);
|
51 |
+
var time = new Date().getTime(),
|
52 |
+
new_val,
|
53 |
+
formpicker_key_spilt = formpicker_key.split('***');
|
54 |
+
|
55 |
+
formpicker_key_spilt = formpicker_key_spilt[0];
|
56 |
+
new_val = formpicker_key_spilt + '***' + time;
|
57 |
+
// console.log(new_val);
|
58 |
+
|
59 |
+
jQuery('body').attr('data-metform-template-load', 'false');
|
60 |
+
self.setValue(new_val);
|
61 |
+
}
|
62 |
+
}, 200);
|
63 |
+
}
|
64 |
+
},{
|
65 |
+
|
66 |
+
});
|
67 |
+
elementor.addControlView('formpicker', ControlFormPickerItemView);
|
68 |
+
});
|
core/entries/action.php
CHANGED
@@ -48,123 +48,6 @@ Class Action{
|
|
48 |
|
49 |
}
|
50 |
|
51 |
-
public function get_entry_count($form_id = null){
|
52 |
-
|
53 |
-
if($form_id != null){
|
54 |
-
$this->form_id = $form_id;
|
55 |
-
}
|
56 |
-
global $wpdb;
|
57 |
-
$entry_count = $wpdb->get_results( " SELECT COUNT( `post_id` ) as `count` FROM `".$wpdb->prefix."postmeta` WHERE `meta_key` LIKE 'metform_entries__form_id' AND `meta_value` = $this->form_id ", OBJECT );
|
58 |
-
|
59 |
-
$entry_count = $entry_count[0]->count;
|
60 |
-
|
61 |
-
$this->entry_count = $entry_count;
|
62 |
-
|
63 |
-
return $entry_count;
|
64 |
-
|
65 |
-
}
|
66 |
-
|
67 |
-
public function get_browser_data(){
|
68 |
-
|
69 |
-
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
|
70 |
-
$ip = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
|
71 |
-
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
|
72 |
-
$ip = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
|
73 |
-
}else{
|
74 |
-
$ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
|
75 |
-
}
|
76 |
-
|
77 |
-
$user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
|
78 |
-
|
79 |
-
return [
|
80 |
-
'ip' => $ip,
|
81 |
-
'user_agent' => $user_agent,
|
82 |
-
];
|
83 |
-
}
|
84 |
-
|
85 |
-
public function get_form_settings($form_id){
|
86 |
-
return get_post_meta($form_id, $this->key_form_settings, true);
|
87 |
-
}
|
88 |
-
|
89 |
-
public function get_file_input_name($fields = null){
|
90 |
-
if($fields != null){
|
91 |
-
$this->fields = $fields;
|
92 |
-
}
|
93 |
-
$response = [];
|
94 |
-
|
95 |
-
$files = array_values(array_filter($this->fields, function($v){
|
96 |
-
if($v->widgetType == 'mf-file-upload'){
|
97 |
-
return $v;
|
98 |
-
}
|
99 |
-
}));
|
100 |
-
foreach($files as $file){
|
101 |
-
$response [] = $file->mf_input_name;
|
102 |
-
}
|
103 |
-
|
104 |
-
if(!empty($response)){
|
105 |
-
return $response;
|
106 |
-
}else{
|
107 |
-
return null;
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
public function get_repeater_input_name($fields = null){
|
112 |
-
if($fields != null){
|
113 |
-
$this->fields = $fields;
|
114 |
-
}
|
115 |
-
$response = [];
|
116 |
-
|
117 |
-
$repeaters = array_values(array_filter($this->fields, function($v){
|
118 |
-
if($v->widgetType == 'mf-simple-repeater'){
|
119 |
-
return $v;
|
120 |
-
}
|
121 |
-
}));
|
122 |
-
foreach($repeaters as $repeater){
|
123 |
-
$response [] = $repeater->mf_input_name;
|
124 |
-
}
|
125 |
-
|
126 |
-
if(!empty($response)){
|
127 |
-
return $response;
|
128 |
-
}else{
|
129 |
-
return null;
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
public function get_email_name($fields = null){
|
134 |
-
if($fields != null){
|
135 |
-
$this->fields = $fields;
|
136 |
-
}
|
137 |
-
$response = null;
|
138 |
-
|
139 |
-
$email = array_values(array_filter($this->fields, function($v){
|
140 |
-
if($v->widgetType == 'mf-email'){
|
141 |
-
return $v;
|
142 |
-
}
|
143 |
-
}));
|
144 |
-
|
145 |
-
if(isset($email[0])){
|
146 |
-
$response = $email[0]->mf_input_name;
|
147 |
-
}
|
148 |
-
return $response;
|
149 |
-
}
|
150 |
-
|
151 |
-
public function process_repeater_data($repeater_data){
|
152 |
-
$data = [];
|
153 |
-
foreach($repeater_data as $index => $value){
|
154 |
-
if(is_array($value)){
|
155 |
-
foreach($value as $input_name => $input_value){
|
156 |
-
$proc_key = $input_name."-".($index+1);
|
157 |
-
if(is_array($input_value)){
|
158 |
-
$data[$proc_key] = implode(', ', $input_value);
|
159 |
-
}else{
|
160 |
-
$data[$proc_key] = $input_value;
|
161 |
-
}
|
162 |
-
}
|
163 |
-
}
|
164 |
-
}
|
165 |
-
return $data;
|
166 |
-
}
|
167 |
-
|
168 |
public function submit($form_id, $form_data, $file_data){
|
169 |
|
170 |
$this->form_id = $form_id;
|
@@ -183,7 +66,13 @@ Class Action{
|
|
183 |
$this->response->error[] = esc_html__('Unauthorized submission.','metform');
|
184 |
return $this->response;
|
185 |
}
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
if(isset($this->form_settings['mf_recaptcha']) && (isset($this->fields['mf-recaptcha'])) && $this->form_settings['mf_recaptcha_site_key'] != ''){
|
189 |
if((isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '') == ""){
|
@@ -289,10 +178,10 @@ Class Action{
|
|
289 |
|
290 |
$this->store( $form_id, $form_data );
|
291 |
|
292 |
-
if(class_exists('\
|
293 |
$url = $this->form_settings['mf_rest_api_url'];
|
294 |
$method = $this->form_settings['mf_rest_api_method'];
|
295 |
-
$rest_api = new \
|
296 |
$response = $rest_api->call_api(
|
297 |
[
|
298 |
'entries' => json_encode($this->form_data),
|
@@ -329,6 +218,110 @@ Class Action{
|
|
329 |
|
330 |
}
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
public function send_user_email($form_data){
|
333 |
|
334 |
$user_mail = (isset($form_data[$this->email_name]) ? $form_data[$this->email_name] : null);
|
@@ -395,48 +388,6 @@ Class Action{
|
|
395 |
|
396 |
}
|
397 |
|
398 |
-
public function upload_file($file_data, $file_input_names){
|
399 |
-
|
400 |
-
foreach($file_input_names as $i => $input_name){
|
401 |
-
// initial upload status, status use as array for multiple file
|
402 |
-
$upload[$input_name]['status'] = false;
|
403 |
-
// empty file upload check by file name
|
404 |
-
if($file_data[$input_name]['name'] != ''){
|
405 |
-
$file_data[$input_name]['name'] = time()."-".$file_data[$input_name]['name'];
|
406 |
-
$upload[$input_name] = wp_upload_bits($file_data[$input_name]['name'], null, file_get_contents($file_data[$input_name]['tmp_name']), time());
|
407 |
-
// status updated as true if file uploaded
|
408 |
-
$upload[$input_name]['status'] = true;
|
409 |
-
}else{
|
410 |
-
// status updated as false for showing file not uploaded
|
411 |
-
$upload[$input_name]['status'] = false;
|
412 |
-
}
|
413 |
-
if ( isset( $upload['error'] ) && $upload['error'] != 0 ) {
|
414 |
-
$this->response->status = 0;
|
415 |
-
$this->response->error[] = esc_html__('There was an error uploading your file. The error is: ', 'metform') . $upload['error'];
|
416 |
-
} else {
|
417 |
-
update_post_meta( $this->entry_id, $this->key_form_file, $upload );
|
418 |
-
$this->response->status = 1;
|
419 |
-
}
|
420 |
-
}
|
421 |
-
}
|
422 |
-
|
423 |
-
public function store($form_id, $form_data, $entry_id = null){
|
424 |
-
|
425 |
-
$this->form_id = $form_id;
|
426 |
-
$this->sanitize($form_data);
|
427 |
-
$this->entry_id = $entry_id;
|
428 |
-
|
429 |
-
if(isset($this->form_settings['store_entries']) && $this->form_settings['store_entries'] == 1){
|
430 |
-
if( $this->entry_id == null ){
|
431 |
-
$this->insert();
|
432 |
-
}
|
433 |
-
else {
|
434 |
-
$this->update();
|
435 |
-
}
|
436 |
-
}
|
437 |
-
|
438 |
-
}
|
439 |
-
|
440 |
public function get_fields($form_id = null){
|
441 |
if($form_id != null){
|
442 |
$this->form_id = $form_id;
|
@@ -474,57 +425,147 @@ Class Action{
|
|
474 |
}
|
475 |
|
476 |
}
|
477 |
-
|
478 |
-
private function insert(){
|
479 |
-
|
480 |
-
$form_settings = $this->form_settings;
|
481 |
-
$form_id = $this->form_id;
|
482 |
|
483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
|
485 |
-
$
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
);
|
491 |
|
492 |
-
$
|
493 |
|
494 |
-
$
|
495 |
-
|
496 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
];
|
498 |
-
|
499 |
|
500 |
-
|
501 |
-
$this->
|
|
|
502 |
|
503 |
-
|
504 |
-
$
|
|
|
|
|
|
|
505 |
|
506 |
-
|
507 |
-
|
508 |
-
|
|
|
|
|
|
|
|
|
|
|
509 |
|
510 |
-
if(
|
511 |
-
|
512 |
-
|
|
|
513 |
}
|
|
|
514 |
|
515 |
-
|
516 |
-
$
|
517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
519 |
-
|
520 |
-
private function update(){
|
521 |
|
522 |
-
|
523 |
-
|
|
|
|
|
|
|
524 |
|
525 |
-
$this->
|
|
|
|
|
|
|
|
|
526 |
|
|
|
|
|
|
|
|
|
527 |
}
|
528 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
|
530 |
}
|
48 |
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
public function submit($form_id, $form_data, $file_data){
|
52 |
|
53 |
$this->form_id = $form_id;
|
66 |
$this->response->error[] = esc_html__('Unauthorized submission.','metform');
|
67 |
return $this->response;
|
68 |
}
|
69 |
+
|
70 |
+
// validate form with max length, min length, length type and expression
|
71 |
+
$validate = $this->validate_form_data($form_data);
|
72 |
+
if($validate == false){
|
73 |
+
$this->response->status = 0;
|
74 |
+
return $this->response;
|
75 |
+
}
|
76 |
|
77 |
if(isset($this->form_settings['mf_recaptcha']) && (isset($this->fields['mf-recaptcha'])) && $this->form_settings['mf_recaptcha_site_key'] != ''){
|
78 |
if((isset($form_data['g-recaptcha-response']) ? $form_data['g-recaptcha-response'] : '') == ""){
|
178 |
|
179 |
$this->store( $form_id, $form_data );
|
180 |
|
181 |
+
if(class_exists('\MetForm_Pro\Core\Integrations\Rest_Api') && isset($this->form_settings['mf_rest_api']) && ($this->form_settings['mf_rest_api_url'] != '')){
|
182 |
$url = $this->form_settings['mf_rest_api_url'];
|
183 |
$method = $this->form_settings['mf_rest_api_method'];
|
184 |
+
$rest_api = new \MetForm_Pro\Core\Integrations\Rest_Api();
|
185 |
$response = $rest_api->call_api(
|
186 |
[
|
187 |
'entries' => json_encode($this->form_data),
|
218 |
|
219 |
}
|
220 |
|
221 |
+
public function validate_form_data( $form_data ){
|
222 |
+
|
223 |
+
$field_count = 0;
|
224 |
+
$errors = 0;
|
225 |
+
|
226 |
+
foreach( $form_data as $key => $value ){
|
227 |
+
if(!is_array($value)){
|
228 |
+
$field_count++;
|
229 |
+
$min = ( ( isset( $this->fields[$key]->mf_input_min_length ) && $this->fields[$key]->mf_input_min_length != '' ) ? $this->fields[$key]->mf_input_min_length : '' );
|
230 |
+
$max = ( ( isset( $this->fields[$key]->mf_input_max_length ) && $this->fields[$key]->mf_input_max_length != '' ) ? $this->fields[$key]->mf_input_max_length : '' );
|
231 |
+
$length_type = ( (isset( $this->fields[$key]->mf_input_length_type ) && $this->fields[$key]->mf_input_length_type != '' ) ? $this->fields[$key]->mf_input_length_type : '' );
|
232 |
+
$expression = ( (isset( $this->fields[$key]->mf_input_validation_expression ) && $this->fields[$key]->mf_input_validation_expression != '' ) ? $this->fields[$key]->mf_input_validation_expression : '' );
|
233 |
+
|
234 |
+
$str_length = ( ( $length_type == 'word' ) ? str_word_count( $value ) : strlen( $value ) );
|
235 |
+
|
236 |
+
if( ( $length_type != 'none' ) && ( $min != '' ) && ( $min > $str_length ) ){
|
237 |
+
$errors++;
|
238 |
+
$this->response->status = 0;
|
239 |
+
$this->response->error[] = esc_html( ( ( $this->fields[$key]->mf_input_label != '' ) ? $this->fields[$key]->mf_input_label : $key ). " minimum input ". $min ." ".$length_type );
|
240 |
+
}
|
241 |
+
if( ( $length_type != 'none' ) && ( $max != '' ) && ( $max < $str_length ) ){
|
242 |
+
$errors++;
|
243 |
+
$this->response->status = 0;
|
244 |
+
$this->response->error[] = esc_html( ( ( $this->fields[$key]->mf_input_label != '' ) ? $this->fields[$key]->mf_input_label : $key ). " maximum input ". $max ." ".$length_type );
|
245 |
+
}
|
246 |
+
if( ( $expression != '' ) && ( !preg_match( "/".$expression."/", $value ) ) ){
|
247 |
+
$errors++;
|
248 |
+
$this->response->status = 0;
|
249 |
+
$this->response->error[] = esc_html( ( ( $this->fields[$key]->mf_input_label != '' ) ? $this->fields[$key]->mf_input_label : $key ). " input criteria is not matched.");
|
250 |
+
}
|
251 |
+
}
|
252 |
+
}
|
253 |
+
|
254 |
+
return ( ( $errors > 0 ) ? false : true );
|
255 |
+
}
|
256 |
+
|
257 |
+
public function store($form_id, $form_data, $entry_id = null){
|
258 |
+
|
259 |
+
$this->form_id = $form_id;
|
260 |
+
$this->sanitize($form_data);
|
261 |
+
$this->entry_id = $entry_id;
|
262 |
+
|
263 |
+
if(isset($this->form_settings['store_entries']) && $this->form_settings['store_entries'] == 1){
|
264 |
+
if( $this->entry_id == null ){
|
265 |
+
$this->insert();
|
266 |
+
}
|
267 |
+
else {
|
268 |
+
$this->update();
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
}
|
273 |
+
|
274 |
+
private function insert(){
|
275 |
+
|
276 |
+
$form_settings = $this->form_settings;
|
277 |
+
$form_id = $this->form_id;
|
278 |
+
|
279 |
+
$this->title = get_the_title($this->form_id);
|
280 |
+
|
281 |
+
$defaults = array(
|
282 |
+
'post_title' => 'Entry data # '.$this->title,
|
283 |
+
'post_status' => 'publish',
|
284 |
+
'post_content' => '',
|
285 |
+
'post_type' => $this->post_type,
|
286 |
+
);
|
287 |
+
|
288 |
+
$this->entry_id = wp_insert_post($defaults);
|
289 |
+
|
290 |
+
$update = [
|
291 |
+
'ID' => $this->entry_id,
|
292 |
+
'post_title' => 'Entry # '.$this->entry_id,
|
293 |
+
];
|
294 |
+
wp_update_post( $update );
|
295 |
+
|
296 |
+
$this->response->data['form_id'] = $form_id;
|
297 |
+
$this->response->data['form_settings'] = $form_settings;
|
298 |
+
|
299 |
+
$entry_count = $this->get_entry_count();
|
300 |
+
$entry_count++;
|
301 |
+
|
302 |
+
update_post_meta( $form_id, $this->key_form_total_entries, $entry_count );
|
303 |
+
update_post_meta( $this->entry_id, $this->key_form_id, $form_id );
|
304 |
+
update_post_meta( $this->entry_id, $this->key_form_data, $this->form_data );
|
305 |
+
|
306 |
+
if(isset($form_settings['capture_user_browser_data']) && $form_settings['capture_user_browser_data'] == '1'){
|
307 |
+
update_post_meta( $this->entry_id, $this->key_browser_data, $this->get_browser_data() );
|
308 |
+
$this->response->status = 1;
|
309 |
+
}
|
310 |
+
|
311 |
+
$this->response->status = 1;
|
312 |
+
$this->response->data['store'] = $this->form_data;
|
313 |
+
|
314 |
+
}
|
315 |
+
|
316 |
+
private function update(){
|
317 |
+
|
318 |
+
update_post_meta( $this->entry_id, $this->key_form_id, $this->form_id );
|
319 |
+
update_post_meta( $this->entry_id, $this->key_form_data, $this->form_data );
|
320 |
+
|
321 |
+
$this->response->status = 1;
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
public function send_user_email($form_data){
|
326 |
|
327 |
$user_mail = (isset($form_data[$this->email_name]) ? $form_data[$this->email_name] : null);
|
388 |
|
389 |
}
|
390 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
public function get_fields($form_id = null){
|
392 |
if($form_id != null){
|
393 |
$this->form_id = $form_id;
|
425 |
}
|
426 |
|
427 |
}
|
|
|
|
|
|
|
|
|
|
|
428 |
|
429 |
+
public function upload_file($file_data, $file_input_names){
|
430 |
+
|
431 |
+
foreach($file_input_names as $i => $input_name){
|
432 |
+
// initial upload status, status use as array for multiple file
|
433 |
+
$upload[$input_name]['status'] = false;
|
434 |
+
// empty file upload check by file name
|
435 |
+
if($file_data[$input_name]['name'] != ''){
|
436 |
+
$file_data[$input_name]['name'] = time()."-".$file_data[$input_name]['name'];
|
437 |
+
$upload[$input_name] = wp_upload_bits($file_data[$input_name]['name'], null, file_get_contents($file_data[$input_name]['tmp_name']), time());
|
438 |
+
// status updated as true if file uploaded
|
439 |
+
$upload[$input_name]['status'] = true;
|
440 |
+
}else{
|
441 |
+
// status updated as false for showing file not uploaded
|
442 |
+
$upload[$input_name]['status'] = false;
|
443 |
+
}
|
444 |
+
if ( isset( $upload['error'] ) && $upload['error'] != 0 ) {
|
445 |
+
$this->response->status = 0;
|
446 |
+
$this->response->error[] = esc_html__('There was an error uploading your file. The error is: ', 'metform') . $upload['error'];
|
447 |
+
} else {
|
448 |
+
update_post_meta( $this->entry_id, $this->key_form_file, $upload );
|
449 |
+
$this->response->status = 1;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
+
public function get_entry_count($form_id = null){
|
455 |
|
456 |
+
if($form_id != null){
|
457 |
+
$this->form_id = $form_id;
|
458 |
+
}
|
459 |
+
global $wpdb;
|
460 |
+
$entry_count = $wpdb->get_results( " SELECT COUNT( `post_id` ) as `count` FROM `".$wpdb->prefix."postmeta` WHERE `meta_key` LIKE 'metform_entries__form_id' AND `meta_value` = $this->form_id ", OBJECT );
|
|
|
461 |
|
462 |
+
$entry_count = $entry_count[0]->count;
|
463 |
|
464 |
+
$this->entry_count = $entry_count;
|
465 |
+
|
466 |
+
return $entry_count;
|
467 |
+
|
468 |
+
}
|
469 |
+
|
470 |
+
public function get_browser_data(){
|
471 |
+
|
472 |
+
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
|
473 |
+
$ip = sanitize_text_field($_SERVER['HTTP_CLIENT_IP']);
|
474 |
+
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
|
475 |
+
$ip = sanitize_text_field($_SERVER['HTTP_X_FORWARDED_FOR']);
|
476 |
+
}else{
|
477 |
+
$ip = sanitize_text_field($_SERVER['REMOTE_ADDR']);
|
478 |
+
}
|
479 |
+
|
480 |
+
$user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
|
481 |
+
|
482 |
+
return [
|
483 |
+
'ip' => $ip,
|
484 |
+
'user_agent' => $user_agent,
|
485 |
];
|
486 |
+
}
|
487 |
|
488 |
+
public function get_form_settings($form_id){
|
489 |
+
return get_post_meta($form_id, $this->key_form_settings, true);
|
490 |
+
}
|
491 |
|
492 |
+
public function get_file_input_name($fields = null){
|
493 |
+
if($fields != null){
|
494 |
+
$this->fields = $fields;
|
495 |
+
}
|
496 |
+
$response = [];
|
497 |
|
498 |
+
$files = array_values(array_filter($this->fields, function($v){
|
499 |
+
if($v->widgetType == 'mf-file-upload'){
|
500 |
+
return $v;
|
501 |
+
}
|
502 |
+
}));
|
503 |
+
foreach($files as $file){
|
504 |
+
$response [] = $file->mf_input_name;
|
505 |
+
}
|
506 |
|
507 |
+
if(!empty($response)){
|
508 |
+
return $response;
|
509 |
+
}else{
|
510 |
+
return null;
|
511 |
}
|
512 |
+
}
|
513 |
|
514 |
+
public function get_repeater_input_name($fields = null){
|
515 |
+
if($fields != null){
|
516 |
+
$this->fields = $fields;
|
517 |
+
}
|
518 |
+
$response = [];
|
519 |
+
|
520 |
+
$repeaters = array_values(array_filter($this->fields, function($v){
|
521 |
+
if($v->widgetType == 'mf-simple-repeater'){
|
522 |
+
return $v;
|
523 |
+
}
|
524 |
+
}));
|
525 |
+
foreach($repeaters as $repeater){
|
526 |
+
$response [] = $repeater->mf_input_name;
|
527 |
+
}
|
528 |
+
|
529 |
+
if(!empty($response)){
|
530 |
+
return $response;
|
531 |
+
}else{
|
532 |
+
return null;
|
533 |
+
}
|
534 |
}
|
|
|
|
|
535 |
|
536 |
+
public function get_email_name($fields = null){
|
537 |
+
if($fields != null){
|
538 |
+
$this->fields = $fields;
|
539 |
+
}
|
540 |
+
$response = null;
|
541 |
|
542 |
+
$email = array_values(array_filter($this->fields, function($v){
|
543 |
+
if($v->widgetType == 'mf-email'){
|
544 |
+
return $v;
|
545 |
+
}
|
546 |
+
}));
|
547 |
|
548 |
+
if(isset($email[0])){
|
549 |
+
$response = $email[0]->mf_input_name;
|
550 |
+
}
|
551 |
+
return $response;
|
552 |
}
|
553 |
|
554 |
+
public function process_repeater_data($repeater_data){
|
555 |
+
$data = [];
|
556 |
+
foreach($repeater_data as $index => $value){
|
557 |
+
if(is_array($value)){
|
558 |
+
foreach($value as $input_name => $input_value){
|
559 |
+
$proc_key = $input_name."-".($index+1);
|
560 |
+
if(is_array($input_value)){
|
561 |
+
$data[$proc_key] = implode(', ', $input_value);
|
562 |
+
}else{
|
563 |
+
$data[$proc_key] = $input_value;
|
564 |
+
}
|
565 |
+
}
|
566 |
+
}
|
567 |
+
}
|
568 |
+
return $data;
|
569 |
+
}
|
570 |
|
571 |
}
|
core/entries/map-el.php
CHANGED
@@ -43,7 +43,7 @@ Class Map_El{
|
|
43 |
'mf_input_placeholder' => ( isset($v->settings->mf_input_placeholder) ? $v->settings->mf_input_placeholder : '' ),
|
44 |
'mf_input_min_length' => ( isset($v->settings->mf_input_min_length) ? $v->settings->mf_input_min_length : '' ),
|
45 |
'mf_input_max_length' => ( isset($v->settings->mf_input_max_length) ? $v->settings->mf_input_max_length : '' ),
|
46 |
-
'
|
47 |
'mf_input_validation_expression' => ( isset($v->settings->mf_input_validation_expression) ? $v->settings->mf_input_validation_expression : '' ),
|
48 |
'widgetType' => ( isset($v->widgetType) ? $v->widgetType : '' ),
|
49 |
];
|
43 |
'mf_input_placeholder' => ( isset($v->settings->mf_input_placeholder) ? $v->settings->mf_input_placeholder : '' ),
|
44 |
'mf_input_min_length' => ( isset($v->settings->mf_input_min_length) ? $v->settings->mf_input_min_length : '' ),
|
45 |
'mf_input_max_length' => ( isset($v->settings->mf_input_max_length) ? $v->settings->mf_input_max_length : '' ),
|
46 |
+
'mf_input_length_type' => ( isset($v->settings->mf_input_length_type) ? $v->settings->mf_input_length_type : '' ),
|
47 |
'mf_input_validation_expression' => ( isset($v->settings->mf_input_validation_expression) ? $v->settings->mf_input_validation_expression : '' ),
|
48 |
'widgetType' => ( isset($v->widgetType) ? $v->widgetType : '' ),
|
49 |
];
|
core/forms/views/modal-editor.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div class="attr-modal attr-fade" id="metform_form_modal" tabindex="-1" role="dialog"
|
2 |
-
aria-labelledby="metform_form_modalLabel">
|
3 |
<div class="attr-modal-dialog attr-modal-dialog-centered" id="metform-form-modalinput-form" role="document">
|
4 |
<form action="" mathod="post" id="metform-form-modalinput-settings"
|
5 |
data-open-editor="0"
|
@@ -183,7 +183,7 @@
|
|
183 |
|
184 |
<div class="attr-modal-body" id="metform_form_modal_body">
|
185 |
|
186 |
-
<?php if(class_exists('\
|
187 |
<div class="mf-input-group mf-input-group-inner">
|
188 |
<label class="attr-input-label">
|
189 |
<input type="checkbox" value="1" name="mf_rest_api" class="mf-admin-control-input mf-form-modalinput-rest_api">
|
@@ -295,7 +295,7 @@
|
|
295 |
</div>
|
296 |
|
297 |
<div class="attr-modal-footer">
|
298 |
-
<button type="button" class="attr-btn attr-btn-default metform-form-save-btn-editor"><img class="form-editor-icon" src="<?php echo \MetForm\Plugin::instance()->
|
299 |
<button type="submit" class="attr-btn attr-btn-primary metform-form-save-btn"><?php esc_html_e('Save changes', 'metform'); ?></button>
|
300 |
</div>
|
301 |
|
1 |
<div class="attr-modal attr-fade" id="metform_form_modal" tabindex="-1" role="dialog"
|
2 |
+
aria-labelledby="metform_form_modalLabel" style="display:none;">
|
3 |
<div class="attr-modal-dialog attr-modal-dialog-centered" id="metform-form-modalinput-form" role="document">
|
4 |
<form action="" mathod="post" id="metform-form-modalinput-settings"
|
5 |
data-open-editor="0"
|
183 |
|
184 |
<div class="attr-modal-body" id="metform_form_modal_body">
|
185 |
|
186 |
+
<?php if(class_exists('MetForm_Pro\Core\Integrations\Rest_Api')): ?>
|
187 |
<div class="mf-input-group mf-input-group-inner">
|
188 |
<label class="attr-input-label">
|
189 |
<input type="checkbox" value="1" name="mf_rest_api" class="mf-admin-control-input mf-form-modalinput-rest_api">
|
295 |
</div>
|
296 |
|
297 |
<div class="attr-modal-footer">
|
298 |
+
<button type="button" class="attr-btn attr-btn-default metform-form-save-btn-editor"><img class="form-editor-icon" src="<?php echo \MetForm\Plugin::instance()->public_url().'assets/img/elementor-edit-logo.png'; ?>"><?php esc_html_e('Edit content', 'metform'); ?></button>
|
299 |
<button type="submit" class="attr-btn attr-btn-primary metform-form-save-btn"><?php esc_html_e('Save changes', 'metform'); ?></button>
|
300 |
</div>
|
301 |
|
core/integrations/rest-api.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
namespace MetForm\Core\Integrations;
|
3 |
-
defined( 'ABSPATH' ) || exit;
|
4 |
-
|
5 |
-
Class Rest_Api{
|
6 |
-
public function call_api( $data, $settings ){
|
7 |
-
$msg = [];
|
8 |
-
|
9 |
-
$args = [
|
10 |
-
'timeout' => 30,
|
11 |
-
'redirection' => 5,
|
12 |
-
'httpversion' => '1.0',
|
13 |
-
'blocking' => true,
|
14 |
-
'headers' => array(),
|
15 |
-
'body' => $data,
|
16 |
-
'cookies' => array()
|
17 |
-
];
|
18 |
-
|
19 |
-
$status = strtolower('wp_remote_'.$settings['method'])($settings['url'], $args);
|
20 |
-
|
21 |
-
if(is_wp_error($status)){
|
22 |
-
$msg['status'] = 0;
|
23 |
-
$msg['msg'] = "Something went wrong : ".$status->get_error_message();
|
24 |
-
}else{
|
25 |
-
$msg['status'] = 1;
|
26 |
-
$msg['msg'] = esc_html__('Your data submitted on api.', 'metform');
|
27 |
-
}
|
28 |
-
return $msg;
|
29 |
-
}
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/assets/js/admin-entry-script.js
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function ($){
|
2 |
-
var form_list_options = $('#metform-formlist');
|
3 |
-
$('#post-query-submit').before(form_list_options.html());
|
4 |
-
form_list_options.remove();
|
5 |
-
|
6 |
-
$('.row-actions .edit a, .page-title-action').html('view');
|
7 |
-
|
8 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/assets/js/admin-script.js
DELETED
@@ -1,389 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function ($) {
|
2 |
-
"use strict";
|
3 |
-
// console.log('foo');
|
4 |
-
|
5 |
-
$('.row-actions .edit a, .page-title-action, .metform-form-edit-btn, body.post-type-metform-form a.row-title').on('click', function (e) {
|
6 |
-
e.preventDefault();
|
7 |
-
var id = 0;
|
8 |
-
var modal = $('#metform_form_modal');
|
9 |
-
var parent = $(this).parents('.column-title');
|
10 |
-
var templateKey = $('body').attr('data-metform-template-key');
|
11 |
-
|
12 |
-
modal.addClass('loading');
|
13 |
-
modal.modal('show');
|
14 |
-
if (parent.length > 0) {
|
15 |
-
|
16 |
-
id = $(this).attr('data-metform-form-id');
|
17 |
-
if( templateKey !== 'undefined'){
|
18 |
-
id = templateKey
|
19 |
-
}
|
20 |
-
id = (id !== undefined) ? id : parent.find('.hidden').attr('id').split('_')[1];
|
21 |
-
var nonce = $('#metform-form-modalinput-settings').attr('data-nonce');
|
22 |
-
|
23 |
-
$.ajax({
|
24 |
-
url: window.metform_api.resturl + 'metform/v1/forms/get/' + id,
|
25 |
-
type: 'get',
|
26 |
-
headers: {
|
27 |
-
'X-WP-Nonce': nonce
|
28 |
-
},
|
29 |
-
dataType: 'json',
|
30 |
-
success: function (data) {
|
31 |
-
MetForm_Form_Editor(data);
|
32 |
-
modal.removeClass('loading');
|
33 |
-
}
|
34 |
-
});
|
35 |
-
|
36 |
-
|
37 |
-
} else {
|
38 |
-
var data = {
|
39 |
-
form_title: $('.mf-form-modalinput-title').attr('data-default-value'),
|
40 |
-
admin_email_body: "",
|
41 |
-
admin_email_from: "",
|
42 |
-
admin_email_reply_to: "",
|
43 |
-
admin_email_subject: "",
|
44 |
-
capture_user_browser_data: "",
|
45 |
-
enable_admin_notification: "",
|
46 |
-
limit_total_entries_status: "",
|
47 |
-
limit_total_entries: "0",
|
48 |
-
redirect_to: "",
|
49 |
-
require_login: "",
|
50 |
-
store_entries: "1",
|
51 |
-
success_message: $('.mf-form-modalinput-success_message').attr('data-default-value'),
|
52 |
-
user_email_body: "",
|
53 |
-
user_email_from: "",
|
54 |
-
user_email_reply_to: "",
|
55 |
-
user_email_subject: "",
|
56 |
-
};
|
57 |
-
MetForm_Form_Editor(data);
|
58 |
-
modal.removeClass('loading');
|
59 |
-
}
|
60 |
-
|
61 |
-
modal.find('form').attr('data-mf-id', id);
|
62 |
-
});
|
63 |
-
|
64 |
-
$('.metform-form-save-btn-editor').on('click', function () {
|
65 |
-
$('.metform-form-save-btn-editor').attr('disabled', true);
|
66 |
-
var form = $('#metform-form-modalinput-settings');
|
67 |
-
form.attr('data-open-editor', '1');
|
68 |
-
form.trigger('submit');
|
69 |
-
});
|
70 |
-
|
71 |
-
$('#metform-form-modalinput-settings').on('submit', function (e) {
|
72 |
-
e.preventDefault();
|
73 |
-
var modal = $('#metform-form-modal');
|
74 |
-
modal.addClass('loading');
|
75 |
-
|
76 |
-
$('.metform-form-save-btn-editor').attr('disabled', true);
|
77 |
-
$('.metform-form-save-btn').attr('disabled', true);
|
78 |
-
|
79 |
-
var form_data = $(this).serialize();
|
80 |
-
var id = $(this).attr('data-mf-id');
|
81 |
-
var open_editor = $(this).attr('data-open-editor');
|
82 |
-
var admin_url = $(this).attr('data-editor-url');
|
83 |
-
var nonce = $(this).attr('data-nonce');
|
84 |
-
|
85 |
-
$.ajax({
|
86 |
-
url: window.metform_api.resturl + 'metform/v1/forms/update/' + id,
|
87 |
-
type: 'post',
|
88 |
-
data: form_data,
|
89 |
-
headers: {
|
90 |
-
'X-WP-Nonce': nonce
|
91 |
-
},
|
92 |
-
dataType: 'json',
|
93 |
-
success: function (output) {
|
94 |
-
$('#message').css('display','block');
|
95 |
-
|
96 |
-
if(output.saved == true){
|
97 |
-
$('#post-' + output.data.id).find('.row-title').html(output.data.title);
|
98 |
-
$('#message').removeClass('attr-alert-warning').addClass('attr-alert-success').html(output.status);
|
99 |
-
}else{
|
100 |
-
$('#message').removeClass('attr-alert-success').addClass('attr-alert-warning').html(output.status);
|
101 |
-
}
|
102 |
-
|
103 |
-
setTimeout( function(){
|
104 |
-
$('#message').css('display','none');
|
105 |
-
} , 5000 );
|
106 |
-
|
107 |
-
modal.removeClass('loading');
|
108 |
-
|
109 |
-
if (open_editor == '1') {
|
110 |
-
setTimeout( function(){
|
111 |
-
window.location.href = admin_url + '?post=' + output.data.id + '&action=elementor';
|
112 |
-
} , 1500 );
|
113 |
-
}else if(id != '0'){
|
114 |
-
$('.metform-form-save-btn-editor').removeAttr('disabled');
|
115 |
-
$('.metform-form-save-btn').removeAttr('disabled');
|
116 |
-
}else if(id == '0'){
|
117 |
-
setTimeout( function(){
|
118 |
-
location.reload();
|
119 |
-
} , 1500 );
|
120 |
-
}
|
121 |
-
}
|
122 |
-
});
|
123 |
-
|
124 |
-
});
|
125 |
-
|
126 |
-
$('input.mf-form-modalinput-limit_status').on('change',function(){
|
127 |
-
if($(this).is(":checked")){
|
128 |
-
$('#limit_status').find('input').removeAttr('disabled');
|
129 |
-
}
|
130 |
-
else if($(this).is(":not(:checked)")){
|
131 |
-
$('#limit_status').find('input').attr('disabled', 'disabled');
|
132 |
-
}
|
133 |
-
});
|
134 |
-
|
135 |
-
$('input.mf-form-user-enable').on('change',function(){
|
136 |
-
if($(this).is(":checked")){
|
137 |
-
$('.mf-form-user-confirmation').show();
|
138 |
-
}
|
139 |
-
else if($(this).is(":not(:checked)")){
|
140 |
-
$('.mf-form-user-confirmation').hide();
|
141 |
-
}
|
142 |
-
});
|
143 |
-
|
144 |
-
$('input.mf-form-admin-enable').on('change',function(){
|
145 |
-
if($(this).is(":checked")){
|
146 |
-
$('.mf-form-admin-notification').show();
|
147 |
-
}
|
148 |
-
else if($(this).is(":not(:checked)")){
|
149 |
-
$('.mf-form-admin-notification').hide();
|
150 |
-
}
|
151 |
-
});
|
152 |
-
|
153 |
-
$('input.mf-form-modalinput-rest_api').on('change',function(){
|
154 |
-
if($(this).is(":checked")){
|
155 |
-
$('.mf-input-rest-api-group').show();
|
156 |
-
}
|
157 |
-
else if($(this).is(":not(:checked)")){
|
158 |
-
$('.mf-input-rest-api-group').hide();
|
159 |
-
}
|
160 |
-
});
|
161 |
-
|
162 |
-
$('input.mf-form-modalinput-mail_chimp').on('change',function(){
|
163 |
-
if($(this).is(":checked")){
|
164 |
-
$('.mf-mailchimp').show();
|
165 |
-
}
|
166 |
-
else if($(this).is(":not(:checked)")){
|
167 |
-
$('.mf-mailchimp').hide();
|
168 |
-
}
|
169 |
-
});
|
170 |
-
|
171 |
-
$('input.mf-form-modalinput-zapier').on('change',function(){
|
172 |
-
if($(this).is(":checked")){
|
173 |
-
$('.mf-zapier').show();
|
174 |
-
}
|
175 |
-
else if($(this).is(":not(:checked)")){
|
176 |
-
$('.mf-zapier').hide();
|
177 |
-
}
|
178 |
-
});
|
179 |
-
|
180 |
-
$('input.mf-form-modalinput-slack').on('change',function(){
|
181 |
-
if($(this).is(":checked")){
|
182 |
-
$('.mf-slack').show();
|
183 |
-
}
|
184 |
-
else if($(this).is(":not(:checked)")){
|
185 |
-
$('.mf-slack').hide();
|
186 |
-
}
|
187 |
-
});
|
188 |
-
|
189 |
-
$('input.mf-form-modalinput-recaptcha').on('change',function(){
|
190 |
-
if($(this).is(":checked")){
|
191 |
-
$('.mf-recaptcha').show();
|
192 |
-
}
|
193 |
-
else if($(this).is(":not(:checked)")){
|
194 |
-
$('.mf-recaptcha').hide();
|
195 |
-
}
|
196 |
-
});
|
197 |
-
|
198 |
-
$('input.mf-form-modalinput-capture_user_browser_data').click(function(){
|
199 |
-
if($(this).is(":checked")){
|
200 |
-
$('#multiple_submission').removeClass('hide_input');
|
201 |
-
$('#multiple_submission').addClass('show_input');
|
202 |
-
}
|
203 |
-
else if($(this).is(":not(:checked)")){
|
204 |
-
$('#multiple_submission').removeClass('show_input');
|
205 |
-
$('#multiple_submission').addClass('hide_input');
|
206 |
-
}
|
207 |
-
});
|
208 |
-
|
209 |
-
function MetForm_Form_Editor(data) {
|
210 |
-
$('.mf-form-user-confirmation').hide();
|
211 |
-
$('.mf-form-admin-notification').hide();
|
212 |
-
|
213 |
-
$('.mf-input-rest-api-group').hide();
|
214 |
-
$('.mf-mailchimp').hide();
|
215 |
-
$('.mf-zapier').hide();
|
216 |
-
$('.mf-slack').hide();
|
217 |
-
$('.mf-recaptcha').hide();
|
218 |
-
|
219 |
-
if(data.form_title != ''){
|
220 |
-
$('.mf-form-modalinput-title').val(data.form_title);
|
221 |
-
$('.mf-form-modalinput-success_message').val(data.success_message);
|
222 |
-
$('.mf-form-modalinput-redirect_to').val(data.redirect_to);
|
223 |
-
$('.mf-form-modalinput-limit_total_entries').val(data.limit_total_entries);
|
224 |
-
|
225 |
-
var store_entries = $('.mf-form-modalinput-store_entries');
|
226 |
-
if (data.store_entries == '1') {
|
227 |
-
store_entries.attr('checked', true);
|
228 |
-
} else {
|
229 |
-
store_entries.removeAttr('checked');
|
230 |
-
}
|
231 |
-
|
232 |
-
var hide_form_after_submission = $('.mf-form-modalinput-hide_form_after_submission');
|
233 |
-
if (data.hide_form_after_submission == '1') {
|
234 |
-
hide_form_after_submission.attr('checked', true);
|
235 |
-
} else {
|
236 |
-
hide_form_after_submission.removeAttr('checked');
|
237 |
-
}
|
238 |
-
|
239 |
-
var require_login = $('.mf-form-modalinput-require_login');
|
240 |
-
if (data.require_login == '1') {
|
241 |
-
require_login.attr('checked', true);
|
242 |
-
} else {
|
243 |
-
require_login.removeAttr('checked');
|
244 |
-
}
|
245 |
-
var limit_entry_status = $('.mf-form-modalinput-limit_status');
|
246 |
-
if (data.limit_total_entries_status == '1') {
|
247 |
-
limit_entry_status.attr('checked', true);
|
248 |
-
} else {
|
249 |
-
limit_entry_status.removeAttr('checked');
|
250 |
-
}
|
251 |
-
|
252 |
-
var multiple_submission = $('.mf-form-modalinput-multiple_submission');
|
253 |
-
if (data.multiple_submission == '1') {
|
254 |
-
multiple_submission.attr('checked', true);
|
255 |
-
} else {
|
256 |
-
multiple_submission.removeAttr('checked');
|
257 |
-
}
|
258 |
-
|
259 |
-
var enable_recaptcha = $('.mf-form-modalinput-enable_recaptcha');
|
260 |
-
if (data.enable_recaptcha == '1') {
|
261 |
-
enable_recaptcha.attr('checked', true);
|
262 |
-
} else {
|
263 |
-
enable_recaptcha.removeAttr('checked');
|
264 |
-
}
|
265 |
-
|
266 |
-
var capture_user_browser_data = $('.mf-form-modalinput-capture_user_browser_data');
|
267 |
-
if (data.capture_user_browser_data == '1') {
|
268 |
-
capture_user_browser_data.attr('checked', true);
|
269 |
-
$('#multiple_submission').removeClass('hide_input');
|
270 |
-
$('#multiple_submission').addClass('show_input');
|
271 |
-
} else {
|
272 |
-
capture_user_browser_data.removeAttr('checked');
|
273 |
-
}
|
274 |
-
|
275 |
-
|
276 |
-
$('.mf-form-user-email-subject').val(data.user_email_subject);
|
277 |
-
$('.mf-form-user-email-from').val(data.user_email_from);
|
278 |
-
$('.mf-form-user-reply-to').val(data.user_email_reply_to);
|
279 |
-
$('.mf-form-user-email-body').val(data.user_email_body);
|
280 |
-
|
281 |
-
|
282 |
-
var enable_user_notification = $('.mf-form-user-enable')
|
283 |
-
if(data.enable_user_notification == '1'){
|
284 |
-
enable_user_notification.attr('checked', true);
|
285 |
-
$('.mf-form-user-confirmation').show();
|
286 |
-
}
|
287 |
-
else{
|
288 |
-
enable_user_notification.removeAttr('checked');
|
289 |
-
$('.mf-form-user-confirmation').hide();
|
290 |
-
}
|
291 |
-
|
292 |
-
var user_submission_copy = $('.mf-form-user-submission-copy')
|
293 |
-
if(data.user_email_attach_submission_copy == '1'){
|
294 |
-
user_submission_copy.attr('checked', true);
|
295 |
-
}
|
296 |
-
else{
|
297 |
-
user_submission_copy.removeAttr('checked');
|
298 |
-
}
|
299 |
-
|
300 |
-
$('.mf-form-admin-email-subject').val(data.admin_email_subject);
|
301 |
-
$('.mf-form-admin-email-from').val(data.admin_email_from);
|
302 |
-
$('.mf-form-admin-email-to').val(data.admin_email_to);
|
303 |
-
$('.mf-form-admin-reply-to').val(data.admin_email_reply_to);
|
304 |
-
$('.mf-form-admin-email-body').val(data.admin_email_body);
|
305 |
-
|
306 |
-
|
307 |
-
var enable_admin_notification = $('.mf-form-admin-enable')
|
308 |
-
if(data.enable_admin_notification == '1'){
|
309 |
-
enable_admin_notification.attr('checked', true);
|
310 |
-
$('.mf-form-admin-notification').show();
|
311 |
-
}
|
312 |
-
else{
|
313 |
-
enable_admin_notification.removeAttr('checked');
|
314 |
-
$('.mf-form-admin-notification').hide();
|
315 |
-
}
|
316 |
-
|
317 |
-
var admin_submission_copy = $('.mf-form-admin-submission-copy')
|
318 |
-
if(data.admin_email_attach_submission_copy == '1'){
|
319 |
-
admin_submission_copy.attr('checked', true);
|
320 |
-
}
|
321 |
-
else{
|
322 |
-
admin_submission_copy.removeAttr('checked');
|
323 |
-
}
|
324 |
-
|
325 |
-
var restApi = $('.mf-form-modalinput-rest_api');
|
326 |
-
if(data.mf_rest_api == '1'){
|
327 |
-
restApi.attr('checked', true);
|
328 |
-
$('.mf-rest-api').show();
|
329 |
-
}else{
|
330 |
-
restApi.removeAttr('checked');
|
331 |
-
$('.mf-rest-api').hide();
|
332 |
-
}
|
333 |
-
|
334 |
-
var mailchimp = $('.mf-form-modalinput-mail_chimp');
|
335 |
-
if(data.mf_mail_chimp == '1'){
|
336 |
-
mailchimp.attr('checked', true);
|
337 |
-
$('.mf-mailchimp').show();
|
338 |
-
}else{
|
339 |
-
mailchimp.removeAttr('checked');
|
340 |
-
$('.mf-mailchimp').hide();
|
341 |
-
}
|
342 |
-
|
343 |
-
var zapier = $('.mf-form-modalinput-zapier');
|
344 |
-
if(data.mf_zapier == '1'){
|
345 |
-
zapier.attr('checked', true);
|
346 |
-
$('.mf-zapier').show();
|
347 |
-
}else{
|
348 |
-
zapier.removeAttr('checked', true);
|
349 |
-
$('.mf-zapier').hide();
|
350 |
-
}
|
351 |
-
|
352 |
-
var slack = $('.mf-form-modalinput-slack');
|
353 |
-
if(data.mf_slack == '1'){
|
354 |
-
slack.attr('checked', true);
|
355 |
-
$('.mf-slack').show();
|
356 |
-
}else{
|
357 |
-
slack.removeAttr('checked', true);
|
358 |
-
$('.mf-slack').hide();
|
359 |
-
}
|
360 |
-
|
361 |
-
var recaptcha = $('.mf-form-modalinput-recaptcha');
|
362 |
-
if(data.mf_recaptcha == '1'){
|
363 |
-
recaptcha.attr('checked', true);
|
364 |
-
$('.mf-recaptcha').show();
|
365 |
-
}else{
|
366 |
-
recaptcha.removeAttr('checked');
|
367 |
-
}
|
368 |
-
|
369 |
-
|
370 |
-
var api_method = (data.mf_rest_api_method && data.mf_rest_api_method.length) ? data.mf_rest_api_method : 'POST';
|
371 |
-
$('.mf-rest-api-method option[value="'+ api_method +'"]').prop('selected', true);
|
372 |
-
|
373 |
-
$('.mf-rest-api-url').val(data.mf_rest_api_url);
|
374 |
-
|
375 |
-
$('.mf-mailchimp-api-key').val(data.mf_mailchimp_api_key);
|
376 |
-
$('.mf-mailchimp-list-id').val(data.mf_mailchimp_list_id);
|
377 |
-
|
378 |
-
$('.mf-zapier-web-hook').val(data.mf_zapier_webhook);
|
379 |
-
$('.mf-slack-web-hook').val(data.mf_slack_webhook);
|
380 |
-
|
381 |
-
$('.mf-recaptcha-site-key').val(data.mf_recaptcha_site_key);
|
382 |
-
$('.mf-recaptcha-secret-key').val(data.mf_recaptcha_secret_key);
|
383 |
-
|
384 |
-
$('input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api').trigger('change');
|
385 |
-
}
|
386 |
-
|
387 |
-
}
|
388 |
-
|
389 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/assets/js/inputs.js
DELETED
@@ -1,188 +0,0 @@
|
|
1 |
-
(function ($, elementor) {
|
2 |
-
"use strict";
|
3 |
-
|
4 |
-
var MetForm = {
|
5 |
-
|
6 |
-
init: function () {
|
7 |
-
var widgets = {
|
8 |
-
'mf-range.default': MetForm.RangeInput,
|
9 |
-
'mf-date.default': MetForm.DateInput,
|
10 |
-
'mf-time.default': MetForm.TimeInput,
|
11 |
-
'mf-select.default': MetForm.SelectInput,
|
12 |
-
'mf-multi-select.default': MetForm.MultiSelectInput,
|
13 |
-
'mf-rating.default': MetForm.Rating,
|
14 |
-
'mf-file-upload.default': MetForm.fileUpload,
|
15 |
-
|
16 |
-
};
|
17 |
-
$.each(widgets, function (widget, callback) {
|
18 |
-
elementor.hooks.addAction('frontend/element_ready/' + widget, callback);
|
19 |
-
});
|
20 |
-
},
|
21 |
-
|
22 |
-
RangeInput: function ($scope) {
|
23 |
-
var el = $scope.find('.mf-rs-range');
|
24 |
-
var min = el.attr('min');
|
25 |
-
var max = el.attr('max');
|
26 |
-
var step = el.attr('step');
|
27 |
-
var range = el.attr('range');
|
28 |
-
|
29 |
-
var config = {
|
30 |
-
step: step,
|
31 |
-
min: min,
|
32 |
-
max: max,
|
33 |
-
}
|
34 |
-
|
35 |
-
if (range == 'true') config.range = Boolean(range);
|
36 |
-
|
37 |
-
el.asRange(config);
|
38 |
-
|
39 |
-
el.on('asRange::change', function (e) {
|
40 |
-
var val = $(this).asRange('get');
|
41 |
-
|
42 |
-
if(Array.isArray(val)){
|
43 |
-
val = Number(val[1]) - Number(val[0]);
|
44 |
-
}
|
45 |
-
$(this).val(val).trigger('change');
|
46 |
-
});
|
47 |
-
},
|
48 |
-
|
49 |
-
DateInput: function ($scope) {
|
50 |
-
var el = $scope.find('.mf-date-input'),
|
51 |
-
minDate = el.attr('data-mfMinDate'),
|
52 |
-
maxDate = el.attr('data-mfMaxDate'),
|
53 |
-
rangeDate = el.attr('data-mfRangeDate'),
|
54 |
-
dateFormat = el.attr('data-mfDateFormat'),
|
55 |
-
enableTime = el.attr('data-mfEnableTime'),
|
56 |
-
disableDates = el.attr('data-mfDisableDates'),
|
57 |
-
wrapper = $scope.find('.mf-input-wrapper');
|
58 |
-
|
59 |
-
var config = {
|
60 |
-
appendTo: wrapper.get(0),
|
61 |
-
}
|
62 |
-
|
63 |
-
if (enableTime == 'yes') {
|
64 |
-
config.enableTime = true;
|
65 |
-
dateFormat = dateFormat+" H:i";
|
66 |
-
};
|
67 |
-
|
68 |
-
if (disableDates != '') { config.disable = JSON.parse(disableDates) };
|
69 |
-
if (minDate != '') { config.minDate = minDate };
|
70 |
-
if (maxDate != '') { config.maxDate = maxDate };
|
71 |
-
if (rangeDate == 'yes') { config.mode = 'range' };
|
72 |
-
|
73 |
-
config.dateFormat = dateFormat;
|
74 |
-
|
75 |
-
el.flatpickr(config);
|
76 |
-
},
|
77 |
-
|
78 |
-
TimeInput: function ($scope) {
|
79 |
-
var el = $scope.find('.mf-input-time');
|
80 |
-
var time24h = el.attr('mftime24h');
|
81 |
-
var wrapper = $scope.find('.mf-input-wrapper');
|
82 |
-
var config = {
|
83 |
-
appendTo: wrapper.get(0),
|
84 |
-
dateFormat: "h:i K",
|
85 |
-
enableTime: true,
|
86 |
-
noCalendar: true
|
87 |
-
}
|
88 |
-
|
89 |
-
if (time24h == 'yes') {
|
90 |
-
config.dateFormat = 'H:i';
|
91 |
-
config.time_24hr = true;
|
92 |
-
}
|
93 |
-
|
94 |
-
el.flatpickr(config);
|
95 |
-
},
|
96 |
-
|
97 |
-
SelectInput: function ($scope) {
|
98 |
-
var el = $scope.find('select.mf-input-select');
|
99 |
-
|
100 |
-
el.select2({
|
101 |
-
dropdownParent: $scope.find('.mf-input-wrapper')
|
102 |
-
});
|
103 |
-
},
|
104 |
-
|
105 |
-
MultiSelectInput: function ($scope) {
|
106 |
-
var el = $scope.find('select.mf-input-multiselect');
|
107 |
-
el.select2({
|
108 |
-
dropdownParent: $scope.find('.mf-input-wrapper')
|
109 |
-
});
|
110 |
-
},
|
111 |
-
|
112 |
-
Rating: function ($scope) {
|
113 |
-
var el = $scope.find('.mf-input-rating li');
|
114 |
-
el.on('mouseover', function () {
|
115 |
-
var onStar = parseInt($(this).data('value'), 10); // The star currently mouse on
|
116 |
-
$(this).parent().children('li.star-li').each(function (e) {
|
117 |
-
if (e < onStar) {
|
118 |
-
$(this).addClass('hover');
|
119 |
-
}
|
120 |
-
else {
|
121 |
-
$(this).removeClass('hover');
|
122 |
-
}
|
123 |
-
});
|
124 |
-
|
125 |
-
}).on('mouseout', function () {
|
126 |
-
$(this).parent().children('li.star-li').each(function (e) {
|
127 |
-
$(this).removeClass('hover');
|
128 |
-
});
|
129 |
-
});
|
130 |
-
|
131 |
-
|
132 |
-
el.on('click', function () {
|
133 |
-
var onStar = parseInt($(this).data('value'), 10);
|
134 |
-
var stars = $(this).parent().children('li.star-li');
|
135 |
-
|
136 |
-
for (let i = 0; i < stars.length; i++) {
|
137 |
-
$(stars[i]).removeClass('selected');
|
138 |
-
}
|
139 |
-
|
140 |
-
for (let i = 0; i < onStar; i++) {
|
141 |
-
$(stars[i]).addClass('selected');
|
142 |
-
}
|
143 |
-
|
144 |
-
var displayId = $(this).parents().find('input.mf-input-hidden');
|
145 |
-
displayId.val(onStar);
|
146 |
-
|
147 |
-
var msg = "";
|
148 |
-
if (onStar > 1) {
|
149 |
-
msg = "<strong>" + onStar + "</strong>";
|
150 |
-
}
|
151 |
-
else {
|
152 |
-
msg = "<strong>" + onStar + " </strong>";
|
153 |
-
}
|
154 |
-
|
155 |
-
});
|
156 |
-
},
|
157 |
-
|
158 |
-
fileUpload: function($scope){
|
159 |
-
$scope.find('.mf-input-file-upload').on('change', function(){
|
160 |
-
var image = $(this).val().match(/\\([^\\]+)$/)[1];
|
161 |
-
|
162 |
-
$scope.find('.mf-file-name span').html(image);
|
163 |
-
});
|
164 |
-
},
|
165 |
-
|
166 |
-
// it's already trigger change function, so this is not necessary
|
167 |
-
// ImageSelect: function($scope){
|
168 |
-
// var el = $scope.find('.mf-input-wrapper .mf-image-select-input[type="radio"]');
|
169 |
-
|
170 |
-
// el.on('click', function (e) {
|
171 |
-
// el.trigger('change');
|
172 |
-
// });
|
173 |
-
// },
|
174 |
-
|
175 |
-
// it's already trigger change function, so this is not necessary
|
176 |
-
// ToggleSelect: function($scope){
|
177 |
-
// var el = $scope.find('.mf-input-wrapper .mf-toggle-select-input[type="radio"]');
|
178 |
-
|
179 |
-
// el.on('click', function (e) {
|
180 |
-
// el.trigger('change');
|
181 |
-
// });
|
182 |
-
// },
|
183 |
-
};
|
184 |
-
|
185 |
-
$(window).on('elementor/frontend/init', MetForm.init);
|
186 |
-
|
187 |
-
|
188 |
-
}(jQuery, window.elementorFrontend));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libs/assets/js/submission.js
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
//recaptcha render
|
2 |
-
var onloadMetFormCallback = function() {
|
3 |
-
var $recaptcha_site_key = jQuery('.recaptcha_site_key');
|
4 |
-
|
5 |
-
$recaptcha_site_key.each(function (indx) {
|
6 |
-
var $el = jQuery(this),
|
7 |
-
$form = $el.parents('.metform-form-content');
|
8 |
-
|
9 |
-
$el.attr( 'id', $el.attr('id') + '_' + indx );
|
10 |
-
grecaptcha.render('recaptcha_site_key' + '_' + indx, {
|
11 |
-
'sitekey' : $form.data('site-key')
|
12 |
-
});
|
13 |
-
});
|
14 |
-
};
|
15 |
-
|
16 |
-
|
17 |
-
jQuery(document).ready(function($) {
|
18 |
-
|
19 |
-
$(".metform-form-content").submit(function(e) {
|
20 |
-
e.preventDefault();
|
21 |
-
|
22 |
-
var form = $(this);
|
23 |
-
|
24 |
-
var formMfInputTel = form.find('.mf-input[type="tel"]');
|
25 |
-
|
26 |
-
formMfInputTel.each(function () {
|
27 |
-
var el = $(this),
|
28 |
-
num = el.val(),
|
29 |
-
code;
|
30 |
-
|
31 |
-
code = el.siblings('.iti__flag-container').find('.iti__selected-dial-code').text();
|
32 |
-
el.val( code + num );
|
33 |
-
});
|
34 |
-
|
35 |
-
var msg = form.parent().find('.metform-msg');
|
36 |
-
var post_url = form.attr("action");
|
37 |
-
var form_data = new FormData(this);
|
38 |
-
var nonce = form.attr('data-nonce');
|
39 |
-
|
40 |
-
if(msg.length > 1){
|
41 |
-
form.parent().find('.metform-inx').remove();
|
42 |
-
}
|
43 |
-
|
44 |
-
$.ajax({
|
45 |
-
url: post_url,
|
46 |
-
type: 'POST',
|
47 |
-
dataType: 'JSON',
|
48 |
-
data: form_data,
|
49 |
-
processData: false,
|
50 |
-
contentType: false,
|
51 |
-
headers: {
|
52 |
-
'X-WP-Nonce': nonce
|
53 |
-
},
|
54 |
-
success: function (response) {
|
55 |
-
//console.log(response);
|
56 |
-
var status = Number(response.status);
|
57 |
-
var formatedError = '';
|
58 |
-
$.each(response.error, function(i, v){
|
59 |
-
formatedError += v + '<br>';
|
60 |
-
});
|
61 |
-
formatedError.replace(/<br>+$/,'');
|
62 |
-
if (status == 1) {
|
63 |
-
msg.css("display","block");
|
64 |
-
msg.removeClass('attr-alert-warning');
|
65 |
-
msg.addClass('attr-alert-success');
|
66 |
-
msg.html(response.data['message']);
|
67 |
-
setTimeout( function(){
|
68 |
-
msg.css("display","none");
|
69 |
-
} , 8000 );
|
70 |
-
|
71 |
-
// form reset after successfully submitted
|
72 |
-
form.trigger("reset");
|
73 |
-
form.find('select.mf-input').val('').trigger('change');
|
74 |
-
form.find('.mf-input > li').removeClass('selected');
|
75 |
-
form.find('.asRange > .asRange-pointer').css('left','0%');
|
76 |
-
form.find('.asRange > .asRange-selected').css({'left':'0%', 'width':'0%' });
|
77 |
-
|
78 |
-
//if(form.attr('site_key') != '' && grecaptcha != undefined) grecaptcha.reset();
|
79 |
-
|
80 |
-
} else {
|
81 |
-
msg.css("display","block");
|
82 |
-
msg.removeClass('attr-alert-success');
|
83 |
-
msg.addClass('attr-alert-warning');
|
84 |
-
msg.html(formatedError);
|
85 |
-
setTimeout( function(){
|
86 |
-
msg.css("display","none");
|
87 |
-
} , 8000 );
|
88 |
-
}
|
89 |
-
|
90 |
-
if(response.data['hide_form'] != ''){
|
91 |
-
setTimeout( function(){
|
92 |
-
form.css('display','none');
|
93 |
-
} , 2000 );
|
94 |
-
}
|
95 |
-
|
96 |
-
if(response.data['redirect_to'] != ''){
|
97 |
-
setTimeout( function(){
|
98 |
-
window.location.replace(response.data['redirect_to']);
|
99 |
-
} , 1500 );
|
100 |
-
}
|
101 |
-
}
|
102 |
-
});
|
103 |
-
|
104 |
-
|
105 |
-
});
|
106 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
metform.php
CHANGED
@@ -5,7 +5,7 @@ defined( 'ABSPATH' ) || exit;
|
|
5 |
* Plugin Name: MetForm
|
6 |
* Plugin URI: http://products.wpmet.com/metform/
|
7 |
* Description: Most flexible and design friendly form builder for Elementor
|
8 |
-
* Version: 1.1.
|
9 |
* Author: Wpmet
|
10 |
* Author URI: https://wpmet.com
|
11 |
* Text Domain: metform
|
@@ -13,7 +13,6 @@ defined( 'ABSPATH' ) || exit;
|
|
13 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
14 |
*/
|
15 |
|
16 |
-
|
17 |
require 'autoloader.php';
|
18 |
require 'plugin.php';
|
19 |
|
5 |
* Plugin Name: MetForm
|
6 |
* Plugin URI: http://products.wpmet.com/metform/
|
7 |
* Description: Most flexible and design friendly form builder for Elementor
|
8 |
+
* Version: 1.1.7
|
9 |
* Author: Wpmet
|
10 |
* Author URI: https://wpmet.com
|
11 |
* Text Domain: metform
|
13 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
14 |
*/
|
15 |
|
|
|
16 |
require 'autoloader.php';
|
17 |
require 'plugin.php';
|
18 |
|
plugin.php
CHANGED
@@ -10,50 +10,13 @@ final class Plugin{
|
|
10 |
private $forms;
|
11 |
|
12 |
public function __construct(){
|
13 |
-
Autoloader::run();
|
14 |
}
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
public function init(){
|
19 |
-
|
20 |
-
// Check if Elementor installed and activated.
|
21 |
-
if ( ! did_action( 'elementor/loaded' ) ) {
|
22 |
-
add_action( 'admin_notices', array( $this, 'missing_elementor' ) );
|
23 |
-
return;
|
24 |
-
}
|
25 |
-
// Check for required Elementor version.
|
26 |
-
if ( ! version_compare( ELEMENTOR_VERSION, '2.6.0', '>=' ) ) {
|
27 |
-
add_action( 'admin_notices', array( $this, 'failed_elementor_version' ) );
|
28 |
-
return;
|
29 |
-
}
|
30 |
-
|
31 |
-
if(current_user_can('manage_options')){
|
32 |
-
add_action( 'admin_menu',[$this,'admin_menu']);
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
add_action( 'elementor/editor/before_enqueue_scripts', [$this, 'edit_view_scripts'] );
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
add_action( 'init', array( $this, 'i18n' ) );
|
42 |
-
|
43 |
-
add_action('admin_enqueue_scripts', [$this,'js_css_admin']);
|
44 |
-
add_action('wp_enqueue_scripts', [$this,'js_css_public']);
|
45 |
-
add_action( 'elementor/frontend/before_enqueue_scripts', [$this, 'elementor_js'] );
|
46 |
-
|
47 |
-
add_action('admin_footer', [$this, 'footer_data']);
|
48 |
-
|
49 |
-
Core\Forms\Base::instance()->init();
|
50 |
-
Controls\Base::instance()->init();
|
51 |
-
$this->entries = Core\Entries\Init::instance();
|
52 |
-
|
53 |
-
Widgets\Manifest::get_instance()->init();
|
54 |
}
|
55 |
|
56 |
-
|
57 |
public function package_type(){
|
58 |
return 'free';
|
59 |
}
|
@@ -98,48 +61,94 @@ final class Plugin{
|
|
98 |
return $this->plugin_dir() . 'widgets/';
|
99 |
}
|
100 |
|
101 |
-
public function
|
102 |
-
return $this->plugin_url() . '
|
103 |
}
|
104 |
|
105 |
-
public function
|
106 |
-
return $this->plugin_dir() . '
|
107 |
}
|
108 |
|
109 |
public function i18n() {
|
110 |
load_plugin_textdomain( 'metform', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
function js_css_public(){
|
114 |
|
115 |
-
wp_enqueue_style('asRange', $this->
|
116 |
-
wp_enqueue_style('select2', $this->
|
117 |
-
wp_enqueue_style('flatpickr', $this->
|
118 |
-
wp_enqueue_style('metform-ui', $this->
|
119 |
-
wp_enqueue_style('font-awesome', $this->
|
120 |
-
wp_enqueue_style('metform-style', $this->
|
121 |
|
122 |
-
wp_enqueue_script('asRange', $this->
|
123 |
-
wp_enqueue_script('select2', $this->
|
124 |
-
wp_enqueue_script('flatpickr', $this->
|
125 |
|
126 |
wp_register_script('recaptcha', 'https://www.google.com/recaptcha/api.js?onload=onloadMetFormCallback&render=explicit', array(), $this->version(), true);
|
127 |
-
wp_enqueue_script('metform-submission', $this->
|
128 |
wp_localize_script('metform-submission', 'mf_plugin', array(
|
129 |
'mf_dir' => plugin_dir_url(__FILE__),
|
130 |
));
|
131 |
|
132 |
do_action('metform/onload/enqueue_scripts');
|
133 |
-
|
134 |
-
|
135 |
}
|
136 |
|
137 |
public function edit_view_scripts(){
|
138 |
-
wp_enqueue_style('metform-ui', $this->
|
139 |
-
wp_enqueue_style('metform-admin-style', $this->
|
140 |
|
141 |
-
wp_enqueue_script('metform-ui', $this->
|
142 |
-
wp_enqueue_script('metform-admin-script', $this->
|
143 |
|
144 |
wp_add_inline_script('metform-admin-script', "
|
145 |
var metform_api = {
|
@@ -149,7 +158,7 @@ final class Plugin{
|
|
149 |
}
|
150 |
|
151 |
public function elementor_js() {
|
152 |
-
wp_enqueue_script('metform-inputs', $this->
|
153 |
wp_localize_script('metform-inputs', 'mf_plugin', array(
|
154 |
'mf_dir' => plugin_dir_url(__FILE__),
|
155 |
));
|
@@ -162,18 +171,18 @@ final class Plugin{
|
|
162 |
|
163 |
if(in_array($screen->id, ['edit-metform-form','metform_page_mt-form-settings', 'metform-entry'])){
|
164 |
|
165 |
-
wp_enqueue_style('metform-ui', $this->
|
166 |
-
wp_enqueue_style('metform-admin-style', $this->
|
167 |
|
168 |
-
wp_enqueue_script('metform-ui', $this->
|
169 |
-
wp_enqueue_script('metform-admin-script', $this->
|
170 |
wp_localize_script('metform-admin-script', 'metform_api', array( 'resturl' => get_rest_url() ));
|
171 |
|
172 |
}
|
173 |
|
174 |
if($screen->id == 'edit-metform-entry' || $screen->id == 'metform-entry'){
|
175 |
-
wp_enqueue_style('metform-ui', $this->
|
176 |
-
wp_enqueue_script('metform-entry-script', $this->
|
177 |
}
|
178 |
|
179 |
}
|
@@ -207,7 +216,6 @@ final class Plugin{
|
|
207 |
}
|
208 |
|
209 |
function admin_menu() {
|
210 |
-
|
211 |
add_menu_page(
|
212 |
esc_html__('MetForm'),
|
213 |
esc_html__('MetForm'),
|
@@ -217,7 +225,6 @@ final class Plugin{
|
|
217 |
'dashicons-feedback',
|
218 |
5
|
219 |
);
|
220 |
-
|
221 |
}
|
222 |
|
223 |
public function missing_elementor() {
|
@@ -244,6 +251,25 @@ final class Plugin{
|
|
244 |
);
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
public function failed_elementor_version(){
|
248 |
|
249 |
$btn['label'] = esc_html__('Update Elementor', 'metform');
|
10 |
private $forms;
|
11 |
|
12 |
public function __construct(){
|
13 |
+
Autoloader::run();
|
14 |
}
|
15 |
+
|
16 |
+
public function version(){
|
17 |
+
return '1.1.7';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
|
|
20 |
public function package_type(){
|
21 |
return 'free';
|
22 |
}
|
61 |
return $this->plugin_dir() . 'widgets/';
|
62 |
}
|
63 |
|
64 |
+
public function public_url(){
|
65 |
+
return $this->plugin_url() . 'public/';
|
66 |
}
|
67 |
|
68 |
+
public function public_dir(){
|
69 |
+
return $this->plugin_dir() . 'public/';
|
70 |
}
|
71 |
|
72 |
public function i18n() {
|
73 |
load_plugin_textdomain( 'metform', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
74 |
+
}
|
75 |
+
|
76 |
+
public function init(){
|
77 |
+
|
78 |
+
new Utils\Notice();
|
79 |
+
|
80 |
+
// Check if Elementor installed and activated.
|
81 |
+
if ( ! did_action( 'elementor/loaded' ) ) {
|
82 |
+
add_action( 'admin_notices', array( $this, 'missing_elementor' ) );
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
// Check for required Elementor version.
|
86 |
+
if ( ! version_compare( ELEMENTOR_VERSION, '2.6.0', '>=' ) ) {
|
87 |
+
add_action( 'admin_notices', array( $this, 'failed_elementor_version' ) );
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
|
91 |
+
// pro available notice
|
92 |
+
if( !file_exists( WP_PLUGIN_DIR . '/metform-pro/metform-pro.php' ) ){
|
93 |
+
add_action( 'admin_notices', [ $this, 'available_metform_pro'] );
|
94 |
+
}
|
95 |
+
|
96 |
+
if(current_user_can('manage_options')){
|
97 |
+
add_action( 'admin_menu',[$this,'admin_menu']);
|
98 |
+
}
|
99 |
+
|
100 |
+
add_action( 'elementor/editor/before_enqueue_scripts', [$this, 'edit_view_scripts'] );
|
101 |
+
|
102 |
+
add_action( 'init', array( $this, 'i18n' ) );
|
103 |
+
|
104 |
+
add_action('admin_enqueue_scripts', [$this,'js_css_admin']);
|
105 |
+
add_action('wp_enqueue_scripts', [$this,'js_css_public']);
|
106 |
+
add_action( 'elementor/frontend/before_enqueue_scripts', [$this, 'elementor_js'] );
|
107 |
+
|
108 |
+
add_action('admin_footer', [$this, 'footer_data']);
|
109 |
+
|
110 |
+
Core\Forms\Base::instance()->init();
|
111 |
+
Controls\Base::instance()->init();
|
112 |
+
$this->entries = Core\Entries\Init::instance();
|
113 |
+
|
114 |
+
Widgets\Manifest::get_instance()->init();
|
115 |
+
|
116 |
+
// Add banner class
|
117 |
+
include $this->utils_dir() . 'banner.php';
|
118 |
+
|
119 |
+
add_action('admin_notices', function(){
|
120 |
+
\WpMet_Banner::run();
|
121 |
+
});
|
122 |
+
}
|
123 |
|
124 |
function js_css_public(){
|
125 |
|
126 |
+
wp_enqueue_style('asRange', $this->public_url().'assets/css/asRange.min.css', false, $this->version());
|
127 |
+
wp_enqueue_style('select2', $this->public_url().'assets/css/select2.min.css', false, $this->version());
|
128 |
+
wp_enqueue_style('flatpickr', $this->public_url().'assets/css/flatpickr.min.css', false, $this->version());
|
129 |
+
wp_enqueue_style('metform-ui', $this->public_url().'assets/css/metform-ui.css', false, $this->version());
|
130 |
+
wp_enqueue_style('font-awesome', $this->public_url().'assets/css/font-awesome.min.css', false, $this->version());
|
131 |
+
wp_enqueue_style('metform-style', $this->public_url().'assets/css/style.css', false, $this->version());
|
132 |
|
133 |
+
wp_enqueue_script('asRange', $this->public_url().'assets/js/jquery-asRange.min.js', array(), $this->version(), true);
|
134 |
+
wp_enqueue_script('select2', $this->public_url().'assets/js/select2.min.js', array(), $this->version(), true);
|
135 |
+
wp_enqueue_script('flatpickr', $this->public_url().'assets/js/flatpickr.js', array(), $this->version(), true);
|
136 |
|
137 |
wp_register_script('recaptcha', 'https://www.google.com/recaptcha/api.js?onload=onloadMetFormCallback&render=explicit', array(), $this->version(), true);
|
138 |
+
wp_enqueue_script('metform-submission', $this->public_url().'assets/js/submission.js', array(), $this->version(), true);
|
139 |
wp_localize_script('metform-submission', 'mf_plugin', array(
|
140 |
'mf_dir' => plugin_dir_url(__FILE__),
|
141 |
));
|
142 |
|
143 |
do_action('metform/onload/enqueue_scripts');
|
|
|
|
|
144 |
}
|
145 |
|
146 |
public function edit_view_scripts(){
|
147 |
+
wp_enqueue_style('metform-ui', $this->public_url().'assets/css/metform-ui.css', false, $this->version());
|
148 |
+
wp_enqueue_style('metform-admin-style', $this->public_url().'assets/css/admin-style.css', false, $this->version());
|
149 |
|
150 |
+
wp_enqueue_script('metform-ui', $this->public_url().'assets/js/ui.min.js', array(), $this->version(), true);
|
151 |
+
wp_enqueue_script('metform-admin-script', $this->public_url().'assets/js/admin-script.js', array(), $this->version(), true);
|
152 |
|
153 |
wp_add_inline_script('metform-admin-script', "
|
154 |
var metform_api = {
|
158 |
}
|
159 |
|
160 |
public function elementor_js() {
|
161 |
+
wp_enqueue_script('metform-inputs', $this->public_url().'assets/js/inputs.js', array('elementor-frontend'), $this->version(), true);
|
162 |
wp_localize_script('metform-inputs', 'mf_plugin', array(
|
163 |
'mf_dir' => plugin_dir_url(__FILE__),
|
164 |
));
|
171 |
|
172 |
if(in_array($screen->id, ['edit-metform-form','metform_page_mt-form-settings', 'metform-entry'])){
|
173 |
|
174 |
+
wp_enqueue_style('metform-ui', $this->public_url().'assets/css/metform-ui.css', false, $this->version());
|
175 |
+
wp_enqueue_style('metform-admin-style', $this->public_url().'assets/css/admin-style.css', false, $this->version());
|
176 |
|
177 |
+
wp_enqueue_script('metform-ui', $this->public_url().'assets/js/ui.min.js', array(), $this->version(), true);
|
178 |
+
wp_enqueue_script('metform-admin-script', $this->public_url().'assets/js/admin-script.js', array(), $this->version(), true);
|
179 |
wp_localize_script('metform-admin-script', 'metform_api', array( 'resturl' => get_rest_url() ));
|
180 |
|
181 |
}
|
182 |
|
183 |
if($screen->id == 'edit-metform-entry' || $screen->id == 'metform-entry'){
|
184 |
+
wp_enqueue_style('metform-ui', $this->public_url().'assets/css/metform-ui.css', false, $this->version());
|
185 |
+
wp_enqueue_script('metform-entry-script', $this->public_url().'assets/js/admin-entry-script.js', array(), $this->version(), true);
|
186 |
}
|
187 |
|
188 |
}
|
216 |
}
|
217 |
|
218 |
function admin_menu() {
|
|
|
219 |
add_menu_page(
|
220 |
esc_html__('MetForm'),
|
221 |
esc_html__('MetForm'),
|
225 |
'dashicons-feedback',
|
226 |
5
|
227 |
);
|
|
|
228 |
}
|
229 |
|
230 |
public function missing_elementor() {
|
251 |
);
|
252 |
}
|
253 |
|
254 |
+
public function available_metform_pro() {
|
255 |
+
if ( isset( $_GET['activate'] ) ) {
|
256 |
+
unset( $_GET['activate'] );
|
257 |
+
}
|
258 |
+
|
259 |
+
$btn['label'] = esc_html__('MetForm Pro', 'metform');
|
260 |
+
$btn['url'] = esc_url( 'https://products.wpmet.com/metform/');
|
261 |
+
|
262 |
+
Utils\Notice::push(
|
263 |
+
[
|
264 |
+
'id' => 'unsupported-metform-pro-version',
|
265 |
+
'type' => 'success',
|
266 |
+
'dismissible' => true,
|
267 |
+
'btn' => $btn,
|
268 |
+
'message' => sprintf( esc_html__( 'We have MetForm Pro version. Check out our pro feature.', 'metform' ), '2.6.0' ),
|
269 |
+
]
|
270 |
+
);
|
271 |
+
}
|
272 |
+
|
273 |
public function failed_elementor_version(){
|
274 |
|
275 |
$btn['label'] = esc_html__('Update Elementor', 'metform');
|
{libs → public}/assets/css/admin-style.css
RENAMED
File without changes
|
{libs → public}/assets/css/asRange.min.css
RENAMED
File without changes
|
{libs → public}/assets/css/flatpickr.min.css
RENAMED
File without changes
|
{libs → public}/assets/css/font-awesome.min.css
RENAMED
File without changes
|
{libs → public}/assets/css/metform-ui.css
RENAMED
File without changes
|
{libs → public}/assets/css/select2.min.css
RENAMED
File without changes
|
{libs → public}/assets/css/style.css
RENAMED
@@ -1,454 +1,456 @@
|
|
1 |
-
#elementor .mf-btn-wraper a.metform-btn {
|
2 |
-
background: #337ab7;
|
3 |
-
color: #ffffff;
|
4 |
-
border-radius: 5px;
|
5 |
-
height: 20%;
|
6 |
-
font-size: 16px;
|
7 |
-
padding: 10px;
|
8 |
-
}
|
9 |
-
|
10 |
-
.mf-input-switch-control {
|
11 |
-
position: relative;
|
12 |
-
display: inline-block;
|
13 |
-
}
|
14 |
-
.mf-input-control {
|
15 |
-
position: absolute;
|
16 |
-
z-index: -1;
|
17 |
-
opacity: 0;
|
18 |
-
}
|
19 |
-
.mf-input-switch .mf-input-control-label::before {
|
20 |
-
position: static;
|
21 |
-
display: block;
|
22 |
-
width: 32px;
|
23 |
-
height: 18px;
|
24 |
-
pointer-events: none;
|
25 |
-
content: "";
|
26 |
-
background-color: #fff;
|
27 |
-
border: #adb5bd solid 1px;
|
28 |
-
border-radius: 50px;
|
29 |
-
left: 0;
|
30 |
-
transition: all .4s;
|
31 |
-
}
|
32 |
-
|
33 |
-
.metform-msg {
|
34 |
-
margin: 0;
|
35 |
-
padding: 10px;
|
36 |
-
max-width: 100%;
|
37 |
-
}
|
38 |
-
.elementor-editor-active.single-metform-form .metform-msg {
|
39 |
-
display: block;
|
40 |
-
}
|
41 |
-
.mf-input-control-label::before, .custom-file-label, .custom-select {
|
42 |
-
transition: background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
43 |
-
}
|
44 |
-
.mf-input-control-label::after {
|
45 |
-
position: absolute;
|
46 |
-
top: 2px;
|
47 |
-
left: 2px;
|
48 |
-
display: block;
|
49 |
-
width: 14px;
|
50 |
-
height: 14px;
|
51 |
-
content: "";
|
52 |
-
background-color: #adb5bd;
|
53 |
-
border-radius: 100px;
|
54 |
-
transition: all .4s;
|
55 |
-
}
|
56 |
-
|
57 |
-
.mf-input-switch label.mf-input-control-label {
|
58 |
-
display: inline-block;
|
59 |
-
position: relative;
|
60 |
-
}
|
61 |
-
|
62 |
-
.mf-input-control:checked~.mf-input-control-label::before {
|
63 |
-
color: #fff;
|
64 |
-
border-color: #007bff;
|
65 |
-
background-color: #007bff;
|
66 |
-
}
|
67 |
-
.mf-input-switch .mf-input-control:checked~.mf-input-control-label::after {
|
68 |
-
background-color: #fff;
|
69 |
-
right: 2px;
|
70 |
-
left: inherit;
|
71 |
-
}
|
72 |
-
.metform-msg{
|
73 |
-
display: none;
|
74 |
-
margin: 0 auto;
|
75 |
-
}
|
76 |
-
.mf-input-wrapper .mf-input-help{
|
77 |
-
display: block;
|
78 |
-
font-size: 0.9em;
|
79 |
-
margin-top: 5px;
|
80 |
-
opacity: 0.7;
|
81 |
-
clear: both;
|
82 |
-
font-weight: 400;
|
83 |
-
}
|
84 |
-
.mf-input-wrapper .mf-input{
|
85 |
-
width: 100%;
|
86 |
-
padding: 12px;
|
87 |
-
height: auto;
|
88 |
-
border-width: 1px;
|
89 |
-
border-style: solid;
|
90 |
-
border-color: #eaeaea;
|
91 |
-
border-radius: 2px;
|
92 |
-
background: #fafafa;
|
93 |
-
box-shadow: none;
|
94 |
-
box-sizing: border-box;
|
95 |
-
transition: all .2s linear;
|
96 |
-
background-color: transparent;
|
97 |
-
font-size: 14px;
|
98 |
-
}
|
99 |
-
.mf-input-wrapper .mf-input::placeholder {
|
100 |
-
color: #c9c1c1;
|
101 |
-
font-weight: 400;
|
102 |
-
font-size: 14px;
|
103 |
-
}
|
104 |
-
.mf-input-wrapper .mf-input::-webkit-input-placeholder {
|
105 |
-
color: #c9c1c1;
|
106 |
-
font-weight: 400;
|
107 |
-
font-size: 14px;
|
108 |
-
}
|
109 |
-
.mf-input-wrapper .mf-input:-moz-placeholder {
|
110 |
-
color: #c9c1c1;
|
111 |
-
font-weight: 400;
|
112 |
-
font-size: 14px;
|
113 |
-
}
|
114 |
-
.mf-input-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered{
|
115 |
-
font-size: 14px;
|
116 |
-
}
|
117 |
-
.mf-input-wrapper .mf-input-label{
|
118 |
-
font-family: "Roboto", Sans-serif;
|
119 |
-
font-weight: 600;
|
120 |
-
font-size: 14px;
|
121 |
-
display: block;
|
122 |
-
color: #000000;
|
123 |
-
font-size: 14px;
|
124 |
-
line-height: 16px;
|
125 |
-
margin-bottom: 5px;
|
126 |
-
}
|
127 |
-
.mf-input-wrapper .mf-input-label,
|
128 |
-
.mf-input-wrapper .mf-input{
|
129 |
-
vertical-align: middle;
|
130 |
-
}
|
131 |
-
.mf-input-required-indicator{
|
132 |
-
color: #FF0000;
|
133 |
-
}
|
134 |
-
|
135 |
-
div.mf-input-wrapper > textarea.mf-input {
|
136 |
-
padding: 15px;
|
137 |
-
}
|
138 |
-
|
139 |
-
.irs--round .irs-min, .irs--round .irs-max{
|
140 |
-
display: none;
|
141 |
-
}
|
142 |
-
.irs--round .irs-handle{
|
143 |
-
cursor: pointer;
|
144 |
-
}
|
145 |
-
.mf-checkbox-option input[type="checkbox"]{
|
146 |
-
display: none;
|
147 |
-
}
|
148 |
-
.mf-checkbox-option input[type="checkbox"] + span:before {
|
149 |
-
content: "\f096";
|
150 |
-
font-family: fontawesome !important;
|
151 |
-
display: inline-block;
|
152 |
-
border: none;
|
153 |
-
font-size: 18px;
|
154 |
-
color: #5F7BFF;
|
155 |
-
font-weight: normal;
|
156 |
-
width: 25px;
|
157 |
-
line-height: 1;
|
158 |
-
top: 2px;
|
159 |
-
position: relative;
|
160 |
-
}
|
161 |
-
.mf-checkbox-option input[type="checkbox"] + span{
|
162 |
-
font-weight: 400;
|
163 |
-
font-size: 14px;
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
.mf-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
font-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
-
|
215 |
-
-
|
216 |
-
-
|
217 |
-
appearance: none;
|
218 |
-
|
219 |
-
|
220 |
-
border-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
border-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
border: none;
|
258 |
-
border-
|
259 |
-
border:
|
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 |
-
margin:
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
border-
|
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 |
-
.mf-input-wrapper .asRange .asRange-
|
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 |
-
|
453 |
-
|
|
|
|
|
454 |
}
|
1 |
+
#elementor .mf-btn-wraper a.metform-btn {
|
2 |
+
background: #337ab7;
|
3 |
+
color: #ffffff;
|
4 |
+
border-radius: 5px;
|
5 |
+
height: 20%;
|
6 |
+
font-size: 16px;
|
7 |
+
padding: 10px;
|
8 |
+
}
|
9 |
+
|
10 |
+
.mf-input-switch-control {
|
11 |
+
position: relative;
|
12 |
+
display: inline-block;
|
13 |
+
}
|
14 |
+
.mf-input-control {
|
15 |
+
position: absolute;
|
16 |
+
z-index: -1;
|
17 |
+
opacity: 0;
|
18 |
+
}
|
19 |
+
.mf-input-switch .mf-input-control-label::before {
|
20 |
+
position: static;
|
21 |
+
display: block;
|
22 |
+
width: 32px;
|
23 |
+
height: 18px;
|
24 |
+
pointer-events: none;
|
25 |
+
content: "";
|
26 |
+
background-color: #fff;
|
27 |
+
border: #adb5bd solid 1px;
|
28 |
+
border-radius: 50px;
|
29 |
+
left: 0;
|
30 |
+
transition: all .4s;
|
31 |
+
}
|
32 |
+
|
33 |
+
.metform-msg {
|
34 |
+
margin: 0;
|
35 |
+
padding: 10px;
|
36 |
+
max-width: 100%;
|
37 |
+
}
|
38 |
+
.elementor-editor-active.single-metform-form .metform-msg {
|
39 |
+
display: block;
|
40 |
+
}
|
41 |
+
.mf-input-control-label::before, .custom-file-label, .custom-select {
|
42 |
+
transition: background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
43 |
+
}
|
44 |
+
.mf-input-control-label::after {
|
45 |
+
position: absolute;
|
46 |
+
top: 2px;
|
47 |
+
left: 2px;
|
48 |
+
display: block;
|
49 |
+
width: 14px;
|
50 |
+
height: 14px;
|
51 |
+
content: "";
|
52 |
+
background-color: #adb5bd;
|
53 |
+
border-radius: 100px;
|
54 |
+
transition: all .4s;
|
55 |
+
}
|
56 |
+
|
57 |
+
.mf-input-switch label.mf-input-control-label {
|
58 |
+
display: inline-block;
|
59 |
+
position: relative;
|
60 |
+
}
|
61 |
+
|
62 |
+
.mf-input-control:checked~.mf-input-control-label::before {
|
63 |
+
color: #fff;
|
64 |
+
border-color: #007bff;
|
65 |
+
background-color: #007bff;
|
66 |
+
}
|
67 |
+
.mf-input-switch .mf-input-control:checked~.mf-input-control-label::after {
|
68 |
+
background-color: #fff;
|
69 |
+
right: 2px;
|
70 |
+
left: inherit;
|
71 |
+
}
|
72 |
+
.metform-msg{
|
73 |
+
display: none;
|
74 |
+
margin: 0 auto;
|
75 |
+
}
|
76 |
+
.mf-input-wrapper .mf-input-help{
|
77 |
+
display: block;
|
78 |
+
font-size: 0.9em;
|
79 |
+
margin-top: 5px;
|
80 |
+
opacity: 0.7;
|
81 |
+
clear: both;
|
82 |
+
font-weight: 400;
|
83 |
+
}
|
84 |
+
.mf-input-wrapper .mf-input{
|
85 |
+
width: 100%;
|
86 |
+
padding: 12px;
|
87 |
+
height: auto;
|
88 |
+
border-width: 1px;
|
89 |
+
border-style: solid;
|
90 |
+
border-color: #eaeaea;
|
91 |
+
border-radius: 2px;
|
92 |
+
background: #fafafa;
|
93 |
+
box-shadow: none;
|
94 |
+
box-sizing: border-box;
|
95 |
+
transition: all .2s linear;
|
96 |
+
background-color: transparent;
|
97 |
+
font-size: 14px;
|
98 |
+
}
|
99 |
+
.mf-input-wrapper .mf-input::placeholder {
|
100 |
+
color: #c9c1c1;
|
101 |
+
font-weight: 400;
|
102 |
+
font-size: 14px;
|
103 |
+
}
|
104 |
+
.mf-input-wrapper .mf-input::-webkit-input-placeholder {
|
105 |
+
color: #c9c1c1;
|
106 |
+
font-weight: 400;
|
107 |
+
font-size: 14px;
|
108 |
+
}
|
109 |
+
.mf-input-wrapper .mf-input:-moz-placeholder {
|
110 |
+
color: #c9c1c1;
|
111 |
+
font-weight: 400;
|
112 |
+
font-size: 14px;
|
113 |
+
}
|
114 |
+
.mf-input-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered{
|
115 |
+
font-size: 14px;
|
116 |
+
}
|
117 |
+
.mf-input-wrapper .mf-input-label{
|
118 |
+
font-family: "Roboto", Sans-serif;
|
119 |
+
font-weight: 600;
|
120 |
+
font-size: 14px;
|
121 |
+
display: block;
|
122 |
+
color: #000000;
|
123 |
+
font-size: 14px;
|
124 |
+
line-height: 16px;
|
125 |
+
margin-bottom: 5px;
|
126 |
+
}
|
127 |
+
.mf-input-wrapper .mf-input-label,
|
128 |
+
.mf-input-wrapper .mf-input{
|
129 |
+
vertical-align: middle;
|
130 |
+
}
|
131 |
+
.mf-input-required-indicator{
|
132 |
+
color: #FF0000;
|
133 |
+
}
|
134 |
+
|
135 |
+
div.mf-input-wrapper > textarea.mf-input {
|
136 |
+
padding: 15px;
|
137 |
+
}
|
138 |
+
|
139 |
+
.irs--round .irs-min, .irs--round .irs-max{
|
140 |
+
display: none;
|
141 |
+
}
|
142 |
+
.irs--round .irs-handle{
|
143 |
+
cursor: pointer;
|
144 |
+
}
|
145 |
+
.mf-checkbox-option input[type="checkbox"]{
|
146 |
+
display: none;
|
147 |
+
}
|
148 |
+
.mf-checkbox-option input[type="checkbox"] + span:before {
|
149 |
+
content: "\f096";
|
150 |
+
font-family: fontawesome !important;
|
151 |
+
display: inline-block;
|
152 |
+
border: none;
|
153 |
+
font-size: 18px;
|
154 |
+
color: #5F7BFF;
|
155 |
+
font-weight: normal;
|
156 |
+
width: 25px;
|
157 |
+
line-height: 1;
|
158 |
+
top: 2px;
|
159 |
+
position: relative;
|
160 |
+
}
|
161 |
+
.mf-checkbox-option input[type="checkbox"] + span{
|
162 |
+
font-weight: 400;
|
163 |
+
font-size: 14px;
|
164 |
+
cursor: pointer;
|
165 |
+
}
|
166 |
+
.mf-checkbox-option input[type="checkbox"]:checked + span:before {
|
167 |
+
content: "\f14a";
|
168 |
+
font-family: fontawesome !important;
|
169 |
+
display: inline-block;
|
170 |
+
border: none;
|
171 |
+
font-size: 18px;
|
172 |
+
color: #5F7BFF;
|
173 |
+
}
|
174 |
+
|
175 |
+
.mf-radio-option input[type="radio"]{
|
176 |
+
display: none;
|
177 |
+
}
|
178 |
+
.mf-radio-option,
|
179 |
+
.mf-checkbox-option {
|
180 |
+
padding-right: 15px;
|
181 |
+
}
|
182 |
+
|
183 |
+
.mf-radio-option input[type="radio"] + span:before {
|
184 |
+
content: "\f10c";
|
185 |
+
font-family: fontawesome !important;
|
186 |
+
display: inline-block;
|
187 |
+
border: none;
|
188 |
+
font-size: 18px;
|
189 |
+
color: #5F7BFF;
|
190 |
+
font-weight: normal;
|
191 |
+
width: 25px;
|
192 |
+
line-height: 1;
|
193 |
+
top: 2px;
|
194 |
+
position: relative;
|
195 |
+
}
|
196 |
+
.mf-radio-option input[type="radio"] + span{
|
197 |
+
font-weight: 400;
|
198 |
+
font-size: 14px;
|
199 |
+
cursor: pointer;
|
200 |
+
}
|
201 |
+
.mf-radio-option input[type="radio"]:checked + span:before {
|
202 |
+
content: "\f058";
|
203 |
+
font-family: fontawesome !important;
|
204 |
+
display: inline-block;
|
205 |
+
border: none;
|
206 |
+
font-size: 18px;
|
207 |
+
color: #5F7BFF;
|
208 |
+
}
|
209 |
+
|
210 |
+
/* Select */
|
211 |
+
.mf-input-wrapper select.mf-input-dropdown {
|
212 |
+
border: none;
|
213 |
+
padding: 15px 25px;
|
214 |
+
font-size: 15px;
|
215 |
+
font-weight: 500 !important;
|
216 |
+
-webkit-appearance: none;
|
217 |
+
-moz-appearance: none;
|
218 |
+
-o-appearance: none;
|
219 |
+
appearance: none;
|
220 |
+
border-width: 1px;
|
221 |
+
border-style: solid;
|
222 |
+
border-color: #eaeaea;
|
223 |
+
}
|
224 |
+
.mf-input-wrapper select.mf-input-dropdown option {
|
225 |
+
background-color: #fff;
|
226 |
+
color: #222222;
|
227 |
+
font-size: 15px;
|
228 |
+
}
|
229 |
+
|
230 |
+
.mf-input-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
|
231 |
+
line-height: 1.8;
|
232 |
+
}
|
233 |
+
.mf-input-wrapper .span.selection{
|
234 |
+
overflow: hidden;
|
235 |
+
}
|
236 |
+
.mf-input-wrapper .select2-container--default .select2-selection--single {
|
237 |
+
display: inline-block;
|
238 |
+
width: 100%;
|
239 |
+
height: auto;
|
240 |
+
border-color: #eaeaea;
|
241 |
+
padding: 7px 8px;
|
242 |
+
border-radius: 0;
|
243 |
+
background-color: transparent;
|
244 |
+
}
|
245 |
+
.mf-input-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow {
|
246 |
+
height: 26px;
|
247 |
+
position: absolute;
|
248 |
+
top: 50%;
|
249 |
+
right: 10px;
|
250 |
+
width: 20px;
|
251 |
+
transform: translateY(-50%);
|
252 |
+
}
|
253 |
+
.mf-input-wrapper ul.select2-results__options .select2-results__option {
|
254 |
+
background-color: #fff;
|
255 |
+
padding: 10px 15px;
|
256 |
+
font-size: 15px;
|
257 |
+
border-top: none !important;
|
258 |
+
border-left: none;
|
259 |
+
border: none;
|
260 |
+
border-color: transparent;
|
261 |
+
border: 1px solid #eaeaea;
|
262 |
+
}
|
263 |
+
|
264 |
+
.mf-input-wrapper .select2-container--default ul.select2-results__options .select2-results__option[aria-selected=true] {
|
265 |
+
background-color: #F0F0F0;
|
266 |
+
color: #333
|
267 |
+
}
|
268 |
+
.mf-input-wrapper .select2-search--dropdown{
|
269 |
+
padding: 0;
|
270 |
+
}
|
271 |
+
.mf-input-wrapper .select2-container--default .select2-selection--multiple,
|
272 |
+
.mf-input-wrapper .select2-container--default.select2-container--focus .select2-selection--multiple {
|
273 |
+
border: none;
|
274 |
+
padding: 0;
|
275 |
+
background: transparent;
|
276 |
+
}
|
277 |
+
.mf-input-wrapper .select2-container .select2-selection--multiple .select2-selection__rendered {
|
278 |
+
display: inline-block;
|
279 |
+
overflow: hidden;
|
280 |
+
padding-left: 8px;
|
281 |
+
text-overflow: ellipsis;
|
282 |
+
white-space: nowrap;
|
283 |
+
border: 1px solid #eaeaea;
|
284 |
+
padding: 5px !important;
|
285 |
+
}
|
286 |
+
.mf-input-wrapper .select2-container--default .select2-selection--multiple .select2-selection__choice {
|
287 |
+
background-color: #eaeaea;
|
288 |
+
border: 1px solid #eaeaea;
|
289 |
+
border-radius: 4px;
|
290 |
+
cursor: default;
|
291 |
+
float: left;
|
292 |
+
margin-right: 5px;
|
293 |
+
margin-top: 5px;
|
294 |
+
padding: 0 5px;
|
295 |
+
margin: 0;
|
296 |
+
margin-right: 5px;
|
297 |
+
}
|
298 |
+
.mf-input-wrapper .select2-dropdown{
|
299 |
+
border: none;
|
300 |
+
}
|
301 |
+
.mf-input-wrapper .select2-container .select2-selection--multiple{
|
302 |
+
min-height: inherit;
|
303 |
+
line-height: inherit;
|
304 |
+
}
|
305 |
+
.mf-input-wrapper .select2-container{
|
306 |
+
box-shadow: none !important;
|
307 |
+
}
|
308 |
+
.select2-container--default .select2-results>.select2-results__options {
|
309 |
+
border-bottom: none !important;
|
310 |
+
border-left: none !important;
|
311 |
+
border-right: none !important;
|
312 |
+
}
|
313 |
+
.mf-input-switch-control.mf-input-switch.mf-input {
|
314 |
+
box-shadow: none !important;
|
315 |
+
vertical-align: -webkit-baseline-middle;
|
316 |
+
border: none;
|
317 |
+
padding: 0;
|
318 |
+
}
|
319 |
+
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
320 |
+
border: 1px solid #eaeaea;
|
321 |
+
}
|
322 |
+
.mf-input-wrapper ul.select2-results__options .select2-results__option:hover {
|
323 |
+
background-color: #F0F0F0;
|
324 |
+
}
|
325 |
+
.select2-results__options{
|
326 |
+
border-top: 1px solid #eaeaea;
|
327 |
+
}
|
328 |
+
.mf-input-wrapper .range-slider {
|
329 |
+
display: inline-block;
|
330 |
+
width: 100%;
|
331 |
+
}
|
332 |
+
.mf-input-wrapper .flatpickr-calendar {
|
333 |
+
bottom: -288px !important;
|
334 |
+
top: inherit !important;
|
335 |
+
left: 0 !important;
|
336 |
+
}
|
337 |
+
.mf-input-wrapper .flatpickr-calendar.hasTime.noCalendar {
|
338 |
+
bottom: -50px !important;
|
339 |
+
top: inherit !important;
|
340 |
+
left: 0 !important;
|
341 |
+
}
|
342 |
+
.mf-input-wrapper .asRange {
|
343 |
+
width: 100%;
|
344 |
+
background-color: #F1F4F9;
|
345 |
+
}
|
346 |
+
.mf-input-wrapper .asRange .asRange-pointer:before,
|
347 |
+
.mf-input-wrapper .asRange .asRange-pointer .asRange-tip:before,
|
348 |
+
.mf-input-wrapper .asRange .asRange-selected {
|
349 |
+
background-color: #1FB787;
|
350 |
+
}
|
351 |
+
.mf-input-wrapper .asRange .asRange-pointer .asRange-tip {
|
352 |
+
background-color: #1FB787;
|
353 |
+
border: 1px solid #1FB787;
|
354 |
+
top: inherit;
|
355 |
+
bottom: 18px;
|
356 |
+
left: -50%;
|
357 |
+
margin-left: 8px;
|
358 |
+
transform: translateX(-50%);
|
359 |
+
}
|
360 |
+
.metform-btn {
|
361 |
+
background-color: #007bff;
|
362 |
+
border: none;
|
363 |
+
box-shadow: none;
|
364 |
+
display: inline-block;
|
365 |
+
padding: 16px 40px;
|
366 |
+
font-size: 16px;
|
367 |
+
border-radius: 2px;
|
368 |
+
cursor: pointer;
|
369 |
+
}
|
370 |
+
|
371 |
+
.mf-input-wrapper ul.mf-input-rating {
|
372 |
+
list-style-type: none;
|
373 |
+
padding: 0;
|
374 |
+
margin: 0px;
|
375 |
+
-moz-user-select: none;
|
376 |
+
-webkit-user-select: none;
|
377 |
+
min-height: 28px;
|
378 |
+
display: inline-block;
|
379 |
+
vertical-align: middle;
|
380 |
+
}
|
381 |
+
.mf-input-wrapper ul.mf-input-rating li.star{
|
382 |
+
display: inline-block;
|
383 |
+
line-height: 17px;
|
384 |
+
cursor: pointer;
|
385 |
+
}
|
386 |
+
.mf-input-wrapper .iti{
|
387 |
+
display: block;
|
388 |
+
}
|
389 |
+
.mf-input-wrapper > .iti{
|
390 |
+
display: inline-block;
|
391 |
+
width: 100%;
|
392 |
+
}
|
393 |
+
|
394 |
+
.mf-input-wrapper .iti .mf-input{
|
395 |
+
width: 100% !important;
|
396 |
+
}
|
397 |
+
.mf-input-wrapper .iti--separate-dial-code .iti__selected-flag {
|
398 |
+
background-color: #f7f6f6;
|
399 |
+
}
|
400 |
+
.mf-input-wrapper .iti .iti__flag-container{
|
401 |
+
display: none;
|
402 |
+
}
|
403 |
+
.mf-input-wrapper .iti > .iti__flag-container{
|
404 |
+
display: block;
|
405 |
+
}
|
406 |
+
/* HIDE RADIO */
|
407 |
+
.mf-image-select-input,
|
408 |
+
.mf-toggle-select-input {
|
409 |
+
position: absolute;
|
410 |
+
opacity: 0;
|
411 |
+
width: 0;
|
412 |
+
height: 0;
|
413 |
+
}
|
414 |
+
|
415 |
+
/* IMAGE STYLES */
|
416 |
+
.mf-image-select-input + img,
|
417 |
+
.mf-toggle-select-input + p {
|
418 |
+
cursor: pointer;
|
419 |
+
}
|
420 |
+
|
421 |
+
.flatpickr-calendar {
|
422 |
+
margin-bottom: -8px;
|
423 |
+
}
|
424 |
+
|
425 |
+
.flatpickr-month {
|
426 |
+
margin-top: 3px;
|
427 |
+
margin-bottom: 5px;
|
428 |
+
}
|
429 |
+
|
430 |
+
ul.mf-input.mf-input-rating{
|
431 |
+
border: none;
|
432 |
+
}
|
433 |
+
.mf-input-file-upload{
|
434 |
+
width: .1px;
|
435 |
+
height: .1px;
|
436 |
+
opacity: 0;
|
437 |
+
visibility: hidden;
|
438 |
+
position: absolute;
|
439 |
+
}
|
440 |
+
.mf-input-file-upload-label {
|
441 |
+
color: #fff;
|
442 |
+
padding: 5px 15px;
|
443 |
+
display: inline-flex;
|
444 |
+
align-items: center;
|
445 |
+
}
|
446 |
+
.mf-input-file-upload-label i{
|
447 |
+
font-size: 18px;
|
448 |
+
}
|
449 |
+
.mf-input-file-upload-label svg {
|
450 |
+
max-width: 18px;
|
451 |
+
height: auto;
|
452 |
+
vertical-align: middle;
|
453 |
+
}
|
454 |
+
.mf-file-name span{
|
455 |
+
display: inline-block
|
456 |
}
|
{libs → public}/assets/fonts/FontAwesome.otf
RENAMED
File without changes
|
{libs → public}/assets/fonts/fontawesome-webfont.eot
RENAMED
File without changes
|
{libs → public}/assets/fonts/fontawesome-webfont.svg
RENAMED
File without changes
|
{libs → public}/assets/fonts/fontawesome-webfont.ttf
RENAMED
File without changes
|
{libs → public}/assets/fonts/fontawesome-webfont.woff
RENAMED
File without changes
|
{libs → public}/assets/fonts/fontawesome-webfont.woff2
RENAMED
File without changes
|
{libs → public}/assets/img/edit_icon.svg
RENAMED
File without changes
|
{libs → public}/assets/img/elementor-edit-logo.png
RENAMED
File without changes
|
{libs → public}/assets/img/flags.png
RENAMED
File without changes
|
{libs → public}/assets/img/flags@2x.png
RENAMED
File without changes
|
public/assets/js/admin-entry-script.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready(function(e){var t=e("#metform-formlist");e("#post-query-submit").before(t.html()),t.remove(),e(".row-actions .edit a, .page-title-action").html("view")});
|
public/assets/js/admin-script.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready(function(e){"use strict";function t(t){if(e(".mf-form-user-confirmation").hide(),e(".mf-form-admin-notification").hide(),e(".mf-input-rest-api-group").hide(),e(".mf-mailchimp").hide(),e(".mf-zapier").hide(),e(".mf-slack").hide(),e(".mf-recaptcha").hide(),""!=t.form_title){e(".mf-form-modalinput-title").val(t.form_title),e(".mf-form-modalinput-success_message").val(t.success_message),e(".mf-form-modalinput-redirect_to").val(t.redirect_to),e(".mf-form-modalinput-limit_total_entries").val(t.limit_total_entries);var i=e(".mf-form-modalinput-store_entries");"1"==t.store_entries?i.attr("checked",!0):i.removeAttr("checked");var a=e(".mf-form-modalinput-hide_form_after_submission");"1"==t.hide_form_after_submission?a.attr("checked",!0):a.removeAttr("checked");var m=e(".mf-form-modalinput-require_login");"1"==t.require_login?m.attr("checked",!0):m.removeAttr("checked");var r=e(".mf-form-modalinput-limit_status");"1"==t.limit_total_entries_status?r.attr("checked",!0):r.removeAttr("checked");var o=e(".mf-form-modalinput-multiple_submission");"1"==t.multiple_submission?o.attr("checked",!0):o.removeAttr("checked");var s=e(".mf-form-modalinput-enable_recaptcha");"1"==t.enable_recaptcha?s.attr("checked",!0):s.removeAttr("checked");var n=e(".mf-form-modalinput-capture_user_browser_data");"1"==t.capture_user_browser_data?(n.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):n.removeAttr("checked"),e(".mf-form-user-email-subject").val(t.user_email_subject),e(".mf-form-user-email-from").val(t.user_email_from),e(".mf-form-user-reply-to").val(t.user_email_reply_to),e(".mf-form-user-email-body").val(t.user_email_body);var c=e(".mf-form-user-enable");"1"==t.enable_user_notification?(c.attr("checked",!0),e(".mf-form-user-confirmation").show()):(c.removeAttr("checked"),e(".mf-form-user-confirmation").hide());var f=e(".mf-form-user-submission-copy");"1"==t.user_email_attach_submission_copy?f.attr("checked",!0):f.removeAttr("checked"),e(".mf-form-admin-email-subject").val(t.admin_email_subject),e(".mf-form-admin-email-from").val(t.admin_email_from),e(".mf-form-admin-email-to").val(t.admin_email_to),e(".mf-form-admin-reply-to").val(t.admin_email_reply_to),e(".mf-form-admin-email-body").val(t.admin_email_body);var d=e(".mf-form-admin-enable");"1"==t.enable_admin_notification?(d.attr("checked",!0),e(".mf-form-admin-notification").show()):(d.removeAttr("checked"),e(".mf-form-admin-notification").hide());var l=e(".mf-form-admin-submission-copy");"1"==t.admin_email_attach_submission_copy?l.attr("checked",!0):l.removeAttr("checked");var u=e(".mf-form-modalinput-rest_api");"1"==t.mf_rest_api?(u.attr("checked",!0),e(".mf-rest-api").show()):(u.removeAttr("checked"),e(".mf-rest-api").hide());var h=e(".mf-form-modalinput-mail_chimp");"1"==t.mf_mail_chimp?(h.attr("checked",!0),e(".mf-mailchimp").show()):(h.removeAttr("checked"),e(".mf-mailchimp").hide());var _=e(".mf-form-modalinput-zapier");"1"==t.mf_zapier?(_.attr("checked",!0),e(".mf-zapier").show()):(_.removeAttr("checked",!0),e(".mf-zapier").hide());var p=e(".mf-form-modalinput-slack");"1"==t.mf_slack?(p.attr("checked",!0),e(".mf-slack").show()):(p.removeAttr("checked",!0),e(".mf-slack").hide());var v=e(".mf-form-modalinput-recaptcha");"1"==t.mf_recaptcha?(v.attr("checked",!0),e(".mf-recaptcha").show()):v.removeAttr("checked");var k=t.mf_rest_api_method&&t.mf_rest_api_method.length?t.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+k+'"]').prop("selected",!0),e(".mf-rest-api-url").val(t.mf_rest_api_url),e(".mf-mailchimp-api-key").val(t.mf_mailchimp_api_key),e(".mf-mailchimp-list-id").val(t.mf_mailchimp_list_id),e(".mf-zapier-web-hook").val(t.mf_zapier_webhook),e(".mf-slack-web-hook").val(t.mf_slack_webhook),e(".mf-recaptcha-site-key").val(t.mf_recaptcha_site_key),e(".mf-recaptcha-secret-key").val(t.mf_recaptcha_secret_key),e("input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api").trigger("change")}}e(".row-actions .edit a, .page-title-action, .metform-form-edit-btn, body.post-type-metform-form a.row-title").on("click",function(i){i.preventDefault();var a=0,m=e("#metform_form_modal"),r=e(this).parents(".column-title"),o=e("body").attr("data-metform-template-key");if(m.addClass("loading"),m.modal("show"),r.length>0){a=e(this).attr("data-metform-form-id"),"undefined"!==o&&(a=o),a=void 0!==a?a:r.find(".hidden").attr("id").split("_")[1];var s=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get/"+a,type:"get",headers:{"X-WP-Nonce":s},dataType:"json",success:function(e){t(e),m.removeClass("loading")}})}else{t({form_title:e(".mf-form-modalinput-title").attr("data-default-value"),admin_email_body:"",admin_email_from:"",admin_email_reply_to:"",admin_email_subject:"",capture_user_browser_data:"",enable_admin_notification:"",limit_total_entries_status:"",limit_total_entries:"0",redirect_to:"",require_login:"",store_entries:"1",success_message:e(".mf-form-modalinput-success_message").attr("data-default-value"),user_email_body:"",user_email_from:"",user_email_reply_to:"",user_email_subject:""}),m.removeClass("loading")}m.find("form").attr("data-mf-id",a)}),e(".metform-form-save-btn-editor").on("click",function(){e(".metform-form-save-btn-editor").attr("disabled",!0);var t=e("#metform-form-modalinput-settings");t.attr("data-open-editor","1"),t.trigger("submit")}),e("#metform-form-modalinput-settings").on("submit",function(t){t.preventDefault();var i=e("#metform-form-modal");i.addClass("loading"),e(".metform-form-save-btn-editor").attr("disabled",!0),e(".metform-form-save-btn").attr("disabled",!0);var a=e(this).serialize(),m=e(this).attr("data-mf-id"),r=e(this).attr("data-open-editor"),o=e(this).attr("data-editor-url"),s=e(this).attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/update/"+m,type:"post",data:a,headers:{"X-WP-Nonce":s},dataType:"json",success:function(t){e("#message").css("display","block"),1==t.saved?(e("#post-"+t.data.id).find(".row-title").html(t.data.title),e("#message").removeClass("attr-alert-warning").addClass("attr-alert-success").html(t.status)):e("#message").removeClass("attr-alert-success").addClass("attr-alert-warning").html(t.status),setTimeout(function(){e("#message").css("display","none")},5e3),i.removeClass("loading"),"1"==r?setTimeout(function(){window.location.href=o+"?post="+t.data.id+"&action=elementor"},1500):"0"!=m?(e(".metform-form-save-btn-editor").removeAttr("disabled"),e(".metform-form-save-btn").removeAttr("disabled")):"0"==m&&setTimeout(function(){location.reload()},1500)}})}),e("input.mf-form-modalinput-limit_status").on("change",function(){e(this).is(":checked")?e("#limit_status").find("input").removeAttr("disabled"):e(this).is(":not(:checked)")&&e("#limit_status").find("input").attr("disabled","disabled")}),e("input.mf-form-user-enable").on("change",function(){e(this).is(":checked")?e(".mf-form-user-confirmation").show():e(this).is(":not(:checked)")&&e(".mf-form-user-confirmation").hide()}),e("input.mf-form-admin-enable").on("change",function(){e(this).is(":checked")?e(".mf-form-admin-notification").show():e(this).is(":not(:checked)")&&e(".mf-form-admin-notification").hide()}),e("input.mf-form-modalinput-rest_api").on("change",function(){e(this).is(":checked")?e(".mf-input-rest-api-group").show():e(this).is(":not(:checked)")&&e(".mf-input-rest-api-group").hide()}),e("input.mf-form-modalinput-mail_chimp").on("change",function(){e(this).is(":checked")?e(".mf-mailchimp").show():e(this).is(":not(:checked)")&&e(".mf-mailchimp").hide()}),e("input.mf-form-modalinput-zapier").on("change",function(){e(this).is(":checked")?e(".mf-zapier").show():e(this).is(":not(:checked)")&&e(".mf-zapier").hide()}),e("input.mf-form-modalinput-slack").on("change",function(){e(this).is(":checked")?e(".mf-slack").show():e(this).is(":not(:checked)")&&e(".mf-slack").hide()}),e("input.mf-form-modalinput-recaptcha").on("change",function(){e(this).is(":checked")?e(".mf-recaptcha").show():e(this).is(":not(:checked)")&&e(".mf-recaptcha").hide()}),e("input.mf-form-modalinput-capture_user_browser_data").click(function(){e(this).is(":checked")?(e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):e(this).is(":not(:checked)")&&(e("#multiple_submission").removeClass("show_input"),e("#multiple_submission").addClass("hide_input"))})});
|
{libs → public}/assets/js/flatpickr.js
RENAMED
File without changes
|
public/assets/js/inputs.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(t,e){"use strict";var a={init:function(){var n={"mf-range.default":a.RangeInput,"mf-date.default":a.DateInput,"mf-time.default":a.TimeInput,"mf-select.default":a.SelectInput,"mf-multi-select.default":a.MultiSelectInput,"mf-rating.default":a.Rating,"mf-file-upload.default":a.fileUpload};t.each(n,function(t,a){e.hooks.addAction("frontend/element_ready/"+t,a)})},RangeInput:function(e){var a=e.find(".mf-rs-range"),n=a.attr("min"),i=a.attr("max"),r=a.attr("step"),f=a.attr("range"),l={step:r,min:n,max:i};"true"==f&&(l.range=Boolean(f)),a.asRange(l),a.on("asRange::change",function(e){var a=t(this).asRange("get");Array.isArray(a)&&(a=Number(a[1])-Number(a[0])),t(this).val(a).trigger("change")})},DateInput:function(t){var e=t.find(".mf-date-input"),a=e.attr("data-mfMinDate"),n=e.attr("data-mfMaxDate"),i=e.attr("data-mfRangeDate"),r=e.attr("data-mfDateFormat"),f=e.attr("data-mfEnableTime"),l=e.attr("data-mfDisableDates"),d={appendTo:t.find(".mf-input-wrapper").get(0)};"yes"==f&&(d.enableTime=!0,r+=" H:i"),""!=l&&(d.disable=JSON.parse(l)),""!=a&&(d.minDate=a),""!=n&&(d.maxDate=n),"yes"==i&&(d.mode="range"),d.dateFormat=r,e.flatpickr(d)},TimeInput:function(t){var e=t.find(".mf-input-time"),a=e.attr("mftime24h"),n={appendTo:t.find(".mf-input-wrapper").get(0),dateFormat:"h:i K",enableTime:!0,noCalendar:!0};"yes"==a&&(n.dateFormat="H:i",n.time_24hr=!0),e.flatpickr(n)},SelectInput:function(t){t.find("select.mf-input-select").select2({dropdownParent:t.find(".mf-input-wrapper")})},MultiSelectInput:function(t){t.find("select.mf-input-multiselect").select2({dropdownParent:t.find(".mf-input-wrapper")})},Rating:function(e){var a=e.find(".mf-input-rating li");a.on("mouseover",function(){var e=parseInt(t(this).data("value"),10);t(this).parent().children("li.star-li").each(function(a){a<e?t(this).addClass("hover"):t(this).removeClass("hover")})}).on("mouseout",function(){t(this).parent().children("li.star-li").each(function(e){t(this).removeClass("hover")})}),a.on("click",function(){var e=parseInt(t(this).data("value"),10),a=t(this).parent().children("li.star-li");for(let e=0;e<a.length;e++)t(a[e]).removeClass("selected");for(let n=0;n<e;n++)t(a[n]).addClass("selected");t(this).parents().find("input.mf-input-hidden").val(e)})},fileUpload:function(e){e.find(".mf-input-file-upload").on("change",function(){var a=t(this).val().match(/\\([^\\]+)$/)[1];e.find(".mf-file-name span").html(a)})}};t(window).on("elementor/frontend/init",a.init)}(jQuery,window.elementorFrontend);
|
{libs → public}/assets/js/jquery-asRange.min.js
RENAMED
File without changes
|
{libs → public}/assets/js/select2.min.js
RENAMED
File without changes
|
public/assets/js/submission.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var onloadMetFormCallback=function(){jQuery(".recaptcha_site_key").each(function(e){var t=jQuery(this),a=t.parents(".metform-form-content");t.attr("id",t.attr("id")+"_"+e),grecaptcha.render("recaptcha_site_key_"+e,{sitekey:a.data("site-key")})})};jQuery(document).ready(function(e){e(".metform-form-content").submit(function(t){t.preventDefault();var a=e(this);a.find('.mf-input[type="tel"]').each(function(){var t,a=e(this),n=a.val();t=a.siblings(".iti__flag-container").find(".iti__selected-dial-code").text(),a.val(t+n)});var n=a.parent().find(".metform-msg"),s=a.attr("action"),r=new FormData(this),i=a.attr("data-nonce");n.length>1&&a.parent().find(".metform-inx").remove(),e.ajax({url:s,type:"POST",dataType:"JSON",data:r,processData:!1,contentType:!1,headers:{"X-WP-Nonce":i},success:function(t){var s=Number(t.status),r="";e.each(t.error,function(e,t){r+=t+"<br>"}),r.replace(/<br>+$/,""),1==s?(n.css("display","block"),n.removeClass("attr-alert-warning"),n.addClass("attr-alert-success"),n.html(t.data.message),setTimeout(function(){n.css("display","none")},8e3),a.trigger("reset"),a.find(".mf-input-select, .mf-input-multiselect").trigger("change"),a.find(".mf-input > li").removeClass("selected"),a.find(".asRange > .asRange-pointer").css("left","0%"),a.find(".asRange > .asRange-selected").css({left:"0%",width:"0%"})):(n.css("display","block"),n.removeClass("attr-alert-success"),n.addClass("attr-alert-warning"),n.html(r),setTimeout(function(){n.css("display","none")},8e3)),""!=t.data.hide_form&&setTimeout(function(){a.css("display","none")},2e3),""!=t.data.redirect_to&&setTimeout(function(){window.location.replace(t.data.redirect_to)},1500)}})})});
|
{libs → public}/assets/js/ui.min.js
RENAMED
File without changes
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: ataurr, wpmet, emrnco, sayedulsayem
|
|
3 |
Tags: Form builder, Elementor form builder, contact form, custom form, forms, drag & drop form builder
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 1.1.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -90,6 +90,19 @@ You can use MailChimp in your contact form also create MailChimp signup forms wi
|
|
90 |
* File Upload
|
91 |
|
92 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
Version: 1.1.5
|
94 |
3rd party plugin compatibility
|
95 |
Rest API Data submit improvement
|
3 |
Tags: Form builder, Elementor form builder, contact form, custom form, forms, drag & drop form builder
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 1.1.7
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
90 |
* File Upload
|
91 |
|
92 |
== Changelog ==
|
93 |
+
Version: 1.1.7
|
94 |
+
Fixed notice removal button
|
95 |
+
Update form-picker-editor.js
|
96 |
+
Update style.css
|
97 |
+
Update banner
|
98 |
+
Update config
|
99 |
+
Libs change to public
|
100 |
+
Multiselect change
|
101 |
+
Fixed array ignore validation
|
102 |
+
Update submission.js
|
103 |
+
Fixed select reset after submission
|
104 |
+
|
105 |
+
|
106 |
Version: 1.1.5
|
107 |
3rd party plugin compatibility
|
108 |
Rest API Data submit improvement
|
traits/common-controls.php
CHANGED
@@ -100,7 +100,7 @@ trait Common_Controls{
|
|
100 |
[
|
101 |
'label' => esc_html__( 'Place holder', 'metform' ),
|
102 |
'type' => Controls_Manager::TEXT,
|
103 |
-
'default' =>
|
104 |
'title' => esc_html__( 'Enter here place holder', 'metform' ),
|
105 |
]
|
106 |
);
|
@@ -154,11 +154,11 @@ trait Common_Controls{
|
|
154 |
);
|
155 |
}
|
156 |
|
157 |
-
if( in_array('CHAR_WORD', $param) ){
|
158 |
$this->add_control(
|
159 |
-
'
|
160 |
[
|
161 |
-
'label' => esc_html__( '
|
162 |
'type' => Controls_Manager::SELECT,
|
163 |
'default' => 'none',
|
164 |
'options' => [
|
@@ -170,6 +170,19 @@ trait Common_Controls{
|
|
170 |
);
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
// $this->add_control(
|
175 |
// 'mf_input_readonly_status',
|
100 |
[
|
101 |
'label' => esc_html__( 'Place holder', 'metform' ),
|
102 |
'type' => Controls_Manager::TEXT,
|
103 |
+
'default' => $this->get_title(),
|
104 |
'title' => esc_html__( 'Enter here place holder', 'metform' ),
|
105 |
]
|
106 |
);
|
154 |
);
|
155 |
}
|
156 |
|
157 |
+
if( in_array('CHAR_WORD', $param ) ){
|
158 |
$this->add_control(
|
159 |
+
'mf_input_length_type',
|
160 |
[
|
161 |
+
'label' => esc_html__( 'Length type', 'metform' ),
|
162 |
'type' => Controls_Manager::SELECT,
|
163 |
'default' => 'none',
|
164 |
'options' => [
|
170 |
);
|
171 |
}
|
172 |
|
173 |
+
if( in_array('EXPRESSION', $param ) && (class_exists('\MetForm_Pro\Base\Package')) ){
|
174 |
+
|
175 |
+
$this->add_control(
|
176 |
+
'mf_input_validation_expression',
|
177 |
+
[
|
178 |
+
'label' => esc_html__( 'Expression for validate ', 'metform' ),
|
179 |
+
'type' => Controls_Manager::TEXTAREA,
|
180 |
+
'rows' => 2,
|
181 |
+
'placeholder' => esc_html__( 'Ex: [a-zA-Z]+ ', 'metform' ),
|
182 |
+
]
|
183 |
+
);
|
184 |
+
}
|
185 |
+
|
186 |
|
187 |
// $this->add_control(
|
188 |
// 'mf_input_readonly_status',
|
utils/banner.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(!class_exists('WpMet_Banner')){
|
4 |
+
class WpMet_Banner{
|
5 |
+
public static $instance = null;
|
6 |
+
|
7 |
+
public $key;
|
8 |
+
public $api;
|
9 |
+
public $data;
|
10 |
+
public $last_check;
|
11 |
+
public $check_interval;
|
12 |
+
|
13 |
+
public $plugin_pages;
|
14 |
+
|
15 |
+
function __construct(){
|
16 |
+
if(!is_admin()){
|
17 |
+
return false;
|
18 |
+
}
|
19 |
+
|
20 |
+
$this->key = 'wpmet_banner';
|
21 |
+
$this->api = 'https://api.wpmet.com/public/banner/';
|
22 |
+
$this->check_interval = (3600 * 24); // 1day
|
23 |
+
$this->get_banner();
|
24 |
+
|
25 |
+
$this->plugin_pages = [
|
26 |
+
'edit-elementskit_template',
|
27 |
+
'toplevel_page_elementskit'
|
28 |
+
];
|
29 |
+
|
30 |
+
if(isset($this->data->plugin_pages) && !empty($this->data->plugin_pages)){
|
31 |
+
$this->show_banner($this->data->plugin_pages);
|
32 |
+
}
|
33 |
+
|
34 |
+
if(isset($this->data->all_pages) && !empty($this->data->all_pages)){
|
35 |
+
$this->show_banner($this->data->all_pages);
|
36 |
+
}
|
37 |
+
|
38 |
+
add_action('admin_footer', [$this, 'style']);
|
39 |
+
}
|
40 |
+
|
41 |
+
private function get_banner(){
|
42 |
+
$this->data = get_option('__data');
|
43 |
+
$this->data = $this->data == '' ? [] : $this->data;
|
44 |
+
|
45 |
+
$this->last_check = get_option('__last_check');
|
46 |
+
$this->last_check = $this->last_check == '' ? 0 : $this->last_check;
|
47 |
+
|
48 |
+
if(($this->check_interval + $this->last_check) < time()){
|
49 |
+
$response = wp_remote_get( $this->api,
|
50 |
+
array(
|
51 |
+
'timeout' => 10,
|
52 |
+
'httpversion' => '1.1',
|
53 |
+
)
|
54 |
+
);
|
55 |
+
|
56 |
+
if(!is_wp_error($response) && isset($response['body']) && $response['body'] != ''){
|
57 |
+
$this->data = json_decode($response['body']);
|
58 |
+
|
59 |
+
update_option('__last_check', time());
|
60 |
+
update_option('__data', $this->data);
|
61 |
+
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
|
68 |
+
public function show_banner($banner){
|
69 |
+
if($banner->start <= time() && time() <= $banner->end){
|
70 |
+
$screen = get_current_screen();
|
71 |
+
|
72 |
+
if($banner->slug == 'all_pages'|| in_array($screen->id, $this->plugin_pages)){
|
73 |
+
$contents = '<a target="_blank" class="wpmet-banner-href" href="'.$banner->url.'"><img src="'.$banner->image.'" /></a>';
|
74 |
+
|
75 |
+
\MetForm\Utils\Notice::push(
|
76 |
+
[
|
77 |
+
'id' => 'wpmet-banner-' . $banner->slug,
|
78 |
+
'type' => 'banner',
|
79 |
+
'class' => 'wpmet-banner-container',
|
80 |
+
'dismissible' => true,
|
81 |
+
'message' => $contents
|
82 |
+
]
|
83 |
+
);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
|
89 |
+
public function style(){
|
90 |
+
?>
|
91 |
+
<style>
|
92 |
+
.wpmet-banner-container{
|
93 |
+
background: none!important;
|
94 |
+
border: 0!important;
|
95 |
+
box-shadow: none!important;
|
96 |
+
padding: 0!important;
|
97 |
+
}
|
98 |
+
.wpmet-banner-href{
|
99 |
+
text-align: center;
|
100 |
+
display: block;
|
101 |
+
}
|
102 |
+
.wpmet-banner-href img{
|
103 |
+
width: 100%;
|
104 |
+
max-width: 1400px;
|
105 |
+
}
|
106 |
+
</style>
|
107 |
+
<?php
|
108 |
+
}
|
109 |
+
|
110 |
+
public static function run() {
|
111 |
+
if ( is_null( self::$instance ) ) {
|
112 |
+
self::$instance = new self();
|
113 |
+
}
|
114 |
+
|
115 |
+
return self::$instance;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
utils/notice.php
CHANGED
@@ -32,9 +32,9 @@ class Notice {
|
|
32 |
*/
|
33 |
public function dismiss() {
|
34 |
|
35 |
-
$id = ( isset( $_POST['id'] ) ) ?
|
36 |
$time = ( isset( $_POST['time'] ) ) ? sanitize_text_field($_POST['time']) : '';
|
37 |
-
$meta = ( isset( $_POST['meta'] ) ) ?
|
38 |
|
39 |
// Valid inputs?
|
40 |
if ( ! empty( $id ) ) {
|
@@ -62,7 +62,7 @@ class Notice {
|
|
62 |
<script>
|
63 |
jQuery(document).ready(function ($) {
|
64 |
$( '.metform-notice.is-dismissible' ).on( 'click', '.notice-dismiss', function() {
|
65 |
-
_this = $( this ).parents( '.metform-
|
66 |
var id = _this.attr( 'id' ) || '';
|
67 |
var time = _this.attr( 'dismissible-time' ) || '';
|
68 |
var meta = _this.attr( 'dismissible-meta' ) || '';
|
@@ -98,7 +98,7 @@ class Notice {
|
|
98 |
'type' => 'info',
|
99 |
'show_if' => true,
|
100 |
'message' => '',
|
101 |
-
'class' => 'metform-
|
102 |
'dismissible' => false,
|
103 |
'btn' => [],
|
104 |
'dismissible-meta' => 'user',
|
@@ -179,6 +179,4 @@ class Notice {
|
|
179 |
</div>
|
180 |
<?php
|
181 |
}
|
182 |
-
}
|
183 |
-
|
184 |
-
new Notice();
|
32 |
*/
|
33 |
public function dismiss() {
|
34 |
|
35 |
+
$id = ( isset( $_POST['id'] ) ) ? sanitize_text_field($_POST['id']) : '';
|
36 |
$time = ( isset( $_POST['time'] ) ) ? sanitize_text_field($_POST['time']) : '';
|
37 |
+
$meta = ( isset( $_POST['meta'] ) ) ? sanitize_text_field($_POST['meta']) : '';
|
38 |
|
39 |
// Valid inputs?
|
40 |
if ( ! empty( $id ) ) {
|
62 |
<script>
|
63 |
jQuery(document).ready(function ($) {
|
64 |
$( '.metform-notice.is-dismissible' ).on( 'click', '.notice-dismiss', function() {
|
65 |
+
_this = $( this ).parents( '.metform-notice' );
|
66 |
var id = _this.attr( 'id' ) || '';
|
67 |
var time = _this.attr( 'dismissible-time' ) || '';
|
68 |
var meta = _this.attr( 'dismissible-meta' ) || '';
|
98 |
'type' => 'info',
|
99 |
'show_if' => true,
|
100 |
'message' => '',
|
101 |
+
'class' => 'metform-notice',
|
102 |
'dismissible' => false,
|
103 |
'btn' => [],
|
104 |
'dismissible-meta' => 'user',
|
179 |
</div>
|
180 |
<?php
|
181 |
}
|
182 |
+
}
|
|
|
|
widgets/email/email.php
CHANGED
@@ -49,7 +49,7 @@ Class MetForm_Input_Email extends widget_base{
|
|
49 |
]
|
50 |
);
|
51 |
|
52 |
-
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
@@ -122,7 +122,8 @@ Class MetForm_Input_Email extends widget_base{
|
|
122 |
$validation = [
|
123 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
124 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
125 |
-
'
|
|
|
126 |
];
|
127 |
|
128 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
49 |
]
|
50 |
);
|
51 |
|
52 |
+
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD', 'EXPRESSION']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
122 |
$validation = [
|
123 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
124 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
125 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
126 |
+
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
127 |
];
|
128 |
|
129 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
widgets/listing-fname/listing-fname.php
CHANGED
@@ -49,7 +49,7 @@ Class MetForm_Input_Listing_Fname extends Widget_Base{
|
|
49 |
]
|
50 |
);
|
51 |
|
52 |
-
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
@@ -121,7 +121,8 @@ Class MetForm_Input_Listing_Fname extends Widget_Base{
|
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
-
'
|
|
|
125 |
];
|
126 |
|
127 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
49 |
]
|
50 |
);
|
51 |
|
52 |
+
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD', 'EXPRESSION']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
125 |
+
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
126 |
];
|
127 |
|
128 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
widgets/listing-lname/listing-lname.php
CHANGED
@@ -49,7 +49,7 @@ Class MetForm_Input_Listing_Lname extends Widget_Base{
|
|
49 |
]
|
50 |
);
|
51 |
|
52 |
-
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
@@ -121,7 +121,8 @@ Class MetForm_Input_Listing_Lname extends Widget_Base{
|
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
-
'
|
|
|
125 |
];
|
126 |
|
127 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
49 |
]
|
50 |
);
|
51 |
|
52 |
+
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD', 'EXPRESSION']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
125 |
+
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
126 |
];
|
127 |
|
128 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
widgets/number/number.php
CHANGED
@@ -120,7 +120,7 @@ Class MetForm_Input_Number extends Widget_Base{
|
|
120 |
$validation = [
|
121 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
122 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
123 |
-
'
|
124 |
];
|
125 |
|
126 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
120 |
$validation = [
|
121 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
122 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
123 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
124 |
];
|
125 |
|
126 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
widgets/password/password.php
CHANGED
@@ -49,7 +49,7 @@ Class MetForm_Input_Password extends Widget_Base{
|
|
49 |
]
|
50 |
);
|
51 |
|
52 |
-
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
@@ -121,7 +121,8 @@ Class MetForm_Input_Password extends Widget_Base{
|
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
-
'
|
|
|
125 |
];
|
126 |
|
127 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
49 |
]
|
50 |
);
|
51 |
|
52 |
+
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD', 'EXPRESSION']);
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
125 |
+
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
126 |
];
|
127 |
|
128 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
widgets/text/text.php
CHANGED
@@ -49,17 +49,7 @@ Class MetForm_Input_Text extends Widget_Base{
|
|
49 |
]
|
50 |
);
|
51 |
|
52 |
-
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD']);
|
53 |
-
|
54 |
-
$this->add_control(
|
55 |
-
'mf_input_validation_expression',
|
56 |
-
[
|
57 |
-
'label' => esc_html__( 'Expression for validate ', 'metform' ),
|
58 |
-
'type' => Controls_Manager::TEXTAREA,
|
59 |
-
'rows' => 2,
|
60 |
-
'placeholder' => esc_html__( 'Enter here regex', 'metform' ),
|
61 |
-
]
|
62 |
-
);
|
63 |
|
64 |
$this->end_controls_section();
|
65 |
|
@@ -131,7 +121,7 @@ Class MetForm_Input_Text extends Widget_Base{
|
|
131 |
$validation = [
|
132 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
133 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
134 |
-
'
|
135 |
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
136 |
];
|
137 |
|
49 |
]
|
50 |
);
|
51 |
|
52 |
+
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD', 'EXPRESSION']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
$this->end_controls_section();
|
55 |
|
121 |
$validation = [
|
122 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
123 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
124 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
125 |
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
126 |
];
|
127 |
|
widgets/textarea/textarea.php
CHANGED
@@ -50,7 +50,7 @@ Class MetForm_Input_Textarea extends Widget_Base{
|
|
50 |
]
|
51 |
);
|
52 |
|
53 |
-
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD']);
|
54 |
|
55 |
$this->end_controls_section();
|
56 |
|
@@ -145,7 +145,8 @@ Class MetForm_Input_Textarea extends Widget_Base{
|
|
145 |
$validation = [
|
146 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
147 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
148 |
-
'
|
|
|
149 |
];
|
150 |
|
151 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
50 |
]
|
51 |
);
|
52 |
|
53 |
+
$this->input_setting_controls(['MAX_MIN', 'CHAR_WORD', 'EXPRESSION']);
|
54 |
|
55 |
$this->end_controls_section();
|
56 |
|
145 |
$validation = [
|
146 |
'min_length' => isset($mf_input_min_length) ? $mf_input_min_length : '',
|
147 |
'max_length' => isset($mf_input_max_length) ? $mf_input_max_length : '',
|
148 |
+
'length_type' => isset($mf_input_length_type) ? $mf_input_length_type : '',
|
149 |
+
'expression' => isset($mf_input_validation_expression) ? $mf_input_validation_expression : '',
|
150 |
];
|
151 |
|
152 |
$class = (isset($settings['mf_conditional_logic_form_list']) ? 'mf-conditional-input' : '');
|
widgets/url/url.php
CHANGED
@@ -38,7 +38,7 @@ Class MetForm_Input_Url extends Widget_Base{
|
|
38 |
]
|
39 |
);
|
40 |
|
41 |
-
$this->input_content_controls(
|
42 |
|
43 |
$this->end_controls_section();
|
44 |
|
@@ -120,8 +120,8 @@ Class MetForm_Input_Url extends Widget_Base{
|
|
120 |
}
|
121 |
?>
|
122 |
<input type="url" class="mf-input" id="mf-input-url-<?php echo esc_attr($this->get_id()); ?>"
|
123 |
-
value="http://"
|
124 |
name="<?php echo esc_attr($mf_input_name); ?>"
|
|
|
125 |
<?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
|
126 |
<?php //echo esc_attr($mf_input_readonly_status); ?>
|
127 |
>
|
38 |
]
|
39 |
);
|
40 |
|
41 |
+
$this->input_content_controls();
|
42 |
|
43 |
$this->end_controls_section();
|
44 |
|
120 |
}
|
121 |
?>
|
122 |
<input type="url" class="mf-input" id="mf-input-url-<?php echo esc_attr($this->get_id()); ?>"
|
|
|
123 |
name="<?php echo esc_attr($mf_input_name); ?>"
|
124 |
+
placeholder="<?php echo esc_html($mf_input_placeholder); ?>"
|
125 |
<?php echo esc_attr(($mf_input_required === 'yes') ? 'required' : '')?>
|
126 |
<?php //echo esc_attr($mf_input_readonly_status); ?>
|
127 |
>
|