Formidable Forms – Form Builder for WordPress - Version 2.03.05

Version Description

  • New: Add Honeypot spam protection
  • Enhancement: Add frm_form_attributes hook.
  • Enhancement: Make field value dropdown code available in free version
  • Enhancement: Add deprecated notice for old globals such as $frm_form, $frm_entry, $frm_entry_meta, and $frmdb
  • Fix: Set default menu name to Formidable
  • Fix: Allow Date column to be toggled on form listing page
  • Pro Version *
  • New: Add Honeypot spam protection on file uploads.
  • New: Add option to get oldest or newest unique values in Views.
  • New: Add custom frmDrawChart event for customizing graphs.
  • Enhancement: Delete temporary files after 6 hours.
  • Enhancement: Add more comparison types for Lookup field queries. Affects frm_set_comparison_type_for_lookup hook options.
  • Enhancement: Add frm_pro_value_selector_options hook for customizing options available in field value dropdown.
  • Enhancement: Trigger frmLookupOptionsLoaded event when options are loaded in Lookup field.
  • Fix: Separate multiple files with comma for Zapier.
  • Fix: Start and end date not applying to repeating date fields.
  • Fix: Do not clear hidden form field in conditionally hidden Repeatable Section.
  • Fix: Create queue for fields watching Lookups so the value set is always the correct value.
  • Fix: If a field doesn't have separate values, simplify the options array to include only the key and displayed value.
  • Fix: Delete child entries when Repeatable Section is conditionally hidden and entry is updated.
Download this release

Release Info

Developer sswells
Plugin Icon 128x128 Formidable Forms – Form Builder for WordPress
Version 2.03.05
Comparing to
See all releases

Code changes from version 2.03.04 to 2.03.05

Files changed (48) hide show
  1. classes/controllers/FrmFormsController.php +1 -21
  2. classes/helpers/FrmAppHelper.php +2 -9
  3. classes/helpers/FrmFieldsHelper.php +29 -0
  4. classes/helpers/FrmFormsHelper.php +14 -0
  5. classes/models/FrmAntiSpam.php +0 -273
  6. classes/models/FrmDb.php +0 -10
  7. classes/models/FrmDbDeprecated.php +135 -0
  8. classes/models/FrmEntry.php +3 -3
  9. classes/models/FrmEntryDeprecated.php +178 -0
  10. classes/models/FrmEntryFormat.php +2 -1
  11. classes/models/FrmEntryMeta.php +0 -7
  12. classes/models/FrmEntryMetaDeprecated.php +122 -0
  13. classes/models/FrmEntryValidate.php +14 -0
  14. classes/models/FrmField.php +4 -21
  15. classes/models/FrmFieldDeprecated.php +302 -0
  16. classes/models/FrmFieldFactory.php +32 -0
  17. classes/models/FrmFieldOption.php +81 -0
  18. classes/models/FrmFieldValueSelector.php +262 -0
  19. classes/models/FrmForm.php +4 -6
  20. classes/models/FrmFormDeprecated.php +277 -0
  21. classes/models/FrmSettings.php +1 -1
  22. classes/views/frm-entries/form.php +1 -0
  23. classes/views/frm-entries/new.php +1 -1
  24. classes/views/frm-settings/form.php +5 -9
  25. css/custom_theme.css.php +4 -0
  26. deprecated.php +5 -5
  27. formidable.php +1 -1
  28. js/formidable.js +130 -5
  29. js/formidable.min.js +98 -96
  30. js/formidable_admin.js +1 -1
  31. languages/formidable-de_DE.mo +0 -0
  32. languages/formidable-de_DE.po +386 -375
  33. languages/formidable-es_ES.mo +0 -0
  34. languages/formidable-es_ES.po +384 -373
  35. languages/formidable-it_IT.mo +0 -0
  36. languages/formidable-it_IT.po +383 -372
  37. languages/formidable-nb_NO.mo +0 -0
  38. languages/formidable-nb_NO.po +449 -434
  39. languages/formidable-nl_NL.mo +0 -0
  40. languages/formidable-nl_NL.po +386 -375
  41. languages/formidable-pl_PL.mo +0 -0
  42. languages/formidable-pl_PL.po +381 -370
  43. languages/formidable-pt_BR.mo +0 -0
  44. languages/formidable-pt_BR.po +385 -374
  45. languages/formidable-sr_RS.mo +0 -0
  46. languages/formidable-sr_RS.po +381 -370
  47. languages/formidable.pot +383 -372
  48. readme.txt +24 -2
classes/controllers/FrmFormsController.php CHANGED
@@ -568,27 +568,7 @@ class FrmFormsController {
568
  }
569
 
570
  public static function hidden_columns( $result ) {
571
- $return = false;
572
- foreach ( (array) $result as $r ) {
573
- if ( ! empty( $r ) ) {
574
- $return = true;
575
- break;
576
- }
577
- }
578
-
579
- if ( $return ) {
580
- return $result;
581
- }
582
-
583
- $type = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : '';
584
-
585
- $result[] = 'created_at';
586
- if ( $type == 'template' ) {
587
- $result[] = 'id';
588
- $result[] = 'form_key';
589
- }
590
-
591
- return $result;
592
  }
593
 
594
  public static function save_per_page( $save, $option, $value ) {
568
  }
569
 
570
  public static function hidden_columns( $result ) {
571
+ return $result;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  }
573
 
