Contact Form7 Widget For Elementor Page Builder - Version 1.1.0

Version Description

  • New: Add and Edit contact form without leaving elementor dashboard.
Download this release

Release Info

Developer voidthemes
Plugin Icon 128x128 Contact Form7 Widget For Elementor Page Builder
Version 1.1.0
Comparing to
See all releases

Code changes from version 1.0.9 to 1.1.0

assets/css/void-cf7-admin.css CHANGED
@@ -1,20 +1,85 @@
1
- /* void cf7 admin css */
2
-
3
- .void-cf7-review{
4
- background : #FFFFFF ;
5
- padding : 10px;
6
- margin-top : 40px;
7
- margin-bottom: 10px;
8
- line-height: 1.5;
9
- font-size: 16px;
10
- border-left: 5px solid #006799;
11
- -webkit-box-shadow: 1px 1px 1px 1px #d3d3d3;
12
- box-shadow: 1px 1px 1px 1px #d3d3d3;
13
- }
14
- .void-cf7-review-btn{
15
- padding-top: 5px;
16
- }
17
- .void-cf7-review-done{
18
- float: right;
19
- text-decoration: none;
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* void cf7 admin css */
2
+
3
+ .void-cf7-review{
4
+ background : #FFFFFF ;
5
+ padding : 10px;
6
+ margin-top : 40px;
7
+ margin-bottom: 10px;
8
+ line-height: 1.5;
9
+ font-size: 16px;
10
+ border-left: 5px solid #006799;
11
+ -webkit-box-shadow: 1px 1px 1px 1px #d3d3d3;
12
+ box-shadow: 1px 1px 1px 1px #d3d3d3;
13
+ }
14
+ .void-cf7-review-btn{
15
+ padding-top: 5px;
16
+ }
17
+ .void-cf7-review-done{
18
+ float: right;
19
+ text-decoration: none;
20
+ }
21
+
22
+ /* notice css start */
23
+ .void-query-promotion-notice{
24
+ background: linear-gradient(to right, #4E40F1 0%, #ffccff 100%);
25
+ border-left-color: linear-gradient(to bottom, #3F2BE2 20%, #0066ff 45%);
26
+ }
27
+ .void-query-promotion-notice .notice-dismiss:before{
28
+ font-size: 22px;
29
+ }
30
+ .void-query-message-inner {
31
+ display: flex;
32
+ -webkit-box-align: center;
33
+ align-items: center;
34
+ }
35
+ .void-query-message-icon,
36
+ .void-query-message-icon > img{
37
+ max-height: 200px;
38
+ width: auto;
39
+ }
40
+ .void-query-message-content{
41
+ padding: 0 20px;
42
+ }
43
+ .void-query-message-content p{
44
+ padding: 0;
45
+ margin: 0;
46
+ font-size: 14px;
47
+ color: #000;
48
+ }
49
+ .void-query-message-action{
50
+ text-align: center;
51
+ display: flex;
52
+ -webkit-box-orient: vertical;
53
+ -webkit-box-direction: normal;
54
+ flex-direction: column;
55
+ margin-left: auto;
56
+ }
57
+ .void-query-message-action .void-query-button{
58
+ background-color: #d30c5c;
59
+ color: #fff;
60
+ border-color: #7c1337;
61
+ -webkit-box-shadow: 0 1px 0 #7c1337;
62
+ box-shadow: 0 1px 0 #7c1337;
63
+ padding: 10px 60px;
64
+ height: auto;
65
+ line-height: 20px;
66
+ text-transform: capitalize;
67
+ text-decoration: none;
68
+ border-radius: 5px;
69
+ margin: 5px;
70
+ font-size: 16px;
71
+ }
72
+ .void-query-message-action .void-query-button:hover{
73
+ font-size: 18px;
74
+ }
75
+
76
+ .void-query-message-action .void-query-never-show{
77
+ color: #D0A7FB;
78
+ margin: 20px 20px 0 20px;
79
+ }
80
+
81
+ .void-query-message-action .void-query-never-show:hover{
82
+ color: #D0A7FB;
83
+ }
84
+
85
+ /* notice css end */
assets/js/void-cf7-admin.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+ // Hook into the "void-query-promotion-notice" class we added to the notice, so
3
+ // Only listen to YOUR notices being dismissed
4
+ var elNotice = $('.void-query-promotion-notice');
5
+
6
+ $( document ).on( 'click', '.void-query-promotion-notice .notice-dismiss', function () {
7
+ // Read the "data-notice" information to track which notice
8
+ // is being dismissed and send it via AJAX
9
+ var type = $( this ).closest( '.void-query-promotion-notice' ).data( 'notice' );
10
+ var nonce = $( this ).closest( '.void-query-promotion-notice' ).data( 'nonce' );
11
+
12
+ //elNotice.hide();
13
+ console.log('cross button click');
14
+
15
+ // Make an AJAX call
16
+ // Since WP 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
17
+ $.ajax({
18
+ // url of ajax request, value of voidCf7Admin.ajaxUrl is localized during enqueue script
19
+ url: ajaxurl,
20
+ type: 'POST',
21
+ data: {
22
+ action: 'dismissed_promotional_notice_handler',
23
+ type: type,
24
+ status: 'remind-me-later',
25
+ },
26
+ // wp verify nonce automatically after sending nonce like this
27
+ headers: {
28
+ 'X-WP-Nonce': nonce
29
+ },
30
+ dataType: 'json',
31
+ });
32
+ });
33
+
34
+ elNotice.find( '.void-query-never-show' ).on( 'click', function (e) {
35
+ e.preventDefault();
36
+ // Read the "data-notice" information to track which notice
37
+ // is being dismissed and send it via AJAX
38
+ var type = $( this ).closest( '.void-query-promotion-notice' ).data( 'notice' );
39
+ var nonce = $( this ).closest( '.void-query-promotion-notice' ).data( 'nonce' );
40
+
41
+ elNotice.hide();
42
+
43
+ // console.log('never click');
44
+
45
+ // Make an AJAX call
46
+ // Since WP 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
47
+ $.ajax({
48
+ // url of ajax request, value of voidCf7Admin.ajaxUrl is localized during enqueue script
49
+ url: ajaxurl,
50
+ type: 'POST',
51
+ data: {
52
+ action: 'dismissed_promotional_notice_handler',
53
+ type: type,
54
+ status: 'never-show',
55
+ },
56
+ // wp verify nonce automatically after sending nonce like this
57
+ headers: {
58
+ 'X-WP-Nonce': nonce
59
+ },
60
+ dataType: 'json',
61
+ });
62
+ });
63
+
64
+ })(jQuery);
assets/screenshot-01.png ADDED
Binary file
assets/screenshot-02.png ADDED
Binary file
assets/{screenshot-1.jpg → screenshot-03.jpg} RENAMED
File without changes
assets/{screenshot-3.jpg → screenshot-04.jpg} RENAMED
File without changes
assets/screenshot-2.jpg DELETED
Binary file
custom-editor/assets/css/void-cf7-elementor-editor.css ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* The Modal (background) */
2
+
3
+ #cf7_widget_elementor_contact_form_control_modal {
4
+ display: none; /* Hidden by default */
5
+ position: fixed; /* Stay in place */
6
+ z-index: 999; /* Sit on top */
7
+ padding-top: 50px; /* Location of the box */
8
+ left: 0;
9
+ top: 0;
10
+ width: 100%; /* Full width */
11
+ height: 100%; /* Full height */
12
+ overflow: auto; /* Enable scroll if needed */
13
+ background-color: rgb(0,0,0); /* Fallback color */
14
+ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
15
+ right: 0;
16
+ bottom: 0;
17
+ }
18
+
19
+ /* Modal Content */
20
+ .cf7-widget-elementor-modal-content {
21
+ background-color: #fefefe;
22
+ margin: auto;
23
+ padding: 0px;
24
+ border: 1px solid #888;
25
+ width: 90%;
26
+ height: 90%;
27
+ overflow: hidden;
28
+ border-radius: 8px;
29
+ position: relative;
30
+ }
31
+ .cf7-widget-elementor-modal-iframe{
32
+ width: 100%;
33
+ height: 100%;
34
+ }
35
+
36
+ /* The Close Button */
37
+ .cf7-widget-elementor-modal-close {
38
+ float: right;
39
+ font-size: 24px;
40
+ font-weight: bold;
41
+ background: #000;
42
+ border-radius: 50%;
43
+ height: 25px;
44
+ width: 25px;
45
+ padding: 0 0 5px 6px;
46
+ color: #ffffff;
47
+ position: absolute;
48
+ z-index: 1;
49
+ right: 0px;
50
+ }
51
+
52
+ .cf7-widget-elementor-modal-close:hover,
53
+ .cf7-widget-elementor-modal-close:focus {
54
+ color: rgb(248, 241, 241);
55
+ text-decoration: none;
56
+ cursor: pointer;
57
+ font-size: 26px;
58
+ }
59
+
60
+ .cf7-widget-elementor-modal-hide-adminmenu{
61
+ display: none;
62
+ }
63
+
64
+ /* loader start*/
65
+
66
+ .cf7-widget-elementor-modal-content-loader.loading {
67
+ position: absolute;
68
+ left: 50%;
69
+ top: 50%;
70
+ z-index: 1;
71
+ width: 150px;
72
+ height: 150px;
73
+ margin: -75px 0 0 -75px;
74
+ border: 16px solid #f3f3f3;
75
+ border-radius: 50%;
76
+ border-top: 16px solid #3498db;
77
+ width: 120px;
78
+ height: 120px;
79
+ -webkit-animation: spin 2s linear infinite;
80
+ animation: spin 2s linear infinite;
81
+ }
82
+
83
+ @-webkit-keyframes spin {
84
+ 0% { -webkit-transform: rotate(0deg); }
85
+ 100% { -webkit-transform: rotate(360deg); }
86
+ }
87
+
88
+ @keyframes spin {
89
+ 0% { transform: rotate(0deg); }
90
+ 100% { transform: rotate(360deg); }
91
+ }
92
+
93
+ /* Add animation to "page content" */
94
+ .animate-bottom {
95
+ position: relative;
96
+ -webkit-animation-name: animatebottom;
97
+ -webkit-animation-duration: 1s;
98
+ animation-name: animatebottom;
99
+ animation-duration: 1s
100
+ }
101
+
102
+ @-webkit-keyframes animatebottom {
103
+ from { bottom:-100px; opacity:0 }
104
+ to { bottom:0px; opacity:1 }
105
+ }
106
+
107
+ @keyframes animatebottom {
108
+ from{ bottom:-100px; opacity:0 }
109
+ to{ bottom:0; opacity:1 }
110
+ }
111
+
112
+ /* loader end */
custom-editor/assets/js/void-cf7-elementor-editor.js ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+ // declare some global variable to avaoid multiple searching on DOM
3
+ var formId;
4
+ var windowParent = window.parent;
5
+ var modal, modalContainer, close, iframe;
6
+ // initialization function, some selector and variable initialize on first load
7
+ var initializeFormInfo = function( $scope, $ ) {
8
+ // form wrapper element
9
+ let elForm = $scope.find( '.void-cf7-form-widget-wrapper' );
10
+ // current selected form by attr of form mark up
11
+ formId = elForm.data('void-cf7-contact-form-id');
12
+ // modal elementor selector
13
+ modal = windowParent.jQuery('#cf7_widget_elementor_contact_form_control_modal');
14
+ modalContainer = modal.find('.cf7-widget-elementor-modal-content');
15
+ modalLoading = modal.find('.cf7-widget-elementor-modal-content-loader');
16
+ close = modal.find('.cf7-widget-elementor-modal-close');
17
+ iframe = modal.find('.cf7-widget-elementor-modal-iframe');
18
+ };
19
+
20
+ // elementor edit panel call back function from hook
21
+ var addEditActionFunction = function (panel, model, view) {
22
+ // form edit button element selector
23
+ let $elementEdit = panel.$el.find( '.void-cf7-edit-form-btn' ).find( '#void-cf7-edit-form-btn' );
24
+ // elementor update preview button selector
25
+ var elUpdatePreviewButton = panel.$el.find('.elementor-update-preview');
26
+ // hide button from edit panel
27
+ elUpdatePreviewButton.hide();
28
+ // form edit button click event function
29
+ $elementEdit.on('click', function(e){
30
+ e.preventDefault();
31
+ // loader add on modal
32
+ modalLoading.addClass('loading');
33
+ // insert src in iframe with edit link of selected form
34
+ iframe.attr('src', voidCf7Admin.url+'admin.php?page=wpcf7&post='+formId+'&action=edit');
35
+ // set opacity 0 to hide iframe untill it's load contents, opacity will be 1 after it's load content from modal-editor.php scripts
36
+ iframe.css('opacity', 0);
37
+ // open modal with contact form edit url
38
+ modal.show();
39
+ // modal close button click event
40
+ close.on('click', function(){
41
+ // reload frondend panel to show updated data
42
+ elUpdatePreviewButton.find('.elementor-update-preview-button').trigger('click');
43
+ // modal modal after completed all the tasks
44
+ modal.fadeOut(500);
45
+ });
46
+ });
47
+
48
+ // form add new button element selector
49
+ let $elementAdd = panel.$el.find( '.void-cf7-add-form-btn' ).find( '#void-cf7-add-form-btn' );
50
+ // form add new button click event function
51
+ $elementAdd.on('click', function(e){
52
+ e.preventDefault();
53
+ // loader add on modal
54
+ modalLoading.addClass('loading');
55
+ // insert src in iframe with edit link of selected form
56
+ iframe.attr('src', voidCf7Admin.url+'admin.php?page=wpcf7-new');
57
+ // set opacity 0 to hide iframe untill it's load contents, opacity will be 1 after it's load content from modal-editor.php scripts
58
+ iframe.css('opacity', 0);
59
+ // open modal with contact form add new url
60
+ modal.show();
61
+ // modal close button click event
62
+ close.on('click', function(){
63
+ // element selector of form selector select2 from panel to avoid multiple search on DOM
64
+ var elCf7 = panel.$el.find('[data-setting="cf7"]');
65
+ // ajax request to admin-ajax for getting all contact form 7 from database
66
+ $.ajax({
67
+ // url of ajax request, value of voidCf7Admin.ajaxUrl is localized during enqueue script
68
+ url: voidCf7Admin.ajaxUrl,
69
+ type: 'POST',
70
+ data: {
71
+ action: 'void_cf7_data'
72
+ },
73
+ // wp verify nonce automatically after sending nonce like this
74
+ headers: {
75
+ 'X-WP-Nonce': voidCf7Admin.wpRestNonce
76
+ },
77
+ dataType: 'json',
78
+ // success function of ajax request
79
+ success: function (output) {
80
+ // clear corrent option from form select select2
81
+ elCf7.empty();
82
+ // running loop by all from data after gettings it from ajax request
83
+ $.each(output, function(index, value){
84
+ // add option to form select select2 with new created from
85
+ elCf7.append('<option value="'+index+'">'+value+'</option>');
86
+ });
87
+ //set already selected value
88
+ elCf7.val( model.attributes.settings.attributes.cf7);
89
+
90
+ // disable select2 of form select if there was no data
91
+ if( elCf7.has('option').length == 0 ) {
92
+ elCf7.attr('disabled', 'disabled');
93
+ }else{
94
+ elCf7.removeAttr('disabled');
95
+ }
96
+ },
97
+ // error function of ajax request
98
+ error: function (e) {
99
+ console.log(e);
100
+ },
101
+ });
102
+ // hide after completed all the actions
103
+ modal.fadeOut(500);
104
+ });
105
+ });
106
+ };
107
+
108
+ // inilialization of js hook on elementor frondend and editor panel
109
+ $(window).on('elementor/frontend/init', function () {
110
+
111
+ // call the initialization function after loading elementor editor
112
+ elementorFrontend.hooks.addAction( 'frontend/element_ready/void-section-cf7.default', initializeFormInfo);
113
+
114
+ // call the the functionality of add, edit form when elementor editor panel is open for edit
115
+ elementor.hooks.addAction('panel/open_editor/widget/void-section-cf7', addEditActionFunction);
116
+
117
+ });
118
+
119
+ })(jQuery);
custom-editor/init.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function void_cf7_elementor_js_load(){
4
+ wp_enqueue_script( 'void-cf7-elementor-js', plugins_url('assets/js/void-cf7-elementor-editor.js', __FILE__ ), array('jquery'), '1.0.0', true );
5
+ wp_localize_script('void-cf7-elementor-js', 'voidCf7Admin',
6
+ [
7
+ 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
8
+ 'url' => get_admin_url(),
9
+ 'wpRestNonce' => wp_create_nonce('wp_rest'),
10
+ ]
11
+ );
12
+ }
13
+
14
+ add_action( 'elementor/frontend/before_enqueue_scripts', 'void_cf7_elementor_js_load');
15
+
16
+ function void_cf7_elementor_css_load(){
17
+ wp_enqueue_style( 'void-cf7-elementor-css', plugins_url('assets/css/void-cf7-elementor-editor.css', __FILE__ ), [], '1.0.0' );
18
+ }
19
+
20
+ add_action( 'elementor/frontend/before_enqueue_styles', 'void_cf7_elementor_css_load');
21
+
22
+ function load_custom_editor_modal(){
23
+ wp_enqueue_style( 'void-cf7-elementor-css', plugins_url('assets/css/void-cf7-elementor-editor.css', __FILE__ ), [], '1.0.0' );
24
+ ?>
25
+ <div class="void-cf7-custom-editor-modal">
26
+ <?php include 'modal-editor.php'; ?>
27
+ </div>
28
+ <?php
29
+ }
30
+
31
+ add_action('elementor/editor/after_enqueue_styles', 'load_custom_editor_modal' );
custom-editor/modal-editor.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- The Modal -->
2
+ <div id="cf7_widget_elementor_contact_form_control_modal" class="cf7_widget_elementor_contact_form_control_modal" style="display: none;">
3
+
4
+ <!-- Modal content -->
5
+ <div class="cf7-widget-elementor-modal-content">
6
+ <div class="cf7-widget-elementor-modal-content-loader loading"></div>
7
+ <span class="cf7-widget-elementor-modal-close">&times;</span>
8
+ <!-- iframe to open contact form edit or add functionality -->
9
+ <iframe style="opacity: 0;" onload="voidCf7IframeOnLoad()" class="cf7-widget-elementor-modal-iframe" ></iframe>
10
+ </div>
11
+ </div>
12
+
13
+ <style>
14
+
15
+ </style>
16
+ <script>
17
+ // menu hide wp admin menu function after onload iframe contants
18
+ function voidCf7IframeOnLoad() {
19
+ // select iframe
20
+ var loader = document.getElementsByClassName("cf7-widget-elementor-modal-content-loader");
21
+ var iframe = document.getElementsByClassName("cf7-widget-elementor-modal-iframe");
22
+ iframe[0].style.opacity = 0;
23
+
24
+ // check iframe found
25
+ if(iframe != null && iframe.length > 0){
26
+ // select wpadminbar, wpcontent, wpadmibar, wp-toolbar for modify it
27
+ var adminBar = iframe[0].contentWindow.document.getElementById("wpadminbar");
28
+ var wpToolBar = iframe[0].contentWindow.document.getElementsByClassName("wp-toolbar");
29
+ var adminMenu = iframe[0].contentWindow.document.getElementById("adminmenumain");
30
+ var wpContent = iframe[0].contentWindow.document.getElementById("wpcontent");
31
+ var addNewButton = iframe[0].contentWindow.document.querySelectorAll('a.page-title-action');
32
+
33
+ // remove add new button on editor
34
+ if(addNewButton != null && addNewButton.length > 0){
35
+ addNewButton[0].style.display = "none";
36
+ }
37
+ // wp admin bar hide
38
+ if(adminBar != null){
39
+ adminBar.style.display = "none";
40
+ }
41
+
42
+ // wp toolbar padding top remove
43
+ if(wpToolBar !=null && wpToolBar.length > 0){
44
+ wpToolBar[0].style.paddingTop = '0px';
45
+ }
46
+
47
+ // wp admin menu hide
48
+ if(adminMenu != null){
49
+ adminMenu.style.display = "none";
50
+ }
51
+
52
+ // wp content margin left hide
53
+ if(wpContent != null){
54
+ wpContent.style.marginLeft = "0px";
55
+ // loader remove on modal after removing everything
56
+ loader[0].classList.remove("loading");
57
+ }
58
+
59
+ // set opacity 1 to show iframe after hiding all the wp bars
60
+ iframe[0].style.opacity = 1;
61
+
62
+ // prevent flickering after save form
63
+ var saveButton = iframe[0].contentWindow.document.querySelectorAll('input.button-primary[name=wpcf7-save]');
64
+ saveButton.forEach(function(item, index){
65
+ saveButton[index].onclick = function(){
66
+ iframe[0].style.opacity = 0;
67
+ if(loader != null && loader.length > 0){
68
+ // loader add again on modal
69
+ loader[0].classList.add("loading");
70
+ }
71
+ }
72
+ });
73
+
74
+ // prevent flickering after copy form
75
+ var copyButton = iframe[0].contentWindow.document.querySelectorAll('input.copy.button[name=wpcf7-copy]');
76
+ copyButton.forEach(function(item, index){
77
+ copyButton[index].onclick = function(){
78
+ iframe[0].style.opacity = 0;
79
+ if(loader != null && loader.length > 0){
80
+ // loader add again on modal
81
+ loader[0].classList.add("loading");
82
+ }
83
+ }
84
+ });
85
+
86
+ // prevent flickering after delete form
87
+ var deleteButton = iframe[0].contentWindow.document.querySelectorAll('input.delete.submitdelete[name=wpcf7-delete]');
88
+ deleteButton.forEach(function(item, index){
89
+ deleteButton[index].onclick = function(){
90
+ iframe[0].style.opacity = 0;
91
+ if(loader != null && loader.length > 0){
92
+ // loader add again on modal
93
+ loader[0].classList.remove("loading");
94
+ }
95
+ }
96
+ });
97
+
98
+ }
99
+
100
+ }
101
+
102
+ </script>
helper/helper.php CHANGED
@@ -1,44 +1,82 @@
1
- <?php
2
-
3
- if ( ! function_exists( 'get_contact_form_7_posts' ) ) :
4
-
5
- function get_contact_form_7_posts(){
6
-
7
- $args = array('post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1);
8
-
9
- $catlist=[];
10
-
11
- if( $categories = get_posts($args)){
12
- foreach ( $categories as $category ) {
13
- (int)$catlist[$category->ID] = $category->post_title;
14
- }
15
- }
16
- else{
17
- (int)$catlist['0'] = esc_html__('No contect From 7 form found', 'void');
18
- }
19
- return $catlist;
20
- }
21
-
22
- endif;
23
-
24
- if ( ! function_exists( 'void_get_all_pages' ) ) :
25
-
26
- function void_get_all_pages(){
27
-
28
- $args = array('post_type' => 'page', 'posts_per_page' => -1);
29
-
30
- $catlist=[];
31
-
32
- if( $categories = get_posts($args)){
33
- foreach ( $categories as $category ) {
34
- (int)$catlist[$category->ID] = $category->post_title;
35
- }
36
- }
37
- else{
38
- (int)$catlist['0'] = esc_html__('No Pages Found!', 'void');
39
- }
40
- return $catlist;
41
- }
42
-
43
- endif;
44
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! function_exists( 'get_contact_form_7_posts' ) ) :
4
+ function get_contact_form_7_posts(){
5
+
6
+ $args = array('post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1);
7
+
8
+ $cf7_form_list=[];
9
+
10
+ if( $cf7_forms = get_posts($args)){
11
+ foreach ( $cf7_forms as $form ) {
12
+ (int)$cf7_form_list[$form->ID] = $form->post_title;
13
+ }
14
+ }
15
+ else{
16
+ (int)$cf7_form_list['0'] = esc_html__('No contect From 7 form found', 'void');
17
+ }
18
+ return $cf7_form_list;
19
+ }
20
+ endif;
21
+
22
+
23
+ // ajax request handler
24
+ if( !function_exists('get_contact_form_7_posts_by_ajax')) {
25
+
26
+ function get_contact_form_7_posts_by_ajax(){
27
+ $cf7_form_list = get_contact_form_7_posts();
28
+ echo json_encode($cf7_form_list);
29
+ wp_die();
30
+ }
31
+
32
+ }
33
+
34
+ //ajax action
35
+ add_action( 'wp_ajax_void_cf7_data', 'get_contact_form_7_posts_by_ajax' );
36
+
37
+
38
+ if ( ! function_exists( 'void_get_all_pages' ) ) :
39
+
40
+ function void_get_all_pages(){
41
+
42
+ $args = array('post_type' => 'page', 'posts_per_page' => -1);
43
+
44
+ $catlist=[];
45
+
46
+ if( $categories = get_posts($args)){
47
+ foreach ( $categories as $category ) {
48
+ (int)$catlist[$category->ID] = $category->post_title;
49
+ }
50
+ }
51
+ else{
52
+ (int)$catlist['0'] = esc_html__('No Pages Found!', 'void');
53
+ }
54
+ return $catlist;
55
+ }
56
+
57
+ endif;
58
+
59
+
60
+ if( !function_exists('promotional_notice_dismiss_handler')){
61
+
62
+ function promotional_notice_dismiss_handler(){
63
+ // Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice)
64
+ $type = $_POST['type'];
65
+
66
+ $status = $_POST['status'];
67
+
68
+ if($status == 'remind-me-later'){
69
+ // Store it in the options table
70
+ update_option( 'dismissed-' . $type . "-at", date('Y-m-d') );
71
+
72
+ }elseif( $status == 'never-show'){
73
+
74
+ update_option( 'dismissed-'. $type . '-never', TRUE );
75
+
76
+ }else{
77
+ update_option( 'dismissed-'. $type . '-never', TRUE );
78
+ }
79
+ }
80
+ }
81
+
82
+ add_action('wp_ajax_dismissed_promotional_notice_handler', 'promotional_notice_dismiss_handler');
plugin.php CHANGED
@@ -1,93 +1,93 @@
1
- <?php
2
- namespace voidelement; //main namespace
3
- use voidelement\Widgets\void_cf7; //path define same as class name of the widget
4
-
5
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
-
7
-
8
- // Add a custom category for panel widgets
9
- add_action( 'elementor/init', function() {
10
- \Elementor\Plugin::$instance->elements_manager->add_category(
11
- 'void-elements', // the name of the category
12
- [
13
- 'title' => esc_html__( 'VOID ELEMENTS', 'void' ),
14
- 'icon' => 'fa fa-header', //default icon
15
- ],
16
- 1 // position
17
- );
18
- } );
19
-
20
-
21
- /**
22
- * Main Plugin Class
23
- *
24
- * Register new elementor widget.
25
- *
26
- * @since 1.0.0
27
- */
28
- class Plugin {
29
-
30
- /**
31
- * Constructor
32
- *
33
- * @since 1.0.0
34
- *
35
- * @access public
36
- */
37
-
38
- public function __construct() {
39
- $this->add_actions();
40
- }
41
-
42
- /**
43
- * Add Actions
44
- *
45
- * @since 1.0.0
46
- *
47
- * @access private
48
- */
49
- private function add_actions() {
50
- add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] );
51
-
52
- }
53
-
54
- /**
55
- * On Widgets Registered
56
- *
57
- * @since 1.0.0
58
- *
59
- * @access public
60
- */
61
- public function on_widgets_registered() {
62
- $this->includes();
63
- $this->register_widget();
64
- }
65
-
66
- /**
67
- * Includes
68
- *
69
- * @since 1.0.0
70
- *
71
- * @access private
72
- */
73
- private function includes() {
74
- $void_cf7= array_map('basename', glob(dirname( __FILE__ ) . '/widgets/*.php'));
75
- require __DIR__ . '/helper/helper.php';
76
- foreach($void_cf7 as $key => $value){
77
- require __DIR__ . '/widgets/'.$value;
78
- }
79
- }
80
-
81
- /**
82
- * Register Widget
83
- *
84
- * @since 1.0.0
85
- *
86
- * @access private
87
- */
88
- private function register_widget() {
89
- \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new void_cf7() );
90
- }
91
- }
92
-
93
- new Plugin();
1
+ <?php
2
+ namespace voidelement; //main namespace
3
+ use voidelement\Widgets\void_cf7; //path define same as class name of the widget
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
+
7
+
8
+ // Add a custom category for panel widgets
9
+ add_action( 'elementor/init', function() {
10
+ \Elementor\Plugin::$instance->elements_manager->add_category(
11
+ 'void-elements', // the name of the category
12
+ [
13
+ 'title' => esc_html__( 'VOID ELEMENTS', 'void' ),
14
+ 'icon' => 'fa fa-header', //default icon
15
+ ],
16
+ 1 // position
17
+ );
18
+ } );
19
+
20
+
21
+ /**
22
+ * Main Plugin Class
23
+ *
24
+ * Register new elementor widget.
25
+ *
26
+ * @since 1.0.0
27
+ */
28
+ class Plugin {
29
+
30
+ /**
31
+ * Constructor
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @access public
36
+ */
37
+
38
+ public function __construct() {
39
+ $this->add_actions();
40
+ }
41
+
42
+ /**
43
+ * Add Actions
44
+ *
45
+ * @since 1.0.0
46
+ *
47
+ * @access private
48
+ */
49
+ private function add_actions() {
50
+ add_action( 'elementor/widgets/widgets_registered', [ $this, 'on_widgets_registered' ] );
51
+
52
+ }
53
+
54
+ /**
55
+ * On Widgets Registered
56
+ *
57
+ * @since 1.0.0
58
+ *
59
+ * @access public
60
+ */
61
+ public function on_widgets_registered() {
62
+ $this->includes();
63
+ $this->register_widget();
64
+ }
65
+
66
+ /**
67
+ * Includes
68
+ *
69
+ * @since 1.0.0
70
+ *
71
+ * @access private
72
+ */
73
+ private function includes() {
74
+ $void_cf7= array_map('basename', glob(dirname( __FILE__ ) . '/widgets/*.php'));
75
+ require __DIR__ . '/helper/helper.php';
76
+ foreach($void_cf7 as $key => $value){
77
+ require __DIR__ . '/widgets/'.$value;
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Register Widget
83
+ *
84
+ * @since 1.0.0
85
+ *
86
+ * @access private
87
+ */
88
+ private function register_widget() {
89
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new void_cf7() );
90
+ }
91
+ }
92
+
93
+ new Plugin();
readme.txt CHANGED
@@ -1,86 +1,98 @@
1
- === Void Contact Form7 Widget For Elementor Page Builder ===
2
- Contributors: voidthemes,voidcoders,soyket,shawon786
3
- Tags: page-builder, elementor, cf7, contact-form-7, contact-form-7 widget, widget, elementor add on, email, contact, form
4
- Requires at least: 4.4
5
- Tested up to: 5.2.2
6
- Stable tag: 1.0.9
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- This WordPress Plugin Adds Contact Form 7 widget element to Elementor page builder for easy drag & drop the created contact forms with CF7 (contact form 7). It also lets you define any page as a thank you / success page after the form has been submitted! You also can add basic custom CSS directly from elementor edit screen now !! If you are a developer who designs sites for clients you will love this because the css panel is developer fridnly as well as noob friendly.
11
-
12
- You must have [Elementor Page Builder](https://wordpress.org/plugins/elementor/) installed.
13
- You must have [Contact form 7](https://wordpress.org/plugins/contact-form-7/) installed and forms created.
14
-
15
- == Description ==
16
-
17
- This plugin adds new element / widget to Elementor Page Builder which helps you to easily drag and drop contact form 7 forms from a drop down list. No need of going in cf7 & copying the shortcode and addding to shortcode widget of elementor anymore !!
18
-
19
- * Now only Drag and drop the widget inside elementor builder & choose your contact form ! Done !
20
- * Want to define style for input, lable, send button, success ? No problem ! This plugin let's you do those directly from elementor screen!
21
- * Want to add custom page to redirect to when the form is submitted ? That is also possible now !
22
- Yet this is just a simple plugin for simple users :)
23
- * What's more interesting is that you can have multiple form of the same single contact form 7 form with different rules and design with this on same page !
24
-
25
- For more details :[VOID CF7 Elementor Widget](https://voidcoders.com/product/contact-form7-widget-for-elementor-free/).
26
- For our other elementor & WP works visit : [VOID CODERS](https://voidcoders.com).
27
- For updates follow us on : [Facebook](https://www.facebook.com/voidcoders).
28
-
29
-
30
- Latest Version Preview
31
- [youtube https://youtu.be/MlzrZ0zXM24]
32
- Older Version Preview
33
- [youtube https://youtu.be/sAHspWvhjNg]
34
-
35
-
36
-
37
- What Does This plugin give you?
38
-
39
- 1. Easy use of contact forms created with Contact form 7 pluing inside elementor live editor
40
- 2. Add Css directly from elementor live preview to your contact form 7 for different field type!!
41
- 3. Add any wordpress page as thank you page with this directly from elementor edit screen when you add the VOID Contact Fom 7 Widget!
42
- 4. Use Single contact form 7 with different Style & redirect rule(Thank you page on success) on the same page with this.
43
-
44
- Note: This plugin is an addon of Elementor Page Builder (https://wordpress.org/plugins/elementor/) and will only work with Elementor Page Builder installed. And your elementor should be up to date to latest version
45
-
46
- == Installation ==
47
-
48
- 1. Upload the plugin folder after extracting it to the "/wp-content/plugins/(the folder of the extracted plugin)" directory, or install the plugin through the WordPress plugins screen directly.
49
- 2. Activate the plugin through the 'Plugins' screen in WordPress
50
- 3. Go to elementor page builder mode and then select our post grid widget and you will see many options when you drag and drop the widget to the live page. To see the real preview in live mode you must click apply button on top to update the layout and finally hit save in elementor and visit your page to see the changes.
51
-
52
-
53
- == Frequently Asked Questions ==
54
-
55
- = Where can to find the new element added =
56
-
57
- Our Contact Form7 Widget For Elementor Page Builder adds a new section in the elementor live page builder named : VOID ELEMENTS. There you will see the widget which you can drag and drop and config settings
58
-
59
-
60
- == Screenshots ==
61
-
62
- 1. /assets/screenshot-1.jpg
63
- 2. /assets/screenshot-2.jpg
64
- 3. /assets/screenshot-3.jpg
65
-
66
-
67
-
68
- == Changelog ==
69
- = 1.0.9 =
70
- * Feature added - External thank you page
71
- = 1.0.6 =
72
- * Css added Number control
73
- * Any post type url from the site for redirect url
74
- = 1.0.5 =
75
- * Css added Hover button
76
- = 1.0.4 =
77
- * Css added for select box
78
- = 1.0.3 =
79
- * CSS Fix
80
- = 1.0.2 =
81
- * Define Any page as thank you page
82
- * More Comporftable Select2 for selecting Contact From
83
- = 1.0.1 =
84
- * Custom CSS Adding option
85
- = 1.0.0 =
86
- * Initial Launch
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Void Contact Form 7 Widget For Elementor Page Builder ===
2
+ Contributors: voidthemes,voidcoders,soyket,shawon786
3
+ Tags: page-builder, elementor, cf7, contact-form-7, contact-form-7 widget, widget, elementor add on, email, contact, form
4
+ Requires at least: 4.4
5
+ Tested up to: 5.4.2
6
+ Stable tag: 1.1.0
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ This WordPress Plugin Adds Contact Form 7 widget element to Elementor page builder for easy drag & drop the created contact forms with CF7 (contact form 7). It also lets you define any page as a thank you / success page / Redirect after the form has been submitted! You also can add basic custom CSS directly from elementor edit screen now !! If you are a developer who designs sites for clients you will love this because the css panel is developer fridnly as well as noob friendly.
11
+
12
+ You must have [Elementor Page Builder](https://wordpress.org/plugins/elementor/) installed.
13
+ You must have [Contact form 7](https://wordpress.org/plugins/contact-form-7/) installed and forms created.
14
+
15
+ == Description ==
16
+
17
+ This plugin adds new element / widget to Elementor Page Builder which helps you to easily drag and drop contact form 7 forms from a drop down list. No need of going in cf7 & copying the shortcode and addding to shortcode widget of elementor anymore !!
18
+
19
+ * Check out our new feature to edit and create contact form from elementor editor. You don't need to leave elementor editor to modify or create contact form 7. boom!
20
+ * Now only Drag and drop the widget inside elementor builder & choose your contact form ! Done !
21
+ * Want to define style for input, lable, send button, success ? No problem ! This plugin let's you do those directly from elementor screen!
22
+ * Want to add custom page to redirect to when the form is submitted ? That is also possible now !
23
+ Yet this is just a simple plugin for simple users :)
24
+ * What's more interesting is that you can have multiple form of the same single contact form 7 form with different rules and design with this on same page !
25
+
26
+ For more details :[VOID CF7 Elementor Widget](https://voidcoders.com/product/contact-form7-widget-for-elementor-free/).
27
+
28
+ For our other elementor & WP works visit : [VOID CODERS](https://voidcoders.com).
29
+
30
+ For updates follow us on : [Facebook](https://www.facebook.com/voidcoders).
31
+
32
+ Follow us on: [Github](https://github.com/soyket/cf7-widget-elementor/).
33
+
34
+ Version 1.1 ( Edit/Add contact from inside Elementor )
35
+ [youtube https://youtu.be/ZI0GMJoESaw]
36
+
37
+ Latest Version Preview
38
+ [youtube https://youtu.be/MlzrZ0zXM24]
39
+
40
+ Older Version Preview
41
+ [youtube https://youtu.be/sAHspWvhjNg]
42
+
43
+
44
+
45
+ What Does This plugin give you?
46
+
47
+ 1. For editing or creating contact form 7, You don't have to leave elementor editor. New popup modal will be open on elementor editor. Edit or create forms on the fly!
48
+ 2. Easy use of contact forms created with Contact form 7 pluing inside elementor live editor
49
+ 3. Add CSS directly from elementor live preview to your contact form 7 for different field type!!
50
+ 4. Add any WordPress page as thank you page with this directly from elementor edit screen when you add the VOID Contact Fom 7 Widget!
51
+ 5. Use Single contact form 7 with different Style & redirect rule(Thank you page on success) on the same page with this.
52
+
53
+ Note: This plugin is an addon of Elementor Page Builder (https://wordpress.org/plugins/elementor/) and will only work with Elementor Page Builder installed along with Contact form 7 plugin.
54
+
55
+ == Installation ==
56
+
57
+ 1. Upload the plugin folder after extracting it to the "/wp-content/plugins/(the folder of the extracted plugin)" directory, or install the plugin through the WordPress plugins screen directly.
58
+ 2. Activate the plugin through the 'Plugins' screen in WordPress
59
+ 3. Go to elementor page builder mode and then select our post grid widget and you will see many options when you drag and drop the widget to the live page. To see the real preview in live mode you must click apply button on top to update the layout and finally hit save in elementor and visit your page to see the changes.
60
+
61
+ == Frequently Asked Questions ==
62
+
63
+ = Where can to find the new element added =
64
+
65
+ Our Contact Form7 Widget For Elementor Page Builder adds a new section in the elementor live page builder named : VOID ELEMENTS. There you will see the widget called -Void Contact form 7- which you can drag and drop and config settings
66
+
67
+
68
+ == Screenshots ==
69
+
70
+ 1. /assets/screenshot-01.png
71
+ 2. /assets/screenshot-02.png
72
+ 3. /assets/screenshot-03.jpg
73
+ 4. /assets/screenshot-04.jpg
74
+
75
+ == Update Instructions ==
76
+ Update the plugin either via WP dashboard or via FTP. After update make sure you clear your browser cache.
77
+
78
+ == Changelog ==
79
+ = 1.1.0 =
80
+ * New: Add and Edit contact form without leaving elementor dashboard.
81
+ = 1.0.9 =
82
+ * Feature added - External thank you page
83
+ = 1.0.6 =
84
+ * Css added Number control
85
+ * Any post type url from the site for redirect url
86
+ = 1.0.5 =
87
+ * Css added Hover button
88
+ = 1.0.4 =
89
+ * Css added for select box
90
+ = 1.0.3 =
91
+ * CSS Fix
92
+ = 1.0.2 =
93
+ * Define Any page as thank you page
94
+ * More Comporftable Select2 for selecting Contact From
95
+ = 1.0.1 =
96
+ * Custom CSS Adding option
97
+ = 1.0.0 =
98
+ * Initial Launch
void-cf7-widget-elementor.php CHANGED
@@ -1,110 +1,181 @@
1
- <?php
2
- /**
3
- * Plugin Name: Void Contact Form 7 Widget For Elementor Page Builder
4
- * Description: Adds Contact Form 7 widget element to Elementor page builder for easy drag & drop the created contact forms with CF7 (contact form 7).
5
- * Version: 1.0.9
6
- * Author: voidCoders
7
- * Plugin URI: https://demo.voidcoders.com/plugins/contact-form7-widget-for-elementor/
8
- * Author URI: https://voidcoders.com
9
- * Text Domain: void
10
- */
11
-
12
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13
-
14
-
15
- function void_cf7_widget() {
16
- // Load localization file
17
- load_plugin_textdomain( 'void' );
18
-
19
- // Notice if the Elementor is not active
20
- if ( ! did_action( 'elementor/loaded' ) ) {
21
- return;
22
- }
23
-
24
- // Check version required
25
- $elementor_version_required = '1.0.0';
26
- if ( ! version_compare( ELEMENTOR_VERSION, $elementor_version_required, '>=' ) ) {
27
- return;
28
- }
29
-
30
- // Require the main plugin file
31
- require( __DIR__ . '/plugin.php' ); //loading the main plugin
32
-
33
- }
34
- add_action( 'plugins_loaded', 'void_cf7_widget' );
35
-
36
- // display custom admin notice
37
- function void_cf7_widget_notice() { ?>
38
-
39
- <?php if (!did_action( 'elementor/loaded' ) || !is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) : ?>
40
- <div class="notice notice-warning is-dismissible">
41
- <p><?php echo sprintf( __( '<a href="%s" target="_blank" >Elementor Page Builder</a> and <a href="%s" target="_blank" >Contact Form 7</a> must be installed and activated for "Contact Form 7 Widget For Elementor Page Builder" to work' ), 'https://wordpress.org/plugins/elementor/', 'https://wordpress.org/plugins/contact-form-7/'); ?></p>
42
- </div>
43
- <?php endif; ?>
44
-
45
- <?php }
46
- add_action('admin_notices', 'void_cf7_widget_notice');
47
-
48
-
49
- // add plugin activation time
50
-
51
- function void_cf7_activation_time(){
52
- $get_installation_time = strtotime("now");
53
- add_option('void_cf7_elementor_activation_time', $get_installation_time );
54
- }
55
- register_activation_hook( __FILE__, 'void_cf7_activation_time' );
56
-
57
- //check if review notice should be shown or not
58
-
59
- function void_cf7_check_installation_time() {
60
-
61
- $spare_me = get_option('void_cf7_spare_me');
62
- if( !$spare_me ){
63
- $install_date = get_option( 'void_cf7_elementor_activation_time' );
64
- $past_date = strtotime( '-7 days' );
65
-
66
- if ( $past_date >= $install_date ) {
67
-
68
- add_action( 'admin_notices', 'void_cf7_display_admin_notice' );
69
-
70
- }
71
- }
72
- }
73
- add_action( 'admin_init', 'void_cf7_check_installation_time' );
74
-
75
- /**
76
- * Display Admin Notice, asking for a review
77
- **/
78
- function void_cf7_display_admin_notice() {
79
- // wordpress global variable
80
- global $pagenow;
81
- if( $pagenow == 'index.php' ){
82
-
83
- $dont_disturb = esc_url( get_admin_url() . '?spare_me2=1' );
84
- $plugin_info = get_plugin_data( __FILE__ , true, true );
85
- $reviewurl = esc_url( 'https://wordpress.org/support/plugin/cf7-widget-elementor/reviews/#new-post' );
86
- $void_url = esc_url( 'https://voidcoders.com/shop/' );
87
-
88
- printf(__('<div class="void-cf7-review wrap">You have been using <b> %s </b> for a while. We hope you liked it ! Please give us a quick rating, it works as a boost for us to keep working on the plugin ! Also you can visit our <a href="%s" target="_blank">site</a> to get more themes & Plugins<div class="void-cf7-review-btn"><a href="%s" class="button button-primary" target=
89
- "_blank">Rate Now!</a><a href="%s" class="void-cf7-review-done"> Already Done !</a></div></div>', $plugin_info['TextDomain']), $plugin_info['Name'], $void_url, $reviewurl, $dont_disturb );
90
- }
91
- }
92
- // remove the notice for the user if review already done or if the user does not want to
93
- function void_cf7_spare_me(){
94
- if( isset( $_GET['spare_me2'] ) && !empty( $_GET['spare_me2'] ) ){
95
- $spare_me = $_GET['spare_me2'];
96
- if( $spare_me == 1 ){
97
- add_option( 'void_cf7_spare_me' , TRUE );
98
- }
99
- }
100
- }
101
- add_action( 'admin_init', 'void_cf7_spare_me', 5 );
102
-
103
- //add admin css
104
- function void_cf7_admin_css(){
105
- global $pagenow;
106
- if( $pagenow == 'index.php' ){
107
- wp_enqueue_style( 'void-cf7-admin', plugins_url( 'assets/css/void-cf7-admin.css', __FILE__ ) );
108
- }
109
- }
110
- add_action( 'admin_enqueue_scripts', 'void_cf7_admin_css' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Void Contact Form 7 Widget For Elementor Page Builder
4
+ * Description: Adds Contact Form 7 widget element to Elementor page builder for easy drag & drop the created contact forms with CF7 (contact form 7).
5
+ * Version: 1.1.0
6
+ * Author: voidCoders
7
+ * Plugin URI: https://demo.voidcoders.com/plugins/contact-form7-widget-for-elementor/
8
+ * Author URI: https://voidcoders.com
9
+ * Text Domain: void
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13
+
14
+ define('CF7_WIDGET_E_VERSION', '1.1.0');
15
+ define('CF7_WIDGET_E_PLUGIN_URL', trailingslashit(plugin_dir_url( __FILE__ )));
16
+ define('CF7_WIDGET_E_PLUGIN_DIR', trailingslashit(plugin_dir_path( __FILE__ )));
17
+
18
+ function void_cf7_widget() {
19
+ // Load localization file
20
+ load_plugin_textdomain( 'void' );
21
+
22
+ // Notice if the Elementor is not active
23
+ if ( ! did_action( 'elementor/loaded' ) ) {
24
+ return;
25
+ }
26
+
27
+ // Check version required
28
+ $elementor_version_required = '2.8.5';
29
+ if ( ! version_compare( ELEMENTOR_VERSION, $elementor_version_required, '>=' ) ) {
30
+ return;
31
+ }
32
+
33
+ // Require the main plugin file
34
+ require( __DIR__ . '/plugin.php' ); //loading the main plugin
35
+ // helper file for this plugin. currently used for gettings all contact form of cf7. also used for ajax request handle
36
+ require __DIR__ . '/helper/helper.php';
37
+
38
+ }
39
+ add_action( 'plugins_loaded', 'void_cf7_widget' );
40
+
41
+ // display activation notice for depended plugin
42
+ function void_cf7_widget_notice() { ?>
43
+
44
+ <?php if ( !is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) || ! did_action( 'elementor/loaded' ) ) : ?>
45
+ <div class="notice notice-warning is-dismissible">
46
+
47
+ <?php if ( file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) && ! did_action( 'elementor/loaded' ) ) : ?>
48
+ <p><?php echo sprintf( __( '<a href="%s" class="button button-primary">Active</a> <b>Elementor Page Builder</b> now for working with <b>"Void Contact Form 7 Widget"</b>' ), wp_nonce_url( 'plugins.php?action=activate&plugin=elementor/elementor.php&plugin_status=all&paged=1', 'activate-plugin_elementor/elementor.php') ); ?></p>
49
+ <?php elseif ( !file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' ) ) : ?>
50
+ <p><?php echo sprintf( __( '<b>Elementor Page Builder</b> must be installed for <b>"Void Contact Form 7 Widget"</b> to work. <a href="%s" class="button button-primary">Install Now</a>' ), wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' )); ?></p>
51
+ <?php endif; ?>
52
+
53
+ <?php if ( file_exists( WP_PLUGIN_DIR . '/contact-form-7/wp-contact-form-7.php' ) && !is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) : ?>
54
+ <p><?php echo sprintf( __( '<a href="%s" class="button button-primary">Active</a> <b>Contact Form 7</b> now to start working with <b>"Void Contact Form 7 Widget"</b>' ), wp_nonce_url( 'plugins.php?action=activate&plugin=contact-form-7/wp-contact-form-7.php&plugin_status=all&paged=1', 'activate-plugin_contact-form-7/wp-contact-form-7.php' )); ?></p>
55
+ <?php elseif ( !file_exists( WP_PLUGIN_DIR . '/contact-form-7/wp-contact-form-7.php' ) ) : ?>
56
+ <p><?php echo sprintf( __( '<b>Contact Form 7</b> must be installed and activated for <b>"Void Contact Form 7 Widget"</b> to work. <a href="%s" class="button button-primary">Install Now</a>' ), wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=contact-form-7' ), 'install-plugin_contact-form-7' )); ?></p>
57
+ <?php endif; ?>
58
+
59
+ </div>
60
+ <?php endif; ?>
61
+
62
+ <?php }
63
+ add_action('admin_notices', 'void_cf7_widget_notice');
64
+
65
+ function void_cf7_widget_promotional_notice(){
66
+ // notice dismiss date form database
67
+ $db_dismiss_date = get_option('dismissed-void-cf7-promotion-notice-ele-query-at');
68
+ // create a date object from database date
69
+ $dismiss_date = date_create($db_dismiss_date);
70
+ // create a current date object
71
+ $current_date = date_create(date('Y-m-d'));
72
+ // get difference of both date
73
+ $diff = date_diff($dismiss_date, $current_date);
74
+ // make conditional days. if date found in database, it will be 30.
75
+ // otherwise it will be 0. Becase difference return 0 if there was no data on database
76
+ $conditional_days = ($db_dismiss_date) ? 15 : 0;
77
+ // elementor pro install check
78
+ if ( file_exists( WP_PLUGIN_DIR . '/elementor-pro/elementor-pro.php' ) || did_action( 'elementor_pro/init' ) ) :
79
+ $url = 'https://elequerybuilder.com?click=cf7-promo';
80
+ // different day condition. notice will again show if dismiss interval is more than equal 30 days
81
+ if( !get_option('dismissed-void-cf7-promotion-notice-ele-query-never', FALSE )):
82
+
83
+ // different day condition. notice will again show if dismiss interval is more than equal 30 days
84
+ if($diff->days >= $conditional_days ):
85
+ $url .= (($conditional_days == 15) ? '&discount=INSIDE10E' : '');
86
+ ?>
87
+ <div class="void-query-promotion-notice notice is-dismissible" data-notice="void-cf7-promotion-notice-ele-query" data-nonce="<?php echo wp_create_nonce('wp_rest'); ?>">
88
+ <div class="void-query-message-inner">
89
+ <div class="void-query-message-icon">
90
+ <img class="void-query-notice-icon" src="https://elequerybuilder.com/wp-content/uploads/2020/05/EQ-Banner.png" alt="voidCoders promotional banner">
91
+ </div>
92
+ <div class="void-query-message-content">
93
+ <?php if ($conditional_days == 15) :?>
94
+ <p>Here is a Little gift for you!</p>
95
+ <p>Get <strong>Ele Query Builder</strong> to build custom query without code with <strong>10% Discount</strong>. <strong>Use Coupon - INSIDE10E</strong></p>
96
+ <?php else: ?>
97
+ <p>We noticed you have <strong>Elementor Pro</strong> on your site.</p>
98
+ <p>Get our <strong>Ele Query Builder</strong> to use custom query by using postmeta, ACF/PODS</p>
99
+ <p>Woocommerce meta and events calendar with no CODE</p>
100
+ <?php endif; ?>
101
+ </div>
102
+ <div class="void-query-message-action">
103
+ <a class="void-query-button" target="__blank" href="<?php echo esc_url($url); ?>">Check Now</a>
104
+ <!-- <a class="void-query-remind-later" href="#">Remind me later -> </a> -->
105
+ <a class="void-query-never-show" href="#">Never show again -> </a>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ <?php endif;
110
+ endif;
111
+ endif;
112
+ }
113
+ add_action('admin_notices', 'void_cf7_widget_promotional_notice');
114
+
115
+
116
+ // add plugin activation time
117
+
118
+ function void_cf7_activation_time(){
119
+ $get_installation_time = strtotime("now");
120
+ add_option('void_cf7_elementor_activation_time', $get_installation_time );
121
+ }
122
+ register_activation_hook( __FILE__, 'void_cf7_activation_time' );
123
+
124
+ //check if review notice should be shown or not
125
+
126
+ function void_cf7_check_installation_time() {
127
+
128
+ $spare_me = get_option('void_cf7_spare_me');
129
+ if( !$spare_me ){
130
+ $install_date = get_option( 'void_cf7_elementor_activation_time' );
131
+ $past_date = strtotime( '-7 days' );
132
+
133
+ if ( $past_date >= $install_date ) {
134
+
135
+ add_action( 'admin_notices', 'void_cf7_display_admin_notice' );
136
+
137
+ }
138
+ }
139
+ }
140
+ add_action( 'admin_init', 'void_cf7_check_installation_time' );
141
+
142
+ /**
143
+ * Display Admin Notice, asking for a review
144
+ **/
145
+ function void_cf7_display_admin_notice() {
146
+ // wordpress global variable
147
+ global $pagenow;
148
+ if( $pagenow == 'index.php' ){
149
+
150
+ $dont_disturb = esc_url( get_admin_url() . '?spare_me2=1' );
151
+ $plugin_info = get_plugin_data( __FILE__ , true, true );
152
+ $reviewurl = esc_url( 'https://wordpress.org/support/plugin/cf7-widget-elementor/reviews/#new-post' );
153
+ $void_url = esc_url( 'https://voidcoders.com/shop/' );
154
+
155
+ printf(__('<div class="void-cf7-review wrap">You have been using <b> %s </b> for a while. We hope you liked it ! Please give us a quick rating, it works as a boost for us to keep working on the plugin ! Also you can visit our <a href="%s" target="_blank">site</a> to get more themes & Plugins<div class="void-cf7-review-btn"><a href="%s" class="button button-primary" target=
156
+ "_blank">Rate Now!</a><a href="%s" class="void-cf7-review-done"> Already Done !</a></div></div>', $plugin_info['TextDomain']), $plugin_info['Name'], $void_url, $reviewurl, $dont_disturb );
157
+ }
158
+ }
159
+ // remove the notice for the user if review already done or if the user does not want to
160
+ function void_cf7_spare_me(){
161
+ if( isset( $_GET['spare_me2'] ) && !empty( $_GET['spare_me2'] ) ){
162
+ $spare_me = $_GET['spare_me2'];
163
+ if( $spare_me == 1 ){
164
+ add_option( 'void_cf7_spare_me' , TRUE );
165
+ }
166
+ }
167
+ }
168
+ add_action( 'admin_init', 'void_cf7_spare_me', 5 );
169
+
170
+ //add admin css
171
+ function void_cf7_admin_css(){
172
+
173
+ global $pagenow;
174
+ if( $pagenow == 'index.php' || file_exists( WP_PLUGIN_DIR . '/elementor-pro/elementor-pro.php' ) || did_action( 'elementor_pro/init' ) || !get_option('dismissed-void-cf7-promotion-notice-ele-query-never', FALSE ) ){
175
+ wp_enqueue_style( 'void-cf7-admin', CF7_WIDGET_E_PLUGIN_URL . 'assets/css/void-cf7-admin.css', [], CF7_WIDGET_E_VERSION, 'all' );
176
+ wp_enqueue_script('void-cf7-admin', CF7_WIDGET_E_PLUGIN_URL . 'assets/js/void-cf7-admin.js', ['jquery'], CF7_WIDGET_E_VERSION, true);
177
+ }
178
+ }
179
+ add_action( 'admin_enqueue_scripts', 'void_cf7_admin_css' );
180
+
181
+ include CF7_WIDGET_E_PLUGIN_DIR.'custom-editor/init.php';
widgets/void-section-cf7.php CHANGED
@@ -1,307 +1,331 @@
1
- <?php
2
- namespace voidelement\Widgets;
3
-
4
- use Elementor\Widget_Base;
5
- use Elementor\Controls_Manager;
6
- use Elementor\Group_Control_Image_Size;
7
- use Elementor\Utils;
8
-
9
-
10
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
-
12
- /**
13
- * Elementor Style for header
14
- *
15
- *
16
- * @since 1.0.0
17
- */
18
-
19
- class void_cf7 extends Widget_Base { //this name is added to plugin.php of the root folder
20
-
21
- public function get_name() {
22
- return 'void-section-cf7';
23
- }
24
-
25
- public function get_title() {
26
- return 'Void Contact From 7'; // title to show on elementor
27
- }
28
-
29
- public function get_icon() {
30
- return 'eicon-mail'; // eicon-posts-ticker-> eicon ow asche icon to show on elelmentor
31
- }
32
-
33
- public function get_categories() {
34
- return [ 'void-elements' ]; // category of the widget
35
- }
36
-
37
- /**
38
- * A list of scripts that the widgets is depended in
39
- * @since 1.3.0
40
- **/
41
- protected function _register_controls() {
42
-
43
- //start of a control box
44
- $this->start_controls_section(
45
- 'section_content',
46
- [
47
- 'label' => esc_html__( 'Contact Form 7', 'void' ), //section name for controler view
48
- ]
49
- );
50
-
51
- $this->add_control(
52
- 'cf7',
53
- [
54
- 'label' => esc_html__( 'Select Contact Form', 'void' ),
55
- 'description' => esc_html__('Contact form 7 - plugin must be installed and there must be some contact forms made with the contact form 7','void'),
56
- 'type' => Controls_Manager::SELECT2,
57
- 'multiple' => false,
58
- 'label_block' => 1,
59
- 'options' => get_contact_form_7_posts(),
60
- ]
61
- );
62
-
63
- $this->end_controls_section();
64
-
65
- $this->start_controls_section(
66
- 'section_stype',
67
- [
68
- 'label' => esc_html__( 'Style Contact Form', 'void' ), //section name for controler view
69
- ]
70
- );
71
-
72
- $this->add_control(
73
- 'cf7_direct_css',
74
- [
75
- 'label' => __( 'Global CSS For all fields', 'void' ),
76
- 'description' => __( 'This is the global css for all fields of cf7. It will not effect the other fileds but if you want to define things such as color, background color use this.', 'void' ),
77
- 'type' => Controls_Manager::TEXTAREA,
78
- 'placeholder' => 'color:#000;',
79
- 'selectors' => [
80
- '{{WRAPPER}} ' => '{{VALUE}}',
81
- ],
82
- ]
83
- );
84
-
85
- $this->add_control(
86
- 'alllabel',
87
- [
88
- 'label' => __( 'All Label CSS', 'void' ),
89
- 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
90
- 'type' => Controls_Manager::TEXTAREA,
91
- 'placeholder' => 'color:#fff;',
92
- 'selectors' => [
93
- '{{WRAPPER}} label' => '{{VALUE}}',
94
- ],
95
- ]
96
- );
97
- $this->add_control(
98
- 'allinput',
99
- [
100
- 'label' => __( 'All Input CSS', 'void' ),
101
- 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
102
- 'type' => Controls_Manager::TEXTAREA,
103
- 'placeholder' => 'width:100%;
104
- background:red;',
105
- 'selectors' => [
106
- '{{WRAPPER}} input' => 'height:auto;',
107
- '{{WRAPPER}} input' => '{{VALUE}}',
108
-
109
- ],
110
- ]
111
- );
112
-
113
- $this->add_control(
114
- 'textinput',
115
- [
116
- 'label' => __( 'Input Type Text CSS', 'void' ),
117
- 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
118
- 'type' => Controls_Manager::TEXTAREA,
119
- 'placeholder' => 'width:100%;
120
- background:red;',
121
- 'selectors' => [
122
- '{{WRAPPER}} .wpcf7-text' => 'height:auto;',
123
- '{{WRAPPER}} .wpcf7-text' => '{{VALUE}}',
124
- ],
125
- ]
126
- );
127
- $this->add_control(
128
- 'textarea',
129
- [
130
- 'label' => __( 'Textarea CSS', 'void' ),
131
- 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
132
- 'type' => Controls_Manager::TEXTAREA,
133
- 'placeholder' => 'height:100px;
134
- width:100%;',
135
- 'selectors' => [
136
- '{{WRAPPER}} textarea' => 'height:auto;',
137
- '{{WRAPPER}} textarea' => '{{VALUE}}',
138
- ],
139
- ]
140
- );
141
-
142
- $this->add_control(
143
- 'checkbox',
144
- [
145
- 'label' => __( 'Checkbox/ Radio CSS', 'void' ),
146
- 'type' => Controls_Manager::TEXTAREA,
147
- 'placeholder' => 'display: block;',
148
- 'selectors' => [
149
- '{{WRAPPER}} .wpcf7-list-item' => '{{VALUE}}',
150
- ],
151
- ]
152
- );
153
-
154
- $this->add_control(
155
- 'selectcss',
156
- [
157
- 'label' => __( 'Dropdown/ Select Box css', 'void' ),
158
- 'type' => Controls_Manager::TEXTAREA,
159
- 'placeholder' => 'width: 100;',
160
- 'selectors' => [
161
- '{{WRAPPER}} select' => '{{VALUE}}',
162
- ],
163
- ]
164
- );
165
- $this->add_control(
166
- 'selectoptionscss',
167
- [
168
- 'label' => __( 'Select Options Css', 'void' ),
169
- 'type' => Controls_Manager::TEXTAREA,
170
- 'placeholder' => 'color: red;',
171
- 'selectors' => [
172
- '{{WRAPPER}} select option' => '{{VALUE}}',
173
- ],
174
- ]
175
- );
176
-
177
- $this->add_control(
178
- 'file',
179
- [
180
- 'label' => __( 'File CSS', 'void' ),
181
- 'type' => Controls_Manager::TEXTAREA,
182
- 'placeholder' => 'display: block;',
183
- 'selectors' => [
184
- '{{WRAPPER}} input[type="file"]' => '{{VALUE}}',
185
- ],
186
- ]
187
- );
188
- $this->add_control(
189
- 'date',
190
- [
191
- 'label' => __( 'Date CSS', 'void' ),
192
- 'type' => Controls_Manager::TEXTAREA,
193
- 'placeholder' => 'display: block;',
194
- 'selectors' => [
195
- '{{WRAPPER}} .wpcf7-date' => '{{VALUE}}',
196
- ],
197
- ]
198
- );
199
- $this->add_control(
200
- 'inputsubmit',
201
- [
202
- 'label' => __( 'Submit Button CSS', 'void' ),
203
- 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
204
- 'type' => Controls_Manager::TEXTAREA,
205
- 'placeholder' => 'width:100%;
206
- background:red;',
207
- 'selectors' => [
208
- '{{WRAPPER}} input[type="submit"]' => '{{VALUE}}',
209
- ],
210
- ]
211
- );
212
- $this->add_control(
213
- 'inputsubmithover',
214
- [
215
- 'label' => __( 'Submit Button Hover CSS', 'void' ),
216
- 'type' => Controls_Manager::TEXTAREA,
217
- 'placeholder' => 'background:#fff;',
218
- 'selectors' => [
219
- '{{WRAPPER}} input[type="submit"]:hover' => '{{VALUE}}',
220
- ],
221
- ]
222
- );
223
-
224
- $this->add_control(
225
- 'responce',
226
- [
227
- 'label' => __( 'Responce CSS', 'void' ),
228
- 'type' => Controls_Manager::TEXTAREA,
229
- 'placeholder' => 'color:red;',
230
- 'selectors' => [
231
- '{{WRAPPER}} .wpcf7-response-output' => '{{VALUE}}',
232
- ],
233
- ]
234
- );
235
-
236
-
237
- $this->end_controls_section();
238
-
239
-
240
-
241
- $this->start_controls_section(
242
- 'section_redirect',
243
- [
244
- 'label' => esc_html__( 'After Submit Redirect Setting', 'void' ), //section name for controler view
245
- ]
246
- );
247
-
248
- $this->add_control(
249
- 'cf7_redirect_external',
250
- [
251
- 'label' => __( 'On Success External URL Redirect', 'void' ),
252
- 'description' => esc_html__('Insert the external URL where you want users to redirect to when the contact form is submitted and is successful. Leave Blank to Disable','void'),
253
- 'type' => \Elementor\Controls_Manager::TEXT,
254
- 'placeholder' => __( 'https://voidcoders.com', 'void' ),
255
- 'label_block' => 1,
256
- ]
257
- );
258
-
259
- $this->add_control(
260
- 'cf7_redirect_page',
261
- [
262
- 'label' => esc_html__( 'On Success Internal Redirect', 'void' ),
263
- 'description' => esc_html__('Select a page within the site which you want users to redirect to when the contact form is submitted and is successful. Leave Blank to Disable','void'),
264
- 'type' => Controls_Manager::SELECT2,
265
- 'multiple' => false,
266
- 'label_block' => 1,
267
- 'options' => void_get_all_pages(),
268
- 'condition' => [
269
- 'cf7_redirect_external' => '',
270
- ],
271
- ]
272
- );
273
-
274
-
275
- $this->end_controls_section();
276
- }
277
-
278
-
279
- protected function render() { //to show on the fontend
280
- static $v_veriable=0;
281
-
282
- $settings = $this->get_settings();
283
- if(!empty($settings['cf7'])){
284
- echo'<div class="elementor-shortcode void-cf7-'.$v_veriable.'">';
285
- echo do_shortcode('[contact-form-7 id="'.$settings['cf7'].'"]');
286
- echo '</div>';
287
- }
288
-
289
- if(!empty($settings['cf7_redirect_page']) || !empty($settings['cf7_redirect_external']) ) { ?>
290
- <script>
291
- var theform = document.querySelector('.void-cf7-<?php echo $v_veriable; ?>');
292
- theform.addEventListener( 'wpcf7mailsent', function( event ) {
293
- location = '<?php
294
- if( !empty($settings['cf7_redirect_external']) ){
295
- echo $settings['cf7_redirect_external'];
296
- }else{
297
- echo get_permalink( $settings['cf7_redirect_page'] );
298
- }
299
- ?>';
300
- }, false );
301
- </script>
302
-
303
- <?php $v_veriable++;
304
- }
305
-
306
- }
307
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace voidelement\Widgets;
3
+
4
+ use Elementor\Widget_Base;
5
+ use Elementor\Controls_Manager;
6
+ use Elementor\Group_Control_Image_Size;
7
+ use Elementor\Utils;
8
+
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
11
+
12
+ /**
13
+ * Elementor Style for header
14
+ *
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+
19
+ class void_cf7 extends Widget_Base { //this name is added to plugin.php of the root folder
20
+
21
+ public function get_name() {
22
+ return 'void-section-cf7';
23
+ }
24
+
25
+ public function get_title() {
26
+ return 'Void Contact From 7'; // title to show on elementor
27
+ }
28
+
29
+ public function get_icon() {
30
+ return 'eicon-mail'; // eicon-posts-ticker-> eicon ow asche icon to show on elelmentor
31
+ }
32
+
33
+ public function get_categories() {
34
+ return [ 'void-elements' ]; // category of the widget
35
+ }
36
+
37
+ public function is_reload_preview_required() {
38
+ return true;
39
+ }
40
+
41
+ /**
42
+ * A list of scripts that the widgets is depended in
43
+ * @since 1.3.0
44
+ **/
45
+ protected function _register_controls() {
46
+
47
+ //start of a control box
48
+ $this->start_controls_section(
49
+ 'section_content',
50
+ [
51
+ 'label' => esc_html__( 'Contact Form 7', 'void' ), //section name for controler view
52
+ ]
53
+ );
54
+
55
+ $this->add_control(
56
+ 'cf7',
57
+ [
58
+ 'label' => esc_html__( 'Select Contact Form', 'void' ),
59
+ 'description' => esc_html__('Contact form 7 - plugin must be installed and there must be some contact forms made with the contact form 7','void'),
60
+ 'type' => Controls_Manager::SELECT2,
61
+ 'multiple' => false,
62
+ 'label_block' => 1,
63
+ 'options' => get_contact_form_7_posts(),
64
+ ]
65
+ );
66
+
67
+ $this->add_control(
68
+ 'void_cf7_form_action_edit',
69
+ [
70
+ 'type' => \Elementor\Controls_Manager::RAW_HTML,
71
+ 'raw' => sprintf( '<a href="#" id="void-cf7-edit-form-btn" style="color:#d30c5c; float: right;">Edit form</a>', 'void' ),
72
+ 'content_classes' => 'void-cf7-edit-form-btn',
73
+ ]
74
+ );
75
+
76
+ $this->add_control(
77
+ 'void_cf7_form_action_add',
78
+ [
79
+ 'type' => \Elementor\Controls_Manager::RAW_HTML,
80
+ 'raw' => sprintf( '<a href="#" id="void-cf7-add-form-btn" style="color:#d30c5c; float: right;">+ Add new form</a>', 'void' ),
81
+ 'content_classes' => 'void-cf7-add-form-btn',
82
+ ]
83
+ );
84
+
85
+ $this->end_controls_section();
86
+
87
+ $this->start_controls_section(
88
+ 'section_stype',
89
+ [
90
+ 'label' => esc_html__( 'Style Contact Form', 'void' ), //section name for controler view
91
+ ]
92
+ );
93
+
94
+ $this->add_control(
95
+ 'cf7_direct_css',
96
+ [
97
+ 'label' => __( 'Global CSS For all fields', 'void' ),
98
+ 'description' => __( 'This is the global css for all fields of cf7. It will not effect the other fileds but if you want to define things such as color, background color use this.', 'void' ),
99
+ 'type' => Controls_Manager::TEXTAREA,
100
+ 'placeholder' => 'color:#000;',
101
+ 'selectors' => [
102
+ '{{WRAPPER}} ' => '{{VALUE}}',
103
+ ],
104
+ ]
105
+ );
106
+
107
+ $this->add_control(
108
+ 'alllabel',
109
+ [
110
+ 'label' => __( 'All Label CSS', 'void' ),
111
+ 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
112
+ 'type' => Controls_Manager::TEXTAREA,
113
+ 'placeholder' => 'color:#fff;',
114
+ 'selectors' => [
115
+ '{{WRAPPER}} label' => '{{VALUE}}',
116
+ ],
117
+ ]
118
+ );
119
+ $this->add_control(
120
+ 'allinput',
121
+ [
122
+ 'label' => __( 'All Input CSS', 'void' ),
123
+ 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
124
+ 'type' => Controls_Manager::TEXTAREA,
125
+ 'placeholder' => 'width:100%;
126
+ background:red;',
127
+ 'selectors' => [
128
+ '{{WRAPPER}} input' => 'height:auto;',
129
+ '{{WRAPPER}} input' => '{{VALUE}}',
130
+
131
+ ],
132
+ ]
133
+ );
134
+
135
+ $this->add_control(
136
+ 'textinput',
137
+ [
138
+ 'label' => __( 'Input Type Text CSS', 'void' ),
139
+ 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
140
+ 'type' => Controls_Manager::TEXTAREA,
141
+ 'placeholder' => 'width:100%;
142
+ background:red;',
143
+ 'selectors' => [
144
+ '{{WRAPPER}} .wpcf7-text' => 'height:auto;',
145
+ '{{WRAPPER}} .wpcf7-text' => '{{VALUE}}',
146
+ ],
147
+ ]
148
+ );
149
+ $this->add_control(
150
+ 'textarea',
151
+ [
152
+ 'label' => __( 'Textarea CSS', 'void' ),
153
+ 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
154
+ 'type' => Controls_Manager::TEXTAREA,
155
+ 'placeholder' => 'height:100px;
156
+ width:100%;',
157
+ 'selectors' => [
158
+ '{{WRAPPER}} textarea' => 'height:auto;',
159
+ '{{WRAPPER}} textarea' => '{{VALUE}}',
160
+ ],
161
+ ]
162
+ );
163
+
164
+ $this->add_control(
165
+ 'checkbox',
166
+ [
167
+ 'label' => __( 'Checkbox/ Radio CSS', 'void' ),
168
+ 'type' => Controls_Manager::TEXTAREA,
169
+ 'placeholder' => 'display: block;',
170
+ 'selectors' => [
171
+ '{{WRAPPER}} .wpcf7-list-item' => '{{VALUE}}',
172
+ ],
173
+ ]
174
+ );
175
+
176
+ $this->add_control(
177
+ 'selectcss',
178
+ [
179
+ 'label' => __( 'Dropdown/ Select Box css', 'void' ),
180
+ 'type' => Controls_Manager::TEXTAREA,
181
+ 'placeholder' => 'width: 100;',
182
+ 'selectors' => [
183
+ '{{WRAPPER}} select' => '{{VALUE}}',
184
+ ],
185
+ ]
186
+ );
187
+ $this->add_control(
188
+ 'selectoptionscss',
189
+ [
190
+ 'label' => __( 'Select Options Css', 'void' ),
191
+ 'type' => Controls_Manager::TEXTAREA,
192
+ 'placeholder' => 'color: red;',
193
+ 'selectors' => [
194
+ '{{WRAPPER}} select option' => '{{VALUE}}',
195
+ ],
196
+ ]
197
+ );
198
+
199
+ $this->add_control(
200
+ 'file',
201
+ [
202
+ 'label' => __( 'File CSS', 'void' ),
203
+ 'type' => Controls_Manager::TEXTAREA,
204
+ 'placeholder' => 'display: block;',
205
+ 'selectors' => [
206
+ '{{WRAPPER}} input[type="file"]' => '{{VALUE}}',
207
+ ],
208
+ ]
209
+ );
210
+ $this->add_control(
211
+ 'date',
212
+ [
213
+ 'label' => __( 'Date CSS', 'void' ),
214
+ 'type' => Controls_Manager::TEXTAREA,
215
+ 'placeholder' => 'display: block;',
216
+ 'selectors' => [
217
+ '{{WRAPPER}} .wpcf7-date' => '{{VALUE}}',
218
+ ],
219
+ ]
220
+ );
221
+ $this->add_control(
222
+ 'inputsubmit',
223
+ [
224
+ 'label' => __( 'Submit Button CSS', 'void' ),
225
+ 'description' => __( 'Changes might not sometimes show in the live preview but check in the front end to see the changes.', 'void' ),
226
+ 'type' => Controls_Manager::TEXTAREA,
227
+ 'placeholder' => 'width:100%;
228
+ background:red;',
229
+ 'selectors' => [
230
+ '{{WRAPPER}} input[type="submit"]' => '{{VALUE}}',
231
+ ],
232
+ ]
233
+ );
234
+ $this->add_control(
235
+ 'inputsubmithover',
236
+ [
237
+ 'label' => __( 'Submit Button Hover CSS', 'void' ),
238
+ 'type' => Controls_Manager::TEXTAREA,
239
+ 'placeholder' => 'background:#fff;',
240
+ 'selectors' => [
241
+ '{{WRAPPER}} input[type="submit"]:hover' => '{{VALUE}}',
242
+ ],
243
+ ]
244
+ );
245
+
246
+ $this->add_control(
247
+ 'responce',
248
+ [
249
+ 'label' => __( 'Responce CSS', 'void' ),
250
+ 'type' => Controls_Manager::TEXTAREA,
251
+ 'placeholder' => 'color:red;',
252
+ 'selectors' => [
253
+ '{{WRAPPER}} .wpcf7-response-output' => '{{VALUE}}',
254
+ ],
255
+ ]
256
+ );
257
+
258
+
259
+ $this->end_controls_section();
260
+
261
+
262
+
263
+ $this->start_controls_section(
264
+ 'section_redirect',
265
+ [
266
+ 'label' => esc_html__( 'After Submit Redirect Setting', 'void' ), //section name for controler view
267
+ ]
268
+ );
269
+
270
+ $this->add_control(
271
+ 'cf7_redirect_external',
272
+ [
273
+ 'label' => __( 'On Success External URL Redirect', 'void' ),
274
+ 'description' => esc_html__('Insert the external URL where you want users to redirect to when the contact form is submitted and is successful. Leave Blank to Disable','void'),
275
+ 'type' => \Elementor\Controls_Manager::TEXT,
276
+ 'placeholder' => __( 'https://voidcoders.com', 'void' ),
277
+ 'label_block' => 1,
278
+ ]
279
+ );
280
+
281
+ $this->add_control(
282
+ 'cf7_redirect_page',
283
+ [
284
+ 'label' => esc_html__( 'On Success Internal Redirect', 'void' ),
285
+ 'description' => esc_html__('Select a page within the site which you want users to redirect to when the contact form is submitted and is successful. Leave Blank to Disable','void'),
286
+ 'type' => Controls_Manager::SELECT2,
287
+ 'multiple' => false,
288
+ 'label_block' => 1,
289
+ 'options' => void_get_all_pages(),
290
+ 'condition' =>
291
+ [
292
+ 'cf7_redirect_external' => '',
293
+ ],
294
+ ]
295
+ );
296
+
297
+
298
+ $this->end_controls_section();
299
+ }
300
+
301
+
302
+ protected function render() { //to show on the fontend
303
+ static $v_veriable=0;
304
+
305
+ $settings = $this->get_settings();
306
+
307
+ if(!empty($settings['cf7'])){
308
+ echo'<div class="void-cf7-form-widget-wrapper elementor-shortcode void-cf7-'.$v_veriable.'" data-void-cf7-contact-form-id="'. $settings['cf7'] .'">';
309
+ echo do_shortcode('[contact-form-7 id="'.$settings['cf7'].'"]');
310
+ echo '</div>';
311
+ }
312
+
313
+ if(!empty($settings['cf7_redirect_page']) || !empty($settings['cf7_redirect_external']) ) { ?>
314
+ <script>
315
+ var theform = document.querySelector('.void-cf7-<?php echo $v_veriable; ?>');
316
+ theform.addEventListener( 'wpcf7mailsent', function( event ) {
317
+ location = '<?php
318
+ if( !empty($settings['cf7_redirect_external']) ){
319
+ echo $settings['cf7_redirect_external'];
320
+ }else{
321
+ echo get_permalink( $settings['cf7_redirect_page'] );
322
+ }
323
+ ?>';
324
+ }, false );
325
+ </script>
326
+
327
+ <?php $v_veriable++;
328
+ }
329
+
330
+ }
331
+ }