PluginProbe ʕ •ᴥ•ʔ
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI / 3.0.1
Everest Forms – Contact Form, Payment Form, Quiz, Survey & Custom Form Builder with AI v3.0.1
3.5.2 3.5.1 3.5.0 3.4.8 3.4.7 3.4.6 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.6.1 1.6.7 1.7.0 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.2 1.7.2.1 1.7.2.2 1.7.3 1.7.4 1.7.5 1.7.5.1 1.7.5.2 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.8.0 1.8.0.1 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.0.1 1.9.1 1.9.2 1.9.3 1.9.4 1.9.4.1 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.0.1 2.0.1 2.0.2 2.0.3 2.0.3.1 2.0.4 2.0.4.1 2.0.5 2.0.6 2.0.7 2.0.8 2.0.8.1 2.0.9 3.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.3.1 3.0.4 3.0.4.1 3.0.4.2 3.0.5 3.0.5.1 3.0.5.2 3.0.6 3.0.6.1 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.0.9.1 3.0.9.2 3.0.9.3 3.0.9.4 3.0.9.5 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.4.0 3.4.1 3.4.2 3.4.2.1 3.4.3 3.4.4 3.4.5 trunk 1.0 1.0.1 1.0.2 1.0.3
everest-forms / includes / class-evf-fields.php
everest-forms / includes Last commit date
RestApi 2 years ago abstracts 2 years ago admin 2 years ago blocks 2 years ago elementor 2 years ago export 2 years ago fields 2 years ago interfaces 8 years ago libraries 2 years ago log-handlers 4 years ago shortcodes 2 years ago stats 3 years ago templates 5 years ago class-everest-forms.php 2 years ago class-evf-ajax.php 2 years ago class-evf-autoloader.php 8 years ago class-evf-background-process-import-entries.php 2 years ago class-evf-background-updater.php 8 years ago class-evf-cache-helper.php 6 years ago class-evf-cron.php 2 years ago class-evf-deprecated-action-hooks.php 6 years ago class-evf-deprecated-filter-hooks.php 5 years ago class-evf-emails.php 2 years ago class-evf-fields.php 2 years ago class-evf-form-handler.php 3 years ago class-evf-form-task.php 2 years ago class-evf-forms-features.php 2 years ago class-evf-frontend-scripts.php 2 years ago class-evf-install.php 2 years ago class-evf-integrations.php 2 years ago class-evf-log-levels.php 8 years ago class-evf-logger.php 5 years ago class-evf-post-types.php 5 years ago class-evf-privacy.php 6 years ago class-evf-report-cron.php 2 years ago class-evf-reporting.php 2 years ago class-evf-session-handler.php 7 years ago class-evf-shortcodes.php 4 years ago class-evf-smart-tags.php 2 years ago class-evf-template-loader.php 2 years ago class-evf-validation.php 6 years ago evf-conditional-functions.php 6 years ago evf-core-functions.php 2 years ago evf-deprecated-functions.php 6 years ago evf-entry-functions.php 2 years ago evf-formatting-functions.php 4 years ago evf-notice-functions.php 4 years ago evf-template-functions.php 4 years ago evf-template-hooks.php 8 years ago evf-update-functions.php 5 years ago
class-evf-fields.php
177 lines
1 <?php
2 /**
3 * EverestForms Form Fields
4 *
5 * Loads form fields via hooks for use in the builder.
6 *
7 * @package EverestForms\Classes\Fields
8 * @version 1.2.0
9 */
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Form fields class.
15 */
16 class EVF_Fields {
17
18 /**
19 * Form fields classes.
20 *
21 * @var array
22 */
23 public $form_fields = array();
24
25 /**
26 * The single instance of the class.
27 *
28 * @var EVF_Fields
29 */
30 protected static $instance = null;
31
32 /**
33 * Main EVF_Fields Instance.
34 *
35 * Ensures only one instance of EVF_Fields is loaded or can be loaded.
36 *
37 * @return EVF_Fields Main instance.
38 */
39 public static function instance() {
40 if ( is_null( self::$instance ) ) {
41 self::$instance = new self();
42 }
43 return self::$instance;
44 }
45
46 /**
47 * Cloning is forbidden.
48 *
49 * @since 1.2.0
50 */
51 public function __clone() {
52 evf_doing_it_wrong( __FUNCTION__, __( 'Cloning is forbidden.', 'everest-forms' ), '1.2.0' );
53 }
54
55 /**
56 * Unserializing instances of this class is forbidden.
57 *
58 * @since 1.2.0
59 */
60 public function __wakeup() {
61 evf_doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'everest-forms' ), '1.2.0' );
62 }
63
64 /**
65 * Initialize form fields.
66 */
67 public function __construct() {
68 $this->init();
69 }
70
71 /**
72 * Load fields and hook in functions.
73 */
74 public function init() {
75 $load_fields = apply_filters(
76 'everest_forms_fields',
77 array(
78 'EVF_Field_First_Name',
79 'EVF_Field_Last_Name',
80 'EVF_Field_Text',
81 'EVF_Field_Textarea',
82 'EVF_Field_Select',
83 'EVF_Field_Radio',
84 'EVF_Field_Checkbox',
85 'EVF_Field_Number',
86 'EVF_Field_Email',
87 'EVF_Field_URL',
88 'EVF_Field_Date_Time',
89 'EVF_Field_Recaptcha',
90 'EVF_Field_Hcaptcha',
91 'EVF_Field_Turnstile',
92 'EVF_Field_AI',
93 'EVF_Field_File_Upload',
94 )
95 );
96 if ( ! class_exists( '\EverestForms\AI' ) ) {
97 $load_fields = array_diff( $load_fields, array( 'EVF_Field_AI' ) );
98 }
99
100 // Get sort order.
101 $order_end = 999;
102
103 // Load form fields.
104 foreach ( $load_fields as $field ) {
105 $load_field = is_string( $field ) ? new $field() : $field;
106
107 if ( isset( $load_field->order ) && is_numeric( $load_field->order ) ) {
108 // Add in position.
109 $this->form_fields[ $load_field->group ][ $load_field->order ] = $load_field;
110 } else {
111 // Add to end of the array.
112 $this->form_fields[ $load_field->group ][ $order_end ] = $load_field;
113 ++$order_end;
114 }
115
116 ksort( $this->form_fields[ $load_field->group ] );
117 }
118 }
119
120 /**
121 * Get fields.
122 *
123 * @return array
124 */
125 public function form_fields() {
126 $_available_fields = array();
127
128 if ( count( $this->form_fields ) > 0 ) {
129 foreach ( $this->form_fields as $group => $field ) {
130 $_available_fields[ $group ] = $field;
131 }
132 }
133
134 return $_available_fields;
135 }
136
137 /**
138 * Get array of registered field types.
139 *
140 * @return array of strings
141 */
142 public function get_form_field_types() {
143 $_available_fields = array();
144
145 if ( count( $this->form_fields ) > 0 ) {
146 foreach ( array_values( $this->form_fields ) as $form_field ) {
147 foreach ( $form_field as $field ) {
148 $_available_fields[] = $field->type;
149 }
150 }
151 }
152
153 return $_available_fields;
154 }
155
156 /**
157 * Get array of registered "Pro" field types.
158 *
159 * @return array of strings
160 */
161 public function get_pro_form_field_types() {
162 $_available_fields = array();
163
164 if ( count( $this->form_fields ) > 0 ) {
165 foreach ( array_values( $this->form_fields ) as $form_field ) {
166 foreach ( $form_field as $field ) {
167 if ( $field->is_pro ) {
168 $_available_fields[] = $field->type;
169 }
170 }
171 }
172 }
173
174 return $_available_fields;
175 }
176 }
177