Version Description
- Bug On Search by ID in Submissions
- Added: Mailchimp in featured plugins
Download this release
Release Info
Developer | webdorado |
Plugin | Contact Form by WD – responsive drag & drop contact form builder tool |
Version | 1.8.38 |
Comparing to | |
See all releases |
Code changes from version 1.8.37 to 1.8.38
- admin/models/FMModelSubmissions_fmc.php +676 -676
- contact-form-maker.php +2 -2
- featured/featured.php +7 -1
- featured/images/mailchimp.png +0 -0
- featured/style.css +1 -0
- readme.txt +6 -2
admin/models/FMModelSubmissions_fmc.php
CHANGED
@@ -1,676 +1,676 @@
|
|
1 |
-
<?php
|
2 |
-
class FMModelSubmissions_fmc {
|
3 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
4 |
-
// Events //
|
5 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
// Constants //
|
8 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
// Variables //
|
11 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
-
// Constructor & Destructor //
|
14 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
15 |
-
public function __construct() {
|
16 |
-
}
|
17 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
18 |
-
// Public Methods //
|
19 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
20 |
-
public function blocked_ips() {
|
21 |
-
global $wpdb;
|
22 |
-
$ips = $wpdb->get_col('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked');
|
23 |
-
return $ips;
|
24 |
-
}
|
25 |
-
|
26 |
-
public function get_form_titles() {
|
27 |
-
global $wpdb;
|
28 |
-
$query = "SELECT id, title FROM " . $wpdb->prefix . "formmaker WHERE `id` IN(" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ") order by title";
|
29 |
-
$forms = $wpdb->get_results($query);
|
30 |
-
return $forms;
|
31 |
-
}
|
32 |
-
|
33 |
-
public function get_statistics($form_id) {
|
34 |
-
global $wpdb;
|
35 |
-
$statistics = array();
|
36 |
-
$query = $wpdb->prepare('SELECT count(distinct group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d"', $form_id);
|
37 |
-
$statistics["total_entries"] = $wpdb->get_var($query);
|
38 |
-
$query = $wpdb->prepare('SELECT `views` FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $form_id);
|
39 |
-
$statistics["total_views"] = $wpdb->get_var($query);
|
40 |
-
if ($statistics["total_views"]) {
|
41 |
-
$statistics["conversion_rate"] = round((($statistics["total_entries"] / $statistics["total_views"]) * 100), 2) . '%';
|
42 |
-
}
|
43 |
-
else {
|
44 |
-
$statistics["conversion_rate"] = '0%';
|
45 |
-
}
|
46 |
-
return $statistics;
|
47 |
-
}
|
48 |
-
|
49 |
-
public function get_labels_parameters($form_id) {
|
50 |
-
global $wpdb;
|
51 |
-
$labels = array();
|
52 |
-
$labels_id = array();
|
53 |
-
$sorted_labels_id = array();
|
54 |
-
$label_names = array();
|
55 |
-
$label_types = array();
|
56 |
-
$sorted_label_types = array();
|
57 |
-
$label_names_original = array();
|
58 |
-
$labels_parameters = array();
|
59 |
-
$join_query = array();
|
60 |
-
$join_where = array();
|
61 |
-
$rows_ord = array();
|
62 |
-
$join = '';
|
63 |
-
for ($i = 0; $i < 8; $i++) {
|
64 |
-
array_push($labels_parameters, NULL);
|
65 |
-
}
|
66 |
-
$sorted_label_names = array();
|
67 |
-
$sorted_label_names_original = array();
|
68 |
-
$where_labels = array();
|
69 |
-
$where2 = array();
|
70 |
-
|
71 |
-
$pagination_clicked = (isset($_POST['pagination_clicked']) && $_POST['pagination_clicked'] == '1' ? '1' : '0');
|
72 |
-
|
73 |
-
$order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
|
74 |
-
$asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
|
75 |
-
$limit = ((isset($_POST['page_number'])) ? ((int) $_POST['page_number'] - 1) * 20 : 0);
|
76 |
-
$lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : '');
|
77 |
-
$lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : '');
|
78 |
-
$lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : '');
|
79 |
-
$lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : '');
|
80 |
-
|
81 |
-
$lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : '');
|
82 |
-
$lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : '');
|
83 |
-
$lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : '');
|
84 |
-
|
85 |
-
if ($lists['ip_search']) {
|
86 |
-
$where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"';
|
87 |
-
}
|
88 |
-
if ($lists['startdate'] != '') {
|
89 |
-
$where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' ";
|
90 |
-
}
|
91 |
-
if ($lists['enddate'] != '') {
|
92 |
-
$where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' ";
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
if ($lists['username_search']) {
|
97 |
-
$where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%'.$lists['username_search'].'%")';
|
98 |
-
}
|
99 |
-
if ($lists['useremail_search']) {
|
100 |
-
$where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%'.$lists['useremail_search'].'%")';
|
101 |
-
}
|
102 |
-
|
103 |
-
if ($lists['id_search']) {
|
104 |
-
$where[] = 'group_id ='
|
105 |
-
}
|
106 |
-
|
107 |
-
$where[] = 'form_id=' . $form_id . '';
|
108 |
-
$where = (count($where) ? ' ' . implode(' AND ', $where) : '');
|
109 |
-
if ($order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip') {
|
110 |
-
$orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . '';
|
111 |
-
}elseif($order_by == 'display_name' or $order_by == 'user_email'){
|
112 |
-
$orderby = ' ORDER BY (SELECT '.$order_by.' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) '. $asc_or_desc .'';
|
113 |
-
}
|
114 |
-
else {
|
115 |
-
$orderby = "";
|
116 |
-
}
|
117 |
-
if ($form_id) {
|
118 |
-
for($i = 0; $i < 8; $i++) {
|
119 |
-
array_pop($labels_parameters);
|
120 |
-
}
|
121 |
-
$query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE ". $where;
|
122 |
-
$results = $wpdb->get_results($query);
|
123 |
-
for ($i = 0; $i < count($results); $i++) {
|
124 |
-
array_push($labels, $results[$i]->element_label);
|
125 |
-
}
|
126 |
-
$form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id));
|
127 |
-
if (strpos($form->label_order, 'type_paypal_')) {
|
128 |
-
$form->label_order = $form->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
|
129 |
-
}
|
130 |
-
|
131 |
-
$form_labels = explode('#****#', $form->label_order);
|
132 |
-
$form_labels = array_slice($form_labels, 0, count($form_labels) - 1);
|
133 |
-
|
134 |
-
foreach ($form_labels as $key => $form_label) {
|
135 |
-
$label_id = explode('#**id**#', $form_label);
|
136 |
-
array_push($labels_id, $label_id[0]);
|
137 |
-
$label_name_type = explode('#**label**#', $label_id[1]);
|
138 |
-
array_push($label_names_original, $label_name_type[0]);
|
139 |
-
$ptn = "/[^a-zA-Z0-9_]/";
|
140 |
-
$rpltxt = "";
|
141 |
-
$label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]);
|
142 |
-
array_push($label_names, $label_name);
|
143 |
-
array_push($label_types, $label_name_type[1]);
|
144 |
-
}
|
145 |
-
|
146 |
-
foreach ($labels_id as $key => $label_id) {
|
147 |
-
if (in_array($label_id, $labels)) {
|
148 |
-
if (!in_array($label_id, $sorted_labels_id)) {
|
149 |
-
array_push($sorted_labels_id, $label_id);
|
150 |
-
}
|
151 |
-
array_push($sorted_label_names, $label_names[$key]);
|
152 |
-
array_push($sorted_label_types, $label_types[$key]);
|
153 |
-
array_push($sorted_label_names_original, $label_names_original[$key]);
|
154 |
-
if (isset($_POST[$form_id . '_' . $label_id . '_search'])) {
|
155 |
-
$search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']);
|
156 |
-
}
|
157 |
-
else {
|
158 |
-
$search_temp = '';
|
159 |
-
}
|
160 |
-
$search_temp = strtolower($search_temp);
|
161 |
-
$lists[$form_id . '_' . $label_id . '_search'] = $search_temp;
|
162 |
-
if ($search_temp) {
|
163 |
-
$join_query[] = 'search';
|
164 |
-
$join_where[] = array('label' => $label_id, 'search' => $search_temp);
|
165 |
-
}
|
166 |
-
}
|
167 |
-
}
|
168 |
-
if (strpos($order_by, "_field")) {
|
169 |
-
if (in_array(str_replace("_field", "", $order_by), $labels)) {
|
170 |
-
$join_query[] = 'sort';
|
171 |
-
$join_where[] = array('label'=>str_replace("_field", "", $order_by));
|
172 |
-
}
|
173 |
-
}
|
174 |
-
$cols = 'group_id';
|
175 |
-
if ($order_by == 'date' or $order_by == 'ip') {
|
176 |
-
$cols = 'group_id, date, ip';
|
177 |
-
}
|
178 |
-
switch (count($join_query)) {
|
179 |
-
case 0:
|
180 |
-
$join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '. $where;
|
181 |
-
break;
|
182 |
-
case 1:
|
183 |
-
if ($join_query[0] == 'sort') {
|
184 |
-
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" ';
|
185 |
-
$join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" ';
|
186 |
-
$orderby = ' ORDER BY `element_value` ' . $asc_or_desc;
|
187 |
-
}
|
188 |
-
else {
|
189 |
-
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . $join_where[0]['label'] . '" AND element_value LIKE "%' . $join_where[0]['search'] . '%" AND ' . $where;
|
190 |
-
}
|
191 |
-
break;
|
192 |
-
default:
|
193 |
-
$join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" AND element_value LIKE "%' . $join_where[0]['search'] . '%" ) as t ';
|
194 |
-
for ($key = 1; $key < count($join_query); $key++) {
|
195 |
-
if ($join_query[$key] == 'sort') {
|
196 |
-
$join .= 'LEFT JOIN (SELECT group_id as group_id' . $key . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '") as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
|
197 |
-
$orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . '';
|
198 |
-
}
|
199 |
-
else {
|
200 |
-
$join .= 'INNER JOIN (SELECT group_id as group_id' . $key . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '.$where.' AND element_label="' . $join_where[$key]['label'] . '" AND element_value LIKE "%' . $join_where[$key]['search'] . '%" ) as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
|
201 |
-
}
|
202 |
-
}
|
203 |
-
break;
|
204 |
-
}
|
205 |
-
$pos = strpos($join, 'SELECT t.group_id');
|
206 |
-
if ($pos === FALSE) {
|
207 |
-
$query = str_replace(array('SELECT group_id','SELECT distinct group_id'), array('SELECT count(distinct group_id)','SELECT count(distinct group_id)'), $join);
|
208 |
-
}
|
209 |
-
else {
|
210 |
-
$query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join);
|
211 |
-
}
|
212 |
-
$total = $wpdb->get_var($query);
|
213 |
-
|
214 |
-
$query_sub_count = "SELECT count(distinct group_id) from ".$wpdb->prefix."formmaker_submits";
|
215 |
-
$sub_count = (int)$wpdb->get_var($query_sub_count);
|
216 |
-
|
217 |
-
$limit1 = (int)$total < $sub_count && !$pagination_clicked ? 0 : $limit;
|
218 |
-
|
219 |
-
$query = $join . ' ' . $orderby . ' limit ' . $limit1 . ', 20 ';
|
220 |
-
$results = $wpdb->get_results($query);
|
221 |
-
for ($i = 0; $i < count($results); $i++) {
|
222 |
-
array_push($rows_ord, $results[$i]->group_id);
|
223 |
-
}
|
224 |
-
$where2 = array();
|
225 |
-
$where2[] = "group_id='0'";
|
226 |
-
foreach ($rows_ord as $rows_ordd) {
|
227 |
-
$where2[] = "group_id='" . $rows_ordd . "'";
|
228 |
-
}
|
229 |
-
$where2 = (count($where2) ? ' WHERE ' . implode( ' OR ', $where2 ) . '' : '' );
|
230 |
-
$query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
|
231 |
-
$rows = $wpdb->get_results($query);
|
232 |
-
$group_ids = $rows_ord;
|
233 |
-
$lists['total'] = $total;
|
234 |
-
$lists['limit'] = (int) ($limit1 / 20 + 1);
|
235 |
-
$where_choices = $where;
|
236 |
-
array_push($labels_parameters, $sorted_labels_id);
|
237 |
-
array_push($labels_parameters, $sorted_label_types);
|
238 |
-
array_push($labels_parameters, $lists);
|
239 |
-
array_push($labels_parameters, $sorted_label_names);
|
240 |
-
array_push($labels_parameters, $sorted_label_names_original);
|
241 |
-
array_push($labels_parameters, $rows);
|
242 |
-
array_push($labels_parameters, $group_ids);
|
243 |
-
array_push($labels_parameters, $where_choices);
|
244 |
-
}
|
245 |
-
return $labels_parameters;
|
246 |
-
}
|
247 |
-
|
248 |
-
public function get_type_address($sorted_label_type, $sorted_label_name_original) {
|
249 |
-
if ($sorted_label_type == 'type_address') {
|
250 |
-
switch ($sorted_label_name_original) {
|
251 |
-
case 'Street Line':
|
252 |
-
$field_title = __('Street Address', 'form_maker');
|
253 |
-
break;
|
254 |
-
case 'Street Line2':
|
255 |
-
$field_title = __('Street Address Line 2', 'form_maker');
|
256 |
-
break;
|
257 |
-
case 'City':
|
258 |
-
$field_title = __('City', 'form_maker');
|
259 |
-
break;
|
260 |
-
case 'State':
|
261 |
-
$field_title = __('State / Province / Region', 'form_maker');
|
262 |
-
break;
|
263 |
-
case 'Postal':
|
264 |
-
$field_title = __('Postal / Zip Code', 'form_maker');
|
265 |
-
break;
|
266 |
-
case 'Country':
|
267 |
-
$field_title = __('Country', 'form_maker');
|
268 |
-
break;
|
269 |
-
default :
|
270 |
-
$field_title = stripslashes($sorted_label_name_original);
|
271 |
-
break;
|
272 |
-
}
|
273 |
-
}
|
274 |
-
else {
|
275 |
-
$field_title = stripslashes($sorted_label_name_original);
|
276 |
-
}
|
277 |
-
return $field_title;
|
278 |
-
}
|
279 |
-
|
280 |
-
public function hide_or_not($hide_strings,$hide_string) {
|
281 |
-
if (strpos($hide_string,'@') === FALSE) {
|
282 |
-
if (strpos($hide_strings, '@' . $hide_string . '@') === FALSE) {
|
283 |
-
$style = '';
|
284 |
-
}
|
285 |
-
else {
|
286 |
-
$style = 'style="display:none"';
|
287 |
-
}
|
288 |
-
}
|
289 |
-
else {
|
290 |
-
if (strpos($hide_strings, $hide_string) === FALSE) {
|
291 |
-
$style = '';
|
292 |
-
}
|
293 |
-
else {
|
294 |
-
$style = 'style="display:none"';
|
295 |
-
}
|
296 |
-
}
|
297 |
-
return $style;
|
298 |
-
}
|
299 |
-
|
300 |
-
public function sort_group_ids($sorted_label_names_count, $group_ids) {
|
301 |
-
$count_labe = $sorted_label_names_count;
|
302 |
-
$group_id_s = array();
|
303 |
-
$l = 0;
|
304 |
-
if (count($group_ids) > 0 and $count_labe) {
|
305 |
-
for ($i = 0; $i < count($group_ids); $i++) {
|
306 |
-
if (!in_array($group_ids[$i], $group_id_s)) {
|
307 |
-
array_push($group_id_s, $group_ids[$i]);
|
308 |
-
}
|
309 |
-
}
|
310 |
-
}
|
311 |
-
return $group_id_s;
|
312 |
-
}
|
313 |
-
|
314 |
-
public function array_for_group_id($group, $rows) {
|
315 |
-
$i = $group;
|
316 |
-
$count_rows = count($rows);
|
317 |
-
$temp = array();
|
318 |
-
for ($j = 0; $j < $count_rows; $j++) {
|
319 |
-
$row = $rows[$j];
|
320 |
-
if ($row->group_id == $i) {
|
321 |
-
array_push($temp, $row);
|
322 |
-
}
|
323 |
-
}
|
324 |
-
return $temp;
|
325 |
-
}
|
326 |
-
|
327 |
-
public function check_radio_type($sorted_label_type) {
|
328 |
-
if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
|
329 |
-
return TRUE;
|
330 |
-
}
|
331 |
-
else {
|
332 |
-
return FALSE;
|
333 |
-
}
|
334 |
-
}
|
335 |
-
|
336 |
-
public function statistic_for_radio($where_choices, $sorted_label_id) {
|
337 |
-
global $wpdb;
|
338 |
-
$choices_params = array();
|
339 |
-
$query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where_choices . " AND element_label='" . $sorted_label_id . "'";
|
340 |
-
$choices = $wpdb->get_results($query);
|
341 |
-
$colors=array('#5FE2FF','#F9E89C');
|
342 |
-
$choices_colors=array('#4EC0D9','#DDCC7F');
|
343 |
-
$choices_labels = array();
|
344 |
-
$choices_count = array();
|
345 |
-
$all = count($choices);
|
346 |
-
$unanswered = 0;
|
347 |
-
foreach ($choices as $key => $choice) {
|
348 |
-
if ($choice->element_value == '') {
|
349 |
-
$unanswered++;
|
350 |
-
}
|
351 |
-
else {
|
352 |
-
if (!in_array($choice->element_value, $choices_labels)) {
|
353 |
-
array_push($choices_labels, $choice->element_value);
|
354 |
-
array_push($choices_count, 0);
|
355 |
-
}
|
356 |
-
$choices_count[array_search($choice->element_value, $choices_labels)]++;
|
357 |
-
}
|
358 |
-
}
|
359 |
-
array_multisort($choices_count, SORT_DESC, $choices_labels);
|
360 |
-
array_push($choices_params, $choices_count);
|
361 |
-
array_push($choices_params, $choices_labels);
|
362 |
-
array_push($choices_params, $unanswered);
|
363 |
-
array_push($choices_params, $all);
|
364 |
-
array_push($choices_params, $colors);
|
365 |
-
array_push($choices_params, $choices_colors);
|
366 |
-
return $choices_params;
|
367 |
-
}
|
368 |
-
|
369 |
-
public function get_data_of_group_id($id) {
|
370 |
-
global $wpdb;
|
371 |
-
$query = "SELECT * FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id=" . $id;
|
372 |
-
$rows = $wpdb->get_results($query);
|
373 |
-
$form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=" . $rows[0]->form_id);
|
374 |
-
$params = array();
|
375 |
-
$label_id = array();
|
376 |
-
$label_order_original = array();
|
377 |
-
$label_type = array();
|
378 |
-
$ispaypal = strpos($form->label_order, 'type_paypal_');
|
379 |
-
if ($form->paypal_mode == 1) {
|
380 |
-
if ($ispaypal) {
|
381 |
-
$form->label_order = $form->label_order."0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
|
382 |
-
}
|
383 |
-
}
|
384 |
-
$label_all = explode('#****#', $form->label_order);
|
385 |
-
$label_all = array_slice($label_all, 0, count($label_all) - 1);
|
386 |
-
foreach ($label_all as $key => $label_each) {
|
387 |
-
$label_id_each = explode('#**id**#', $label_each);
|
388 |
-
array_push($label_id, $label_id_each[0]);
|
389 |
-
$label_oder_each = explode('#**label**#', $label_id_each[1]);
|
390 |
-
array_push($label_order_original, $label_oder_each[0]);
|
391 |
-
array_push($label_type, $label_oder_each[1]);
|
392 |
-
}
|
393 |
-
/*$theme_id = $wpdb->get_var("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form->id . "'");*/
|
394 |
-
$css = $wpdb->get_var("SELECT css FROM " . $wpdb->prefix . "formmaker_themes");
|
395 |
-
array_push($params, $rows);
|
396 |
-
array_push($params, $label_id);
|
397 |
-
array_push($params, $label_order_original);
|
398 |
-
array_push($params, $label_type);
|
399 |
-
array_push($params, $ispaypal);
|
400 |
-
array_push($params, $form);
|
401 |
-
array_push($params, $css);
|
402 |
-
return $params;
|
403 |
-
}
|
404 |
-
|
405 |
-
public function check_type_for_edit_function($label_type) {
|
406 |
-
if ($label_type != 'type_editor' and $label_type != 'type_submit_reset' and $label_type != 'type_map' and $label_type != 'type_mark_map' and $label_type != 'type_captcha' and $label_type != 'type_recaptcha' and $label_type != 'type_button') {
|
407 |
-
return TRUE;
|
408 |
-
}
|
409 |
-
else {
|
410 |
-
return FALSE;
|
411 |
-
}
|
412 |
-
}
|
413 |
-
|
414 |
-
public function check_for_submited_label($rows, $label_id) {
|
415 |
-
foreach ($rows as $row) {
|
416 |
-
if ($row->element_label == $label_id) {
|
417 |
-
$element_value = $row->element_value;
|
418 |
-
break;
|
419 |
-
}
|
420 |
-
else {
|
421 |
-
$element_value = 'continue';
|
422 |
-
}
|
423 |
-
}
|
424 |
-
return $element_value;
|
425 |
-
}
|
426 |
-
|
427 |
-
public function view_for_star_rating($element_value, $element_label) {
|
428 |
-
$view_star_rating_array = array();
|
429 |
-
$new_filename = str_replace("***star_rating***", '', $element_value);
|
430 |
-
$stars = "";
|
431 |
-
$new_filename=explode('***', $new_filename);
|
432 |
-
for ($j = 0; $j < $new_filename[1]; $j++) {
|
433 |
-
$stars .= '<img id="' . $element_label . '_star_' . $j . '" src="' . WD_FMC_URL . '/images/star_' . $new_filename[2] . '.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
434 |
-
}
|
435 |
-
for ($k = $new_filename[1]; $k < $new_filename[0]; $k++) {
|
436 |
-
$stars .= '<img id="' . $element_label . '_star_' . $k . '" src="' . WD_FMC_URL . '/images/star.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
437 |
-
}
|
438 |
-
array_push($view_star_rating_array, $stars);
|
439 |
-
return $view_star_rating_array;
|
440 |
-
}
|
441 |
-
|
442 |
-
public function view_for_grading($element_value) {
|
443 |
-
$view_grading_array = array();
|
444 |
-
$new_filename = str_replace("***grading***", '', $element_value);
|
445 |
-
$grading = explode(":", $new_filename);
|
446 |
-
$items_count = sizeof($grading) - 1;
|
447 |
-
$items = "";
|
448 |
-
$total = "";
|
449 |
-
for ($k = 0; $k < $items_count / 2; $k++) {
|
450 |
-
$items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
|
451 |
-
$total += $grading[$k];
|
452 |
-
}
|
453 |
-
$items .= "Total: " . $total;
|
454 |
-
array_push($view_grading_array, $items);
|
455 |
-
return $view_grading_array;
|
456 |
-
}
|
457 |
-
|
458 |
-
public function images_for_star_rating($element_value, $label_id) {
|
459 |
-
$edit_stars = "";
|
460 |
-
$star_rating_array = array();
|
461 |
-
$element_value1 = str_replace("***star_rating***", '', $element_value);
|
462 |
-
$stars_value = explode('***', $element_value1);
|
463 |
-
for ($j = 0; $j < $stars_value[1]; $j++) {
|
464 |
-
$edit_stars .= '<img id="'.$label_id.'_star_'.$j.'" onclick="edit_star_rating('.$j.','.$label_id.')" src="' . WD_FMC_URL . '/images/star_'.$stars_value[2].'.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
465 |
-
}
|
466 |
-
for( $k=$stars_value[1];$k<$stars_value[0];$k++) {
|
467 |
-
$edit_stars .= '<img id="'.$label_id.'_star_'.$k.'" onclick="edit_star_rating('.$k.','.$label_id.')" src="' . WD_FMC_URL . '/images/star.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
468 |
-
}
|
469 |
-
array_push($star_rating_array, $edit_stars);
|
470 |
-
array_push($star_rating_array, $stars_value);
|
471 |
-
return $star_rating_array;
|
472 |
-
}
|
473 |
-
|
474 |
-
public function params_for_scale_rating($element_value, $label_id) {
|
475 |
-
$scale_rating_array = array();
|
476 |
-
$scale_radio = explode('/', $element_value);
|
477 |
-
$scale_value = $scale_radio[0];
|
478 |
-
$scale = '<table><tr>';
|
479 |
-
for ($k = 1; $k <= $scale_radio[1]; $k++) {
|
480 |
-
$scale .= '<td style="text-align:center"><span>' . $k . '</span></td>';
|
481 |
-
}
|
482 |
-
$scale .= '<tr></tr>';
|
483 |
-
for ($l = 1; $l <= $scale_radio[1]; $l++) {
|
484 |
-
if ($l == $scale_radio[0]) {
|
485 |
-
$checked = "checked";
|
486 |
-
}
|
487 |
-
else {
|
488 |
-
$checked = "";
|
489 |
-
}
|
490 |
-
$scale .= '<td><input type="radio" name = "'.$label_id.'_scale_rating_radio" id = "'.$label_id.'_scale_rating_radio_'.$l.'" value="'.$l.'" '.$checked.' onClick="edit_scale_rating(this.value,'.$label_id.')" /></td>';
|
491 |
-
}
|
492 |
-
$scale .= '</tr></table>';
|
493 |
-
array_push($scale_rating_array, $scale);
|
494 |
-
array_push($scale_rating_array, $scale_radio);
|
495 |
-
array_push($scale_rating_array, $checked);
|
496 |
-
return $scale_rating_array;
|
497 |
-
}
|
498 |
-
|
499 |
-
public function params_for_type_range($element_value, $label_id) {
|
500 |
-
$range_value = explode('-', $element_value);
|
501 |
-
$range = '<input name="'.$label_id.'_element0" id="'.$label_id.'_element0" type="text" value="'.$range_value[0].'" onChange="edit_range(this.value,'.$label_id.',0)" size="8"/> - <input name="'.$label_id.'_element1" id="'.$label_id.'_element1" type="text" value="'.$range_value[1].'" onChange="edit_range(this.value,'.$label_id.',1)" size="8"/>';
|
502 |
-
return $range;
|
503 |
-
}
|
504 |
-
|
505 |
-
public function params_for_type_grading($element_value, $label_id) {
|
506 |
-
$type_grading_array = array();
|
507 |
-
$element_value1 = str_replace("***grading***", '', $element_value);
|
508 |
-
$garding_value = explode(':', $element_value1);
|
509 |
-
$items_count = sizeof($garding_value) - 1;
|
510 |
-
$garding = "";
|
511 |
-
$sum = "";
|
512 |
-
for ($k = 0; $k < $items_count/2; $k++) {
|
513 |
-
$garding .= '<input name="'.$label_id.'_element'.$k.'" id="'.$label_id.'_element'.$k.'" type="text" value="'.$garding_value[$k].'" onKeyUp="edit_grading('.$label_id.','.$items_count.')" size="5"/> '.$garding_value[$items_count/2+$k].'</br>';
|
514 |
-
$sum += $garding_value[$k];
|
515 |
-
}
|
516 |
-
array_push($type_grading_array, $garding);
|
517 |
-
array_push($type_grading_array, $garding_value);
|
518 |
-
array_push($type_grading_array, $sum);
|
519 |
-
array_push($type_grading_array, $items_count);
|
520 |
-
array_push($type_grading_array, $element_value1);
|
521 |
-
return $type_grading_array;
|
522 |
-
}
|
523 |
-
|
524 |
-
public function params_for_type_matrix($element_value, $label_id) {
|
525 |
-
$type_matrix_array = array();
|
526 |
-
$new_filename = str_replace("***matrix***", '', $element_value);
|
527 |
-
$matrix_value = explode('***', $new_filename);
|
528 |
-
$matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
|
529 |
-
$mat_rows = $matrix_value[0];
|
530 |
-
$mat_columns = $matrix_value[$mat_rows + 1];
|
531 |
-
$matrix = "<table>";
|
532 |
-
$matrix .= '<tr><td></td>';
|
533 |
-
for ($k = 1; $k <= $mat_columns; $k++) {
|
534 |
-
$matrix .= '<td style="background-color:#BBBBBB; padding:5px; border:1px; ">'.$matrix_value[$mat_rows+1+$k].'</td>';
|
535 |
-
}
|
536 |
-
$matrix .= '</tr>';
|
537 |
-
$aaa = Array();
|
538 |
-
$var_checkbox = 1;
|
539 |
-
$selected_value = "";
|
540 |
-
$selected_value_yes = "";
|
541 |
-
$selected_value_no = "";
|
542 |
-
for ($k = 1; $k <= $mat_rows; $k++) {
|
543 |
-
$matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px; border:1px;">'.$matrix_value[$k].'</td>';
|
544 |
-
if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
|
545 |
-
if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
|
546 |
-
$checked = "";
|
547 |
-
$aaa[1] = "";
|
548 |
-
}
|
549 |
-
else {
|
550 |
-
$aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
|
551 |
-
}
|
552 |
-
for ($l = 1; $l <= $mat_columns; $l++) {
|
553 |
-
if ($aaa[1] == $l) {
|
554 |
-
$checked = 'checked';
|
555 |
-
}
|
556 |
-
else {
|
557 |
-
$checked = "";
|
558 |
-
}
|
559 |
-
$index = "'" . $k . '_' . $l . "'";
|
560 |
-
$matrix .= '<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" '.$checked.' onClick="change_radio_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
|
561 |
-
}
|
562 |
-
}
|
563 |
-
else {
|
564 |
-
if ($matrix_value[$mat_rows+$mat_columns+2] == "checkbox") {
|
565 |
-
for ($l = 1; $l <= $mat_columns; $l++) {
|
566 |
-
if ($matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox] == 1) {
|
567 |
-
$checked = 'checked';
|
568 |
-
}
|
569 |
-
else {
|
570 |
-
$checked = '';
|
571 |
-
}
|
572 |
-
$index = "'".$k.'_'.$l."'";
|
573 |
-
$matrix .='<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" '.$checked.' onClick="change_checkbox_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
|
574 |
-
$var_checkbox++;
|
575 |
-
}
|
576 |
-
}
|
577 |
-
else {
|
578 |
-
if ($matrix_value[$mat_rows + $mat_columns + 2] == "text") {
|
579 |
-
for ($l = 1; $l <= $mat_columns; $l++) {
|
580 |
-
$text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
|
581 |
-
$index = "'".$k.'_'.$l."'";
|
582 |
-
$matrix .= '<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" value="'.$text_value.'" onKeyUp="change_text_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
|
583 |
-
$var_checkbox++;
|
584 |
-
}
|
585 |
-
}
|
586 |
-
else {
|
587 |
-
for ($l = 1; $l <= $mat_columns; $l++) {
|
588 |
-
$selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
|
589 |
-
if ($selected_text == 'yes') {
|
590 |
-
$selected_value_yes = 'selected';
|
591 |
-
$selected_value_no = '';
|
592 |
-
$selected_value = '';
|
593 |
-
}
|
594 |
-
else {
|
595 |
-
if ($selected_text=='no') {
|
596 |
-
$selected_value_yes ='';
|
597 |
-
$selected_value_no ='selected';
|
598 |
-
$selected_value ='';
|
599 |
-
}
|
600 |
-
else {
|
601 |
-
$selected_value_yes = '';
|
602 |
-
$selected_value_no ='';
|
603 |
-
$selected_value ='selected';
|
604 |
-
}
|
605 |
-
}
|
606 |
-
$index = "'".$k.'_'.$l."'";
|
607 |
-
$matrix .= '<td style="text-align:center;"><select name="'.$label_id.'_select_yes_noform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_select_yes_noform_id_temp'.$k.'_'.$l.'" onChange="change_option_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"><option value="" '.$selected_value.'></option><option value="yes" '.$selected_value_yes.' >Yes</option><option value="no" '.$selected_value_no.'>No</option></select></td>';
|
608 |
-
$var_checkbox++;
|
609 |
-
}
|
610 |
-
}
|
611 |
-
}
|
612 |
-
}
|
613 |
-
$matrix .= '</tr>';
|
614 |
-
}
|
615 |
-
$matrix .= '</table>';
|
616 |
-
array_push($type_matrix_array, $matrix);
|
617 |
-
array_push($type_matrix_array, $new_filename);
|
618 |
-
return $type_matrix_array;
|
619 |
-
}
|
620 |
-
|
621 |
-
public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
|
622 |
-
global $wpdb;
|
623 |
-
|
624 |
-
$query = "SELECT `" . $label_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
|
625 |
-
if($db_info) {
|
626 |
-
$temp = explode('@@@wdfhostwdf@@@',$db_info);
|
627 |
-
$host = $temp[0];
|
628 |
-
$temp = explode('@@@wdfportwdf@@@',$temp[1]);
|
629 |
-
$port = $temp[0];
|
630 |
-
$temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
|
631 |
-
$username = $temp[0];
|
632 |
-
$temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
|
633 |
-
$password = $temp[0];
|
634 |
-
$temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
|
635 |
-
$database = $temp[0];
|
636 |
-
|
637 |
-
$wpdb_temp = new wpdb($username, $password, $database, $host);
|
638 |
-
$choices_labels = $wpdb_temp->get_col($query);
|
639 |
-
}
|
640 |
-
else {
|
641 |
-
$choices_labels = $wpdb->get_col($query);
|
642 |
-
}
|
643 |
-
return $choices_labels;
|
644 |
-
}
|
645 |
-
public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
|
646 |
-
global $wpdb;
|
647 |
-
$query = "SELECT `" . $value_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
|
648 |
-
if($db_info) {
|
649 |
-
$temp = explode('@@@wdfhostwdf@@@',$db_info);
|
650 |
-
$host = $temp[0];
|
651 |
-
$temp = explode('@@@wdfportwdf@@@',$temp[1]);
|
652 |
-
$port = $temp[0];
|
653 |
-
$temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
|
654 |
-
$username = $temp[0];
|
655 |
-
$temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
|
656 |
-
$password = $temp[0];
|
657 |
-
$temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
|
658 |
-
$database = $temp[0];
|
659 |
-
|
660 |
-
$wpdb_temp = new wpdb($username, $password, $database, $host);
|
661 |
-
$choices_values = $wpdb_temp->get_col($query);
|
662 |
-
}
|
663 |
-
else {
|
664 |
-
$choices_values = $wpdb->get_col($query);
|
665 |
-
}
|
666 |
-
return $choices_values;
|
667 |
-
}
|
668 |
-
public function get_subs_count($form_id) {
|
669 |
-
global $wpdb;
|
670 |
-
$query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
|
671 |
-
$group_id_s = $wpdb->get_col($query);
|
672 |
-
return count($group_id_s);
|
673 |
-
}
|
674 |
-
}
|
675 |
-
|
676 |
-
?>
|
1 |
+
<?php
|
2 |
+
class FMModelSubmissions_fmc {
|
3 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
4 |
+
// Events //
|
5 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
6 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
+
// Constants //
|
8 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
+
// Variables //
|
11 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
+
// Constructor & Destructor //
|
14 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
15 |
+
public function __construct() {
|
16 |
+
}
|
17 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
18 |
+
// Public Methods //
|
19 |
+
////////////////////////////////////////////////////////////////////////////////////////
|
20 |
+
public function blocked_ips() {
|
21 |
+
global $wpdb;
|
22 |
+
$ips = $wpdb->get_col('SELECT ip FROM ' . $wpdb->prefix . 'formmaker_blocked');
|
23 |
+
return $ips;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function get_form_titles() {
|
27 |
+
global $wpdb;
|
28 |
+
$query = "SELECT id, title FROM " . $wpdb->prefix . "formmaker WHERE `id` IN(" . (get_option('contact_form_forms', '') != '' ? get_option('contact_form_forms') : 0) . ") order by title";
|
29 |
+
$forms = $wpdb->get_results($query);
|
30 |
+
return $forms;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function get_statistics($form_id) {
|
34 |
+
global $wpdb;
|
35 |
+
$statistics = array();
|
36 |
+
$query = $wpdb->prepare('SELECT count(distinct group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id ="%d"', $form_id);
|
37 |
+
$statistics["total_entries"] = $wpdb->get_var($query);
|
38 |
+
$query = $wpdb->prepare('SELECT `views` FROM ' . $wpdb->prefix . 'formmaker_views WHERE form_id="%d"', $form_id);
|
39 |
+
$statistics["total_views"] = $wpdb->get_var($query);
|
40 |
+
if ($statistics["total_views"]) {
|
41 |
+
$statistics["conversion_rate"] = round((($statistics["total_entries"] / $statistics["total_views"]) * 100), 2) . '%';
|
42 |
+
}
|
43 |
+
else {
|
44 |
+
$statistics["conversion_rate"] = '0%';
|
45 |
+
}
|
46 |
+
return $statistics;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function get_labels_parameters($form_id) {
|
50 |
+
global $wpdb;
|
51 |
+
$labels = array();
|
52 |
+
$labels_id = array();
|
53 |
+
$sorted_labels_id = array();
|
54 |
+
$label_names = array();
|
55 |
+
$label_types = array();
|
56 |
+
$sorted_label_types = array();
|
57 |
+
$label_names_original = array();
|
58 |
+
$labels_parameters = array();
|
59 |
+
$join_query = array();
|
60 |
+
$join_where = array();
|
61 |
+
$rows_ord = array();
|
62 |
+
$join = '';
|
63 |
+
for ($i = 0; $i < 8; $i++) {
|
64 |
+
array_push($labels_parameters, NULL);
|
65 |
+
}
|
66 |
+
$sorted_label_names = array();
|
67 |
+
$sorted_label_names_original = array();
|
68 |
+
$where_labels = array();
|
69 |
+
$where2 = array();
|
70 |
+
|
71 |
+
$pagination_clicked = (isset($_POST['pagination_clicked']) && $_POST['pagination_clicked'] == '1' ? '1' : '0');
|
72 |
+
|
73 |
+
$order_by = ((isset($_POST['order_by']) && esc_html(stripslashes($_POST['order_by'])) != '') ? esc_html(stripslashes($_POST['order_by'])) : 'group_id');
|
74 |
+
$asc_or_desc = ((isset($_POST['asc_or_desc']) && $_POST['asc_or_desc'] == 'desc') ? 'desc' : 'asc');
|
75 |
+
$limit = ((isset($_POST['page_number'])) ? ((int) $_POST['page_number'] - 1) * 20 : 0);
|
76 |
+
$lists['hide_label_list'] = ((isset($_POST['hide_label_list'])) ? esc_html(stripslashes($_POST['hide_label_list'])) : '');
|
77 |
+
$lists['startdate'] = ((isset($_POST['startdate'])) ? esc_html(stripslashes($_POST['startdate'])) : '');
|
78 |
+
$lists['enddate'] = ((isset($_POST['enddate'])) ? esc_html(stripslashes($_POST['enddate'])) : '');
|
79 |
+
$lists['ip_search'] = ((isset($_POST['ip_search'])) ? esc_html(stripslashes($_POST['ip_search'])) : '');
|
80 |
+
|
81 |
+
$lists['username_search'] = ((isset($_POST['username_search'])) ? esc_html(stripslashes($_POST['username_search'])) : '');
|
82 |
+
$lists['useremail_search'] = ((isset($_POST['useremail_search'])) ? esc_html(stripslashes($_POST['useremail_search'])) : '');
|
83 |
+
$lists['id_search'] = ((isset($_POST['id_search'])) ? esc_html(stripslashes($_POST['id_search'])) : '');
|
84 |
+
|
85 |
+
if ($lists['ip_search']) {
|
86 |
+
$where[] = 'ip LIKE "%' . $lists['ip_search'] . '%"';
|
87 |
+
}
|
88 |
+
if ($lists['startdate'] != '') {
|
89 |
+
$where[] = " `date`>='" . $lists['startdate'] . " 00:00:00' ";
|
90 |
+
}
|
91 |
+
if ($lists['enddate'] != '') {
|
92 |
+
$where[] = " `date`<='" . $lists['enddate'] . " 23:59:59' ";
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
if ($lists['username_search']) {
|
97 |
+
$where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE display_name LIKE "%'.$lists['username_search'].'%")';
|
98 |
+
}
|
99 |
+
if ($lists['useremail_search']) {
|
100 |
+
$where[] = 'user_id_wd IN (SELECT ID FROM ' . $wpdb->prefix . 'users WHERE user_email LIKE "%'.$lists['useremail_search'].'%")';
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($lists['id_search']) {
|
104 |
+
$where[] = 'group_id ='.(int)$lists['id_search'];
|
105 |
+
}
|
106 |
+
|
107 |
+
$where[] = 'form_id=' . $form_id . '';
|
108 |
+
$where = (count($where) ? ' ' . implode(' AND ', $where) : '');
|
109 |
+
if ($order_by == 'group_id' or $order_by == 'date' or $order_by == 'ip') {
|
110 |
+
$orderby = ' ORDER BY ' . $order_by . ' ' . $asc_or_desc . '';
|
111 |
+
}elseif($order_by == 'display_name' or $order_by == 'user_email'){
|
112 |
+
$orderby = ' ORDER BY (SELECT '.$order_by.' FROM ' . $wpdb->prefix . 'users WHERE ID=user_id_wd) '. $asc_or_desc .'';
|
113 |
+
}
|
114 |
+
else {
|
115 |
+
$orderby = "";
|
116 |
+
}
|
117 |
+
if ($form_id) {
|
118 |
+
for($i = 0; $i < 8; $i++) {
|
119 |
+
array_pop($labels_parameters);
|
120 |
+
}
|
121 |
+
$query = "SELECT distinct element_label FROM " . $wpdb->prefix . "formmaker_submits WHERE ". $where;
|
122 |
+
$results = $wpdb->get_results($query);
|
123 |
+
for ($i = 0; $i < count($results); $i++) {
|
124 |
+
array_push($labels, $results[$i]->element_label);
|
125 |
+
}
|
126 |
+
$form = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id='%d'", $form_id));
|
127 |
+
if (strpos($form->label_order, 'type_paypal_')) {
|
128 |
+
$form->label_order = $form->label_order . "item_total#**id**#Item Total#**label**#type_paypal_payment_total#****#total#**id**#Total#**label**#type_paypal_payment_total#****#0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
|
129 |
+
}
|
130 |
+
|
131 |
+
$form_labels = explode('#****#', $form->label_order);
|
132 |
+
$form_labels = array_slice($form_labels, 0, count($form_labels) - 1);
|
133 |
+
|
134 |
+
foreach ($form_labels as $key => $form_label) {
|
135 |
+
$label_id = explode('#**id**#', $form_label);
|
136 |
+
array_push($labels_id, $label_id[0]);
|
137 |
+
$label_name_type = explode('#**label**#', $label_id[1]);
|
138 |
+
array_push($label_names_original, $label_name_type[0]);
|
139 |
+
$ptn = "/[^a-zA-Z0-9_]/";
|
140 |
+
$rpltxt = "";
|
141 |
+
$label_name = preg_replace($ptn, $rpltxt, $label_name_type[0]);
|
142 |
+
array_push($label_names, $label_name);
|
143 |
+
array_push($label_types, $label_name_type[1]);
|
144 |
+
}
|
145 |
+
|
146 |
+
foreach ($labels_id as $key => $label_id) {
|
147 |
+
if (in_array($label_id, $labels)) {
|
148 |
+
if (!in_array($label_id, $sorted_labels_id)) {
|
149 |
+
array_push($sorted_labels_id, $label_id);
|
150 |
+
}
|
151 |
+
array_push($sorted_label_names, $label_names[$key]);
|
152 |
+
array_push($sorted_label_types, $label_types[$key]);
|
153 |
+
array_push($sorted_label_names_original, $label_names_original[$key]);
|
154 |
+
if (isset($_POST[$form_id . '_' . $label_id . '_search'])) {
|
155 |
+
$search_temp = esc_html($_POST[$form_id . '_' . $label_id . '_search']);
|
156 |
+
}
|
157 |
+
else {
|
158 |
+
$search_temp = '';
|
159 |
+
}
|
160 |
+
$search_temp = strtolower($search_temp);
|
161 |
+
$lists[$form_id . '_' . $label_id . '_search'] = $search_temp;
|
162 |
+
if ($search_temp) {
|
163 |
+
$join_query[] = 'search';
|
164 |
+
$join_where[] = array('label' => $label_id, 'search' => $search_temp);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
if (strpos($order_by, "_field")) {
|
169 |
+
if (in_array(str_replace("_field", "", $order_by), $labels)) {
|
170 |
+
$join_query[] = 'sort';
|
171 |
+
$join_where[] = array('label'=>str_replace("_field", "", $order_by));
|
172 |
+
}
|
173 |
+
}
|
174 |
+
$cols = 'group_id';
|
175 |
+
if ($order_by == 'date' or $order_by == 'ip') {
|
176 |
+
$cols = 'group_id, date, ip';
|
177 |
+
}
|
178 |
+
switch (count($join_query)) {
|
179 |
+
case 0:
|
180 |
+
$join = 'SELECT distinct group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '. $where;
|
181 |
+
break;
|
182 |
+
case 1:
|
183 |
+
if ($join_query[0] == 'sort') {
|
184 |
+
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" ';
|
185 |
+
$join_count = 'SELECT count(group_id) FROM ' . $wpdb->prefix . 'formmaker_submits WHERE form_id="' . $form_id . '" AND element_label="' . $join_where[0]['label'] . '" ';
|
186 |
+
$orderby = ' ORDER BY `element_value` ' . $asc_or_desc;
|
187 |
+
}
|
188 |
+
else {
|
189 |
+
$join = 'SELECT group_id FROM ' . $wpdb->prefix . 'formmaker_submits WHERE element_label="' . $join_where[0]['label'] . '" AND element_value LIKE "%' . $join_where[0]['search'] . '%" AND ' . $where;
|
190 |
+
}
|
191 |
+
break;
|
192 |
+
default:
|
193 |
+
$join = 'SELECT t.group_id FROM (SELECT ' . $cols . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[0]['label'] . '" AND element_value LIKE "%' . $join_where[0]['search'] . '%" ) as t ';
|
194 |
+
for ($key = 1; $key < count($join_query); $key++) {
|
195 |
+
if ($join_query[$key] == 'sort') {
|
196 |
+
$join .= 'LEFT JOIN (SELECT group_id as group_id' . $key . ', element_value FROM ' . $wpdb->prefix . 'formmaker_submits WHERE ' . $where . ' AND element_label="' . $join_where[$key]['label'] . '") as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
|
197 |
+
$orderby = ' ORDER BY t' . $key . '.`element_value` ' . $asc_or_desc . '';
|
198 |
+
}
|
199 |
+
else {
|
200 |
+
$join .= 'INNER JOIN (SELECT group_id as group_id' . $key . ' FROM ' . $wpdb->prefix . 'formmaker_submits WHERE '.$where.' AND element_label="' . $join_where[$key]['label'] . '" AND element_value LIKE "%' . $join_where[$key]['search'] . '%" ) as t' . $key . ' ON t' . $key . '.group_id' . $key . '=t.group_id ';
|
201 |
+
}
|
202 |
+
}
|
203 |
+
break;
|
204 |
+
}
|
205 |
+
$pos = strpos($join, 'SELECT t.group_id');
|
206 |
+
if ($pos === FALSE) {
|
207 |
+
$query = str_replace(array('SELECT group_id','SELECT distinct group_id'), array('SELECT count(distinct group_id)','SELECT count(distinct group_id)'), $join);
|
208 |
+
}
|
209 |
+
else {
|
210 |
+
$query = str_replace('SELECT t.group_id', 'SELECT count(t.group_id)', $join);
|
211 |
+
}
|
212 |
+
$total = $wpdb->get_var($query);
|
213 |
+
|
214 |
+
$query_sub_count = "SELECT count(distinct group_id) from ".$wpdb->prefix."formmaker_submits";
|
215 |
+
$sub_count = (int)$wpdb->get_var($query_sub_count);
|
216 |
+
|
217 |
+
$limit1 = (int)$total < $sub_count && !$pagination_clicked ? 0 : $limit;
|
218 |
+
|
219 |
+
$query = $join . ' ' . $orderby . ' limit ' . $limit1 . ', 20 ';
|
220 |
+
$results = $wpdb->get_results($query);
|
221 |
+
for ($i = 0; $i < count($results); $i++) {
|
222 |
+
array_push($rows_ord, $results[$i]->group_id);
|
223 |
+
}
|
224 |
+
$where2 = array();
|
225 |
+
$where2[] = "group_id='0'";
|
226 |
+
foreach ($rows_ord as $rows_ordd) {
|
227 |
+
$where2[] = "group_id='" . $rows_ordd . "'";
|
228 |
+
}
|
229 |
+
$where2 = (count($where2) ? ' WHERE ' . implode( ' OR ', $where2 ) . '' : '' );
|
230 |
+
$query = 'SELECT * FROM ' . $wpdb->prefix . 'formmaker_submits ' . $where2;
|
231 |
+
$rows = $wpdb->get_results($query);
|
232 |
+
$group_ids = $rows_ord;
|
233 |
+
$lists['total'] = $total;
|
234 |
+
$lists['limit'] = (int) ($limit1 / 20 + 1);
|
235 |
+
$where_choices = $where;
|
236 |
+
array_push($labels_parameters, $sorted_labels_id);
|
237 |
+
array_push($labels_parameters, $sorted_label_types);
|
238 |
+
array_push($labels_parameters, $lists);
|
239 |
+
array_push($labels_parameters, $sorted_label_names);
|
240 |
+
array_push($labels_parameters, $sorted_label_names_original);
|
241 |
+
array_push($labels_parameters, $rows);
|
242 |
+
array_push($labels_parameters, $group_ids);
|
243 |
+
array_push($labels_parameters, $where_choices);
|
244 |
+
}
|
245 |
+
return $labels_parameters;
|
246 |
+
}
|
247 |
+
|
248 |
+
public function get_type_address($sorted_label_type, $sorted_label_name_original) {
|
249 |
+
if ($sorted_label_type == 'type_address') {
|
250 |
+
switch ($sorted_label_name_original) {
|
251 |
+
case 'Street Line':
|
252 |
+
$field_title = __('Street Address', 'form_maker');
|
253 |
+
break;
|
254 |
+
case 'Street Line2':
|
255 |
+
$field_title = __('Street Address Line 2', 'form_maker');
|
256 |
+
break;
|
257 |
+
case 'City':
|
258 |
+
$field_title = __('City', 'form_maker');
|
259 |
+
break;
|
260 |
+
case 'State':
|
261 |
+
$field_title = __('State / Province / Region', 'form_maker');
|
262 |
+
break;
|
263 |
+
case 'Postal':
|
264 |
+
$field_title = __('Postal / Zip Code', 'form_maker');
|
265 |
+
break;
|
266 |
+
case 'Country':
|
267 |
+
$field_title = __('Country', 'form_maker');
|
268 |
+
break;
|
269 |
+
default :
|
270 |
+
$field_title = stripslashes($sorted_label_name_original);
|
271 |
+
break;
|
272 |
+
}
|
273 |
+
}
|
274 |
+
else {
|
275 |
+
$field_title = stripslashes($sorted_label_name_original);
|
276 |
+
}
|
277 |
+
return $field_title;
|
278 |
+
}
|
279 |
+
|
280 |
+
public function hide_or_not($hide_strings,$hide_string) {
|
281 |
+
if (strpos($hide_string,'@') === FALSE) {
|
282 |
+
if (strpos($hide_strings, '@' . $hide_string . '@') === FALSE) {
|
283 |
+
$style = '';
|
284 |
+
}
|
285 |
+
else {
|
286 |
+
$style = 'style="display:none"';
|
287 |
+
}
|
288 |
+
}
|
289 |
+
else {
|
290 |
+
if (strpos($hide_strings, $hide_string) === FALSE) {
|
291 |
+
$style = '';
|
292 |
+
}
|
293 |
+
else {
|
294 |
+
$style = 'style="display:none"';
|
295 |
+
}
|
296 |
+
}
|
297 |
+
return $style;
|
298 |
+
}
|
299 |
+
|
300 |
+
public function sort_group_ids($sorted_label_names_count, $group_ids) {
|
301 |
+
$count_labe = $sorted_label_names_count;
|
302 |
+
$group_id_s = array();
|
303 |
+
$l = 0;
|
304 |
+
if (count($group_ids) > 0 and $count_labe) {
|
305 |
+
for ($i = 0; $i < count($group_ids); $i++) {
|
306 |
+
if (!in_array($group_ids[$i], $group_id_s)) {
|
307 |
+
array_push($group_id_s, $group_ids[$i]);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
}
|
311 |
+
return $group_id_s;
|
312 |
+
}
|
313 |
+
|
314 |
+
public function array_for_group_id($group, $rows) {
|
315 |
+
$i = $group;
|
316 |
+
$count_rows = count($rows);
|
317 |
+
$temp = array();
|
318 |
+
for ($j = 0; $j < $count_rows; $j++) {
|
319 |
+
$row = $rows[$j];
|
320 |
+
if ($row->group_id == $i) {
|
321 |
+
array_push($temp, $row);
|
322 |
+
}
|
323 |
+
}
|
324 |
+
return $temp;
|
325 |
+
}
|
326 |
+
|
327 |
+
public function check_radio_type($sorted_label_type) {
|
328 |
+
if ($sorted_label_type == "type_checkbox" || $sorted_label_type == "type_radio" || $sorted_label_type == "type_own_select" || $sorted_label_type == "type_country" || $sorted_label_type == "type_paypal_select" || $sorted_label_type == "type_paypal_radio" || $sorted_label_type == "type_paypal_checkbox" || $sorted_label_type == "type_paypal_shipping") {
|
329 |
+
return TRUE;
|
330 |
+
}
|
331 |
+
else {
|
332 |
+
return FALSE;
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
public function statistic_for_radio($where_choices, $sorted_label_id) {
|
337 |
+
global $wpdb;
|
338 |
+
$choices_params = array();
|
339 |
+
$query = "SELECT element_value FROM " . $wpdb->prefix . "formmaker_submits WHERE " . $where_choices . " AND element_label='" . $sorted_label_id . "'";
|
340 |
+
$choices = $wpdb->get_results($query);
|
341 |
+
$colors=array('#5FE2FF','#F9E89C');
|
342 |
+
$choices_colors=array('#4EC0D9','#DDCC7F');
|
343 |
+
$choices_labels = array();
|
344 |
+
$choices_count = array();
|
345 |
+
$all = count($choices);
|
346 |
+
$unanswered = 0;
|
347 |
+
foreach ($choices as $key => $choice) {
|
348 |
+
if ($choice->element_value == '') {
|
349 |
+
$unanswered++;
|
350 |
+
}
|
351 |
+
else {
|
352 |
+
if (!in_array($choice->element_value, $choices_labels)) {
|
353 |
+
array_push($choices_labels, $choice->element_value);
|
354 |
+
array_push($choices_count, 0);
|
355 |
+
}
|
356 |
+
$choices_count[array_search($choice->element_value, $choices_labels)]++;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
array_multisort($choices_count, SORT_DESC, $choices_labels);
|
360 |
+
array_push($choices_params, $choices_count);
|
361 |
+
array_push($choices_params, $choices_labels);
|
362 |
+
array_push($choices_params, $unanswered);
|
363 |
+
array_push($choices_params, $all);
|
364 |
+
array_push($choices_params, $colors);
|
365 |
+
array_push($choices_params, $choices_colors);
|
366 |
+
return $choices_params;
|
367 |
+
}
|
368 |
+
|
369 |
+
public function get_data_of_group_id($id) {
|
370 |
+
global $wpdb;
|
371 |
+
$query = "SELECT * FROM " . $wpdb->prefix . "formmaker_submits WHERE group_id=" . $id;
|
372 |
+
$rows = $wpdb->get_results($query);
|
373 |
+
$form = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "formmaker WHERE id=" . $rows[0]->form_id);
|
374 |
+
$params = array();
|
375 |
+
$label_id = array();
|
376 |
+
$label_order_original = array();
|
377 |
+
$label_type = array();
|
378 |
+
$ispaypal = strpos($form->label_order, 'type_paypal_');
|
379 |
+
if ($form->paypal_mode == 1) {
|
380 |
+
if ($ispaypal) {
|
381 |
+
$form->label_order = $form->label_order."0#**id**#Payment Status#**label**#type_paypal_payment_status#****#";
|
382 |
+
}
|
383 |
+
}
|
384 |
+
$label_all = explode('#****#', $form->label_order);
|
385 |
+
$label_all = array_slice($label_all, 0, count($label_all) - 1);
|
386 |
+
foreach ($label_all as $key => $label_each) {
|
387 |
+
$label_id_each = explode('#**id**#', $label_each);
|
388 |
+
array_push($label_id, $label_id_each[0]);
|
389 |
+
$label_oder_each = explode('#**label**#', $label_id_each[1]);
|
390 |
+
array_push($label_order_original, $label_oder_each[0]);
|
391 |
+
array_push($label_type, $label_oder_each[1]);
|
392 |
+
}
|
393 |
+
/*$theme_id = $wpdb->get_var("SELECT theme FROM " . $wpdb->prefix . "formmaker WHERE id='" . $form->id . "'");*/
|
394 |
+
$css = $wpdb->get_var("SELECT css FROM " . $wpdb->prefix . "formmaker_themes");
|
395 |
+
array_push($params, $rows);
|
396 |
+
array_push($params, $label_id);
|
397 |
+
array_push($params, $label_order_original);
|
398 |
+
array_push($params, $label_type);
|
399 |
+
array_push($params, $ispaypal);
|
400 |
+
array_push($params, $form);
|
401 |
+
array_push($params, $css);
|
402 |
+
return $params;
|
403 |
+
}
|
404 |
+
|
405 |
+
public function check_type_for_edit_function($label_type) {
|
406 |
+
if ($label_type != 'type_editor' and $label_type != 'type_submit_reset' and $label_type != 'type_map' and $label_type != 'type_mark_map' and $label_type != 'type_captcha' and $label_type != 'type_recaptcha' and $label_type != 'type_button') {
|
407 |
+
return TRUE;
|
408 |
+
}
|
409 |
+
else {
|
410 |
+
return FALSE;
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
public function check_for_submited_label($rows, $label_id) {
|
415 |
+
foreach ($rows as $row) {
|
416 |
+
if ($row->element_label == $label_id) {
|
417 |
+
$element_value = $row->element_value;
|
418 |
+
break;
|
419 |
+
}
|
420 |
+
else {
|
421 |
+
$element_value = 'continue';
|
422 |
+
}
|
423 |
+
}
|
424 |
+
return $element_value;
|
425 |
+
}
|
426 |
+
|
427 |
+
public function view_for_star_rating($element_value, $element_label) {
|
428 |
+
$view_star_rating_array = array();
|
429 |
+
$new_filename = str_replace("***star_rating***", '', $element_value);
|
430 |
+
$stars = "";
|
431 |
+
$new_filename=explode('***', $new_filename);
|
432 |
+
for ($j = 0; $j < $new_filename[1]; $j++) {
|
433 |
+
$stars .= '<img id="' . $element_label . '_star_' . $j . '" src="' . WD_FMC_URL . '/images/star_' . $new_filename[2] . '.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
434 |
+
}
|
435 |
+
for ($k = $new_filename[1]; $k < $new_filename[0]; $k++) {
|
436 |
+
$stars .= '<img id="' . $element_label . '_star_' . $k . '" src="' . WD_FMC_URL . '/images/star.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
437 |
+
}
|
438 |
+
array_push($view_star_rating_array, $stars);
|
439 |
+
return $view_star_rating_array;
|
440 |
+
}
|
441 |
+
|
442 |
+
public function view_for_grading($element_value) {
|
443 |
+
$view_grading_array = array();
|
444 |
+
$new_filename = str_replace("***grading***", '', $element_value);
|
445 |
+
$grading = explode(":", $new_filename);
|
446 |
+
$items_count = sizeof($grading) - 1;
|
447 |
+
$items = "";
|
448 |
+
$total = "";
|
449 |
+
for ($k = 0; $k < $items_count / 2; $k++) {
|
450 |
+
$items .= $grading[$items_count / 2 + $k] . ": " . $grading[$k] . "</br>";
|
451 |
+
$total += $grading[$k];
|
452 |
+
}
|
453 |
+
$items .= "Total: " . $total;
|
454 |
+
array_push($view_grading_array, $items);
|
455 |
+
return $view_grading_array;
|
456 |
+
}
|
457 |
+
|
458 |
+
public function images_for_star_rating($element_value, $label_id) {
|
459 |
+
$edit_stars = "";
|
460 |
+
$star_rating_array = array();
|
461 |
+
$element_value1 = str_replace("***star_rating***", '', $element_value);
|
462 |
+
$stars_value = explode('***', $element_value1);
|
463 |
+
for ($j = 0; $j < $stars_value[1]; $j++) {
|
464 |
+
$edit_stars .= '<img id="'.$label_id.'_star_'.$j.'" onclick="edit_star_rating('.$j.','.$label_id.')" src="' . WD_FMC_URL . '/images/star_'.$stars_value[2].'.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
465 |
+
}
|
466 |
+
for( $k=$stars_value[1];$k<$stars_value[0];$k++) {
|
467 |
+
$edit_stars .= '<img id="'.$label_id.'_star_'.$k.'" onclick="edit_star_rating('.$k.','.$label_id.')" src="' . WD_FMC_URL . '/images/star.png?ver='. get_option("wd_form_maker_version").'" /> ';
|
468 |
+
}
|
469 |
+
array_push($star_rating_array, $edit_stars);
|
470 |
+
array_push($star_rating_array, $stars_value);
|
471 |
+
return $star_rating_array;
|
472 |
+
}
|
473 |
+
|
474 |
+
public function params_for_scale_rating($element_value, $label_id) {
|
475 |
+
$scale_rating_array = array();
|
476 |
+
$scale_radio = explode('/', $element_value);
|
477 |
+
$scale_value = $scale_radio[0];
|
478 |
+
$scale = '<table><tr>';
|
479 |
+
for ($k = 1; $k <= $scale_radio[1]; $k++) {
|
480 |
+
$scale .= '<td style="text-align:center"><span>' . $k . '</span></td>';
|
481 |
+
}
|
482 |
+
$scale .= '<tr></tr>';
|
483 |
+
for ($l = 1; $l <= $scale_radio[1]; $l++) {
|
484 |
+
if ($l == $scale_radio[0]) {
|
485 |
+
$checked = "checked";
|
486 |
+
}
|
487 |
+
else {
|
488 |
+
$checked = "";
|
489 |
+
}
|
490 |
+
$scale .= '<td><input type="radio" name = "'.$label_id.'_scale_rating_radio" id = "'.$label_id.'_scale_rating_radio_'.$l.'" value="'.$l.'" '.$checked.' onClick="edit_scale_rating(this.value,'.$label_id.')" /></td>';
|
491 |
+
}
|
492 |
+
$scale .= '</tr></table>';
|
493 |
+
array_push($scale_rating_array, $scale);
|
494 |
+
array_push($scale_rating_array, $scale_radio);
|
495 |
+
array_push($scale_rating_array, $checked);
|
496 |
+
return $scale_rating_array;
|
497 |
+
}
|
498 |
+
|
499 |
+
public function params_for_type_range($element_value, $label_id) {
|
500 |
+
$range_value = explode('-', $element_value);
|
501 |
+
$range = '<input name="'.$label_id.'_element0" id="'.$label_id.'_element0" type="text" value="'.$range_value[0].'" onChange="edit_range(this.value,'.$label_id.',0)" size="8"/> - <input name="'.$label_id.'_element1" id="'.$label_id.'_element1" type="text" value="'.$range_value[1].'" onChange="edit_range(this.value,'.$label_id.',1)" size="8"/>';
|
502 |
+
return $range;
|
503 |
+
}
|
504 |
+
|
505 |
+
public function params_for_type_grading($element_value, $label_id) {
|
506 |
+
$type_grading_array = array();
|
507 |
+
$element_value1 = str_replace("***grading***", '', $element_value);
|
508 |
+
$garding_value = explode(':', $element_value1);
|
509 |
+
$items_count = sizeof($garding_value) - 1;
|
510 |
+
$garding = "";
|
511 |
+
$sum = "";
|
512 |
+
for ($k = 0; $k < $items_count/2; $k++) {
|
513 |
+
$garding .= '<input name="'.$label_id.'_element'.$k.'" id="'.$label_id.'_element'.$k.'" type="text" value="'.$garding_value[$k].'" onKeyUp="edit_grading('.$label_id.','.$items_count.')" size="5"/> '.$garding_value[$items_count/2+$k].'</br>';
|
514 |
+
$sum += $garding_value[$k];
|
515 |
+
}
|
516 |
+
array_push($type_grading_array, $garding);
|
517 |
+
array_push($type_grading_array, $garding_value);
|
518 |
+
array_push($type_grading_array, $sum);
|
519 |
+
array_push($type_grading_array, $items_count);
|
520 |
+
array_push($type_grading_array, $element_value1);
|
521 |
+
return $type_grading_array;
|
522 |
+
}
|
523 |
+
|
524 |
+
public function params_for_type_matrix($element_value, $label_id) {
|
525 |
+
$type_matrix_array = array();
|
526 |
+
$new_filename = str_replace("***matrix***", '', $element_value);
|
527 |
+
$matrix_value = explode('***', $new_filename);
|
528 |
+
$matrix_value = array_slice($matrix_value, 0, count($matrix_value) - 1);
|
529 |
+
$mat_rows = $matrix_value[0];
|
530 |
+
$mat_columns = $matrix_value[$mat_rows + 1];
|
531 |
+
$matrix = "<table>";
|
532 |
+
$matrix .= '<tr><td></td>';
|
533 |
+
for ($k = 1; $k <= $mat_columns; $k++) {
|
534 |
+
$matrix .= '<td style="background-color:#BBBBBB; padding:5px; border:1px; ">'.$matrix_value[$mat_rows+1+$k].'</td>';
|
535 |
+
}
|
536 |
+
$matrix .= '</tr>';
|
537 |
+
$aaa = Array();
|
538 |
+
$var_checkbox = 1;
|
539 |
+
$selected_value = "";
|
540 |
+
$selected_value_yes = "";
|
541 |
+
$selected_value_no = "";
|
542 |
+
for ($k = 1; $k <= $mat_rows; $k++) {
|
543 |
+
$matrix .= '<tr><td style="background-color:#BBBBBB; padding:5px; border:1px;">'.$matrix_value[$k].'</td>';
|
544 |
+
if ($matrix_value[$mat_rows + $mat_columns + 2] == "radio") {
|
545 |
+
if ($matrix_value[$mat_rows + $mat_columns + 2 + $k] == 0) {
|
546 |
+
$checked = "";
|
547 |
+
$aaa[1] = "";
|
548 |
+
}
|
549 |
+
else {
|
550 |
+
$aaa = explode("_", $matrix_value[$mat_rows + $mat_columns + 2 + $k]);
|
551 |
+
}
|
552 |
+
for ($l = 1; $l <= $mat_columns; $l++) {
|
553 |
+
if ($aaa[1] == $l) {
|
554 |
+
$checked = 'checked';
|
555 |
+
}
|
556 |
+
else {
|
557 |
+
$checked = "";
|
558 |
+
}
|
559 |
+
$index = "'" . $k . '_' . $l . "'";
|
560 |
+
$matrix .= '<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" '.$checked.' onClick="change_radio_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
|
561 |
+
}
|
562 |
+
}
|
563 |
+
else {
|
564 |
+
if ($matrix_value[$mat_rows+$mat_columns+2] == "checkbox") {
|
565 |
+
for ($l = 1; $l <= $mat_columns; $l++) {
|
566 |
+
if ($matrix_value[$mat_rows + $mat_columns + 2 + $var_checkbox] == 1) {
|
567 |
+
$checked = 'checked';
|
568 |
+
}
|
569 |
+
else {
|
570 |
+
$checked = '';
|
571 |
+
}
|
572 |
+
$index = "'".$k.'_'.$l."'";
|
573 |
+
$matrix .='<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" '.$checked.' onClick="change_checkbox_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
|
574 |
+
$var_checkbox++;
|
575 |
+
}
|
576 |
+
}
|
577 |
+
else {
|
578 |
+
if ($matrix_value[$mat_rows + $mat_columns + 2] == "text") {
|
579 |
+
for ($l = 1; $l <= $mat_columns; $l++) {
|
580 |
+
$text_value = $matrix_value[$mat_rows+$mat_columns+2+$var_checkbox];
|
581 |
+
$index = "'".$k.'_'.$l."'";
|
582 |
+
$matrix .= '<td style="text-align:center;"><input name="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_input_elementform_id_temp'.$k.'_'.$l.'" type="'.$matrix_value[$mat_rows+$mat_columns+2].'" value="'.$text_value.'" onKeyUp="change_text_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"/></td>';
|
583 |
+
$var_checkbox++;
|
584 |
+
}
|
585 |
+
}
|
586 |
+
else {
|
587 |
+
for ($l = 1; $l <= $mat_columns; $l++) {
|
588 |
+
$selected_text = $matrix_value[$mat_rows+$mat_columns + 2 + $var_checkbox];
|
589 |
+
if ($selected_text == 'yes') {
|
590 |
+
$selected_value_yes = 'selected';
|
591 |
+
$selected_value_no = '';
|
592 |
+
$selected_value = '';
|
593 |
+
}
|
594 |
+
else {
|
595 |
+
if ($selected_text=='no') {
|
596 |
+
$selected_value_yes ='';
|
597 |
+
$selected_value_no ='selected';
|
598 |
+
$selected_value ='';
|
599 |
+
}
|
600 |
+
else {
|
601 |
+
$selected_value_yes = '';
|
602 |
+
$selected_value_no ='';
|
603 |
+
$selected_value ='selected';
|
604 |
+
}
|
605 |
+
}
|
606 |
+
$index = "'".$k.'_'.$l."'";
|
607 |
+
$matrix .= '<td style="text-align:center;"><select name="'.$label_id.'_select_yes_noform_id_temp'.$k.'_'.$l.'" id="'.$label_id.'_select_yes_noform_id_temp'.$k.'_'.$l.'" onChange="change_option_values('.$index.','.$label_id.','.$mat_rows.','.$mat_columns.')"><option value="" '.$selected_value.'></option><option value="yes" '.$selected_value_yes.' >Yes</option><option value="no" '.$selected_value_no.'>No</option></select></td>';
|
608 |
+
$var_checkbox++;
|
609 |
+
}
|
610 |
+
}
|
611 |
+
}
|
612 |
+
}
|
613 |
+
$matrix .= '</tr>';
|
614 |
+
}
|
615 |
+
$matrix .= '</table>';
|
616 |
+
array_push($type_matrix_array, $matrix);
|
617 |
+
array_push($type_matrix_array, $new_filename);
|
618 |
+
return $type_matrix_array;
|
619 |
+
}
|
620 |
+
|
621 |
+
public function select_data_from_db_for_labels($db_info,$label_column, $table, $where, $order_by) {
|
622 |
+
global $wpdb;
|
623 |
+
|
624 |
+
$query = "SELECT `" . $label_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
|
625 |
+
if($db_info) {
|
626 |
+
$temp = explode('@@@wdfhostwdf@@@',$db_info);
|
627 |
+
$host = $temp[0];
|
628 |
+
$temp = explode('@@@wdfportwdf@@@',$temp[1]);
|
629 |
+
$port = $temp[0];
|
630 |
+
$temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
|
631 |
+
$username = $temp[0];
|
632 |
+
$temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
|
633 |
+
$password = $temp[0];
|
634 |
+
$temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
|
635 |
+
$database = $temp[0];
|
636 |
+
|
637 |
+
$wpdb_temp = new wpdb($username, $password, $database, $host);
|
638 |
+
$choices_labels = $wpdb_temp->get_col($query);
|
639 |
+
}
|
640 |
+
else {
|
641 |
+
$choices_labels = $wpdb->get_col($query);
|
642 |
+
}
|
643 |
+
return $choices_labels;
|
644 |
+
}
|
645 |
+
public function select_data_from_db_for_values($db_info,$value_column, $table, $where, $order_by) {
|
646 |
+
global $wpdb;
|
647 |
+
$query = "SELECT `" . $value_column . "` FROM " . $table . $where . " ORDER BY " . $order_by;
|
648 |
+
if($db_info) {
|
649 |
+
$temp = explode('@@@wdfhostwdf@@@',$db_info);
|
650 |
+
$host = $temp[0];
|
651 |
+
$temp = explode('@@@wdfportwdf@@@',$temp[1]);
|
652 |
+
$port = $temp[0];
|
653 |
+
$temp = explode('@@@wdfusernamewdf@@@',$temp[1]);
|
654 |
+
$username = $temp[0];
|
655 |
+
$temp = explode('@@@wdfpasswordwdf@@@',$temp[1]);
|
656 |
+
$password = $temp[0];
|
657 |
+
$temp = explode('@@@wdfdatabasewdf@@@',$temp[1]);
|
658 |
+
$database = $temp[0];
|
659 |
+
|
660 |
+
$wpdb_temp = new wpdb($username, $password, $database, $host);
|
661 |
+
$choices_values = $wpdb_temp->get_col($query);
|
662 |
+
}
|
663 |
+
else {
|
664 |
+
$choices_values = $wpdb->get_col($query);
|
665 |
+
}
|
666 |
+
return $choices_values;
|
667 |
+
}
|
668 |
+
public function get_subs_count($form_id) {
|
669 |
+
global $wpdb;
|
670 |
+
$query = $wpdb->prepare("SELECT distinct group_id FROM " . $wpdb->prefix . "formmaker_submits where form_id=%d", $form_id);
|
671 |
+
$group_id_s = $wpdb->get_col($query);
|
672 |
+
return count($group_id_s);
|
673 |
+
}
|
674 |
+
}
|
675 |
+
|
676 |
+
?>
|
contact-form-maker.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Contact Form Maker
|
4 |
* Plugin URI: http://web-dorado.com/products/form-maker-wordpress.html
|
5 |
* Description: WordPress Contact Form Maker is a simple contact form builder, which allows the user with almost no knowledge of programming to create and edit different type of contact forms.
|
6 |
-
* Version: 1.8.
|
7 |
* Author: WebDorado
|
8 |
* Author URI: http://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -249,7 +249,7 @@ function register_fmcemailverification_cpt(){
|
|
249 |
// Activate plugin.
|
250 |
function form_maker_activate_cfm() {
|
251 |
$version = get_option("wd_form_maker_version");
|
252 |
-
$new_version = '1.8.
|
253 |
global $wpdb;
|
254 |
if (!$version) {
|
255 |
add_option("wd_form_maker_version", $new_version, '', 'no');
|
3 |
* Plugin Name: Contact Form Maker
|
4 |
* Plugin URI: http://web-dorado.com/products/form-maker-wordpress.html
|
5 |
* Description: WordPress Contact Form Maker is a simple contact form builder, which allows the user with almost no knowledge of programming to create and edit different type of contact forms.
|
6 |
+
* Version: 1.8.38
|
7 |
* Author: WebDorado
|
8 |
* Author URI: http://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
249 |
// Activate plugin.
|
250 |
function form_maker_activate_cfm() {
|
251 |
$version = get_option("wd_form_maker_version");
|
252 |
+
$new_version = '1.8.38';
|
253 |
global $wpdb;
|
254 |
if (!$version) {
|
255 |
add_option("wd_form_maker_version", $new_version, '', 'no');
|
featured/featured.php
CHANGED
@@ -12,6 +12,12 @@ function fmc_featured_page($current_plugin = '') {
|
|
12 |
'text' => 'Wordpress form builder plugin',
|
13 |
'content' => 'Form Maker is a modern and advanced tool for creating WordPress forms easily and fast.',
|
14 |
'href' => 'https://web-dorado.com/products/wordpress-form.html'
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
),
|
16 |
"photo-gallery" => array(
|
17 |
'title' => 'Photo Gallery',
|
@@ -145,7 +151,7 @@ function fmc_featured_page($current_plugin = '') {
|
|
145 |
<h3>Featured Plugins</h3>
|
146 |
<div class="featured_header">
|
147 |
<a href="https://web-dorado.com/wordpress-plugins.html?source=contactformmaker" target="_blank">
|
148 |
-
<h1>GET <?php echo $plugins[$current_plugin]["title"]; ?> +
|
149 |
<h1 class="get_plugins">FOR $100 ONLY <span>- SAVE 70%</span></h1>
|
150 |
<div class="try-now">
|
151 |
<span>TRY NOW</span>
|
12 |
'text' => 'Wordpress form builder plugin',
|
13 |
'content' => 'Form Maker is a modern and advanced tool for creating WordPress forms easily and fast.',
|
14 |
'href' => 'https://web-dorado.com/products/wordpress-form.html'
|
15 |
+
),
|
16 |
+
"mailchimp" => array(
|
17 |
+
'title' => 'MailChimp WD',
|
18 |
+
'text' => 'MailChimp WD plugin',
|
19 |
+
'content' => 'MailChimp WD is a functional plugin developed to create MailChimp subscribe/unsubscribe forms and manage lists from your WordPress site.',
|
20 |
+
'href' => 'https://web-dorado.com/products/wordpress-mailchimp-wd.html'
|
21 |
),
|
22 |
"photo-gallery" => array(
|
23 |
'title' => 'Photo Gallery',
|
151 |
<h3>Featured Plugins</h3>
|
152 |
<div class="featured_header">
|
153 |
<a href="https://web-dorado.com/wordpress-plugins.html?source=contactformmaker" target="_blank">
|
154 |
+
<h1>GET <?php echo $plugins[$current_plugin]["title"]; ?> +23 PLUGINS</h1>
|
155 |
<h1 class="get_plugins">FOR $100 ONLY <span>- SAVE 70%</span></h1>
|
156 |
<div class="try-now">
|
157 |
<span>TRY NOW</span>
|
featured/images/mailchimp.png
ADDED
Binary file
|
featured/style.css
CHANGED
@@ -75,6 +75,7 @@
|
|
75 |
#main_featured_plugins_page #featured-plugins-list li.instagram_feed .product {background:url("images/instagram_feed.png") center center no-repeat;}
|
76 |
#main_featured_plugins_page #featured-plugins-list li.post-slider .product {background:url("images/post-slider.png") center center no-repeat;}
|
77 |
#main_featured_plugins_page #featured-plugins-list li.google-maps .product {background:url("images/google-maps.png") center center no-repeat;}
|
|
|
78 |
|
79 |
#main_featured_plugins_page #featured-plugins-list li .title .heading {
|
80 |
display: block;
|
75 |
#main_featured_plugins_page #featured-plugins-list li.instagram_feed .product {background:url("images/instagram_feed.png") center center no-repeat;}
|
76 |
#main_featured_plugins_page #featured-plugins-list li.post-slider .product {background:url("images/post-slider.png") center center no-repeat;}
|
77 |
#main_featured_plugins_page #featured-plugins-list li.google-maps .product {background:url("images/google-maps.png") center center no-repeat;}
|
78 |
+
#main_featured_plugins_page #featured-plugins-list li.mailchimp .product {background:url("images/mailchimp.png") center center no-repeat;}
|
79 |
|
80 |
#main_featured_plugins_page #featured-plugins-list li .title .heading {
|
81 |
display: block;
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: webdorado
|
|
3 |
Donate link: http://web-dorado.com/products/wordpress-contact-form-maker-plugin.html
|
4 |
Tags: captcha, contact, contact form, contact forms, custom form, email, feedback, form, form builder, form manager, forms, survey
|
5 |
Requires at least: 3.4
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -146,6 +146,10 @@ If you want to update the plugin while preserving your existing contact forms, y
|
|
146 |
|
147 |
== Changelog ==
|
148 |
|
|
|
|
|
|
|
|
|
149 |
= 1.8.37 =
|
150 |
* Fixed: Bug on edit_old() function for old forms.
|
151 |
|
3 |
Donate link: http://web-dorado.com/products/wordpress-contact-form-maker-plugin.html
|
4 |
Tags: captcha, contact, contact form, contact forms, custom form, email, feedback, form, form builder, form manager, forms, survey
|
5 |
Requires at least: 3.4
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 1.8.38
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
146 |
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= 1.8.38 =
|
150 |
+
* Bug On Search by ID in Submissions
|
151 |
+
* Added: Mailchimp in featured plugins
|
152 |
+
|
153 |
= 1.8.37 =
|
154 |
* Fixed: Bug on edit_old() function for old forms.
|
155 |
|