PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.20.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.20.3
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 / GlobalHelper.php

GlobalHelper.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.20.3, at includes/GlobalHelper.php

36 lines 876 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm;
4
5 if (!\defined('ABSPATH')) {
6 exit;
7 }
8
9 class GlobalHelper
10 {
11 /**
12 * Get all forms.
13 *
14 * @return array
15 */
16 public static function getForms()
17 {
18 global $wpdb;
19
20 $allForms = $wpdb->get_results("SELECT forms.id,forms.entries as fm_entries,forms.form_name,forms.status,forms.views,forms.created_at,COUNT(entries.id) as entries FROM `{$wpdb->prefix}bitforms_form` as forms LEFT JOIN `{$wpdb->prefix}bitforms_form_entries` as entries ON forms.id = entries.form_id GROUP BY forms.id");
21
22 if (is_wp_error($allForms)) {
23 return $allForms;
24 }
25 $forms = array_reduce($allForms, function ($carry, $form) {
26 $carry[$form->id] = $form->form_name . ' (' . $form->id . ')';
27 return $carry;
28 }, []);
29
30 if (!empty($forms)) {
31 $forms[0] = __('Select a Bitform', 'bit-form');
32 }
33 return $forms;
34 }
35 }
36