Version Description
- Fixed a bug: Redirection Pro for Contact Form 7 not disappearing after clicking the X button (for some users).
Download this release
Release Info
Developer | yuvalsabar |
Plugin | Contact Form 7 Redirection |
Version | 1.3.5 |
Comparing to | |
See all releases |
Code changes from version 1.3.3 to 1.3.5
- admin/wpcf7-redirect-admin-script.js +66 -66
- admin/wpcf7-redirect-admin-style.css +83 -83
- js/wpcf7-redirect-script.js +2 -2
- lang/readme.txt +3 -3
- readme.txt +126 -118
- wpcf7-redirect.php +142 -112
admin/wpcf7-redirect-admin-script.js
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
-
// field - open in a new tab
|
4 |
-
$( '#wpcf7-redirect-open-in-new-tab' ).change(function() {
|
5 |
-
if ( $( this ).is( ":checked" ) ) {
|
6 |
-
$( '.field-notice-alert' ).removeClass( 'field-notice-hidden' );
|
7 |
-
} else {
|
8 |
-
$( '.field-notice-alert' ).addClass( 'field-notice-hidden' );
|
9 |
-
}
|
10 |
-
});
|
11 |
-
|
12 |
-
if ( $( '#wpcf7-redirect-open-in-new-tab' ).is( ":checked" ) ) {
|
13 |
-
$( '.field-notice-alert' ).removeClass( 'field-notice-hidden' );
|
14 |
-
}
|
15 |
-
|
16 |
-
// fields - http build query
|
17 |
-
$( '#wpcf7-redirect-http-build-query-selectively' ).change(function() {
|
18 |
-
if ( $( this ).is( ":checked" ) ) {
|
19 |
-
$( '#wpcf7-redirect-http-build-query-selectively-fields' ).removeClass( 'field-hidden' );
|
20 |
-
}
|
21 |
-
});
|
22 |
-
|
23 |
-
$( '#wpcf7-redirect-http-build-query' ).change(function() {
|
24 |
-
if ( $( this ).is( ":checked" ) ) {
|
25 |
-
$( '#wpcf7-redirect-http-build-query-selectively-fields' ).addClass( 'field-hidden' );
|
26 |
-
}
|
27 |
-
});
|
28 |
-
|
29 |
-
if ( $( '#wpcf7-redirect-http-build-query-selectively' ).is( ":checked" ) ) {
|
30 |
-
$( '#wpcf7-redirect-http-build-query-selectively-fields' ).removeClass( 'field-hidden' );
|
31 |
-
}
|
32 |
-
|
33 |
-
$('.checkbox-radio-1').change(function() {
|
34 |
-
var checked = $(this).is(':checked');
|
35 |
-
$('.checkbox-radio-1').prop('checked', false);
|
36 |
-
if ( checked ) {
|
37 |
-
$(this).prop('checked',true);
|
38 |
-
}
|
39 |
-
});
|
40 |
-
|
41 |
-
// field - after sent script
|
42 |
-
$( '#wpcf7-redirect-after-sent-script' ).keyup(function() {
|
43 |
-
if ( $(this).val().length != 0 ) {
|
44 |
-
$( '.field-warning-alert' ).removeClass( 'field-notice-hidden' );
|
45 |
-
} else {
|
46 |
-
$( '.field-warning-alert' ).addClass( 'field-notice-hidden' );
|
47 |
-
}
|
48 |
-
});
|
49 |
-
|
50 |
-
if ( $( '#wpcf7-redirect-after-sent-script' ).val() ) {
|
51 |
-
$( '.field-warning-alert' ).removeClass( 'field-notice-hidden' );
|
52 |
-
}
|
53 |
-
|
54 |
-
$('.wpcf7-redirect-pro-admin-notice .notice-dismiss').click(function(e) {
|
55 |
-
e.preventDefault();
|
56 |
-
sign = window.location.href.indexOf("?") > -1 ? '&' : '?';
|
57 |
-
location.href = window.location.href + sign + 'wpcf7_redirect_dismiss_notice=1';
|
58 |
-
});
|
59 |
-
|
60 |
-
$('#redirect-panel .banner-wrap .notice-dismiss').click(function(e) {
|
61 |
-
e.preventDefault();
|
62 |
-
sign = window.location.href.indexOf("?") > -1 ? '&' : '?';
|
63 |
-
location.href = window.location.href + sign + 'wpcf7_redirect_dismiss_banner=1';
|
64 |
-
});
|
65 |
-
|
66 |
-
});
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
// field - open in a new tab
|
4 |
+
$( '#wpcf7-redirect-open-in-new-tab' ).change(function() {
|
5 |
+
if ( $( this ).is( ":checked" ) ) {
|
6 |
+
$( '.field-notice-alert' ).removeClass( 'field-notice-hidden' );
|
7 |
+
} else {
|
8 |
+
$( '.field-notice-alert' ).addClass( 'field-notice-hidden' );
|
9 |
+
}
|
10 |
+
});
|
11 |
+
|
12 |
+
if ( $( '#wpcf7-redirect-open-in-new-tab' ).is( ":checked" ) ) {
|
13 |
+
$( '.field-notice-alert' ).removeClass( 'field-notice-hidden' );
|
14 |
+
}
|
15 |
+
|
16 |
+
// fields - http build query
|
17 |
+
$( '#wpcf7-redirect-http-build-query-selectively' ).change(function() {
|
18 |
+
if ( $( this ).is( ":checked" ) ) {
|
19 |
+
$( '#wpcf7-redirect-http-build-query-selectively-fields' ).removeClass( 'field-hidden' );
|
20 |
+
}
|
21 |
+
});
|
22 |
+
|
23 |
+
$( '#wpcf7-redirect-http-build-query' ).change(function() {
|
24 |
+
if ( $( this ).is( ":checked" ) ) {
|
25 |
+
$( '#wpcf7-redirect-http-build-query-selectively-fields' ).addClass( 'field-hidden' );
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
+
if ( $( '#wpcf7-redirect-http-build-query-selectively' ).is( ":checked" ) ) {
|
30 |
+
$( '#wpcf7-redirect-http-build-query-selectively-fields' ).removeClass( 'field-hidden' );
|
31 |
+
}
|
32 |
+
|
33 |
+
$('.checkbox-radio-1').change(function() {
|
34 |
+
var checked = $(this).is(':checked');
|
35 |
+
$('.checkbox-radio-1').prop('checked', false);
|
36 |
+
if ( checked ) {
|
37 |
+
$(this).prop('checked',true);
|
38 |
+
}
|
39 |
+
});
|
40 |
+
|
41 |
+
// field - after sent script
|
42 |
+
$( '#wpcf7-redirect-after-sent-script' ).keyup(function() {
|
43 |
+
if ( $(this).val().length != 0 ) {
|
44 |
+
$( '.field-warning-alert' ).removeClass( 'field-notice-hidden' );
|
45 |
+
} else {
|
46 |
+
$( '.field-warning-alert' ).addClass( 'field-notice-hidden' );
|
47 |
+
}
|
48 |
+
});
|
49 |
+
|
50 |
+
if ( $( '#wpcf7-redirect-after-sent-script' ).val() ) {
|
51 |
+
$( '.field-warning-alert' ).removeClass( 'field-notice-hidden' );
|
52 |
+
}
|
53 |
+
|
54 |
+
$('.wpcf7-redirect-pro-admin-notice .notice-dismiss').click(function(e) {
|
55 |
+
e.preventDefault();
|
56 |
+
sign = window.location.href.indexOf("?") > -1 ? '&' : '?';
|
57 |
+
location.href = window.location.href + sign + 'wpcf7_redirect_dismiss_notice=1';
|
58 |
+
});
|
59 |
+
|
60 |
+
$('#redirect-panel .banner-wrap .notice-dismiss').click(function(e) {
|
61 |
+
e.preventDefault();
|
62 |
+
sign = window.location.href.indexOf("?") > -1 ? '&' : '?';
|
63 |
+
location.href = window.location.href + sign + 'wpcf7_redirect_dismiss_banner=1';
|
64 |
+
});
|
65 |
+
|
66 |
+
});
|
admin/wpcf7-redirect-admin-style.css
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
#redirect-panel .banner-wrap {
|
2 |
-
position: relative;
|
3 |
-
padding: 15px 40px;
|
4 |
-
border: 1px solid #ddd;
|
5 |
-
}
|
6 |
-
#redirect-panel .banner-wrap img {
|
7 |
-
display: block;
|
8 |
-
max-width: 100%;
|
9 |
-
margin: auto;
|
10 |
-
}
|
11 |
-
#redirect-panel .field-wrap {
|
12 |
-
margin-bottom: 10px;
|
13 |
-
}
|
14 |
-
#redirect-panel .field-wrap [type='url'],
|
15 |
-
#redirect-panel .field-wrap [type='select'] {
|
16 |
-
height: 28px;
|
17 |
-
}
|
18 |
-
#redirect-panel .field-wrap [type='url'],
|
19 |
-
#redirect-panel .field-wrap [type='text'] {
|
20 |
-
width: 100%;
|
21 |
-
}
|
22 |
-
#redirect-panel .field-wrap [type='checkbox'] {
|
23 |
-
margin-top: 1px;
|
24 |
-
}
|
25 |
-
#redirect-panel .field-wrap textarea {
|
26 |
-
direction: ltr;
|
27 |
-
width: 100%;
|
28 |
-
}
|
29 |
-
#redirect-panel .field-wrap-after-sent-script {
|
30 |
-
margin-top: 10px;
|
31 |
-
}
|
32 |
-
#redirect-panel .field-wrap-page-id label,
|
33 |
-
#redirect-panel .field-wrap-after-sent-script label {
|
34 |
-
display: block;
|
35 |
-
margin-bottom: 5px;
|
36 |
-
}
|
37 |
-
#redirect-panel .field-wrap-http-build-query-selectively [type='text'] {
|
38 |
-
margin-top: 10px;
|
39 |
-
}
|
40 |
-
#redirect-panel .field-wrap-after-sent-script .field-message {
|
41 |
-
margin-bottom: 10px;
|
42 |
-
}
|
43 |
-
#redirect-panel .field-notice {
|
44 |
-
margin-top: 10px;
|
45 |
-
margin-bottom: 20px;
|
46 |
-
padding: 15px;
|
47 |
-
border: 1px solid;
|
48 |
-
border-radius: 4px;
|
49 |
-
background: #fff;
|
50 |
-
}
|
51 |
-
#redirect-panel .field-notice-alert {
|
52 |
-
color: #8a6d3b;
|
53 |
-
border: 1px solid #faebcc;
|
54 |
-
background-color: #fcf8e3;
|
55 |
-
}
|
56 |
-
#redirect-panel .field-hidden,
|
57 |
-
#redirect-panel .field-notice-hidden {
|
58 |
-
display: none;
|
59 |
-
}
|
60 |
-
#redirect-panel .field-warning-alert {
|
61 |
-
color: #a94442;
|
62 |
-
border-color: #ebccd1;
|
63 |
-
background-color: #f2dede;
|
64 |
-
}
|
65 |
-
#redirect-panel .get-pro-wrap {
|
66 |
-
direction: ltr;
|
67 |
-
text-align: center;
|
68 |
-
}
|
69 |
-
#redirect-panel .get-pro-wrap .get-pro {
|
70 |
-
display: inline-block;
|
71 |
-
padding: 15px;
|
72 |
-
color: #8a6d3b;
|
73 |
-
border: 1px solid #ddd;
|
74 |
-
background-color: #fff;
|
75 |
-
}
|
76 |
-
#redirect-panel .get-pro-wrap .get-pro .dashicons-star-filled {
|
77 |
-
color: #e7c201;
|
78 |
-
}
|
79 |
-
#redirect-panel .get-pro-wrap .get-pro a {
|
80 |
-
position: relative;
|
81 |
-
top: 2px;
|
82 |
-
margin: 0 8px;
|
83 |
-
}
|
1 |
+
#redirect-panel .banner-wrap {
|
2 |
+
position: relative;
|
3 |
+
padding: 15px 40px;
|
4 |
+
border: 1px solid #ddd;
|
5 |
+
}
|
6 |
+
#redirect-panel .banner-wrap img {
|
7 |
+
display: block;
|
8 |
+
max-width: 100%;
|
9 |
+
margin: auto;
|
10 |
+
}
|
11 |
+
#redirect-panel .field-wrap {
|
12 |
+
margin-bottom: 10px;
|
13 |
+
}
|
14 |
+
#redirect-panel .field-wrap [type='url'],
|
15 |
+
#redirect-panel .field-wrap [type='select'] {
|
16 |
+
height: 28px;
|
17 |
+
}
|
18 |
+
#redirect-panel .field-wrap [type='url'],
|
19 |
+
#redirect-panel .field-wrap [type='text'] {
|
20 |
+
width: 100%;
|
21 |
+
}
|
22 |
+
#redirect-panel .field-wrap [type='checkbox'] {
|
23 |
+
margin-top: 1px;
|
24 |
+
}
|
25 |
+
#redirect-panel .field-wrap textarea {
|
26 |
+
direction: ltr;
|
27 |
+
width: 100%;
|
28 |
+
}
|
29 |
+
#redirect-panel .field-wrap-after-sent-script {
|
30 |
+
margin-top: 10px;
|
31 |
+
}
|
32 |
+
#redirect-panel .field-wrap-page-id label,
|
33 |
+
#redirect-panel .field-wrap-after-sent-script label {
|
34 |
+
display: block;
|
35 |
+
margin-bottom: 5px;
|
36 |
+
}
|
37 |
+
#redirect-panel .field-wrap-http-build-query-selectively [type='text'] {
|
38 |
+
margin-top: 10px;
|
39 |
+
}
|
40 |
+
#redirect-panel .field-wrap-after-sent-script .field-message {
|
41 |
+
margin-bottom: 10px;
|
42 |
+
}
|
43 |
+
#redirect-panel .field-notice {
|
44 |
+
margin-top: 10px;
|
45 |
+
margin-bottom: 20px;
|
46 |
+
padding: 15px;
|
47 |
+
border: 1px solid;
|
48 |
+
border-radius: 4px;
|
49 |
+
background: #fff;
|
50 |
+
}
|
51 |
+
#redirect-panel .field-notice-alert {
|
52 |
+
color: #8a6d3b;
|
53 |
+
border: 1px solid #faebcc;
|
54 |
+
background-color: #fcf8e3;
|
55 |
+
}
|
56 |
+
#redirect-panel .field-hidden,
|
57 |
+
#redirect-panel .field-notice-hidden {
|
58 |
+
display: none;
|
59 |
+
}
|
60 |
+
#redirect-panel .field-warning-alert {
|
61 |
+
color: #a94442;
|
62 |
+
border-color: #ebccd1;
|
63 |
+
background-color: #f2dede;
|
64 |
+
}
|
65 |
+
#redirect-panel .get-pro-wrap {
|
66 |
+
direction: ltr;
|
67 |
+
text-align: center;
|
68 |
+
}
|
69 |
+
#redirect-panel .get-pro-wrap .get-pro {
|
70 |
+
display: inline-block;
|
71 |
+
padding: 15px;
|
72 |
+
color: #8a6d3b;
|
73 |
+
border: 1px solid #ddd;
|
74 |
+
background-color: #fff;
|
75 |
+
}
|
76 |
+
#redirect-panel .get-pro-wrap .get-pro .dashicons-star-filled {
|
77 |
+
color: #e7c201;
|
78 |
+
}
|
79 |
+
#redirect-panel .get-pro-wrap .get-pro a {
|
80 |
+
position: relative;
|
81 |
+
top: 2px;
|
82 |
+
margin: 0 8px;
|
83 |
+
}
|
js/wpcf7-redirect-script.js
CHANGED
@@ -21,7 +21,8 @@ function wpcf7_redirect_mailsent_handler() {
|
|
21 |
|
22 |
// Build http query
|
23 |
if ( form.http_build_query ) {
|
24 |
-
|
|
|
25 |
redirect_url = redirect_url + '?' + decodeURIComponent(http_query);
|
26 |
} else if ( form.http_build_query_selectively ) {
|
27 |
http_query = '?';
|
@@ -39,7 +40,6 @@ function wpcf7_redirect_mailsent_handler() {
|
|
39 |
// Redirect
|
40 |
if ( redirect_url ) {
|
41 |
if ( ! form.open_in_new_tab ) {
|
42 |
-
console.log(form);
|
43 |
// Open in current tab
|
44 |
if ( form.delay_redirect ) {
|
45 |
setTimeout(function() {
|
21 |
|
22 |
// Build http query
|
23 |
if ( form.http_build_query ) {
|
24 |
+
temp_http_query = jQuery.param( event.detail.inputs, true );
|
25 |
+
http_query = temp_http_query.replace(new RegExp('\\+', 'g'), '%20');
|
26 |
redirect_url = redirect_url + '?' + decodeURIComponent(http_query);
|
27 |
} else if ( form.http_build_query_selectively ) {
|
28 |
http_query = '?';
|
40 |
// Redirect
|
41 |
if ( redirect_url ) {
|
42 |
if ( ! form.open_in_new_tab ) {
|
|
|
43 |
// Open in current tab
|
44 |
if ( form.delay_redirect ) {
|
45 |
setTimeout(function() {
|
lang/readme.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
Translations have moved to https://translate.wordpress.org/projects/wp-plugins/wpcf7-redirect
|
2 |
-
|
3 |
-
Your are more than welcome contribute :)
|
1 |
+
Translations have moved to https://translate.wordpress.org/projects/wp-plugins/wpcf7-redirect
|
2 |
+
|
3 |
+
Your are more than welcome contribute :)
|
readme.txt
CHANGED
@@ -1,119 +1,127 @@
|
|
1 |
-
=== Redirection for Contact Form 7 ===
|
2 |
-
Tags: contact form 7 redirect, contact form 7 thank you page, redirect cf7, redirect contact form 7, contact form 7 success page, cf7 redirect
|
3 |
-
Contributors: yuvalsabar
|
4 |
-
Requires at least: 4.7.0
|
5 |
-
Tested up to: 5.
|
6 |
-
Stable tag: 1.3.
|
7 |
-
License: GPLv3 or later
|
8 |
-
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
-
|
10 |
-
A simple add-on for Contact Form 7 that adds a redirect option after form sent successfully.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
A straightforward add-on plugin for Contact Form 7 - adds the option to redirect to any page you choose after mail sent successfully, with DOM Events and without AJAX being disabled.
|
15 |
-
NOTE: This plugin requires Contact Form 7 version 4.8 or later.
|
16 |
-
|
17 |
-
== Usage ==
|
18 |
-
|
19 |
-
Simply go to your form settings, choose the "Redirect Settings" tab and set the page you want to be redirected to.
|
20 |
-
|
21 |
-
== Features ==
|
22 |
-
|
23 |
-
* Redirect to any URL
|
24 |
-
* Open page in a new tab
|
25 |
-
* Run JavaScript after form submission (great for conversion management)
|
26 |
-
* Pass fields from the form as URL query parameters
|
27 |
-
|
28 |
-
* **[Pro]** Create registration forms
|
29 |
-
* **[Pro]** Create login forms
|
30 |
-
* **[Pro]** Add to Mailchimp list
|
31 |
-
* **[Pro]** Conditional error managment
|
32 |
-
* **[Pro]** Redirect rules
|
33 |
-
* **[Pro]** Conditional logic for each action
|
34 |
-
* **[Pro]** Manage email notifications by conditional logic
|
35 |
-
* **[Pro]** Fire custom JavaScript events by conditional logic
|
36 |
-
* **[Pro]** Send data to remote servers (3rd-party integration)
|
37 |
-
* **[Pro]** Send RESTful Json/XML to remote servers
|
38 |
-
* **[Pro]** Send RESTful POST/GET to remote servers
|
39 |
-
* **[Pro]** Manage Facebook conversion pixels
|
40 |
-
* **[Pro]** Manage Google Adwords conversion pixels
|
41 |
-
* **[Pro]** Leads Manager - save leads to database
|
42 |
-
* **[Pro]** PayPal Integration
|
43 |
-
|
44 |
-
|
45 |
-
> Note: some features are availible only in the Pro version. Which means you need Redirection for Contact Form 7 Pro to unlock those features. You can [get Redirection for Contact Form 7 Pro here](http://querysol.com/product/contact-form-7-redirection/)!
|
46 |
-
|
47 |
-
== Installation ==
|
48 |
-
|
49 |
-
Installing Redirection for Contact Form 7 can be done either by searching for "Redirection for Contact Form 7" via the "Plugins > Add New" screen in your WordPress dashboard, or by using the following steps:
|
50 |
-
|
51 |
-
1. Download the plugin via WordPress.org.
|
52 |
-
2. Upload the ZIP file through the "Plugins > Add New > Upload" screen in your WordPress dashboard.
|
53 |
-
3. Activate the plugin through the 'Plugins' menu in WordPress
|
54 |
-
4. Visit the settings screen and configure, as desired.
|
55 |
-
|
56 |
-
== Frequently Asked Questions ==
|
57 |
-
|
58 |
-
= Does the plugin disables Contact Form 7 Ajax? =
|
59 |
-
|
60 |
-
No, it doesn't. The plugin does not disables any of Contact Form 7 normal behavior, unlike all other plugins that do the same.
|
61 |
-
|
62 |
-
= Does this plugin uses "on_sent_ok" additional setting? =
|
63 |
-
|
64 |
-
No. One of the reasons we developed this plugin, is because on_send_ok is now deprecated, and is going to be abolished by the end of 2017. This plugin is the only redirect plugin for Contact Form 7 that has been updated to use [DOM events](https://contactform7.com/dom-events/) to perform redirect, as Contact Form 7 developer Takayuki Miyoshi recommends.
|
65 |
-
|
66 |
-
== Screenshots ==
|
67 |
-
|
68 |
-
1. Redirect Settings tab
|
69 |
-
|
70 |
-
== Changelog ==
|
71 |
-
|
72 |
-
= 1.3.
|
73 |
-
* Fixed a bug:
|
74 |
-
|
75 |
-
= 1.3.
|
76 |
-
*
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
*
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
*
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
*
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
*
|
112 |
-
|
113 |
-
= 1.
|
114 |
-
*
|
115 |
-
*
|
116 |
-
*
|
117 |
-
|
118 |
-
= 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
* Initial release.
|
1 |
+
=== Redirection for Contact Form 7 ===
|
2 |
+
Tags: contact form 7 redirect, contact form 7 thank you page, redirect cf7, redirect contact form 7, contact form 7 success page, cf7 redirect
|
3 |
+
Contributors: yuvalsabar
|
4 |
+
Requires at least: 4.7.0
|
5 |
+
Tested up to: 5.4
|
6 |
+
Stable tag: 1.3.5
|
7 |
+
License: GPLv3 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
|
10 |
+
A simple add-on for Contact Form 7 that adds a redirect option after form sent successfully.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
A straightforward add-on plugin for Contact Form 7 - adds the option to redirect to any page you choose after mail sent successfully, with DOM Events and without AJAX being disabled.
|
15 |
+
NOTE: This plugin requires Contact Form 7 version 4.8 or later.
|
16 |
+
|
17 |
+
== Usage ==
|
18 |
+
|
19 |
+
Simply go to your form settings, choose the "Redirect Settings" tab and set the page you want to be redirected to.
|
20 |
+
|
21 |
+
== Features ==
|
22 |
+
|
23 |
+
* Redirect to any URL
|
24 |
+
* Open page in a new tab
|
25 |
+
* Run JavaScript after form submission (great for conversion management)
|
26 |
+
* Pass fields from the form as URL query parameters
|
27 |
+
|
28 |
+
* **[Pro]** Create registration forms
|
29 |
+
* **[Pro]** Create login forms
|
30 |
+
* **[Pro]** Add to Mailchimp list
|
31 |
+
* **[Pro]** Conditional error managment
|
32 |
+
* **[Pro]** Redirect rules
|
33 |
+
* **[Pro]** Conditional logic for each action
|
34 |
+
* **[Pro]** Manage email notifications by conditional logic
|
35 |
+
* **[Pro]** Fire custom JavaScript events by conditional logic
|
36 |
+
* **[Pro]** Send data to remote servers (3rd-party integration)
|
37 |
+
* **[Pro]** Send RESTful Json/XML to remote servers
|
38 |
+
* **[Pro]** Send RESTful POST/GET to remote servers
|
39 |
+
* **[Pro]** Manage Facebook conversion pixels
|
40 |
+
* **[Pro]** Manage Google Adwords conversion pixels
|
41 |
+
* **[Pro]** Leads Manager - save leads to database
|
42 |
+
* **[Pro]** PayPal Integration
|
43 |
+
|
44 |
+
|
45 |
+
> Note: some features are availible only in the Pro version. Which means you need Redirection for Contact Form 7 Pro to unlock those features. You can [get Redirection for Contact Form 7 Pro here](http://querysol.com/product/contact-form-7-redirection/)!
|
46 |
+
|
47 |
+
== Installation ==
|
48 |
+
|
49 |
+
Installing Redirection for Contact Form 7 can be done either by searching for "Redirection for Contact Form 7" via the "Plugins > Add New" screen in your WordPress dashboard, or by using the following steps:
|
50 |
+
|
51 |
+
1. Download the plugin via WordPress.org.
|
52 |
+
2. Upload the ZIP file through the "Plugins > Add New > Upload" screen in your WordPress dashboard.
|
53 |
+
3. Activate the plugin through the 'Plugins' menu in WordPress
|
54 |
+
4. Visit the settings screen and configure, as desired.
|
55 |
+
|
56 |
+
== Frequently Asked Questions ==
|
57 |
+
|
58 |
+
= Does the plugin disables Contact Form 7 Ajax? =
|
59 |
+
|
60 |
+
No, it doesn't. The plugin does not disables any of Contact Form 7 normal behavior, unlike all other plugins that do the same.
|
61 |
+
|
62 |
+
= Does this plugin uses "on_sent_ok" additional setting? =
|
63 |
+
|
64 |
+
No. One of the reasons we developed this plugin, is because on_send_ok is now deprecated, and is going to be abolished by the end of 2017. This plugin is the only redirect plugin for Contact Form 7 that has been updated to use [DOM events](https://contactform7.com/dom-events/) to perform redirect, as Contact Form 7 developer Takayuki Miyoshi recommends.
|
65 |
+
|
66 |
+
== Screenshots ==
|
67 |
+
|
68 |
+
1. Redirect Settings tab
|
69 |
+
|
70 |
+
== Changelog ==
|
71 |
+
|
72 |
+
= 1.3.5 =
|
73 |
+
* Fixed a bug: Redirection Pro for Contact Form 7 not disappearing after clicking the X button (for some users).
|
74 |
+
|
75 |
+
= 1.3.4 =
|
76 |
+
* Fixed a bug: "Changes you made may not be saved" pop-up no longer appears when no changes have been made.
|
77 |
+
* Fixed a bug: When passing all fields as parameters, "+" sign is now replaced with "%20".
|
78 |
+
* Minor code styling changes to fully meet WordPress standards.
|
79 |
+
|
80 |
+
= 1.3.3 =
|
81 |
+
* Fixed a bug: URL query parameters are now properly decoded.
|
82 |
+
|
83 |
+
= 1.3.2 =
|
84 |
+
* New feature: delay redirection in milliseconds.
|
85 |
+
|
86 |
+
= 1.3.1 =
|
87 |
+
* Fixed a bug in legacy browsers: the Pro message keep showing.
|
88 |
+
|
89 |
+
= 1.3.0 =
|
90 |
+
* Minor dev improvements.
|
91 |
+
|
92 |
+
= 1.2.9 =
|
93 |
+
* Fixed a bug: when passing specific fields as URL query parameters, not all the fields were passed.
|
94 |
+
|
95 |
+
= 1.2.8 =
|
96 |
+
* New feature: Pass specific fields from the form as URL query parameters.
|
97 |
+
* Minor dev improvements.
|
98 |
+
|
99 |
+
= 1.2.7 =
|
100 |
+
* Script field now accepts special characters, such as < and >.
|
101 |
+
|
102 |
+
= 1.2.6 =
|
103 |
+
* Added support for browsers that don't support AJAX.
|
104 |
+
* Minor CSS changes.
|
105 |
+
|
106 |
+
= 1.2.5 =
|
107 |
+
* Added error message if Contact Form 7 version is earlier than 4.8.
|
108 |
+
|
109 |
+
= 1.2.4 =
|
110 |
+
* Fixed a bug regarding sanitizing URL, causing & to change to #038;
|
111 |
+
* Unnecessary variables removed.
|
112 |
+
|
113 |
+
= 1.2.2 =
|
114 |
+
* New feature: Pass all fields from the form as URL query parameters.
|
115 |
+
* Minor CSS changes.
|
116 |
+
* Dev improvements.
|
117 |
+
|
118 |
+
= 1.2 =
|
119 |
+
* New feature: add script after the form has been sent successfully.
|
120 |
+
|
121 |
+
= 1.0.2 =
|
122 |
+
* Added full support for form duplication.
|
123 |
+
* New feature: open page in a new tab.
|
124 |
+
* Added plugin class CF7_Redirect.
|
125 |
+
|
126 |
+
= 1.0.0 =
|
127 |
* Initial release.
|
wpcf7-redirect.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Redirection for Contact Form 7
|
4 |
* Plugin URI: http://querysol.com
|
5 |
* Description: Contact Form 7 Add-on - Redirect after mail sent.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: Query Solutions
|
8 |
* Author URI: http://querysol.com
|
9 |
* Contributors: querysolutions, yuvalsabar
|
@@ -29,24 +29,24 @@ class WPCF7_Redirect {
|
|
29 |
* Construct class
|
30 |
*/
|
31 |
public function __construct() {
|
32 |
-
$this->plugin_url
|
33 |
-
$this->plugin_path
|
34 |
-
$this->version
|
35 |
$this->add_actions();
|
36 |
}
|
37 |
|
38 |
-
static function
|
39 |
update_option( 'wpcf7_redirect_admin_notice_dismiss', 0 );
|
40 |
update_option( 'wpcf7_redirect_banner_dismiss', 0 );
|
41 |
}
|
42 |
|
43 |
-
public function
|
44 |
-
if ( isset( $_GET['wpcf7_redirect_dismiss_notice'] ) && $_GET['wpcf7_redirect_dismiss_notice']
|
45 |
-
|
46 |
-
}
|
47 |
|
48 |
-
if ( isset( $_GET['wpcf7_redirect_dismiss_banner'] ) && $_GET['wpcf7_redirect_dismiss_banner']
|
49 |
-
|
50 |
}
|
51 |
}
|
52 |
|
@@ -61,7 +61,7 @@ class WPCF7_Redirect {
|
|
61 |
add_action( 'wpcf7_after_save', array( $this, 'store_meta' ) );
|
62 |
add_action( 'wpcf7_after_create', array( $this, 'duplicate_form_support' ) );
|
63 |
add_action( 'wpcf7_submit', array( $this, 'non_ajax_redirection' ) );
|
64 |
-
add_action( 'admin_init', array( $this, '
|
65 |
add_action( 'admin_notices', array( $this, 'dependencies_notice' ) );
|
66 |
add_action( 'admin_notices', array( $this, 'pro_notice' ) );
|
67 |
}
|
@@ -88,8 +88,8 @@ class WPCF7_Redirect {
|
|
88 |
wp_enqueue_script( 'wpcf7-redirect-script', $this->plugin_url . 'js/wpcf7-redirect-script.js', array(), null, true );
|
89 |
wp_localize_script( 'wpcf7-redirect-script', 'wpcf7_redirect_forms', $this->get_forms() );
|
90 |
|
91 |
-
if ( isset( $this->enqueue_new_tab_script ) && $this->enqueue_new_tab_script ){
|
92 |
-
wp_add_inline_script( 'wpcf7-redirect-script', 'window.open("'. $this->redirect_url .'");' );
|
93 |
}
|
94 |
}
|
95 |
|
@@ -100,8 +100,8 @@ class WPCF7_Redirect {
|
|
100 |
*/
|
101 |
public function add_panel( $panels ) {
|
102 |
$panels['redirect-panel'] = array(
|
103 |
-
'title'
|
104 |
-
'callback'
|
105 |
);
|
106 |
return $panels;
|
107 |
}
|
@@ -164,7 +164,7 @@ class WPCF7_Redirect {
|
|
164 |
$fields = $this->get_plugin_fields();
|
165 |
|
166 |
foreach ( $fields as $field ) {
|
167 |
-
$values[ $field['name'] ] = get_post_meta( $post_id, '_wpcf7_redirect_' . $field['name']
|
168 |
}
|
169 |
|
170 |
return $values;
|
@@ -183,9 +183,9 @@ class WPCF7_Redirect {
|
|
183 |
return;
|
184 |
}
|
185 |
|
186 |
-
$form_id
|
187 |
-
$fields
|
188 |
-
$data
|
189 |
|
190 |
foreach ( $fields as $field ) {
|
191 |
$value = isset( $data[ $field['name'] ] ) ? $data[ $field['name'] ] : '';
|
@@ -216,30 +216,32 @@ class WPCF7_Redirect {
|
|
216 |
|
217 |
/**
|
218 |
* Push all forms redirect settings data into an array.
|
|
|
219 |
* @return array Form redirect settings data
|
220 |
*/
|
221 |
public function get_forms() {
|
222 |
-
$args
|
223 |
-
'post_type'
|
224 |
-
'posts_per_page'
|
225 |
-
'suppress_filters' => true
|
226 |
);
|
227 |
$query = new WP_Query( $args );
|
228 |
|
229 |
$forms = array();
|
230 |
-
|
231 |
if ( $query->have_posts() ) :
|
232 |
|
233 |
$fields = $this->get_plugin_fields();
|
234 |
|
235 |
-
while ( $query->have_posts() ) :
|
|
|
236 |
|
237 |
$post_id = get_the_ID();
|
238 |
|
239 |
foreach ( $fields as $field ) {
|
240 |
$forms[ $post_id ][ $field['name'] ] = get_post_meta( $post_id, '_wpcf7_redirect_' . $field['name'], true );
|
241 |
|
242 |
-
if ( $field['type']
|
243 |
$forms[ $post_id ][ $field['name'] ] = $forms[ $post_id ][ $field['name'] ];
|
244 |
}
|
245 |
}
|
@@ -286,10 +288,10 @@ class WPCF7_Redirect {
|
|
286 |
|
287 |
<div class="wpcf7-redirect-error error notice">
|
288 |
<h3>
|
289 |
-
<?php esc_html_e( 'Contact Form Redirection', 'wpcf7-redirect' )
|
290 |
</h3>
|
291 |
<p>
|
292 |
-
<?php esc_html_e( 'Error: Contact Form 7 version is too old. Contact Form Redirection is compatible from version 4.8 and above. Please update Contact Form 7.', 'wpcf7-redirect' )
|
293 |
</p>
|
294 |
</div>
|
295 |
|
@@ -300,10 +302,10 @@ class WPCF7_Redirect {
|
|
300 |
?>
|
301 |
<div class="wpcf7-redirect-error error notice">
|
302 |
<h3>
|
303 |
-
<?php esc_html_e( 'Contact Form Redirection', 'wpcf7-redirect' )
|
304 |
</h3>
|
305 |
<p>
|
306 |
-
<?php esc_html_e( 'Error: Please install and activate Contact Form 7.', 'wpcf7-redirect' )
|
307 |
</p>
|
308 |
</div>
|
309 |
|
@@ -312,52 +314,54 @@ class WPCF7_Redirect {
|
|
312 |
}
|
313 |
|
314 |
public function pro_notice() {
|
315 |
-
if ( ! get_option( 'wpcf7_redirect_admin_notice_dismiss' ) ) :
|
|
|
316 |
|
317 |
<div class="wpcf7-redirect-pro-admin-notice updated notice is-dismissible">
|
318 |
<p>
|
319 |
<a href="https://querysol.com/product/contact-form-7-redirection/" target="_blank">
|
320 |
-
Redirection
|
321 |
</a>
|
322 |
</p>
|
323 |
</div>
|
324 |
|
325 |
-
|
|
|
326 |
}
|
327 |
|
328 |
|
329 |
/**
|
330 |
-
* Add plugin support to browsers that don't support ajax
|
331 |
*/
|
332 |
public function non_ajax_redirection( $contact_form ) {
|
333 |
$this->fields = $this->get_fields_values( $contact_form->id() );
|
334 |
|
335 |
if ( isset( $this->fields ) && ! WPCF7_Submission::is_restful() ) {
|
336 |
-
$submission
|
337 |
|
338 |
-
if ( $submission->get_status()
|
339 |
|
340 |
// Use extrnal url
|
341 |
-
if ( $this->fields['external_url'] && $this->fields['use_external_url']
|
342 |
$this->redirect_url = $this->fields['external_url'];
|
343 |
} else {
|
344 |
$this->redirect_url = get_permalink( $this->fields['page_id'] );
|
345 |
}
|
346 |
|
347 |
// Pass all fields from the form as URL query parameters
|
348 |
-
if ( isset( $this->redirect_url ) && $this->redirect_url ) {
|
349 |
-
if ( $this->fields['http_build_query']
|
350 |
-
$posted_data
|
351 |
// Remove WPCF7 keys from posted data
|
352 |
-
$remove_keys
|
353 |
-
$posted_data
|
354 |
$this->redirect_url = add_query_arg( $posted_data, $this->redirect_url );
|
355 |
}
|
356 |
}
|
357 |
|
358 |
// Open link in a new tab
|
359 |
if ( isset( $this->redirect_url ) && $this->redirect_url ) {
|
360 |
-
if ( $this->fields['open_in_new_tab']
|
361 |
$this->enqueue_new_tab_script = true;
|
362 |
} else {
|
363 |
wp_redirect( $this->redirect_url );
|
@@ -378,110 +382,136 @@ class WPCF7_Redirect {
|
|
378 |
|
379 |
$fields = $this->get_fields_values( $post->id() );
|
380 |
?>
|
381 |
-
|
382 |
<?php if ( ! get_option( 'wpcf7_redirect_banner_dismiss' ) ) : ?>
|
383 |
|
384 |
<div class="banner-wrap">
|
385 |
<button type="button" class="notice-dismiss">
|
386 |
-
<span class="screen-reader-text"><?php _e( 'Close Banner', 'qstheme' )
|
387 |
</button>
|
388 |
<a href="https://querysol.com/product/contact-form-7-redirection/" target="_blank">
|
389 |
-
<img src="<?php echo $this->plugin_url
|
390 |
</a>
|
391 |
</div>
|
392 |
|
393 |
-
<?php endif
|
394 |
|
395 |
<h2>
|
396 |
-
<?php esc_html_e( 'Redirect Settings', 'wpcf7-redirect' )
|
397 |
</h2>
|
398 |
|
399 |
<fieldset>
|
400 |
<div class="field-wrap field-wrap-page-id">
|
401 |
<label for="wpcf7-redirect-page-id">
|
402 |
-
<?php esc_html_e( 'Select a page to redirect to on successful form submission.', 'wpcf7-redirect' )
|
403 |
</label>
|
|
|
404 |
<?php
|
405 |
-
|
406 |
-
|
407 |
-
'
|
408 |
-
'
|
409 |
-
'
|
410 |
-
'selected' => $fields['page_id'],
|
411 |
-
'id' => 'wpcf7-redirect-page-id',
|
412 |
)
|
413 |
);
|
414 |
-
|
415 |
-
</div>
|
416 |
|
417 |
-
|
418 |
-
|
419 |
-
|
|
|
420 |
|
421 |
-
|
422 |
-
<input type="checkbox" id="wpcf7-redirect-use-external-url" name="wpcf7-redirect[use_external_url]" <?php checked( $fields['use_external_url'], 'on', true ); ?>/>
|
423 |
-
<label for="wpcf7-redirect-use-external-url">
|
424 |
-
<?php esc_html_e( 'Use external URL', 'wpcf7-redirect' );?>
|
425 |
-
</label>
|
426 |
-
</div>
|
427 |
|
|
|
|
|
|
|
428 |
|
429 |
-
|
430 |
-
|
431 |
-
<label for="wpcf7-redirect-open-in-new-tab"><?php esc_html_e( 'Open page in a new tab', 'wpcf7-redirect' );?></label>
|
432 |
-
<div class="field-notice field-notice-alert field-notice-hidden">
|
433 |
-
<strong>
|
434 |
-
<?php esc_html_e( 'Notice!', 'wpcf7-redirect' );?>
|
435 |
-
</strong>
|
436 |
-
<?php esc_html_e( 'This option might not work as expected, since browsers often block popup windows. This option depends on the browser settings.', 'wpcf7-redirect' );?>
|
437 |
</div>
|
438 |
-
</div>
|
439 |
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
<?php esc_html_e( 'Pass all the fields from the form as URL query parameters', 'wpcf7-redirect' );?>
|
444 |
-
</label>
|
445 |
-
</div>
|
446 |
|
447 |
-
|
448 |
-
|
449 |
-
<label for="wpcf7-redirect-http-build-query-selectively">
|
450 |
-
<?php esc_html_e( 'Pass specific fields from the form as URL query parameters', 'wpcf7-redirect' );?>
|
451 |
-
</label>
|
452 |
-
<input type="text" id="wpcf7-redirect-http-build-query-selectively-fields" class="field-hidden" placeholder="<?php esc_html_e( 'Fields to pass, separated by commas', 'wpcf7-redirect' );?>" name="wpcf7-redirect[http_build_query_selectively_fields]" value="<?php echo $fields['http_build_query_selectively_fields'];?>">
|
453 |
-
</div>
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
</
|
459 |
-
|
460 |
-
|
|
|
461 |
|
462 |
-
|
463 |
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
</div>
|
471 |
-
<textarea id="wpcf7-redirect-after-sent-script" name="wpcf7-redirect[after_sent_script]" rows="8" cols="100"><?php echo $fields['after_sent_script'];?></textarea>
|
472 |
</div>
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
</div>
|
479 |
</fieldset>
|
480 |
-
|
481 |
<div class="get-pro-wrap">
|
482 |
<div class="get-pro">
|
483 |
<span class="dashicons dashicons-star-filled"></span>
|
484 |
-
<a href="https://querysol.com/product/contact-form-7-redirection/" target="_blank">
|
|
|
|
|
485 |
<span class="dashicons dashicons-star-filled"></span>
|
486 |
</div>
|
487 |
</div>
|
@@ -490,6 +520,6 @@ class WPCF7_Redirect {
|
|
490 |
}
|
491 |
}
|
492 |
|
493 |
-
register_activation_hook( __FILE__, array( 'WPCF7_Redirect', '
|
494 |
|
495 |
$cf7_redirect = new WPCF7_Redirect();
|
3 |
* Plugin Name: Redirection for Contact Form 7
|
4 |
* Plugin URI: http://querysol.com
|
5 |
* Description: Contact Form 7 Add-on - Redirect after mail sent.
|
6 |
+
* Version: 1.3.5
|
7 |
* Author: Query Solutions
|
8 |
* Author URI: http://querysol.com
|
9 |
* Contributors: querysolutions, yuvalsabar
|
29 |
* Construct class
|
30 |
*/
|
31 |
public function __construct() {
|
32 |
+
$this->plugin_url = plugin_dir_url( __FILE__ );
|
33 |
+
$this->plugin_path = plugin_dir_path( __FILE__ );
|
34 |
+
$this->version = '1.3.5';
|
35 |
$this->add_actions();
|
36 |
}
|
37 |
|
38 |
+
static function plugin_activated( $file ) {
|
39 |
update_option( 'wpcf7_redirect_admin_notice_dismiss', 0 );
|
40 |
update_option( 'wpcf7_redirect_banner_dismiss', 0 );
|
41 |
}
|
42 |
|
43 |
+
public function dismiss_ads() {
|
44 |
+
if ( isset( $_GET['wpcf7_redirect_dismiss_notice'] ) && 1 == $_GET['wpcf7_redirect_dismiss_notice'] ) {
|
45 |
+
update_option( 'wpcf7_redirect_admin_notice_dismiss', 1 );
|
46 |
+
}
|
47 |
|
48 |
+
if ( isset( $_GET['wpcf7_redirect_dismiss_banner'] ) && 1 == $_GET['wpcf7_redirect_dismiss_banner'] ) {
|
49 |
+
update_option( 'wpcf7_redirect_banner_dismiss', 1 );
|
50 |
}
|
51 |
}
|
52 |
|
61 |
add_action( 'wpcf7_after_save', array( $this, 'store_meta' ) );
|
62 |
add_action( 'wpcf7_after_create', array( $this, 'duplicate_form_support' ) );
|
63 |
add_action( 'wpcf7_submit', array( $this, 'non_ajax_redirection' ) );
|
64 |
+
add_action( 'admin_init', array( $this, 'dismiss_ads' ) );
|
65 |
add_action( 'admin_notices', array( $this, 'dependencies_notice' ) );
|
66 |
add_action( 'admin_notices', array( $this, 'pro_notice' ) );
|
67 |
}
|
88 |
wp_enqueue_script( 'wpcf7-redirect-script', $this->plugin_url . 'js/wpcf7-redirect-script.js', array(), null, true );
|
89 |
wp_localize_script( 'wpcf7-redirect-script', 'wpcf7_redirect_forms', $this->get_forms() );
|
90 |
|
91 |
+
if ( isset( $this->enqueue_new_tab_script ) && $this->enqueue_new_tab_script ) {
|
92 |
+
wp_add_inline_script( 'wpcf7-redirect-script', 'window.open("' . $this->redirect_url . '");' );
|
93 |
}
|
94 |
}
|
95 |
|
100 |
*/
|
101 |
public function add_panel( $panels ) {
|
102 |
$panels['redirect-panel'] = array(
|
103 |
+
'title' => __( 'Redirect Settings', 'wpcf7-redirect' ),
|
104 |
+
'callback' => array( $this, 'create_panel_inputs' ),
|
105 |
);
|
106 |
return $panels;
|
107 |
}
|
164 |
$fields = $this->get_plugin_fields();
|
165 |
|
166 |
foreach ( $fields as $field ) {
|
167 |
+
$values[ $field['name'] ] = get_post_meta( $post_id, '_wpcf7_redirect_' . $field['name'], true );
|
168 |
}
|
169 |
|
170 |
return $values;
|
183 |
return;
|
184 |
}
|
185 |
|
186 |
+
$form_id = $contact_form->id();
|
187 |
+
$fields = $this->get_plugin_fields( $form_id );
|
188 |
+
$data = $_POST['wpcf7-redirect'];
|
189 |
|
190 |
foreach ( $fields as $field ) {
|
191 |
$value = isset( $data[ $field['name'] ] ) ? $data[ $field['name'] ] : '';
|
216 |
|
217 |
/**
|
218 |
* Push all forms redirect settings data into an array.
|
219 |
+
*
|
220 |
* @return array Form redirect settings data
|
221 |
*/
|
222 |
public function get_forms() {
|
223 |
+
$args = array(
|
224 |
+
'post_type' => 'wpcf7_contact_form',
|
225 |
+
'posts_per_page' => -1,
|
226 |
+
'suppress_filters' => true,
|
227 |
);
|
228 |
$query = new WP_Query( $args );
|
229 |
|
230 |
$forms = array();
|
231 |
+
|
232 |
if ( $query->have_posts() ) :
|
233 |
|
234 |
$fields = $this->get_plugin_fields();
|
235 |
|
236 |
+
while ( $query->have_posts() ) :
|
237 |
+
$query->the_post();
|
238 |
|
239 |
$post_id = get_the_ID();
|
240 |
|
241 |
foreach ( $fields as $field ) {
|
242 |
$forms[ $post_id ][ $field['name'] ] = get_post_meta( $post_id, '_wpcf7_redirect_' . $field['name'], true );
|
243 |
|
244 |
+
if ( 'textarea' === $field['type'] ) {
|
245 |
$forms[ $post_id ][ $field['name'] ] = $forms[ $post_id ][ $field['name'] ];
|
246 |
}
|
247 |
}
|
288 |
|
289 |
<div class="wpcf7-redirect-error error notice">
|
290 |
<h3>
|
291 |
+
<?php esc_html_e( 'Contact Form Redirection', 'wpcf7-redirect' ); ?>
|
292 |
</h3>
|
293 |
<p>
|
294 |
+
<?php esc_html_e( 'Error: Contact Form 7 version is too old. Contact Form Redirection is compatible from version 4.8 and above. Please update Contact Form 7.', 'wpcf7-redirect' ); ?>
|
295 |
</p>
|
296 |
</div>
|
297 |
|
302 |
?>
|
303 |
<div class="wpcf7-redirect-error error notice">
|
304 |
<h3>
|
305 |
+
<?php esc_html_e( 'Contact Form Redirection', 'wpcf7-redirect' ); ?>
|
306 |
</h3>
|
307 |
<p>
|
308 |
+
<?php esc_html_e( 'Error: Please install and activate Contact Form 7.', 'wpcf7-redirect' ); ?>
|
309 |
</p>
|
310 |
</div>
|
311 |
|
314 |
}
|
315 |
|
316 |
public function pro_notice() {
|
317 |
+
if ( ! get_option( 'wpcf7_redirect_admin_notice_dismiss' ) ) :
|
318 |
+
?>
|
319 |
|
320 |
<div class="wpcf7-redirect-pro-admin-notice updated notice is-dismissible">
|
321 |
<p>
|
322 |
<a href="https://querysol.com/product/contact-form-7-redirection/" target="_blank">
|
323 |
+
Redirection Pro For Contact Form 7 - We've added exciting new features!
|
324 |
</a>
|
325 |
</p>
|
326 |
</div>
|
327 |
|
328 |
+
<?php
|
329 |
+
endif;
|
330 |
}
|
331 |
|
332 |
|
333 |
/**
|
334 |
+
* Add plugin support to browsers that don't support ajax
|
335 |
*/
|
336 |
public function non_ajax_redirection( $contact_form ) {
|
337 |
$this->fields = $this->get_fields_values( $contact_form->id() );
|
338 |
|
339 |
if ( isset( $this->fields ) && ! WPCF7_Submission::is_restful() ) {
|
340 |
+
$submission = WPCF7_Submission::get_instance();
|
341 |
|
342 |
+
if ( $submission->get_status() === 'mail_sent' ) {
|
343 |
|
344 |
// Use extrnal url
|
345 |
+
if ( 'on' === $this->fields['external_url'] && $this->fields['use_external_url'] ) {
|
346 |
$this->redirect_url = $this->fields['external_url'];
|
347 |
} else {
|
348 |
$this->redirect_url = get_permalink( $this->fields['page_id'] );
|
349 |
}
|
350 |
|
351 |
// Pass all fields from the form as URL query parameters
|
352 |
+
if ( isset( $this->redirect_url ) && $this->redirect_url ) {
|
353 |
+
if ( 'on' === $this->fields['http_build_query'] ) {
|
354 |
+
$posted_data = $submission->get_posted_data();
|
355 |
// Remove WPCF7 keys from posted data
|
356 |
+
$remove_keys = array( '_wpcf7', '_wpcf7_version', '_wpcf7_locale', '_wpcf7_unit_tag', '_wpcf7_container_post' );
|
357 |
+
$posted_data = array_diff_key( $posted_data, array_flip( $remove_keys ) );
|
358 |
$this->redirect_url = add_query_arg( $posted_data, $this->redirect_url );
|
359 |
}
|
360 |
}
|
361 |
|
362 |
// Open link in a new tab
|
363 |
if ( isset( $this->redirect_url ) && $this->redirect_url ) {
|
364 |
+
if ( 'on' === $this->fields['open_in_new_tab'] ) {
|
365 |
$this->enqueue_new_tab_script = true;
|
366 |
} else {
|
367 |
wp_redirect( $this->redirect_url );
|
382 |
|
383 |
$fields = $this->get_fields_values( $post->id() );
|
384 |
?>
|
385 |
+
|
386 |
<?php if ( ! get_option( 'wpcf7_redirect_banner_dismiss' ) ) : ?>
|
387 |
|
388 |
<div class="banner-wrap">
|
389 |
<button type="button" class="notice-dismiss">
|
390 |
+
<span class="screen-reader-text"><?php _e( 'Close Banner', 'qstheme' ); ?>.</span>
|
391 |
</button>
|
392 |
<a href="https://querysol.com/product/contact-form-7-redirection/" target="_blank">
|
393 |
+
<img src="<?php echo $this->plugin_url; ?>/img/banner-pro.png" alt="<?php _e( 'Banner - Redirection Pro For Contact Form 7', 'wpcf7-redirect' ); ?>">
|
394 |
</a>
|
395 |
</div>
|
396 |
|
397 |
+
<?php endif; ?>
|
398 |
|
399 |
<h2>
|
400 |
+
<?php esc_html_e( 'Redirect Settings', 'wpcf7-redirect' ); ?>
|
401 |
</h2>
|
402 |
|
403 |
<fieldset>
|
404 |
<div class="field-wrap field-wrap-page-id">
|
405 |
<label for="wpcf7-redirect-page-id">
|
406 |
+
<?php esc_html_e( 'Select a page to redirect to on successful form submission.', 'wpcf7-redirect' ); ?>
|
407 |
</label>
|
408 |
+
|
409 |
<?php
|
410 |
+
$pages = get_posts(
|
411 |
+
array(
|
412 |
+
'post_type' => 'page',
|
413 |
+
'posts_per_page' => -1,
|
414 |
+
'suppress_filters' => true,
|
|
|
|
|
415 |
)
|
416 |
);
|
417 |
+
?>
|
|
|
418 |
|
419 |
+
<select name="wpcf7-redirect[page_id]" id="wpcf7-redirect-page-id">
|
420 |
+
<option value="0" <?php selected( 0, $fields['page_id'] ); ?>>
|
421 |
+
<?php _e( 'Choose Page', 'wpcf7-redirect' ); ?>
|
422 |
+
</option>
|
423 |
|
424 |
+
<?php foreach ( $pages as $p ) : ?>
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
+
<option value="<?php echo $p->ID; ?>" <?php selected( $p->ID, $fields['page_id'] ); ?>>
|
427 |
+
<?php echo $p->post_title; ?>
|
428 |
+
</option>
|
429 |
|
430 |
+
<?php endforeach ?>
|
431 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
</div>
|
|
|
433 |
|
434 |
+
<div class="field-wrap field-wrap-external-url">
|
435 |
+
<input type="url" id="wpcf7-redirect-external-url" placeholder="<?php esc_html_e( 'External URL', 'wpcf7-redirect' ); ?>" name="wpcf7-redirect[external_url]" value="<?php echo $fields['external_url']; ?>">
|
436 |
+
</div>
|
|
|
|
|
|
|
437 |
|
438 |
+
<div class="field-wrap field-wrap-use-external-url">
|
439 |
+
<input type="checkbox" id="wpcf7-redirect-use-external-url" name="wpcf7-redirect[use_external_url]" <?php checked( $fields['use_external_url'], 'on', true ); ?>/>
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
+
<label for="wpcf7-redirect-use-external-url">
|
442 |
+
<?php esc_html_e( 'Use external URL', 'wpcf7-redirect' ); ?>
|
443 |
+
</label>
|
444 |
+
</div>
|
445 |
+
|
446 |
+
<div class="field-wrap field-wrap-open-in-new-tab">
|
447 |
+
<input type="checkbox" id="wpcf7-redirect-open-in-new-tab" name="wpcf7-redirect[open_in_new_tab]" <?php checked( $fields['open_in_new_tab'], 'on', true ); ?>/>
|
448 |
|
449 |
+
<label for="wpcf7-redirect-open-in-new-tab"><?php esc_html_e( 'Open page in a new tab', 'wpcf7-redirect' ); ?></label>
|
450 |
|
451 |
+
<div class="field-notice field-notice-alert field-notice-hidden">
|
452 |
+
<strong>
|
453 |
+
<?php esc_html_e( 'Notice!', 'wpcf7-redirect' ); ?>
|
454 |
+
</strong>
|
455 |
+
|
456 |
+
<?php esc_html_e( 'This option might not work as expected, since browsers often block popup windows. This option depends on the browser settings.', 'wpcf7-redirect' ); ?>
|
457 |
</div>
|
|
|
458 |
</div>
|
459 |
+
|
460 |
+
<div class="field-wrap field-wrap-http-build-query">
|
461 |
+
<input type="checkbox" id="wpcf7-redirect-http-build-query" class="checkbox-radio-1" name="wpcf7-redirect[http_build_query]" <?php checked( $fields['http_build_query'], 'on', true ); ?>/>
|
462 |
+
|
463 |
+
<label for="wpcf7-redirect-http-build-query">
|
464 |
+
<?php esc_html_e( 'Pass all the fields from the form as URL query parameters', 'wpcf7-redirect' ); ?>
|
465 |
+
</label>
|
466 |
+
</div>
|
467 |
+
|
468 |
+
<div class="field-wrap field-wrap-http-build-query-selectively">
|
469 |
+
<input type="checkbox" id="wpcf7-redirect-http-build-query-selectively" class="checkbox-radio-1" name="wpcf7-redirect[http_build_query_selectively]" <?php checked( $fields['http_build_query_selectively'], 'on', true ); ?>/>
|
470 |
+
|
471 |
+
<label for="wpcf7-redirect-http-build-query-selectively">
|
472 |
+
<?php esc_html_e( 'Pass specific fields from the form as URL query parameters', 'wpcf7-redirect' ); ?>
|
473 |
+
</label>
|
474 |
+
|
475 |
+
<input type="text" id="wpcf7-redirect-http-build-query-selectively-fields" class="field-hidden" placeholder="<?php esc_html_e( 'Fields to pass, separated by commas', 'wpcf7-redirect' ); ?>" name="wpcf7-redirect[http_build_query_selectively_fields]" value="<?php echo $fields['http_build_query_selectively_fields']; ?>">
|
476 |
+
</div>
|
477 |
+
|
478 |
+
<div class="field-wrap field-wrap-delay-redirect">
|
479 |
+
<label for="wpcf7-redirect-delay-redirect">
|
480 |
+
<?php esc_html_e( 'Delay redirect (in milliseconds)', 'wpcf7-redirect' ); ?>
|
481 |
+
</label>
|
482 |
+
|
483 |
+
<input type="number" id="wpcf7-redirect-delay-redirect" name="wpcf7-redirect[delay_redirect]" value="<?php echo $fields['delay_redirect']; ?>">
|
484 |
+
</div>
|
485 |
+
|
486 |
+
<hr />
|
487 |
+
|
488 |
+
<div class="field-wrap field-wrap-after-sent-script">
|
489 |
+
<label for="wpcf7-redirect-after-sent-script">
|
490 |
+
<?php esc_html_e( 'Here you can add scripts to run after form sent successfully.', 'wpcf7-redirect' ); ?>
|
491 |
+
</label>
|
492 |
+
|
493 |
+
<div class="field-message">
|
494 |
+
<?php esc_html_e( 'Do not include <script> tags.', 'wpcf7-redirect' ); ?>
|
495 |
+
</div>
|
496 |
+
|
497 |
+
<textarea id="wpcf7-redirect-after-sent-script" name="wpcf7-redirect[after_sent_script]" rows="8" cols="100"><?php echo $fields['after_sent_script']; ?></textarea>
|
498 |
+
|
499 |
+
<div class="field-notice field-warning-alert field-notice-hidden">
|
500 |
+
<strong>
|
501 |
+
<?php esc_html_e( 'Warning!', 'wpcf7-redirect' ); ?>
|
502 |
+
</strong>
|
503 |
+
|
504 |
+
<?php esc_html_e( 'This option is for developers only - use with caution. If the plugin does not redirect after you have added scripts, it means you have a problem with your script. Either fix the script, or remove it.', 'wpcf7-redirect' ); ?>
|
505 |
+
</div>
|
506 |
</div>
|
507 |
</fieldset>
|
508 |
+
|
509 |
<div class="get-pro-wrap">
|
510 |
<div class="get-pro">
|
511 |
<span class="dashicons dashicons-star-filled"></span>
|
512 |
+
<a href="https://querysol.com/product/contact-form-7-redirection/" target="_blank">
|
513 |
+
Redirection Pro For Contact Form 7 - We've added exciting new features!
|
514 |
+
</a>
|
515 |
<span class="dashicons dashicons-star-filled"></span>
|
516 |
</div>
|
517 |
</div>
|
520 |
}
|
521 |
}
|
522 |
|
523 |
+
register_activation_hook( __FILE__, array( 'WPCF7_Redirect', 'plugin_activated' ) );
|
524 |
|
525 |
$cf7_redirect = new WPCF7_Redirect();
|