PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Core / Database / FormEntryModel.php

FormEntryModel.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.0, at includes/Core/Database/FormEntryModel.php

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Provides Base Model Class
5 */
6
7 namespace BitCode\BitForm\Core\Database;
8
9 /**
10 * Undocumented class
11 */
12
13 use WP_Error;
14
15 class FormEntryModel extends Model {
16 protected static $table = 'bitforms_form_entries';
17
18 public function bulkDelete(array $condition = null) {
19 if (
20 !\is_null($condition)
21 && \is_array($condition)
22 && array_keys($condition) !== range(0, count($condition) - 1)
23 ) {
24 $delete_condition = $condition;
25 } else {
26 return new WP_Error(
27 'deletion_error',
28 __('At least 1 condition needed', 'bit-form')
29 );
30 }
31 $formatted_conditions = $this->getFormatedCondition($delete_condition);
32 if ($formatted_conditions) {
33 $condition_to_check = $formatted_conditions['conditions'];
34 $all_values = $formatted_conditions['values'];
35 } else {
36 $condition_to_check = null;
37 return new WP_Error(
38 'deletion_error',
39 __('At least 1 condition needed', 'bit-form')
40 );
41 }
42 $prefix = $this->app_db->prefix;
43 $sql = "DELETE `{$prefix}bitforms_form_entries`,`{$prefix}bitforms_form_entrymeta` FROM "
44 . "`{$prefix}bitforms_form_entries` "
45 . " INNER JOIN `{$prefix}bitforms_form_entrymeta` ON "
46 . " `{$prefix}bitforms_form_entries`.`id` "
47 . "= `{$prefix}bitforms_form_entrymeta`.`bitforms_form_entry_id` "
48 . " $condition_to_check";
49 return $this->execute($sql, $all_values)->getResult();
50 }
51 }
52