574
  public static function save_per_page( $save, $option, $value ) {
classes/helpers/FrmAppHelper.php CHANGED
@@ -4,13 +4,13 @@ if ( ! defined('ABSPATH') ) {
4
  }
5
 
6
  class FrmAppHelper {
7
- public static $db_version = 42; //version of the database we are moving to
8
  public static $pro_db_version = 37; //deprecated
9
 
10
  /**
11
  * @since 2.0
12
  */
13
- public static $plug_version = '2.03.04';
14
 
15
  /**
16
  * @since 1.07.02
@@ -67,13 +67,6 @@ class FrmAppHelper {
67
 
68
  public static function get_affiliate() {
69
  return '';
70
- $affiliate_id = apply_filters( 'frm_affiliate_link', get_option('frm_aff') );
71
- $affiliate_id = strtolower( $affiliate_id );
72
- $allowed_affiliates = array();
73
- if ( ! in_array( $affiliate_id, $allowed_affiliates ) ) {
74
- $affiliate_id = false;
75
- }
76
- return $affiliate_id;
77
  }
78
 
79
  /**
4
  }
5
 
6
  class FrmAppHelper {
7
+ public static $db_version = 43; //version of the database we are moving to
8
  public static $pro_db_version = 37; //deprecated
9
 
10
  /**
11
  * @since 2.0
12
  */
13
+ public static $plug_version = '2.03.05';
14
 
15
  /**
16
  * @since 1.07.02
67
 
68
  public static function get_affiliate() {
69
  return '';
 
 
 
 
 
 
 
70
  }
71
 
72
  /**
classes/helpers/FrmFieldsHelper.php CHANGED
@@ -1304,6 +1304,35 @@ DEFAULT_HTML;
1304
  $prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1305
  }
1306
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1307
  public static function field_selection() {
1308
  _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::field_selection' );
1309
  return FrmField::field_selection();
1304
  $prepop = apply_filters( 'frm_bulk_field_choices', $prepop );
1305
  }
1306
 
1307
+ /**
1308
+ * Display a field value selector
1309
+ *
1310
+ * @since 2.03.05
1311
+ *
1312
+ * @param int $selector_field_id
1313
+ * @param array $selector_args
1314
+ */
1315
+ public static function display_field_value_selector( $selector_field_id, $selector_args ) {
1316
+ $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args );
1317
+ $field_value_selector->display();
1318
+ }
1319
+
1320
+ /**
1321
+ * Convert a field object to a flat array
1322
+ *
1323
+ * @since 2.03.05
1324
+ *
1325
+ * @param object $field
1326
+ *
1327
+ * @return array
1328
+ */
1329
+ public static function convert_field_object_to_flat_array( $field ) {
1330
+ $field_options = $field->field_options;
1331
+ $field_array = get_object_vars( $field );
1332
+ unset( $field_array['field_options'] );
1333
+ return $field_array + $field_options;
1334
+ }
1335
+
1336
  public static function field_selection() {
1337
  _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::field_selection' );
1338
  return FrmField::field_selection();
classes/helpers/FrmFormsHelper.php CHANGED
@@ -450,6 +450,20 @@ BEFORE_HTML;
450
  return $submit;
451
  }
452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  public static function get_form_style_class( $form = false ) {
454
  $style = self::get_form_style($form);
455
  $class = ' with_frm_style';
450
  return $submit;
451
  }
452
 
453
+ /**
454
+ * If the Formidable styling isn't being loaded,
455
+ * use inline styling to hide the element
456
+ * @since 2.03.05
457
+ */
458
+ public static function maybe_hide_inline() {
459
+ $frm_settings = FrmAppHelper::get_settings();
460
+ if ( $frm_settings->load_style == 'none' ) {
461
+ echo ' style="display:none;"';
462
+ } elseif ( $frm_settings->load_style == 'dynamic' ) {
463
+ FrmStylesController::enqueue_style();
464
+ }
465
+ }
466
+
467
  public static function get_form_style_class( $form = false ) {
468
  $style = self::get_form_style($form);
469
  $class = ' with_frm_style';
classes/models/FrmAntiSpam.php DELETED
@@ -1,273 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- die( 'You are not allowed to call this page directly.' );
5
- }
6
-
7
- class FrmAntiSpam {
8
-
9
- private static function is_spam( $comment ) {
10
- $url = $comment; // TODO: get values from form
11
- $email = $comment;
12
- $author = $comment;
13
- $body = $comment;
14
-
15
- $options = array(
16
- 'time_check' => 1, 'bbcode_check' => 1,
17
- 'advanced_check' => 1, 'regexp_check' => 1,
18
- 'dnsbl_check' => 1,
19
- );
20
-
21
- $response = array( 'spam' => false );
22
-
23
- /* Check if logged in */
24
- if ( is_user_logged_in() ) {
25
- return $response;
26
- }
27
-
28
- /* Honeypot */
29
- if ( ! empty( $_POST['ab_spam__hidden_field'] ) ) {
30
- $response['reason'] = 'css';
31
- return $response;
32
- }
33
-
34
- $ip = FrmAppHelper::get_ip_address();
35
- if ( empty( $ip ) ) {
36
- $response['reason'] = 'empty';
37
- return $response;
38
- }
39
-
40
- /* Action time */
41
- if ( $options['time_check'] && self::_is_shortest_time() ) {
42
- $response['reason'] = 'time';
43
- return $response;
44
- }
45
-
46
- /* BBCode Spam */
47
- if ( $options['bbcode_check'] && self::_is_bbcode_spam( $body ) ) {
48
- $response['reason'] = 'bbcode';
49
- return $response;
50
- }
51
-
52
- if ( $options['advanced_check'] && self::_is_fake_ip( $ip ) ) {
53
- $response['reason'] = 'server';
54
- return $response;
55
- }
56
-
57
- /* Regexp for Spam */
58
- if ( $options['regexp_check'] ) {
59
- $is_spam = self::_is_regexp_spam( array(
60
- 'ip' => $ip,
61
- 'host' => parse_url( $url, PHP_URL_HOST ),
62
- 'body' => $body,
63
- 'email' => $email,
64
- 'author' => $author,
65
- ) );
66
- if ( $is_spam ) {
67
- $response['reason'] = 'regexp';
68
- return $response;
69
- }
70
- }
71
-
72
- /* DNSBL Spam */
73
- if ( $options['dnsbl_check'] && self::_is_dnsbl_spam( $ip ) ) {
74
- $response['reason'] = 'dnsbl';
75
- return $response;
76
- }
77
- }
78
-
79
- /**
80
- * Check for form submission time
81
- *
82
- * @return boolean TRUE if the action time is less than 5 seconds
83
- */
84
-
85
- private static function _is_shortest_time() {
86
- $too_short = false;
87
- $start_time = FrmAppHelper::get_post_param( 'ab_init_time', 0, 'absint' );
88
-
89
- if ( $start_time ) {
90
- // Compare time values
91
- $min_seconds = apply_filters( 'frm_spam_time_limit', 5 );
92
- $total_time = time() - $start_time;
93
- if ( $total_time < $min_seconds ) {
94
- $too_short = true;
95
- }
96
- }
97
-
98
- return $too_short;
99
- }
100
-
101
- private static function _is_bbcode_spam( $body ) {
102
- return (bool) preg_match( '/\[url[=\]].*\[\/url\]/is', $body );
103
- }
104
-
105
- private static function _is_fake_ip( $client_ip, $client_host = false ) {
106
- /* Remote Host */
107
- $host_by_ip = gethostbyaddr( $client_ip );
108
-
109
- /* IPv6 */
110
- if ( self::_is_ipv6( $client_ip ) ) {
111
- return $client_ip != $host_by_ip;
112
- }
113
-
114
- /* IPv4 */
115
- if ( empty( $client_host ) ) {
116
- $ip_by_host = gethostbyname( $host_by_ip );
117
-
118
- if ( $ip_by_host === $host_by_ip ) {
119
- return false;
120
- }
121
- } else {
122
- /* IPv4 / API */
123
- if ( $host_by_ip === $client_ip ) {
124
- return true;
125
- }
126
-
127
- $ip_by_host = gethostbyname( $client_host );
128
- }
129
-
130
- if ( strpos( $client_ip, self::_cut_ip( $ip_by_host ) ) === false ) {
131
- return true;
132
- }
133
-
134
- return false;
135
- }
136
-
137
- /**
138
- * Check for an IPv6 address
139
- *
140
- * @param string $ip IP to validate
141
- * @return boolean TRUE if IPv6
142
- */
143
-
144
- private static function _is_ipv6( $ip ) {
145
- if ( function_exists('filter_var') ) {
146
- return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) !== false;
147
- } else {
148
- return ! self::_is_ipv4( $ip );
149
- }
150
- }
151
-
152
- /**
153
- * Check for an IPv4 address
154
- *
155
- * @param string $ip IP to validate
156
- * @return integer TRUE if IPv4
157
- */
158
- private static function _is_ipv4( $ip ) {
159
- if ( function_exists('filter_var') ) {
160
- return filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 ) !== false;
161
- } else {
162
- return preg_match( '/^\d{1,3}(\.\d{1,3}){3,3}$/', $ip );
163
- }
164
- }
165
-
166
- private static function _cut_ip( $ip, $cut_end = true ) {
167
- $separator = ( self::_is_ipv4( $ip ) ? '.' : ':' );
168
- $part = ( $cut_end ? strrchr( $ip, $separator ) : strstr( $ip, $separator ) );
169
-
170
- return str_replace( $part, '', $ip );
171
- }
172
-
173
- private static function _is_regexp_spam( $comment ) {
174
- /* Felder */
175
- $fields = array(
176
- 'ip',
177
- 'host',
178
- 'body',
179
- 'email',
180
- 'author',
181
- );
182
-
183
- /* Regexp */
184
- $patterns = array(
185
- 0 => array(
186
- 'host' => '^(www\.)?\d+\w+\.com$',
187
- 'body' => '^\w+\s\d+$',
188
- 'email' => '@gmail.com$',
189
- ),
190
- 1 => array(
191
- 'body' => '\<\!.+?mfunc.+?\>',
192
- ),
193
- );
194
-
195
- /* Spammy author */
196
- $quoted_author = preg_quote( $comment['author'], '/' );
197
- if ( $quoted_author ) {
198
- $patterns[] = array(
199
- 'body' => sprintf( '<a.+?>%s<\/a>$', $quoted_author ),
200
- );
201
- $patterns[] = array(
202
- 'body' => sprintf( '%s https?:.+?$', $quoted_author ),
203
- );
204
- $patterns[] = array(
205
- 'email' => '@gmail.com$',
206
- 'author' => '^[a-z0-9-\.]+\.[a-z]{2,6}$',
207
- 'host' => sprintf( '^%s$', $quoted_author ),
208
- );
209
- }
210
-
211
- /* Hook */
212
- $patterns = apply_filters( 'antispam_bee_patterns', $patterns );
213
-
214
- if ( ! $patterns ) {
215
- return false;
216
- }
217
-
218
- foreach ( $patterns as $pattern ) {
219
- $hits = array();
220
-
221
- foreach ( $pattern as $field => $regexp ) {
222
- $is_empty = ( empty( $field ) || ! in_array( $field, $fields ) || empty( $regexp ) );
223
- if ( $is_empty ) {
224
- continue;
225
- }
226
-
227
- /* Ignore non utf-8 chars */
228
- $comment[ $field ] = ( function_exists('iconv') ? iconv( 'utf-8', 'utf-8//TRANSLIT', $comment[ $field ] ) : $comment[ $field ] );
229
-
230
- if ( empty( $comment[ $field ] ) ) {
231
- continue;
232
- }
233
-
234
- /* Perform regex */
235
- if ( preg_match( '/' . $regexp . '/isu', $comment[ $field ] ) ) {
236
- $hits[ $field ] = true;
237
- }
238
- }
239
-
240
- if ( count( $hits ) === count( $pattern ) ) {
241
- return true;
242
- }
243
- }
244
-
245
- return false;
246
- }
247
-
248
- private static function _is_dnsbl_spam( $ip ) {
249
-
250
- $response = wp_safe_remote_request(
251
- esc_url_raw(
252
- sprintf( 'http://www.stopforumspam.com/api?ip=%s&f=json', $ip ),
253
- 'http'
254
- )
255
- );
256
-
257
- if ( is_wp_error( $response ) ) {
258
- return false;
259
- }
260
-
261
- /* Get JSON */
262
- $json = wp_remote_retrieve_body( $response );
263
-
264
- $result = json_decode( $json );
265
-
266
- if ( empty( $result->success ) ) {
267
- return false;
268
- }
269
-
270
- $status = (bool) $result->ip->appears;
271
- return $status;
272
- }
273
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/models/FrmDb.php CHANGED
@@ -812,14 +812,4 @@ DEFAULT_HTML;
812
  $wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) );
