submit_popup_settings.php
5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
if (!defined('ABSPATH'))
exit;
if (!class_exists('CF7POPUP_submit_menu')) {
class CF7POPUP_submit_menu {
protected static $instance;
function CF7POPUP_wpcf7_ajax_json_echo( $items, $result ) {
$formid = $_REQUEST['_wpcf7'];
$items["popup_id"] = get_post_meta( $formid, 'enabled-popup', true );
$items["failure_popup_id"] = get_post_meta( $formid, 'enabled-popup-failure', true );
// Check popup message if text is not available then it pass default text
if( ! empty(get_post_meta( $formid, 'popup_message', true ))){
$items["popup_message"] = get_post_meta( $formid, 'popup_message', true );
}else{
$items["popup_message"] = "Form has been submitted successfully.";
}
// Check popup width if width is not available then it pass default width
if( ! empty(get_post_meta( $formid, 'm_popup_width', true ))){
$items["m_popup_width"] = get_post_meta( $formid, 'm_popup_width', true );
}else{
$items["m_popup_width"] = "500px";
}
// Check popup border radius if border radius is not available then it pass default border radius
if( ! empty(get_post_meta( $formid, 'm_popup_radius', true ))){
$items["m_popup_radius"] = get_post_meta( $formid, 'm_popup_radius', true );
}else{
$items["m_popup_radius"] = "10px";
}
// Check popup duration time if duration time is not available then it pass default duration time
if( ! empty(get_post_meta( $formid, 'm_popup_duration', true ))){
$items["m_popup_duration"] = get_post_meta( $formid, 'm_popup_duration', true );
}else{
$items["m_popup_duration"] = "100000000000";
}
// Check popup background option if option is not available then it pass popup background option
if( ! empty(get_post_meta( $formid, 'popup_background_option', true ))){
$items["popup_background_option"] = get_post_meta( $formid, 'popup_background_option', true );
}else{
$items["popup_background_option"] = "bg_color";
}
// Check popup background color if color is not available then it pass default color
if( ! empty(get_post_meta( $formid, 'popup_background_color', true ))){
$items["popup_background_color"] = get_post_meta( $formid, 'popup_background_color', true );
}else{
$items["popup_background_color"] = "#fff";
}
// Check popup background image if image is not available then it pass blank value
if( ! empty(get_post_meta( $formid, 'popup_image_color', true ))){
$items["popup_image_color"] = get_post_meta( $formid, 'popup_image_color', true );
}else{
$items["popup_image_color"] = plugins_url( '/popup-message-for-contact-form-7/popup_img2.png');
}
// Check popup background gradient color if gradient color is not available then it pass gradient color
if( ! empty(get_post_meta( $formid, 'popup_gradient_color', true ))){
$items["popup_gradient_color"] = get_post_meta( $formid, 'popup_gradient_color', true );
}else{
$items["popup_gradient_color"] = "#fff";
}
// Check popup background gradient color 2 if gradient color 2 is not available then it pass gradient color
if( ! empty(get_post_meta( $formid, 'popup_gradient_color1', true ))){
$items["popup_gradient_color1"] = get_post_meta( $formid, 'popup_gradient_color1', true );
}else{
$items["popup_gradient_color1"] = "#FF0000";
}
// Check popup text color if color is not available then it pass default color
if( ! empty(get_post_meta( $formid, 'popup_text_color', true ))){
$items["popup_text_color"] = get_post_meta( $formid, 'popup_text_color', true );
}else{
$items["popup_text_color"] = "#000";
}
// Check popup button text if text is not available then it pass default text
if( ! empty(get_post_meta( $formid, 'popup_button_text', true ))){
$items["popup_button_text"] = get_post_meta( $formid, 'popup_button_text', true );
}else{
$items["popup_button_text"] = "Ok";
}
// Check popup button background color if color is not available then it pass default color
if( ! empty(get_post_meta( $formid, 'popup_button_background_color', true ))){
$items["popup_button_background_color"] = get_post_meta( $formid, 'popup_button_background_color', true );
}else{
$items["popup_button_background_color"] = "#3085d6";
}
return $items;
}
function init() {
add_filter( 'wpcf7_ajax_json_echo', array( $this, 'CF7POPUP_wpcf7_ajax_json_echo'), 10, 2 );
}
public static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
self::$instance->init();
}
return self::$instance;
}
}
CF7POPUP_submit_menu::instance();
}