PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmForm.php +88 -517 6.265.1 View file →
@@ -6,10 +6,9 @@
6 6 class FrmForm {
7 7
8 8 /**
9 9 * @param array $values
10 - *
11 - * @return bool|int id on success or false on failure.
10 + * @return int|boolean id on success or false on failure
12 11 */
13 12 public static function create( $values ) {
14 13 global $wpdb;
15 14
@@ -18,33 +17,24 @@
18 17 $new_values = array(
19 18 'form_key' => FrmAppHelper::get_unique_key( $values['form_key'], $wpdb->prefix . 'frm_forms', 'form_key' ),
20 19 'name' => $values['name'],
21 20 'description' => $values['description'],
22 - 'status' => $values['status'] ?? 'published',
23 - 'logged_in' => $values['logged_in'] ?? 0,
21 + 'status' => isset( $values['status'] ) ? $values['status'] : 'published',
22 + 'logged_in' => isset( $values['logged_in'] ) ? $values['logged_in'] : 0,
24 23 'is_template' => isset( $values['is_template'] ) ? (int) $values['is_template'] : 0,
25 24 'parent_form_id' => isset( $values['parent_form_id'] ) ? absint( $values['parent_form_id'] ) : 0,
26 25 'editable' => isset( $values['editable'] ) ? (int) $values['editable'] : 0,
27 - 'created_at' => $values['created_at'] ?? current_time( 'mysql', 1 ),
26 + 'created_at' => isset( $values['created_at'] ) ? $values['created_at'] : current_time( 'mysql', 1 ),
28 27 );
29 28
30 29 $options = isset( $values['options'] ) ? (array) $values['options'] : array();
31 30 FrmFormsHelper::fill_form_options( $options, $values );
32 31
33 - $options['before_html'] = $values['options']['before_html'] ?? FrmFormsHelper::get_default_html( 'before' );
34 - $options['after_html'] = $values['options']['after_html'] ?? FrmFormsHelper::get_default_html( 'after' );
35 - $options['submit_html'] = $values['options']['submit_html'] ?? FrmFormsHelper::get_default_html( 'submit' );
32 + $options['before_html'] = isset( $values['options']['before_html'] ) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html( 'before' );
33 + $options['after_html'] = isset( $values['options']['after_html'] ) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html( 'after' );
34 + $options['submit_html'] = isset( $values['options']['submit_html'] ) ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
36 35
37 - /**
38 - * Allows modifying form options before updating or creating.
39 - *
40 - * @since 5.4 Add the third param.
41 - *
42 - * @param array $options Form options.
43 - * @param array $values Form data.
44 - * @param bool $update Is form updating or creating. It's `true` if is updating.
45 - */
46 - $options = apply_filters( 'frm_form_options_before_update', $options, $values, false );
36 + $options = apply_filters( 'frm_form_options_before_update', $options, $values );
47 37 $options = self::maybe_filter_form_options( $options );
48 38 $new_values['options'] = serialize( $options );
49 39
50 40 $wpdb->insert( $wpdb->prefix . 'frm_forms', $new_values );
@@ -60,9 +50,8 @@
60 50 /**
61 51 * @since 5.0.08
62 52 *
63 53 * @param array $options
64 - *
65 54 * @return array
66 55 */
67 56 private static function maybe_filter_form_options( $options ) {
68 57 if ( ! FrmAppHelper::allow_unfiltered_html() && ! empty( $options['submit_html'] ) ) {
@@ -71,22 +60,14 @@
71 60 return FrmAppHelper::maybe_filter_array( $options, array( 'submit_value', 'success_msg', 'before_html', 'after_html' ) );
72 61 }
73 62
74 63 /**
75 - * Duplicate a form.
76 - *
77 - * @param int $id Form ID to duplicate.
78 - * @param bool $template Whether the duplicated form is a template.
79 - * @param bool $copy_keys Whether to copy the original form key.
80 - * @param false|int $blog_id Blog ID when duplicating across sites, or false for current site.
81 - *
82 - * @return bool|int ID on success or false on failure
64 + * @return int|boolean ID on success or false on failure
83 65 */
84 66 public static function duplicate( $id, $template = false, $copy_keys = false, $blog_id = false ) {
85 67 global $wpdb;
86 68
87 69 $values = self::getOne( $id, $blog_id );
88 -
89 70 if ( ! $values ) {
90 71 return false;
91 72 }
92 73
@@ -103,10 +84,10 @@
103 84 'is_template' => $template ? 1 : 0,
104 85 );
105 86
106 87 if ( $blog_id ) {
107 - $new_values['status'] = 'published';
108 - $new_options = $values->options;
88 + $new_values['status'] = 'published';
89 + $new_options = $values->options;
109 90 FrmAppHelper::unserialize_or_decode( $new_options );
110 91 $new_options['email_to'] = get_option( 'admin_email' );
111 92 $new_options['copy'] = false;
112 93 $new_values['options'] = $new_options;
@@ -135,16 +116,10 @@
135 116
136 117 return false;
137 118 }
138 119
139 - /**
140 - * @param int $form_id
141 - * @param array $values
142 - *
143 - * @return void
144 - */
145 120 public static function after_duplicate( $form_id, $values ) {
146 - $new_opts = $values['options'];
121 + $new_opts = $values['options'];
147 122 FrmAppHelper::unserialize_or_decode( $new_opts );
148 123 $values['options'] = $new_opts;
149 124
150 125 if ( isset( $new_opts['success_msg'] ) ) {
@@ -156,100 +131,13 @@
156 131 if ( $new_opts != $values['options'] ) {
157 132 global $wpdb;
158 133 $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $new_opts ) ), array( 'id' => $form_id ) );
159 134 }
160 -
161 - self::switch_field_ids_in_fields( $form_id );
162 135 }
163 136
164 137 /**
165 - * Switches field ID in fields.
166 - *
167 - * @since 5.3
168 - *
169 - * @param int $form_id Form ID.
170 - *
171 - * @return void
138 + * @return int|boolean
172 139 */
173 - private static function switch_field_ids_in_fields( $form_id ) {
174 - global $wpdb;
175 -
176 - // Keys of fields that you want to check to replace field ID.
177 - $keys = array( 'default_value', 'field_options' );
178 - $sql_cols = 'fi.id';
179 -
180 - foreach ( $keys as $key ) {
181 - $sql_cols .= ',fi.' . $key;
182 - }
183 -
184 - $fields = FrmDb::get_results(
185 - "{$wpdb->prefix}frm_fields AS fi LEFT OUTER JOIN {$wpdb->prefix}frm_forms AS fr ON fi.form_id = fr.id",
186 - array(
187 - 'or' => 1,
188 - 'fi.form_id' => $form_id,
189 - 'fr.parent_form_id' => $form_id,
190 - ),
191 - $sql_cols
192 - );
193 -
194 - if ( ! $fields || ! is_array( $fields ) ) {
195 - return;
196 - }
197 -
198 - foreach ( $fields as $field ) {
199 - self::switch_field_ids_in_field( (array) $field );
200 - }
201 - }
202 -
203 - /**
204 - * Switches field ID in a field.
205 - *
206 - * @since 5.3
207 - *
208 - * @param array $field Field array.
209 - *
210 - * @return void
211 - */
212 - private static function switch_field_ids_in_field( $field ) {
213 - $new_values = array();
214 -
215 - foreach ( $field as $key => $value ) {
216 - if ( 'id' === $key || ! $value ) {
217 - continue;
218 - }
219 -
220 - if ( ! is_string( $value ) && ! is_array( $value ) ) {
221 - continue;
222 - }
223 -
224 - if ( 'field_options' === $key ) {
225 - // Need to loop through field_options to prevent breaking serialized string when length changed.
226 - FrmAppHelper::unserialize_or_decode( $value );
227 - $new_val = FrmFieldsHelper::switch_field_ids( $value );
228 - $new_val = serialize( $new_val );
229 - } else {
230 - $new_val = FrmFieldsHelper::switch_field_ids( $value );
231 - }
232 -
233 - if ( $new_val !== $value ) {
234 - $new_values[ $key ] = $new_val;
235 - }
236 - }//end foreach
237 -
238 - if ( ! empty( $new_values ) ) {
239 - FrmField::update( $field['id'], $new_values );
240 - }
241 - }
242 -
243 - /**
244 - * Update a form.
245 - *
246 - * @param int $id Form ID.
247 - * @param array $values Form values to update.
248 - * @param bool $create_link Whether this is being called from link creation.
249 - *
250 - * @return bool|int
251 - */
252 140 public static function update( $id, $values, $create_link = false ) {
253 141 global $wpdb;
254 142
255 143 $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) );
@@ -271,15 +159,14 @@
271 159 $new_values[ $value_key ] = $value;
272 160 }
273 161 }
274 162
275 - if ( ! empty( $values['new_status'] ) ) {
163 + if ( isset( $values['new_status'] ) && ! empty( $values['new_status'] ) ) {
276 164 $new_values['status'] = $values['new_status'];
277 165 }
278 166
279 167 if ( ! empty( $new_values ) ) {
280 168 $query_results = $wpdb->update( $wpdb->prefix . 'frm_forms', $new_values, array( 'id' => $id ) );
281 -
282 169 if ( $query_results ) {
283 170 self::clear_form_cache();
284 171 }
285 172 } else {
@@ -298,9 +185,8 @@
298 185 /**
299 186 * @param array $new_values
300 187 * @param array $values
301 188 * @param array $args
302 - *
303 189 * @return array
304 190 */
305 191 public static function set_update_options( $new_values, $values, $args = array() ) {
306 192 if ( ! isset( $values['options'] ) ) {
@@ -306,26 +192,22 @@
306 192 if ( ! isset( $values['options'] ) ) {
307 193 return $new_values;
308 194 }
309 195
310 - $options = ! empty( $values['options'] ) ? (array) $values['options'] : array();
196 + $options = isset( $values['options'] ) ? (array) $values['options'] : array();
311 197 FrmFormsHelper::fill_form_options( $options, $values );
312 198
313 - $options['custom_style'] = $values['options']['custom_style'] ?? 0;
314 - $options['before_html'] = $values['options']['before_html'] ?? FrmFormsHelper::get_default_html( 'before' );
315 - $options['after_html'] = $values['options']['after_html'] ?? FrmFormsHelper::get_default_html( 'after' );
316 - $options['submit_html'] = isset( $values['options']['submit_html'] ) && '' !== $values['options']['submit_html'] ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
199 + $options['custom_style'] = isset( $values['options']['custom_style'] ) ? $values['options']['custom_style'] : 0;
200 + $options['before_html'] = isset( $values['options']['before_html'] ) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html( 'before' );
201 + $options['after_html'] = isset( $values['options']['after_html'] ) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html( 'after' );
202 + $options['submit_html'] = ( isset( $values['options']['submit_html'] ) && '' !== $values['options']['submit_html'] ) ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
317 203
318 - /**
319 - * Allows modifying form options before updating or creating.
320 - *
321 - * @since 5.4 Added the third param.
322 - *
323 - * @param array $options Form options.
324 - * @param array $values Form data.
325 - * @param bool $update Is form updating or creating. It's `true` if is updating.
326 - */
327 - $options = apply_filters( 'frm_form_options_before_update', $options, $values, true );
204 + if ( ! empty( $options['success_url'] ) && ! empty( $args['form_id'] ) ) {
205 + $options['success_url'] = FrmFormsHelper::maybe_add_sanitize_url_attr( $options['success_url'], (int) $args['form_id'] );
206 + $values['options']['success_url'] = $options['success_url'];
207 + }
208 +
209 + $options = apply_filters( 'frm_form_options_before_update', $options, $values );
328 210 $options = self::maybe_filter_form_options( $options );
329 211 $new_values['options'] = serialize( $options );
330 212
331 213 return $new_values;
@@ -331,11 +213,8 @@
331 213 return $new_values;
332 214 }
333 215
334 216 /**
335 - * @param int $id Form ID.
336 - * @param array $values Form values array.
337 - *
338 217 * @return array
339 218 */
340 219 public static function update_fields( $id, $values ) {
341 220
@@ -343,9 +222,8 @@
343 222 return $values;
344 223 }
345 224
346 225 $all_fields = FrmField::get_all_for_form( $id );
347 -
348 226 if ( empty( $all_fields ) ) {
349 227 return $values;
350 228 }
351 229
@@ -354,9 +232,8 @@
354 232 }
355 233
356 234 $field_array = array();
357 235 $existing_keys = array_keys( $values['item_meta'] );
358 -
359 236 foreach ( $all_fields as $fid ) {
360 237 if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) {
361 238 $values['item_meta'][ $fid->id ] = '';
362 239 }
@@ -375,9 +252,8 @@
375 252 continue;
376 253 }
377 254
378 255 $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) );
379 -
380 256 if ( $is_settings_page ) {
381 257 self::get_settings_page_html( $values, $field );
382 258
383 259 if ( ! defined( 'WP_IMPORTING' ) ) {
@@ -384,20 +260,15 @@
384 260 continue;
385 261 }
386 262 }
387 263
388 - // Updating the form.
264 + //updating the form
389 265 $update_options = FrmFieldsHelper::get_default_field_options_from_field( $field );
390 - // Don't check for POST html.
391 - unset( $update_options['custom_html'] );
266 + unset( $update_options['custom_html'] ); // don't check for POST html
392 267 $update_options = apply_filters( 'frm_field_options_to_update', $update_options );
393 268
394 - if ( ! is_array( $field->field_options ) ) {
395 - $field->field_options = array();
396 - }
397 -
398 269 foreach ( $update_options as $opt => $default ) {
399 - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default;
270 + $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
400 271 self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
401 272 }
402 273
403 274 $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
@@ -406,94 +277,32 @@
406 277 'field_options' => $field->field_options,
407 278 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '',
408 279 );
409 280
410 - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) {
411 - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) {
412 - if ( is_array( $option ) ) {
413 - foreach ( $option as $key => $item ) {
414 - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' );
415 - }
416 - }
417 - }
418 - }
419 -
420 281 self::prepare_field_update_values( $field, $values, $new_field );
421 - self::maybe_update_max_option( $field, $values, $new_field );
422 282
423 283 FrmField::update( $field_id, $new_field );
424 284
425 285 FrmField::delete_form_transient( $field->form_id );
426 - }//end foreach
286 + }
427 287 self::clear_form_cache();
428 288
429 289 return $values;
430 290 }
431 291
432 - /**
433 - * Resets the 'max' option of a field when changing paragraph field type to other field types like text, email etc.
434 - *
435 - * @since 6.7
436 - *
437 - * @param array $field
438 - * @param array $values
439 - * @param array $new_field
440 - *
441 - * @return void
442 - */
443 - private static function maybe_update_max_option( $field, $values, &$new_field ) {
444 - if ( $field->type === 'textarea' &&
445 - ! empty( $values['field_options'][ 'type_' . $field->id ] ) &&
446 - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) {
447 -
448 - $new_field['field_options']['max'] = '';
449 -
450 - /**
451 - * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads.
452 - * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting.
453 - */
454 - $_POST['field_options'][ 'max_' . $field->id ] = '';
455 - }
456 - }
457 -
458 - /**
459 - * @param string $opt
460 - * @param mixed $value
461 - *
462 - * @return void
463 - */
464 292 private static function sanitize_field_opt( $opt, &$value ) {
465 - if ( ! is_string( $value ) ) {
466 - return;
293 + if ( is_string( $value ) ) {
294 + if ( $opt === 'calc' ) {
295 + $value = self::sanitize_calc( $value );
296 + } else {
297 + $value = FrmAppHelper::kses( $value, 'all' );
298 + }
299 + $value = trim( $value );
467 300 }
468 -
469 - /**
470 - * Allow the option to turn off sanitization for a field. This way a custom rule can be used instead.
471 - * Make sure to add custom sanitization using the frm_update_field_options filter as the data will no longer be sanitized.
472 - *
473 - * @since 6.0
474 - *
475 - * @param bool $should_sanitize
476 - * @param string $opt
477 - */
478 - $should_sanitize = apply_filters( 'frm_should_sanitize_field_opt_string', true, $opt );
479 -
480 - if ( ! $should_sanitize ) {
481 - return;
482 - }
483 -
484 - if ( $opt === 'calc' ) {
485 - $value = self::sanitize_calc( $value );
486 - } else {
487 - $value = FrmAppHelper::kses( $value, 'all' );
488 - }
489 -
490 - $value = trim( $value );
491 301 }
492 302
493 303 /**
494 304 * @param string $value
495 - *
496 305 * @return string
497 306 */
498 307 private static function sanitize_calc( $value ) {
499 308 if ( false !== strpos( $value, '<' ) ) {
@@ -498,10 +307,9 @@
498 307 private static function sanitize_calc( $value ) {
499 308 if ( false !== strpos( $value, '<' ) ) {
500 309 $value = self::normalize_calc_spaces( $value );
501 310 }
502 - // Allow <= and >=.
503 - $allow = array( '<= ', ' >=' );
311 + $allow = array( '<= ', ' >=' ); // Allow <= and >=
504 312 $temp = array( '< = ', ' > =' );
505 313 $value = str_replace( $allow, $temp, $value );
506 314 $value = strip_tags( $value );
507 315 $value = str_replace( $temp, $allow, $value );
@@ -512,44 +320,35 @@
512 320 * Format a comparison like 5<10 to 5 < 10. Also works on 5< 10, 5 <10, 5<=10 variations.
513 321 * This is to avoid an issue with unspaced calculations being recognized as HTML that gets removed when strip_tags is called.
514 322 *
515 323 * @param string $calc
516 - *
517 324 * @return string
518 325 */
519 326 private static function normalize_calc_spaces( $calc ) {
520 327 // Check for a pattern with 5 parts
521 - // $1 \d|\] the first comparison digit or the end of a comparison shortcode.
328 + // $1 \d the first comparison digit.
522 329 // $2 a space (optional).
523 330 // $3 an equals sign (optional) that follows the < operator for <= comparisons.
524 331 // $4 another space (optional).
525 - // $5 \d|\[ the second comparison digit or the start of a comparison shortcode.
526 - $calc = preg_replace( '/(\d|\])( ){0,1}<(=){0,1}( ){0,1}(\d|\[)/', '$1 <$3 $5', $calc );
527 -
528 - return $calc;
332 + // $5 \d the second comparison digit.
333 + return preg_replace( '/(\d)( ){0,1}<(=){0,1}( ){0,1}(\d)/', '$1 <$3 $5', $calc );
529 334 }
530 335
531 336 /**
532 337 * Updating the settings page
533 - *
534 - * @param array $values Form values array.
535 - * @param object $field Field object, passed by reference.
536 - *
537 - * @return void
538 338 */
539 339 private static function get_settings_page_html( $values, &$field ) {
540 340 if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
541 341 $prev_opts = array();
542 - $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type );
342 + $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
543 343
544 - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html;
545 - } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) {
344 + $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
345 + } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) {
546 346 $prev_opts = $field->field_options;
547 347 }
548 348
549 349 if ( isset( $prev_opts ) ) {
550 350 $field->field_options = apply_filters( 'frm_update_form_field_options', $field->field_options, $field, $values );
551 -
552 351 if ( $prev_opts != $field->field_options ) {
553 352 FrmField::update( $field->id, array( 'field_options' => $field->field_options ) );
554 353 }
555 354 }
@@ -554,15 +353,8 @@
554 353 }
555 354 }
556 355 }
557 356
558 - /**
559 - * @param object $field
560 - * @param array $values
561 - * @param array $new_field
562 - *
563 - * @return void
564 - */
565 357 private static function prepare_field_update_values( $field, $values, &$new_field ) {
566 358 $field_cols = array(
567 359 'field_order' => 0,
568 360 'field_key' => '',
@@ -571,16 +363,12 @@
571 363 'description' => '',
572 364 'options' => '',
573 365 'name' => '',
574 366 );
575 -
576 367 foreach ( $field_cols as $col => $default ) {
577 - $default = $default === '' ? $field->{$col} : $default;
578 - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default;
579 - }
368 + $default = ( $default === '' ) ? $field->{$col} : $default;
580 369
581 - if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) {
582 - $new_field['field_order'] = $field->field_order;
370 + $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
583 371 }
584 372
585 373 // Don't save the template option.
586 374 if ( is_array( $new_field['options'] ) && isset( $new_field['options']['000'] ) ) {
@@ -592,12 +380,9 @@
592 380 * Get a list of all form settings that should be translated
593 381 * on a multilingual site.
594 382 *
595 383 * @since 3.06.01
596 - *
597 - * @param object $form The form object.
598 - *
599 - * @return array
384 + * @param object $form - The form object
600 385 */
601 386 public static function translatable_strings( $form ) {
602 387 $strings = array(
603 388 'name',
@@ -604,12 +389,8 @@
604 389 'description',
605 390 'submit_value',
606 391 'submit_msg',
607 392 'success_msg',
608 - 'invalid_msg',
609 - 'failed_msg',
610 - 'login_msg',
611 - 'admin_permission',
612 393 );
613 394
614 395 return apply_filters( 'frm_form_strings', $strings, $form );
615 396 }
@@ -614,12 +395,11 @@
614 395 return apply_filters( 'frm_form_strings', $strings, $form );
615 396 }
616 397
617 398 /**
618 - * @param int $id
619 399 * @param string $status
620 400 *
621 - * @return bool|int
401 + * @return int|boolean
622 402 */
623 403 public static function set_status( $id, $status ) {
624 404 if ( 'trash' == $status ) {
625 405 return self::trash( $id );
@@ -625,10 +405,9 @@
625 405 return self::trash( $id );
626 406 }
627 407
628 408 $statuses = array( 'published', 'draft', 'trash' );
629 -
630 - if ( ! in_array( $status, $statuses, true ) ) {
409 + if ( ! in_array( $status, $statuses ) ) {
631 410 return false;
632 411 }
633 412
634 413 global $wpdb;
@@ -655,11 +434,9 @@
655 434 return $query_results;
656 435 }
657 436
658 437 /**
659 - * @param int|string $id Form ID.
660 - *
661 - * @return bool|int
438 + * @return int|boolean
662 439 */
663 440 public static function trash( $id ) {
664 441 if ( ! EMPTY_TRASH_DAYS ) {
665 442 return self::destroy( $id );
@@ -665,17 +442,12 @@
665 442 return self::destroy( $id );
666 443 }
667 444
668 445 $form = self::getOne( $id );
669 -
670 446 if ( ! $form ) {
671 447 return false;
672 448 }
673 449
674 - if ( $form->status === 'trash' ) {
675 - return false;
676 - }
677 -
678 450 $options = $form->options;
679 451 $options['trash_time'] = time();
680 452
681 453 global $wpdb;
@@ -708,26 +480,21 @@
708 480 return $query_results;
709 481 }
710 482
711 483 /**
712 - * @param int|string $id Form ID.
713 - *
714 - * @return bool|int
484 + * @return int|boolean
715 485 */
716 486 public static function destroy( $id ) {
717 487 global $wpdb;
718 488
719 489 $form = self::getOne( $id );
720 -
721 490 if ( ! $form ) {
722 491 return false;
723 492 }
724 -
725 493 $id = $form->id;
726 494
727 495 // Disconnect the entries from this form
728 496 $entries = FrmDb::get_col( $wpdb->prefix . 'frm_items', array( 'form_id' => $id ) );
729 -
730 497 foreach ( $entries as $entry_id ) {
731 498 FrmEntry::destroy( $entry_id );
732 499 unset( $entry_id );
733 500 }
@@ -735,14 +502,10 @@
735 502 // Disconnect the fields from this form
736 503 $wpdb->query( $wpdb->prepare( 'DELETE fi FROM ' . $wpdb->prefix . 'frm_fields AS fi LEFT JOIN ' . $wpdb->prefix . 'frm_forms fr ON (fi.form_id = fr.id) WHERE fi.form_id=%d OR parent_form_id=%d', $id, $id ) );
737 504
738 505 $query_results = $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_forms WHERE id=%d OR parent_form_id=%d', $id, $id ) );
739 -
740 506 if ( $query_results ) {
741 507 // Delete all form actions linked to this form
742 - /**
743 - * @var FrmFormAction
744 - */
745 508 $action_control = FrmFormActionsController::get_form_actions( 'email' );
746 509 $action_control->destroy( $id, 'all' );
747 510
748 511 // Clear form caching
@@ -757,16 +520,14 @@
757 520
758 521 /**
759 522 * Delete trashed forms based on how long they have been trashed
760 523 *
761 - * @param int|string $delete_timestamp Timestamp cutoff for deletion.
762 - *
763 524 * @return int The number of forms deleted
764 525 */
765 526 public static function scheduled_delete( $delete_timestamp = '' ) {
766 527 global $wpdb;
767 528
768 - $trash_forms = FrmDb::get_results( $wpdb->prefix . 'frm_forms', array( 'status' => 'trash' ), 'id, parent_form_id, options' );
529 + $trash_forms = FrmDb::get_results( $wpdb->prefix . 'frm_forms', array( 'status' => 'trash' ), 'id, options' );
769 530
770 531 if ( ! $trash_forms ) {
771 532 return 0;
772 533 }
@@ -775,18 +536,13 @@
775 536 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
776 537 }
777 538
778 539 $count = 0;
779 -
780 540 foreach ( $trash_forms as $form ) {
781 541 FrmAppHelper::unserialize_or_decode( $form->options );
782 -
783 542 if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) {
784 543 self::destroy( $form->id );
785 -
786 - if ( empty( $form->parent_form_id ) ) {
787 - ++$count;
788 - }
544 + $count ++;
789 545 }
790 546
791 547 unset( $form );
792 548 }
@@ -794,15 +550,12 @@
794 550 return $count;
795 551 }
796 552
797 553 /**
798 - * @param int|string $id Form ID or key.
799 - *
800 554 * @return string form name
801 555 */
802 556 public static function getName( $id ) {
803 557 $form = FrmDb::check_cache( $id, 'frm_form' );
804 -
805 558 if ( $form ) {
806 559 $r = stripslashes( $form->name );
807 560
808 561 return $r;
@@ -809,12 +562,10 @@
809 562 }
810 563
811 564 $query_key = is_numeric( $id ) ? 'id' : 'form_key';
812 565 $r = FrmDb::get_var( 'frm_forms', array( $query_key => $id ), 'name' );
566 + $r = stripslashes( $r );
813 567
814 - // An empty form name can result in a null value.
815 - $r = is_null( $r ) ? '' : stripslashes( $r );
816 -
817 568 return $r;
818 569 }
819 570
820 571 /**
@@ -830,9 +581,9 @@
830 581
831 582 /**
832 583 * @since 3.0
833 584 *
834 - * @param int|string $id
585 + * @param int $id
835 586 *
836 587 * @return string form key
837 588 */
838 589 public static function get_key_by_id( $id ) {
@@ -837,9 +588,8 @@
837 588 */
838 589 public static function get_key_by_id( $id ) {
839 590 $id = (int) $id;
840 591 $cache = FrmDb::check_cache( $id, 'frm_form' );
841 -
842 592 if ( $cache ) {
843 593 return $cache->form_key;
844 594 }
845 595
@@ -850,13 +600,11 @@
850 600
851 601 /**
852 602 * If $form is numeric, get the form object
853 603 *
604 + * @param object|int $form
605 + *
854 606 * @since 2.0.9
855 - *
856 - * @param int|object $form
857 - *
858 - * @return void
859 607 */
860 608 public static function maybe_get_form( &$form ) {
861 609 if ( ! is_object( $form ) && ! is_array( $form ) && ! empty( $form ) ) {
862 610 $form = self::getOne( $form );
@@ -863,28 +611,27 @@
863 611 }
864 612 }
865 613
866 614 /**
867 - * @param int|string $id
868 - * @param false|int $blog_id
869 - *
870 - * @return stdClass|null
615 + * @return object form
871 616 */
872 617 public static function getOne( $id, $blog_id = false ) {
873 618 global $wpdb;
874 619
875 620 if ( $blog_id && is_multisite() ) {
876 - $prefix = $wpdb->get_blog_prefix( $blog_id );
621 + global $wpmuBaseTablePrefix;
622 + $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix . $blog_id . '_' : $wpdb->get_blog_prefix( $blog_id );
623 +
877 624 $table_name = $prefix . 'frm_forms';
878 625 } else {
879 626 $table_name = $wpdb->prefix . 'frm_forms';
880 627 $cache = wp_cache_get( $id, 'frm_form' );
881 -
882 628 if ( $cache ) {
883 629 if ( isset( $cache->options ) ) {
884 630 FrmAppHelper::unserialize_or_decode( $cache->options );
885 631 }
886 - return self::prepare_form_row_data( $cache );
632 +
633 + return wp_unslash( $cache );
887 634 }
888 635 }
889 636
890 637 if ( is_numeric( $id ) ) {
@@ -899,49 +646,17 @@
899 646 FrmDb::set_cache( $results->id, $results, 'frm_form' );
900 647 FrmAppHelper::unserialize_or_decode( $results->options );
901 648 }
902 649
903 - return self::prepare_form_row_data( $results );
650 + return apply_filters( 'frm_form_object', wp_unslash( $results ) );
904 651 }
905 652
906 653 /**
907 - * Make sure that if $row is an object, that $row->options is an array and not a string.
908 - *
909 - * @since 6.8.3
910 - *
911 - * @param stdClass|null $row The database row for a target form.
912 - *
913 - * @return stdClass|null
654 + * @return object|array of objects
914 655 */
915 - private static function prepare_form_row_data( $row ) {
916 - $row = wp_unslash( $row );
917 -
918 - if ( ! is_object( $row ) ) {
919 - return $row;
920 - }
921 -
922 - if ( ! is_array( $row->options ) ) {
923 - $row->options = FrmFormsHelper::get_default_opts();
924 - }
925 -
926 - /**
927 - * @since 4.03.02
928 - *
929 - * @param stdClass $row
930 - */
931 - return apply_filters( 'frm_form_object', $row );
932 - }
933 -
934 - /**
935 - * @param array|string $where Where conditions array or raw WHERE string.
936 - * @param string $order_by Order by clause.
937 - * @param int|string $limit Limit clause or number.
938 - *
939 - * @return array|object of objects
940 - */
941 656 public static function getAll( $where = array(), $order_by = '', $limit = '' ) {
942 657 if ( is_array( $where ) && ! empty( $where ) ) {
943 - if ( ! empty( $where['is_template'] ) && ! isset( $where['status'] ) && ! isset( $where['status !'] ) ) {
658 + if ( isset( $where['is_template'] ) && $where['is_template'] && ! isset( $where['status'] ) && ! isset( $where['status !'] ) ) {
944 659 // don't get trashed templates
945 660 $where['status'] = array( null, '', 'published' );
946 661 }
947 662
@@ -948,9 +663,9 @@
948 663 $results = FrmDb::get_results( 'frm_forms', $where, '*', compact( 'order_by', 'limit' ) );
949 664 } else {
950 665 global $wpdb;
951 666
952 - // The query has already been prepared if this is not an array.
667 + // the query has already been prepared if this is not an array
953 668 $query = 'SELECT * FROM ' . $wpdb->prefix . 'frm_forms' . FrmDb::prepend_and_or_where( ' WHERE ', $where ) . FrmDb::esc_order( $order_by ) . FrmDb::esc_limit( $limit );
954 669 $results = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
955 670 }
956 671
@@ -960,9 +675,9 @@
960 675 FrmAppHelper::unserialize_or_decode( $result->options );
961 676 }
962 677 }
963 678
964 - if ( $limit === ' LIMIT 1' || $limit == 1 ) {
679 + if ( $limit == ' LIMIT 1' || $limit == 1 ) {
965 680 // return the first form object if we are only getting one form
966 681 $results = reset( $results );
967 682 }
968 683
@@ -972,20 +687,14 @@
972 687 /**
973 688 * Get all published forms
974 689 *
975 690 * @since 2.0
976 - *
977 - * @param array $query
978 - * @param int $limit
979 - * @param string $inc_children
980 - *
981 - * @return array|object of forms A single form object would be passed if $limit was set to 1.
691 + * @return array of forms
982 692 */
983 693 public static function get_published_forms( $query = array(), $limit = 999, $inc_children = 'exclude' ) {
984 694 $query['is_template'] = 0;
985 695 $query['status'] = array( null, '', 'published' );
986 -
987 - if ( $inc_children === 'exclude' ) {
696 + if ( $inc_children == 'exclude' ) {
988 697 $query['parent_form_id'] = array( null, 0 );
989 698 }
990 699
991 700 $forms = self::getAll( $query, 'name', $limit );
@@ -1001,14 +710,13 @@
1001 710
1002 711 $cache_key = 'frm_form_counts';
1003 712
1004 713 $counts = wp_cache_get( $cache_key, 'frm_form' );
1005 -
1006 714 if ( false !== $counts ) {
1007 715 return $counts;
1008 716 }
1009 717
1010 - $results = FrmDb::get_results(
718 + $results = (array) FrmDb::get_results(
1011 719 'frm_forms',
1012 720 array(
1013 721 'or' => 1,
1014 722 'parent_form_id' => null,
@@ -1022,18 +730,18 @@
1022 730
1023 731 foreach ( $results as $row ) {
1024 732 if ( 'trash' != $row->status ) {
1025 733 if ( $row->is_template ) {
1026 - ++$counts['template'];
734 + $counts['template'] ++;
1027 735 } else {
1028 - ++$counts['published'];
736 + $counts['published'] ++;
1029 737 }
1030 738 } else {
1031 - ++$counts['trash'];
739 + $counts['trash'] ++;
1032 740 }
1033 741
1034 742 if ( 'draft' == $row->status ) {
1035 - ++$counts['draft'];
743 + $counts['draft'] ++;
1036 744 }
1037 745
1038 746 unset( $row );
1039 747 }
@@ -1049,10 +757,8 @@
1049 757 * Called when a form is created, updated, duplicated, or deleted
1050 758 * or when the form status is changed
1051 759 *
1052 760 * @since 2.0.4
1053 - *
1054 - * @return void
1055 761 */
1056 762 public static function clear_form_cache() {
1057 763 FrmDb::cache_delete_group( 'frm_form' );
1058 764 }
@@ -1057,22 +763,16 @@
1057 763 FrmDb::cache_delete_group( 'frm_form' );
1058 764 }
1059 765
1060 766 /**
1061 - * @param array $values Form values to validate.
1062 - *
1063 767 * @return array of errors
1064 768 */
1065 769 public static function validate( $values ) {
1066 770 $errors = array();
771 +
1067 772 return apply_filters( 'frm_validate_form', $errors, $values );
1068 773 }
1069 774
1070 - /**
1071 - * @param object|null $form
1072 - *
1073 - * @return array
1074 - */
1075 775 public static function get_params( $form = null ) {
1076 776 global $frm_vars;
1077 777
1078 778 if ( ! $form ) {
@@ -1102,17 +802,16 @@
1102 802 );
1103 803
1104 804 $values = array();
1105 805 $values['posted_form_id'] = FrmAppHelper::get_param( 'form_id', '', 'get', 'absint' );
1106 -
1107 806 if ( ! $values['posted_form_id'] ) {
1108 807 $values['posted_form_id'] = FrmAppHelper::get_param( 'form', '', 'get', 'absint' );
1109 808 }
1110 809
1111 810 if ( $form->id == $values['posted_form_id'] ) {
1112 - // If there are two forms on the same page, make sure not to submit both.
811 + //if there are two forms on the same page, make sure not to submit both
1113 812 foreach ( $default_values as $var => $default ) {
1114 - if ( $var === 'action' ) {
813 + if ( $var == 'action' ) {
1115 814 $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
1116 815 } else {
1117 816 $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1118 817 }
@@ -1133,11 +832,8 @@
1133 832
1134 833 return $values;
1135 834 }
1136 835
1137 - /**
1138 - * @return array
1139 - */
1140 836 public static function list_page_params() {
1141 837 $values = array();
1142 838 $defaults = array(
1143 839 'template' => 0,
@@ -1147,9 +843,8 @@
1147 843 'search' => '',
1148 844 'sort' => '',
1149 845 'sdir' => '',
1150 846 );
1151 -
1152 847 foreach ( $defaults as $var => $default ) {
1153 848 $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1154 849 }
1155 850
@@ -1155,16 +850,10 @@
1155 850
1156 851 return $values;
1157 852 }
1158 853
1159 - /**
1160 - * @param int|object|string|null $form
1161 - *
1162 - * @return array
1163 - */
1164 854 public static function get_admin_params( $form = null ) {
1165 855 $form_id = $form;
1166 -
1167 856 if ( $form === null ) {
1168 857 $form_id = self::get_current_form_id();
1169 858 } elseif ( $form && is_object( $form ) ) {
1170 859 $form_id = $form->id;
@@ -1182,9 +871,8 @@
1182 871 'sdir' => '',
1183 872 'fid' => '',
1184 873 'keep_post' => '',
1185 874 );
1186 -
1187 875 foreach ( $defaults as $var => $default ) {
1188 876 $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1189 877 }
1190 878
@@ -1190,39 +878,27 @@
1190 878
1191 879 return $values;
1192 880 }
1193 881
1194 - /**
1195 - * @param string $default_form
1196 - *
1197 - * @return int|string
1198 - */
1199 882 public static function get_current_form_id( $default_form = 'none' ) {
1200 - if ( 'first' === $default_form ) {
883 + if ( 'first' == $default_form ) {
1201 884 $form = self::get_current_form();
1202 885 } else {
1203 886 $form = self::maybe_get_current_form();
1204 887 }
1205 -
1206 888 $form_id = $form ? $form->id : 0;
1207 889
1208 890 return $form_id;
1209 891 }
1210 892
1211 - /**
1212 - * @param int|string $form_id
1213 - *
1214 - * @return false|int|object|string
1215 - */
1216 893 public static function maybe_get_current_form( $form_id = 0 ) {
1217 894 global $frm_vars;
1218 895
1219 - if ( ! empty( $frm_vars['current_form'] ) && ( ! $form_id || $form_id == $frm_vars['current_form']->id ) ) {
896 + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && ( ! $form_id || $form_id == $frm_vars['current_form']->id ) ) {
1220 897 return $frm_vars['current_form'];
1221 898 }
1222 899
1223 900 $form_id = FrmAppHelper::get_param( 'form', $form_id, 'get', 'absint' );
1224 -
1225 901 if ( $form_id ) {
1226 902 $form_id = self::set_current_form( $form_id );
1227 903 }
1228 904
@@ -1228,16 +904,10 @@
1228 904
1229 905 return $form_id;
1230 906 }
1231 907
1232 - /**
1233 - * @param int $form_id
1234 - *
1235 - * @return false|object
1236 - */
1237 908 public static function get_current_form( $form_id = 0 ) {
1238 909 $form = self::maybe_get_current_form( $form_id );
1239 -
1240 910 if ( is_numeric( $form ) ) {
1241 911 $form = self::set_current_form( $form );
1242 912 }
1243 913
@@ -1243,18 +913,12 @@
1243 913
1244 914 return $form;
1245 915 }
1246 916
1247 - /**
1248 - * @param int $form_id
1249 - *
1250 - * @return false|object
1251 - */
1252 917 public static function set_current_form( $form_id ) {
1253 918 global $frm_vars;
1254 919
1255 920 $query = array();
1256 -
1257 921 if ( $form_id ) {
1258 922 $query['id'] = $form_id;
1259 923 }
1260 924
@@ -1262,19 +926,11 @@
1262 926
1263 927 return $frm_vars['current_form'];
1264 928 }
1265 929
1266 - /**
1267 - * @param object $form
1268 - * @param int|string $this_load
1269 - * @param bool $global_load
1270 - *
1271 - * @return bool
1272 - */
1273 930 public static function is_form_loaded( $form, $this_load, $global_load ) {
1274 931 global $frm_vars;
1275 932 $small_form = new stdClass();
1276 -
1277 933 foreach ( array( 'id', 'form_key', 'name' ) as $var ) {
1278 934 $small_form->{$var} = $form->{$var};
1279 935 unset( $var );
1280 936 }
@@ -1285,9 +941,9 @@
1285 941 $global_load = true;
1286 942 $frm_vars['load_css'] = true;
1287 943 }
1288 944
1289 - return empty( $frm_vars['css_loaded'] ) && $global_load;
945 + return ( ( ! isset( $frm_vars['css_loaded'] ) || ! $frm_vars['css_loaded'] ) && $global_load );
1290 946 }
1291 947
1292 948 /**
1293 949 * @since 4.06.03
@@ -1302,26 +958,13 @@
1302 958 } else {
1303 959 $visible = true;
1304 960 }
1305 961
1306 - /**
1307 - * @since 6.25
1308 - *
1309 - * @param bool $visible
1310 - * @param object $form
1311 - */
1312 - $visible = (bool) apply_filters( 'frm_form_is_visible', $visible, $form );
1313 -
1314 962 return $visible;
1315 963 }
1316 964
1317 - /**
1318 - * @param object $form
1319 - *
1320 - * @return bool
1321 - */
1322 965 public static function show_submit( $form ) {
1323 - $show = ( ! $form->is_template && $form->status === 'published' && ! FrmAppHelper::is_admin() );
966 + $show = ( ! $form->is_template && $form->status == 'published' && ! FrmAppHelper::is_admin() );
1324 967 $show = apply_filters( 'frm_show_submit_button', $show, $form );
1325 968
1326 969 return $show;
1327 970 }
@@ -1327,18 +970,14 @@
1327 970 }
1328 971
1329 972 /**
1330 973 * @since 2.3
1331 - *
1332 - * @param array $atts Attributes including form, option, and default.
1333 - *
1334 - * @return mixed
1335 974 */
1336 975 public static function get_option( $atts ) {
1337 - $form = $atts['form'];
1338 - $default = $atts['default'] ?? '';
976 + $form = $atts['form'];
977 + $default = isset( $atts['default'] ) ? $atts['default'] : '';
1339 978
1340 - return $form->options[ $atts['option'] ] ?? $default;
979 + return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default;
1341 980 }
1342 981
1343 982 /**
1344 983 * Get the link to edit this form.
@@ -1343,12 +982,9 @@
1343 982 /**
1344 983 * Get the link to edit this form.
1345 984 *
1346 985 * @since 4.0
1347 - *
1348 986 * @param int $form_id The id of the form.
1349 - *
1350 - * @return string
1351 987 */
1352 988 public static function get_edit_link( $form_id ) {
1353 989 return admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id );
1354 990 }
@@ -1353,67 +989,9 @@
1353 989 return admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id );
1354 990 }
1355 991
1356 992 /**
1357 - * Check if the "Submit this form with AJAX" setting is toggled on.
1358 - *
1359 - * @since 6.2
1360 - *
1361 - * @param stdClass $form
1362 - *
1363 - * @return bool
1364 - */
1365 - public static function is_ajax_on( $form ) {
1366 - return ! empty( $form->options['ajax_submit'] );
1367 - }
1368 -
1369 - /**
1370 - * Get the latest form available.
1371 - *
1372 - * @since 6.8
1373 - *
1374 - * @return object
1375 - */
1376 - public static function get_latest_form() {
1377 -
1378 - $args = array(
1379 - array(
1380 - 'or' => 1,
1381 - 'parent_form_id' => null,
1382 - 'parent_form_id <' => 1,
1383 - ),
1384 - 'is_template' => 0,
1385 - 'status !' => 'trash',
1386 - );
1387 -
1388 - return self::getAll( $args, 'created_at desc', 1 );
1389 - }
1390 -
1391 - /**
1392 - * Count and return total forms.
1393 - *
1394 - * @since 6.8
1395 - *
1396 - * @return int
1397 - */
1398 - public static function get_forms_count() {
1399 -
1400 - $args = array(
1401 - array(
1402 - 'or' => 1,
1403 - 'parent_form_id' => null,
1404 - 'parent_form_id <' => 1,
1405 - ),
1406 - 'is_template' => 0,
1407 - 'status !' => 'trash',
1408 - );
1409 -
1410 - return FrmDb::get_count( 'frm_forms', $args );
1411 - }
1412 -
1413 - /**
1414 - * @deprecated 2.03.05 This is still referenced in a few add ons (API, locations).
1415 - *
993 + * @deprecated 3.0
1416 994 * @codeCoverageIgnore
1417 995 *
1418 996 * @param string $key
1419 997 *
@@ -1419,22 +997,15 @@
1419 997 *
1420 998 * @return int form id
1421 999 */
1422 1000 public static function getIdByKey( $key ) {
1423 - _deprecated_function( __FUNCTION__, '2.03.05', 'FrmForm::get_id_by_key' );
1424 - return self::get_id_by_key( $key );
1001 + return FrmFormDeprecated::getIdByKey( $key );
1425 1002 }
1426 1003
1427 1004 /**
1428 - * @deprecated 2.03.05 This is still referenced in the API add on as of v1.13.
1429 - *
1005 + * @deprecated 3.0
1430 1006 * @codeCoverageIgnore
1431 - *
1432 - * @param int|string $id
1433 - *
1434 - * @return string
1435 1007 */
1436 1008 public static function getKeyById( $id ) {
1437 - _deprecated_function( __FUNCTION__, '2.03.05', 'FrmForm::get_key_by_id' );
1438 - return self::get_key_by_id( $id );
1009 + return FrmFormDeprecated::getKeyById( $id );
1439 1010 }
1440 1011 }