813
  }
814
  }
815
-
816
- public static function get_one_record( $table, $args = array(), $fields = '*', $order_by = '' ) {
817
- _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_row' );
818
- return self::get_var( $table, $args, $fields, array( 'order_by' => $order_by, 'limit' => 1 ), '', 'row' );
819
- }
820
-
821
- public static function get_records( $table, $args = array(), $order_by = '', $limit = '', $fields = '*' ) {
822
- _deprecated_function( __FUNCTION__, '2.0', 'FrmDb::get_results' );
823
- return self::get_results( $table, $args, $fields, compact('order_by', 'limit') );
824
- }
825
  }
812
  $wpdb->update( $this->entries, array( 'user_id' => $user_id->meta_value ), array( 'id' => $user_id->item_id ) );
813
  }
814
  }
 
 
 
 
 
 
 
 
 
 
815
  }
classes/models/FrmDbDeprecated.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class FrmDbDeprecated
5
+ *
6
+ * @since 2.03.05
7
+ */
8
+ class FrmDbDeprecated {
9
+
10
+ var $fields;
11
+ var $forms;
12
+ var $entries;
13
+ var $entry_metas;
14
+
15
+ public function __construct() {
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ die( 'You are not allowed to call this page directly.' );
18
+ }
19
+
20
+ global $wpdb;
21
+ $this->fields = $wpdb->prefix . 'frm_fields';
22
+ $this->forms = $wpdb->prefix . 'frm_forms';
23
+ $this->entries = $wpdb->prefix . 'frm_items';
24
+ $this->entry_metas = $wpdb->prefix . 'frm_item_metas';
25
+ }
26
+
27
+ /**
28
+ * @deprecated 2.03.05
29
+ */
30
+ public function upgrade( $old_db_version = false ) {
31
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::upgrade( $old_db_version )' );
32
+
33
+ $db = new FrmDb();
34
+ $db->upgrade( $old_db_version );
35
+ }
36
+
37
+ /**
38
+ * @deprecated 2.03.05
39
+ */
40
+ public function collation() {
41
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::collation()' );
42
+
43
+ $db = new FrmDb();
44
+ $db->collation();
45
+ }
46
+
47
+ /**
48
+ * @deprecated 2.03.05
49
+ */
50
+ public function uninstall() {
51
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::uninstall()' );
52
+
53
+ $db = new FrmDb();
54
+ $db->uninstall();
55
+ }
56
+
57
+ /**
58
+ * @deprecated 2.03.05
59
+ */
60
+ public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
61
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_where_clause_and_values( $args, $starts_with )' );
62
+ FrmDb::get_where_clause_and_values( $args, $starts_with );
63
+ }
64
+
65
+ /**
66
+ * @deprecated 2.03.05
67
+ */
68
+ public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
69
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::parse_where_from_array( $args, $base_where, $where, $values )' );
70
+ FrmDb::parse_where_from_array( $args, $base_where, $where, $values );
71
+ }
72
+
73
+ /**
74
+ * @deprecated 2.03.05
75
+ */
76
+ public static function get_count( $table, $where = array(), $args = array() ) {
77
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_count' );
78
+
79
+ return FrmDb::get_count( $table, $where, $args );
80
+ }
81
+
82
+ /**
83
+ * @deprecated 2.03.05
84
+ */
85
+ public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
86
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_var' );
87
+
88
+ return FrmDb::get_var( $table, $where, $field, $args, $limit, $type );
89
+ }
90
+
91
+ /**
92
+ * @deprecated 2.03.05
93
+ */
94
+ public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
95
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_col' );
96
+
97
+ return FrmDb::get_col( $table, $where, $field, $args, $limit );
98
+ }
99
+
100
+ /**
101
+ * @deprecated 2.03.05
102
+ */
103
+ public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
104
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_row' );
105
+
106
+ return FrmDb::get_row( $table, $where, $fields, $args );
107
+ }
108
+
109
+ /**
110
+ * @deprecated 2.03.05
111
+ */
112
+ public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
113
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_results' );
114
+
115
+ return FrmDb::get_results( $table, $where, $fields, $args );
116
+ }
117
+
118
+ /**
119
+ * @deprecated 2.03.05
120
+ */
121
+ public static function append_where_is( $where_is ) {
122
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::append_where_is' );
123
+
124
+ return FrmDb::append_where_is( $where_is );
125
+ }
126
+
127
+ /**
128
+ * @deprecated 2.03.05
129
+ */
130
+ public static function get_associative_array_results( $columns, $table, $where ) {
131
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmDb::get_associative_array_results' );
132
+
133
+ return FrmDb::get_associative_array_results( $columns, $table, $where );
134
+ }
135
+ }
classes/models/FrmEntry.php CHANGED
@@ -199,7 +199,7 @@ class FrmEntry {
199
  return $query_results;
200
  }
201
 
202
- public static function &destroy( $id ) {
203
  global $wpdb;
204
  $id = (int) $id;
205
 
@@ -219,7 +219,7 @@ class FrmEntry {
219
  return $result;
220
  }
221
 
222
- public static function &update_form( $id, $value, $form_id ) {
223
  global $wpdb;
224
  $form_id = isset($value) ? $form_id : null;
225
  $result = $wpdb->update( $wpdb->prefix . 'frm_items', array( 'form_id' => $form_id ), array( 'id' => $id ) );
@@ -327,7 +327,7 @@ class FrmEntry {
327
  /**
328
  * @param string $id
329
  */
330
- public static function &exists( $id ) {
331
  global $wpdb;
332
 
333
  if ( FrmAppHelper::check_cache( $id, 'frm_entry' ) ) {
199
  return $query_results;
200
  }
201
 
202
+ public static function destroy( $id ) {
203
  global $wpdb;
204
  $id = (int) $id;
205
 
219
  return $result;
220
  }
221
 
222
+ public static function update_form( $id, $value, $form_id ) {
223
  global $wpdb;
224
  $form_id = isset($value) ? $form_id : null;
225
  $result = $wpdb->update( $wpdb->prefix . 'frm_items', array( 'form_id' => $form_id ), array( 'id' => $id ) );
327
  /**
328
  * @param string $id
329
  */
330
+ public static function exists( $id ) {
331
  global $wpdb;
332
 
333
  if ( FrmAppHelper::check_cache( $id, 'frm_entry' ) ) {
classes/models/FrmEntryDeprecated.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @since 2.03.05
5
+ */
6
+ class FrmEntryDeprecated {
7
+
8
+ /**
9
+ * @deprecated 2.03.05
10
+ */
11
+ public static function create( $values ) {
12
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::create' );
13
+
14
+ return FrmEntry::create( $values );
15
+ }
16
+
17
+ /**
18
+ * @deprecated 2.03.05
19
+ */
20
+ public static function is_duplicate( $new_values, $values ) {
21
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::is_duplicate' );
22
+
23
+ return FrmEntry::is_duplicate( $new_values, $values );
24
+ }
25
+
26
+ /**
27
+ * @deprecated 2.03.05
28
+ */
29
+ public static function duplicate( $id ) {
30
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::duplicate' );
31
+
32
+ return FrmEntry::duplicate( $id );
33
+ }
34
+
35
+ /**
36
+ * @deprecated 2.03.05
37
+ */
38
+ public static function update( $id, $values ) {
39
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::update' );
40
+
41
+ return FrmEntry::update( $id, $values );
42
+ }
43
+
44
+ /**
45
+ * @deprecated 2.03.05
46
+ */
47
+ public static function destroy( $id ) {
48
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::destroy' );
49
+
50
+ return FrmEntry::destroy( $id );
51
+ }
52
+
53
+ /**
54
+ * @deprecated 2.03.05
55
+ */
56
+ public static function update_form( $id, $value, $form_id ) {
57
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::update_form' );
58
+
59
+ return FrmEntry::update_form( $id, $value, $form_id );
60
+ }
61
+
62
+ /**
63
+ * @deprecated 2.03.05
64
+ */
65
+ public static function clear_cache() {
66
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::clear_cache' );
67
+
68
+ FrmEntry::clear_cache();
69
+ }
70
+
71
+ /**
72
+ * @deprecated 2.03.05
73
+ */
74
+ public static function get_new_entry_name( $values, $default = '' ) {
75
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::get_new_entry_name' );
76
+
77
+ return FrmEntry::get_new_entry_name( $values, $default );
78
+ }
79
+
80
+ /**
81
+ * @deprecated 2.03.05
82
+ */
83
+ public static function maybe_get_entry( &$entry ) {
84
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::maybe_get_entry' );
85
+
86
+ FrmEntry::maybe_get_entry( $entry );
87
+ }
88
+
89
+ /**
90
+ * @deprecated 2.03.05
91
+ */
92
+ public static function getOne( $id, $meta = false ) {
93
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::getOne' );
94
+
95
+ return FrmEntry::getOne( $id, $meta );
96
+ }
97
+
98
+ /**
99
+ * @deprecated 2.03.05
100
+ */
101
+ public static function get_meta( $entry ) {
102
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::get_meta' );
103
+
104
+ return FrmEntry::get_meta( $entry );
105
+ }
106
+
107
+ /**
108
+ * @deprecated 2.03.05
109
+ */
110
+ public static function exists( $id ) {
111
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::exists' );
112
+
113
+ return FrmEntry::exists( $id );
114
+ }
115
+
116
+ /**
117
+ * @deprecated 2.03.05
118
+ */
119
+ public static function getAll( $where, $order_by = '', $limit = '', $meta = false, $inc_form = true ) {
120
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::getAll' );
121
+
122
+ return FrmEntry::getAll( $where, $order_by, $limit, $meta, $inc_form );
123
+ }
124
+
125
+ /**
126
+ * @deprecated 2.03.05
127
+ */
128
+ public static function getRecordCount( $where = '' ) {
129
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::getRecordCount' );
130
+
131
+ return FrmEntry::getRecordCount( $where );
132
+ }
133
+
134
+ /**
135
+ * @deprecated 2.03.05
136
+ */
137
+ public static function getPageCount( $p_size, $where = '' ) {
138
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::getPageCount' );
139
+
140
+ return FrmEntry::getPageCount( $p_size, $where );
141
+ }
142
+
143
+ /**
144
+ * @deprecated 2.03.05
145
+ */
146
+ public static function sanitize_entry_post( &$values ) {
147
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::sanitize_entry_post' );
148
+
149
+ FrmEntry::sanitize_entry_post( $values );
150
+ }
151
+
152
+ /**
153
+ * @deprecated 2.03.05
154
+ */
155
+ public static function create_entry_from_xml( $values ) {
156
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::create_entry_from_xml' );
157
+
158
+ return FrmEntry::create_entry_from_xml( $values );
159
+ }
160
+
161
+ /**
162
+ * @deprecated 2.03.05
163
+ */
164
+ public static function update_entry_from_xml( $id, $values ) {
165
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::update_entry_from_xml ' );
166
+
167
+ return FrmEntry::update_entry_from_xml( $id, $values );
168
+ }
169
+
170
+ /**
171
+ * @deprecated 2.03.05
172
+ */
173
+ public static function get_id_by_key( $key ) {
174
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntry::get_id_by_key' );
175
+
176
+ return FrmEntry::get_id_by_key( $key );
177
+ }
178
+ }
classes/models/FrmEntryFormat.php CHANGED
@@ -190,7 +190,8 @@ class FrmEntryFormat {
190
  } elseif ( isset( $atts['filter'] ) && $atts['filter'] == false ) {
191
  $val = $prev_val;
192
  } else {
193
- $val = apply_filters( 'frm_email_value', $prev_val, (object) $meta, $atts['entry'], compact( 'field' ) );
 
194
  }
195
  }
196
  }
190
  } elseif ( isset( $atts['filter'] ) && $atts['filter'] == false ) {
191
  $val = $prev_val;
192
  } else {
193
+ $email_value_atts = array( 'field' => $f, 'format' => $atts['format'] );
194
+ $val = apply_filters( 'frm_email_value', $prev_val, (object) $meta, $atts['entry'], $email_value_atts );
195
  }
196
  }
197
  }
classes/models/FrmEntryMeta.php CHANGED
@@ -180,13 +180,6 @@ class FrmEntryMeta {
180
  return $result;
181
  }
182
 
183
- public static function get_entry_metas( $entry_id ) {
184
- _deprecated_function( __FUNCTION__, '1.07.10');
185
-
186
- global $wpdb;
187
- return FrmDb::get_col( $wpdb->prefix . 'frm_item_metas', array( 'item_id' => $entry_id ), 'meta_value' );
188
- }
189
-
190
  public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
191
  $defaults = array( 'value' => false, 'unique' => false, 'stripslashes' => true, 'is_draft' => false );
192
  $args = wp_parse_args( $args, $defaults );
180
  return $result;
181
  }
182
 
 
 
 
 
 
 
 
183
  public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
184
  $defaults = array( 'value' => false, 'unique' => false, 'stripslashes' => true, 'is_draft' => false );
185
  $args = wp_parse_args( $args, $defaults );
classes/models/FrmEntryMetaDeprecated.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @since 2.03.05
5
+ */
6
+ class FrmEntryMetaDeprecated {
7
+
8
+ /**
9
+ * @deprecated 2.03.05
10
+ */
11
+ public static function add_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) {
12
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::add_entry_meta' );
13
+
14
+ return FrmEntryMeta::add_entry_meta( $entry_id, $field_id, $meta_key, $meta_value );
15
+ }
16
+
17
+ /**
18
+ * @deprecated 2.03.05
19
+ */
20
+ public static function update_entry_meta( $entry_id, $field_id, $meta_key = null, $meta_value ) {
21
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::update_entry_meta' );
22
+
23
+ return FrmEntryMeta::update_entry_meta( $entry_id, $field_id, $meta_key, $meta_value );
24
+ }
25
+
26
+ /**
27
+ * @deprecated 2.03.05
28
+ */
29
+ public static function update_entry_metas( $entry_id, $values ) {
30
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::update_entry_metas' );
31
+
32
+ return FrmEntryMeta::update_entry_metas( $entry_id, $values );
33
+ }
34
+
35
+ /**
36
+ * @deprecated 2.03.05
37
+ */
38
+ public static function duplicate_entry_metas( $old_id, $new_id ) {
39
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::duplicate_entry_metas' );
40
+ FrmEntryMeta::duplicate_entry_metas( $old_id, $new_id );
41
+ }
42
+
43
+ /**
44
+ * @deprecated 2.03.05
45
+ */
46
+ public static function delete_entry_meta( $entry_id, $field_id ) {
47
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::delete_entry_meta' );
48
+
49
+ return FrmEntryMeta::delete_entry_meta( $entry_id, $field_id );
50
+ }
51
+
52
+ /**
53
+ * @deprecated 2.03.05
54
+ */
55
+ public static function clear_cache() {
56
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::clear_cache' );
57
+ FrmEntryMeta::clear_cache();
58
+ }
59
+
60
+ /**
61
+ * @deprecated 2.03.05
62
+ */
63
+ public static function get_meta_value( $entry, $field_id ) {
64
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::get_meta_value' );
65
+
66
+ return FrmEntryMeta::get_meta_value( $entry, $field_id );
67
+ }
68
+
69
+ /**
70
+ * @deprecated 2.03.05
71
+ */
72
+ public static function get_entry_meta_by_field( $entry_id, $field_id ) {
73
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::get_entry_meta_by_field' );
74
+
75
+ return FrmEntryMeta::get_entry_meta_by_field( $entry_id, $field_id );
76
+ }
77
+
78
+ /**
79
+ * @deprecated 2.03.05
80
+ */
81
+ public static function get_entry_metas_for_field( $field_id, $order = '', $limit = '', $args = array() ) {
82
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::get_entry_metas_for_field' );
83
+
84
+ return FrmEntryMeta::get_entry_metas_for_field( $field_id, $order, $limit, $args );
85
+ }
86
+
87
+ /**
88
+ * @deprecated 2.03.05
89
+ */
90
+ public static function get_entry_meta_info( $entry_id ) {
91
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::get_entry_meta_info' );
92
+
93
+ return FrmEntryMeta::get_entry_meta_info( $entry_id );
94
+ }
95
+
96
+ /**
97
+ * @deprecated 2.03.05
98
+ */
99
+ public static function getAll( $where = array(), $order_by = '', $limit = '', $stripslashes = false ) {
100
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::getAll' );
101
+
102
+ return FrmEntryMeta::getAll( $where, $order_by, $limit, $stripslashes );
103
+ }
104
+
105
+ /**
106
+ * @deprecated 2.03.05
107
+ */
108
+ public static function getEntryIds( $where = array(), $order_by = '', $limit = '', $unique = true, $args = array() ) {
109
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::getEntryIds' );
110
+
111
+ return FrmEntryMeta::getEntryIds( $where, $order_by, $limit, $unique, $args );
112
+ }
113
+
114
+ /**
115
+ * @deprecated 2.03.05
116
+ */
117
+ public static function search_entry_metas( $search, $field_id = '', $operator ) {
118
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmEntryMeta::search_entry_metas' );
119
+
120
+ return FrmEntryMeta::search_entry_metas( $search, $field_id, $operator );
121
+ }
122
+ }
classes/models/FrmEntryValidate.php CHANGED
@@ -272,6 +272,10 @@ class FrmEntryValidate {
272
  return;
273
  }
274
 
 
 
 
 
275
  if ( self::blacklist_check( $values ) ) {
276
  $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
277
  }
@@ -283,6 +287,16 @@ class FrmEntryValidate {
283
  }
284
  }
285
 
 
 
 
 
 
 
 
 
 
 
286
  private static function is_akismet_spam( $values ) {
287
  global $wpcom_api_key;
288
  return ( is_callable('Akismet::http_post') && ( get_option('wordpress_api_key') || $wpcom_api_key ) && self::akismet( $values ) );
272
  return;
273
  }
274
 
275
+ if ( self::is_honeypot_spam() || self::is_spam_bot() ) {
276
+ $errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' );
277
+ }
278
+
279
  if ( self::blacklist_check( $values ) ) {
280
  $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' );
281
  }
287
  }
288
  }
289
 
290
+ private static function is_honeypot_spam() {
291
+ $honeypot_value = FrmAppHelper::get_param( 'frm_verify', '', 'get', 'sanitize_text_field' );
292
+ return ( $honeypot_value !== '' );
293
+ }
294
+
295
+ private static function is_spam_bot() {
296
+ $ip = FrmAppHelper::get_ip_address();
297
+ return empty( $ip );
298
+ }
299
+
300
  private static function is_akismet_spam( $values ) {
301
  global $wpcom_api_key;
302
  return ( is_callable('Akismet::http_post') && ( get_option('wordpress_api_key') || $wpcom_api_key ) && self::akismet( $values ) );
classes/models/FrmField.php CHANGED
@@ -4,6 +4,7 @@ if ( ! defined('ABSPATH') ) {
4
  }
5
 
6
  class FrmField {
 
7
  static $use_cache = true;
8
  static $transient_size = 200;
9
 
@@ -93,7 +94,7 @@ class FrmField {
93
  }
94
 
95
  if ( ! $return ) {
96
- return;
97
  }
98
 
99
  if ( $query_results ) {
@@ -254,7 +255,7 @@ class FrmField {
254
 
255
  public static function getOne( $id ) {
256
  if ( empty( $id ) ) {
257
- return;
258
  }
259
 
260
  global $wpdb;
@@ -284,7 +285,7 @@ class FrmField {
284
  * @param int|string The field id or key
285
  * @param mixed $col The name of the column in the fields database table
286
  */
287
- public static function &get_type( $id, $col = 'type' ) {
288
  $field = FrmAppHelper::check_cache( $id, 'frm_field' );
289
  if ( $field ) {
290
  $type = $field->{$col};
@@ -559,24 +560,6 @@ class FrmField {
559
  }
560
  }
561
 
562
- public static function getIds( $where = '', $order_by = '', $limit = '' ) {
563
- _deprecated_function( __FUNCTION__, '2.0' );
564
- global $wpdb;
565
- if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) {
566
- $order_by = ' ORDER BY ' . $order_by;
567
- }
568
-
569
- $query = 'SELECT fi.id FROM ' . $wpdb->prefix . 'frm_fields fi ' .
570
- 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON fi.form_id=fr.id' .
571
- FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit;
572
-
573
- $method = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'get_var' : 'get_col';
574
- $cache_key = 'getIds_' . maybe_serialize( $where ) . $order_by . $limit;
575
- $results = FrmAppHelper::check_cache($cache_key, 'frm_field', $query, $method);
576
-
577
- return $results;
578
- }
579
-
580
  public static function is_no_save_field( $type ) {
581
  return in_array( $type, self::no_save_fields() );
582
  }
4
  }
5
 
6
  class FrmField {
7
+
8
  static $use_cache = true;
9
  static $transient_size = 200;
10
 
94
  }
95
 
96
  if ( ! $return ) {
97
+ return false;
98
  }
99
 
100
  if ( $query_results ) {
255
 
256
  public static function getOne( $id ) {
257
  if ( empty( $id ) ) {
258
+ return null;
259
  }
260
 
261
  global $wpdb;
285
  * @param int|string The field id or key
286
  * @param mixed $col The name of the column in the fields database table
287
  */
288
+ public static function get_type( $id, $col = 'type' ) {
289
  $field = FrmAppHelper::check_cache( $id, 'frm_field' );
290
  if ( $field ) {
291
  $type = $field->{$col};
560
  }
561
  }
562
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  public static function is_no_save_field( $type ) {
564
  return in_array( $type, self::no_save_fields() );
565
  }
classes/models/FrmFieldDeprecated.php ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @since 2.03.05
5
+ */
6
+ class FrmFieldDeprecated {
7
+
8
+ /**
9
+ * @deprecated 2.03.05
10
+ */
11
+ public static function field_selection() {
12
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::field_selection' );
13
+
14
+ return FrmField::field_selection();
15
+ }
16
+
17
+ /**
18
+ * @deprecated 2.03.05
19
+ */
20
+ public static function pro_field_selection() {
21
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::pro_field_selection' );
22
+
23
+ return FrmField::pro_field_selection();
24
+ }
25
+
26
+ /**
27
+ * @deprecated 2.03.05
28
+ */
29
+ public static function create( $values, $return = true ) {
30
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::create' );
31
+
32
+ return FrmField::create( $values, $return );
33
+ }
34
+
35
+ /**
36
+ * @deprecated 2.03.05
37
+ */
38
+ public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) {
39
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::duplicate' );
40
+ FrmField::duplicate( $old_form_id, $form_id, $copy_keys, $blog_id );
41
+ }
42
+
43
+ /**
44
+ * @deprecated 2.03.05
45
+ */
46
+ public static function update( $id, $values ) {
47
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::update' );
48
+
49
+ return FrmField::update( $id, $values );
50
+ }
51
+
52
+ /**
53
+ * @deprecated 2.03.05
54
+ */
55
+ public static function destroy( $id ) {
56
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::destroy' );
57
+
58
+ return FrmField::destroy( $id );
59
+ }
60
+
61
+ /**
62
+ * @deprecated 2.03.05
63
+ */
64
+ public static function delete_form_transient( $form_id ) {
65
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::delete_form_transient' );
66
+
67
+ return FrmField::delete_form_transient( $form_id );
68
+ }
69
+
70
+ /**
71
+ * @deprecated 2.03.05
72
+ */
73
+ public static function maybe_get_field( &$field ) {
74
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::maybe_get_field' );
75
+ FrmField::maybe_get_field( $field );
76
+ }
77
+
78
+ /**
79
+ * @deprecated 2.03.05
80
+ */
81
+ public static function getOne( $id ) {
82
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::getOne' );
83
+
84
+ return FrmField::getOne( $id );
85
+ }
86
+
87
+ /**
88
+ * @deprecated 2.03.05
89
+ */
90
+ public static function get_type( $id, $col = 'type' ) {
91
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_type' );
92
+
93
+ return FrmField::get_type( $id, $col );
94
+ }
95
+
96
+ /**
97
+ * @deprecated 2.03.05
98
+ */
99
+ public static function get_all_types_in_form( $form_id, $type, $limit = '', $inc_sub = 'exclude' ) {
100
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_all_types_in_form' );
101
+
102
+ return FrmField::get_all_types_in_form( $form_id, $type, $limit, $inc_sub );
103
+ }
104
+
105
+ /**
106
+ * @deprecated 2.03.05
107
+ */
108
+ public static function get_all_for_form( $form_id, $limit = '', $inc_embed = 'exclude', $inc_repeat = 'include' ) {
109
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_all_for_form' );
110
+
111
+ return FrmField::get_all_for_form( $form_id, $limit, $inc_embed, $inc_repeat );
112
+ }
113
+
114
+ /**
115
+ * @deprecated 2.03.05
116
+ */
117
+ public static function include_sub_fields( &$results, $inc_embed, $type = 'all' ) {
118
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::include_sub_fields' );
119
+ FrmField::include_sub_fields( $results, $inc_embed, $type );
120
+ }
121
+
122
+ /**
123
+ * @deprecated 2.03.05
124
+ */
125
+ public static function getAll( $where = array(), $order_by = '', $limit = '', $blog_id = false ) {
126
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::getAll' );
127
+
128
+ return FrmField::getAll( $where, $order_by, $limit, $blog_id );
129
+ }
130
+
131
+ /**
132
+ * @deprecated 2.03.05
133
+ */
134
+ public static function is_no_save_field( $type ) {
135
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_no_save_field' );
136
+
137
+ return FrmField::is_no_save_field( $type );
138
+ }
139
+
140
+ /**
141
+ * @deprecated 2.03.05
142
+ */
143
+ public static function no_save_fields() {
144
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::no_save_fields' );
145
+
146
+ return FrmField::no_save_fields();
147
+ }
148
+
149
+ /**
150
+ * @deprecated 2.03.05
151
+ */
152
+ public static function is_field_with_multiple_values( $field ) {
153
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_field_with_multiple_values' );
154
+
155
+ return FrmField::is_field_with_multiple_values( $field );
156
+ }
157
+
158
+ /**
159
+ * @deprecated 2.03.05
160
+ */
161
+ public static function is_multiple_select( $field ) {
162
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_multiple_select' );
163
+
164
+ return FrmField::is_multiple_select( $field );
165
+ }
166
+
167
+ /**
168
+ * @deprecated 2.03.05
169
+ */
170
+ public static function is_read_only( $field ) {
171
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_read_only' );
172
+
173
+ return FrmField::is_read_only( $field );
174
+ }
175
+
176
+ /**
177
+ * @deprecated 2.03.05
178
+ */
179
+ public static function is_required( $field ) {
180
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_required' );
181
+
182
+ return FrmField::is_required( $field );
183
+ }
184
+
185
+ /**
186
+ * @deprecated 2.03.05
187
+ */
188
+ public static function is_option_true( $field, $option ) {
189
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_true' );
190
+
191
+ return FrmField::is_option_true( $field, $option );
192
+ }
193
+
194
+ /**
195
+ * @deprecated 2.03.05
196
+ */
197
+ public static function is_option_empty( $field, $option ) {
198
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_empty' );
199
+
200
+ return FrmField::is_option_empty( $field, $option );
201
+ }
202
+
203
+ /**
204
+ * @deprecated 2.03.05
205
+ */
206
+ public static function is_option_true_in_array( $field, $option ) {
207
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_true_in_array' );
208
+
209
+ return FrmField::is_option_true_in_array( $field, $option );
210
+ }
211
+
212
+ /**
213
+ * @deprecated 2.03.05
214
+ */
215
+ public static function is_option_true_in_object( $field, $option ) {
216
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_true_in_object' );
217
+
218
+ return FrmField::is_option_true_in_object( $field, $option );
219
+ }
220
+
221
+ /**
222
+ * @deprecated 2.03.05
223
+ */
224
+ public static function is_option_empty_in_array( $field, $option ) {
225
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_empty_in_array' );
226
+
227
+ return FrmField::is_option_empty_in_array( $field, $option );
228
+ }
229
+
230
+ /**
231
+ * @deprecated 2.03.05
232
+ */
233
+ public static function is_option_empty_in_object( $field, $option ) {
234
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_empty_in_object' );
235
+
236
+ return FrmField::is_option_empty_in_object( $field, $option );
237
+ }
238
+
239
+ /**
240
+ * @deprecated 2.03.05
241
+ */
242
+ public static function is_option_value_in_object( $field, $option ) {
243
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_option_value_in_object' );
244
+
245
+ return FrmField::is_option_value_in_object( $field, $option );
246
+ }
247
+
248
+ /**
249
+ * @deprecated 2.03.05
250
+ */
251
+ public static function get_option( $field, $option ) {
252
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_option' );
253
+
254
+ return FrmField::get_option( $field, $option );
255
+ }
256
+
257
+ /**
258
+ * @deprecated 2.03.05
259
+ */
260
+ public static function get_option_in_array( $field, $option ) {
261
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_option_in_array' );
262
+
263
+ return FrmField::get_option_in_array( $field, $option );
264
+ }
265
+
266
+ /**
267
+ * @deprecated 2.03.05
268
+ */
269
+ public static function get_option_in_object( $field, $option ) {
270
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_option_in_object' );
271
+
272
+ return FrmField::get_option_in_object( $field, $option );
273
+ }
274
+
275
+ /**
276
+ * @deprecated 2.03.05
277
+ */
278
+ public static function is_repeating_field( $field ) {
279
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::is_repeating_field' );
280
+
281
+ return FrmField::is_repeating_field( $field );
282
+ }
283
+
284
+ /**
285
+ * @deprecated 2.03.05
286
+ */
287
+ public static function get_id_by_key( $key ) {
288
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_id_by_key' );
289
+
290
+ return FrmField::get_id_by_key( $key );
291
+ }
292
+
293
+ /**
294
+ * @deprecated 2.03.05
295
+ */
296
+ public static function get_key_by_id( $id ) {
297
+ _deprecated_function( __FUNCTION__, '2.03.05', 'FrmField::get_key_by_id' );
298
+
299
+ return FrmField::get_key_by_id( $id );
300
+ }
301
+
302
+ }
classes/models/FrmFieldFactory.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @since 2.03.05
5
+ */
6
+ class FrmFieldFactory {
7
+
8
+ /**
9
+ * Create an instance of an FrmFieldValueSelector object
10
+ *
11
+ * @since 2.03.05
12
+ *
13
+ * @param int $field_id
14
+ * @param array $args
15
+ *
16
+ * @return FrmFieldValueSelector
17
+ */
18
+ public static function create_field_value_selector( $field_id, $args ) {
19
+ $selector = null;
20
+
21
+ if ( $field_id > 0 ) {
22
+ $selector = apply_filters( 'frm_create_field_value_selector', $selector, $field_id, $args );
23
+ }
24
+
25
+ if ( ! is_object( $selector ) ) {
26
+ $selector = new FrmFieldValueSelector( $field_id, $args );
27
+ }
28
+
29
+ return $selector;
30
+ }
31
+
32
+ }
classes/models/FrmFieldOption.php ADDED
@@ -0,0 +1,81 @@