PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
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 +65 -162 6.25.16.7 View file →
@@ -6,9 +6,9 @@
6 6 class FrmForm {
7 7
8 8 /**
9 9 * @param array $values
10 - * @return bool|int id on success or false on failure.
10 + * @return int|bool id on success or false on failure.
11 11 */
12 12 public static function create( $values ) {
13 13 global $wpdb;
14 14
@@ -17,22 +17,22 @@
17 17 $new_values = array(
18 18 'form_key' => FrmAppHelper::get_unique_key( $values['form_key'], $wpdb->prefix . 'frm_forms', 'form_key' ),
19 19 'name' => $values['name'],
20 20 'description' => $values['description'],
21 - 'status' => $values['status'] ?? 'published',
22 - '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,
23 23 'is_template' => isset( $values['is_template'] ) ? (int) $values['is_template'] : 0,
24 24 'parent_form_id' => isset( $values['parent_form_id'] ) ? absint( $values['parent_form_id'] ) : 0,
25 25 'editable' => isset( $values['editable'] ) ? (int) $values['editable'] : 0,
26 - 'created_at' => $values['created_at'] ?? current_time( 'mysql', 1 ),
26 + 'created_at' => isset( $values['created_at'] ) ? $values['created_at'] : current_time( 'mysql', 1 ),
27 27 );
28 28
29 29 $options = isset( $values['options'] ) ? (array) $values['options'] : array();
30 30 FrmFormsHelper::fill_form_options( $options, $values );
31 31
32 - $options['before_html'] = $values['options']['before_html'] ?? FrmFormsHelper::get_default_html( 'before' );
33 - $options['after_html'] = $values['options']['after_html'] ?? FrmFormsHelper::get_default_html( 'after' );
34 - $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' );
35 35
36 36 /**
37 37 * Allows modifying form options before updating or creating.
38 38 *
@@ -69,9 +69,9 @@
69 69 return FrmAppHelper::maybe_filter_array( $options, array( 'submit_value', 'success_msg', 'before_html', 'after_html' ) );
70 70 }
71 71
72 72 /**
73 - * @return bool|int ID on success or false on failure
73 + * @return int|boolean ID on success or false on failure
74 74 */
75 75 public static function duplicate( $id, $template = false, $copy_keys = false, $blog_id = false ) {
76 76 global $wpdb;
77 77
@@ -93,10 +93,10 @@
93 93 'is_template' => $template ? 1 : 0,
94 94 );
95 95
96 96 if ( $blog_id ) {
97 - $new_values['status'] = 'published';
98 - $new_options = $values->options;
97 + $new_values['status'] = 'published';
98 + $new_options = $values->options;
99 99 FrmAppHelper::unserialize_or_decode( $new_options );
100 100 $new_options['email_to'] = get_option( 'admin_email' );
101 101 $new_options['copy'] = false;
102 102 $new_values['options'] = $new_options;
@@ -126,9 +126,9 @@
126 126 return false;
127 127 }
128 128
129 129 public static function after_duplicate( $form_id, $values ) {
130 - $new_opts = $values['options'];
130 + $new_opts = $values['options'];
131 131 FrmAppHelper::unserialize_or_decode( $new_opts );
132 132 $values['options'] = $new_opts;
133 133
134 134 if ( isset( $new_opts['success_msg'] ) ) {
@@ -158,9 +158,9 @@
158 158 // Keys of fields that you want to check to replace field ID.
159 159 $keys = array( 'default_value', 'field_options' );
160 160 $sql_cols = 'fi.id';
161 161 foreach ( $keys as $key ) {
162 - $sql_cols .= ',fi.' . $key;
162 + $sql_cols .= ( ',fi.' . $key );
163 163 }
164 164
165 165 $fields = FrmDb::get_results(
166 166 "{$wpdb->prefix}frm_fields AS fi LEFT OUTER JOIN {$wpdb->prefix}frm_forms AS fr ON fi.form_id = fr.id",
@@ -210,9 +210,9 @@
210 210
211 211 if ( $new_val !== $value ) {
212 212 $new_values[ $key ] = $new_val;
213 213 }
214 - }//end foreach
214 + }
215 215
216 216 if ( ! empty( $new_values ) ) {
217 217 FrmField::update( $field['id'], $new_values );
218 218 }
@@ -218,9 +218,9 @@
218 218 }
219 219 }
220 220
221 221 /**
222 - * @return bool|int
222 + * @return int|boolean
223 223 */
224 224 public static function update( $id, $values, $create_link = false ) {
225 225 global $wpdb;
226 226
@@ -243,9 +243,9 @@
243 243 $new_values[ $value_key ] = $value;
244 244 }
245 245 }
246 246
247 - if ( ! empty( $values['new_status'] ) ) {
247 + if ( isset( $values['new_status'] ) && ! empty( $values['new_status'] ) ) {
248 248 $new_values['status'] = $values['new_status'];
249 249 }
250 250
251 251 if ( ! empty( $new_values ) ) {
@@ -276,15 +276,15 @@
276 276 if ( ! isset( $values['options'] ) ) {
277 277 return $new_values;
278 278 }
279 279
280 - $options = ! empty( $values['options'] ) ? (array) $values['options'] : array();
280 + $options = isset( $values['options'] ) ? (array) $values['options'] : array();
281 281 FrmFormsHelper::fill_form_options( $options, $values );
282 282
283 - $options['custom_style'] = $values['options']['custom_style'] ?? 0;
284 - $options['before_html'] = $values['options']['before_html'] ?? FrmFormsHelper::get_default_html( 'before' );
285 - $options['after_html'] = $values['options']['after_html'] ?? FrmFormsHelper::get_default_html( 'after' );
286 - $options['submit_html'] = isset( $values['options']['submit_html'] ) && '' !== $values['options']['submit_html'] ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
283 + $options['custom_style'] = isset( $values['options']['custom_style'] ) ? $values['options']['custom_style'] : 0;
284 + $options['before_html'] = isset( $values['options']['before_html'] ) ? $values['options']['before_html'] : FrmFormsHelper::get_default_html( 'before' );
285 + $options['after_html'] = isset( $values['options']['after_html'] ) ? $values['options']['after_html'] : FrmFormsHelper::get_default_html( 'after' );
286 + $options['submit_html'] = ( isset( $values['options']['submit_html'] ) && '' !== $values['options']['submit_html'] ) ? $values['options']['submit_html'] : FrmFormsHelper::get_default_html( 'submit' );
287 287
288 288 /**
289 289 * Allows modifying form options before updating or creating.
290 290 *
@@ -348,20 +348,15 @@
348 348 continue;
349 349 }
350 350 }
351 351
352 - // Updating the form.
352 + //updating the form
353 353 $update_options = FrmFieldsHelper::get_default_field_options_from_field( $field );
354 - // Don't check for POST html.
355 - unset( $update_options['custom_html'] );
354 + unset( $update_options['custom_html'] ); // don't check for POST html
356 355 $update_options = apply_filters( 'frm_field_options_to_update', $update_options );
357 356
358 - if ( ! is_array( $field->field_options ) ) {
359 - $field->field_options = array();
360 - }
361 -
362 357 foreach ( $update_options as $opt => $default ) {
363 - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default;
358 + $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default;
364 359 self::sanitize_field_opt( $opt, $field->field_options[ $opt ] );
365 360 }
366 361
367 362 $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values );
@@ -386,9 +381,9 @@
386 381
387 382 FrmField::update( $field_id, $new_field );
388 383
389 384 FrmField::delete_form_transient( $field->form_id );
390 - }//end foreach
385 + }
391 386 self::clear_form_cache();
392 387
393 388 return $values;
394 389 }
@@ -459,10 +454,9 @@
459 454 private static function sanitize_calc( $value ) {
460 455 if ( false !== strpos( $value, '<' ) ) {
461 456 $value = self::normalize_calc_spaces( $value );
462 457 }
463 - // Allow <= and >=.
464 - $allow = array( '<= ', ' >=' );
458 + $allow = array( '<= ', ' >=' ); // Allow <= and >=
465 459 $temp = array( '< = ', ' > =' );
466 460 $value = str_replace( $allow, $temp, $value );
467 461 $value = strip_tags( $value );
468 462 $value = str_replace( $temp, $allow, $value );
@@ -477,16 +471,14 @@
477 471 * @return string
478 472 */
479 473 private static function normalize_calc_spaces( $calc ) {
480 474 // Check for a pattern with 5 parts
481 - // $1 \d|\] the first comparison digit or the end of a comparison shortcode.
475 + // $1 \d the first comparison digit.
482 476 // $2 a space (optional).
483 477 // $3 an equals sign (optional) that follows the < operator for <= comparisons.
484 478 // $4 another space (optional).
485 - // $5 \d|\[ the second comparison digit or the start of a comparison shortcode.
486 - $calc = preg_replace( '/(\d|\])( ){0,1}<(=){0,1}( ){0,1}(\d|\[)/', '$1 <$3 $5', $calc );
487 -
488 - return $calc;
479 + // $5 \d the second comparison digit.
480 + return preg_replace( '/(\d)( ){0,1}<(=){0,1}( ){0,1}(\d)/', '$1 <$3 $5', $calc );
489 481 }
490 482
491 483 /**
492 484 * Updating the settings page
@@ -493,12 +485,12 @@
493 485 */
494 486 private static function get_settings_page_html( $values, &$field ) {
495 487 if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) {
496 488 $prev_opts = array();
497 - $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type );
489 + $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type );
498 490
499 - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html;
500 - } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) {
491 + $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html;
492 + } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) {
501 493 $prev_opts = $field->field_options;
502 494 }
503 495
504 496 if ( isset( $prev_opts ) ) {
@@ -519,14 +511,11 @@
519 511 'options' => '',
520 512 'name' => '',
521 513 );
522 514 foreach ( $field_cols as $col => $default ) {
523 - $default = $default === '' ? $field->{$col} : $default;
524 - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default;
525 - }
515 + $default = ( $default === '' ) ? $field->{$col} : $default;
526 516
527 - if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) {
528 - $new_field['field_order'] = $field->field_order;
517 + $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
529 518 }
530 519
531 520 // Don't save the template option.
532 521 if ( is_array( $new_field['options'] ) && isset( $new_field['options']['000'] ) ) {
@@ -538,9 +527,9 @@
538 527 * Get a list of all form settings that should be translated
539 528 * on a multilingual site.
540 529 *
541 530 * @since 3.06.01
542 - * @param object $form The form object.
531 + * @param object $form - The form object
543 532 */
544 533 public static function translatable_strings( $form ) {
545 534 $strings = array(
546 535 'name',
@@ -557,12 +546,11 @@
557 546 return apply_filters( 'frm_form_strings', $strings, $form );
558 547 }
559 548
560 549 /**
561 - * @param int $id
562 550 * @param string $status
563 551 *
564 - * @return bool|int
552 + * @return int|boolean
565 553 */
566 554 public static function set_status( $id, $status ) {
567 555 if ( 'trash' == $status ) {
568 556 return self::trash( $id );
@@ -568,9 +556,9 @@
568 556 return self::trash( $id );
569 557 }
570 558
571 559 $statuses = array( 'published', 'draft', 'trash' );
572 - if ( ! in_array( $status, $statuses, true ) ) {
560 + if ( ! in_array( $status, $statuses ) ) {
573 561 return false;
574 562 }
575 563
576 564 global $wpdb;
@@ -597,9 +585,9 @@
597 585 return $query_results;
598 586 }
599 587
600 588 /**
601 - * @return bool|int
589 + * @return int|boolean
602 590 */
603 591 public static function trash( $id ) {
604 592 if ( ! EMPTY_TRASH_DAYS ) {
605 593 return self::destroy( $id );
@@ -609,12 +597,8 @@
609 597 if ( ! $form ) {
610 598 return false;
611 599 }
612 600
613 - if ( $form->status === 'trash' ) {
614 - return false;
615 - }
616 -
617 601 $options = $form->options;
618 602 $options['trash_time'] = time();
619 603
620 604 global $wpdb;
@@ -647,9 +631,9 @@
647 631 return $query_results;
648 632 }
649 633
650 634 /**
651 - * @return bool|int
635 + * @return int|boolean
652 636 */
653 637 public static function destroy( $id ) {
654 638 global $wpdb;
655 639
@@ -671,11 +655,8 @@
671 655
672 656 $query_results = $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_forms WHERE id=%d OR parent_form_id=%d', $id, $id ) );
673 657 if ( $query_results ) {
674 658 // Delete all form actions linked to this form
675 - /**
676 - * @var FrmFormAction
677 - */
678 659 $action_control = FrmFormActionsController::get_form_actions( 'email' );
679 660 $action_control->destroy( $id, 'all' );
680 661
681 662 // Clear form caching
@@ -695,9 +676,9 @@
695 676 */
696 677 public static function scheduled_delete( $delete_timestamp = '' ) {
697 678 global $wpdb;
698 679
699 - $trash_forms = FrmDb::get_results( $wpdb->prefix . 'frm_forms', array( 'status' => 'trash' ), 'id, parent_form_id, options' );
680 + $trash_forms = FrmDb::get_results( $wpdb->prefix . 'frm_forms', array( 'status' => 'trash' ), 'id, options' );
700 681
701 682 if ( ! $trash_forms ) {
702 683 return 0;
703 684 }
@@ -710,11 +691,9 @@
710 691 foreach ( $trash_forms as $form ) {
711 692 FrmAppHelper::unserialize_or_decode( $form->options );
712 693 if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) {
713 694 self::destroy( $form->id );
714 - if ( empty( $form->parent_form_id ) ) {
715 - ++$count;
716 - }
695 + $count ++;
717 696 }
718 697
719 698 unset( $form );
720 699 }
@@ -774,10 +753,11 @@
774 753
775 754 /**
776 755 * If $form is numeric, get the form object
777 756 *
757 + * @param object|int $form
758 + *
778 759 * @since 2.0.9
779 - * @param int|object $form
780 760 */
781 761 public static function maybe_get_form( &$form ) {
782 762 if ( ! is_object( $form ) && ! is_array( $form ) && ! empty( $form ) ) {
783 763 $form = self::getOne( $form );
@@ -784,11 +764,9 @@
784 764 }
785 765 }
786 766
787 767 /**
788 - * @param int|string $id
789 - * @param false|int $blog_id
790 - * @return stdClass|null
768 + * @return object form
791 769 */
792 770 public static function getOne( $id, $blog_id = false ) {
793 771 global $wpdb;
794 772
@@ -803,9 +781,10 @@
803 781 if ( $cache ) {
804 782 if ( isset( $cache->options ) ) {
805 783 FrmAppHelper::unserialize_or_decode( $cache->options );
806 784 }
807 - return self::prepare_form_row_data( $cache );
785 +
786 + return apply_filters( 'frm_form_object', wp_unslash( $cache ) );
808 787 }
809 788 }
810 789
811 790 if ( is_numeric( $id ) ) {
@@ -820,43 +799,17 @@
820 799 FrmDb::set_cache( $results->id, $results, 'frm_form' );
821 800 FrmAppHelper::unserialize_or_decode( $results->options );
822 801 }
823 802
824 - return self::prepare_form_row_data( $results );
803 + return apply_filters( 'frm_form_object', wp_unslash( $results ) );
825 804 }
826 805
827 806 /**
828 - * Make sure that if $row is an object, that $row->options is an array and not a string.
829 - *
830 - * @since 6.8.3
831 - *
832 - * @param stdClass|null $row The database row for a target form.
833 - * @return stdClass|null
807 + * @return object|array of objects
834 808 */
835 - private static function prepare_form_row_data( $row ) {
836 - $row = wp_unslash( $row );
837 - if ( ! is_object( $row ) ) {
838 - return $row;
839 - }
840 -
841 - if ( ! is_array( $row->options ) ) {
842 - $row->options = FrmFormsHelper::get_default_opts();
843 - }
844 -
845 - /**
846 - * @since 4.03.02
847 - *
848 - * @param stdClass $row
849 - */
850 - return apply_filters( 'frm_form_object', $row );
851 - }
852 -
853 - /**
854 - * @return array|object of objects
855 - */
856 809 public static function getAll( $where = array(), $order_by = '', $limit = '' ) {
857 810 if ( is_array( $where ) && ! empty( $where ) ) {
858 - if ( ! empty( $where['is_template'] ) && ! isset( $where['status'] ) && ! isset( $where['status !'] ) ) {
811 + if ( isset( $where['is_template'] ) && $where['is_template'] && ! isset( $where['status'] ) && ! isset( $where['status !'] ) ) {
859 812 // don't get trashed templates
860 813 $where['status'] = array( null, '', 'published' );
861 814 }
862 815
@@ -863,9 +816,9 @@
863 816 $results = FrmDb::get_results( 'frm_forms', $where, '*', compact( 'order_by', 'limit' ) );
864 817 } else {
865 818 global $wpdb;
866 819
867 - // The query has already been prepared if this is not an array.
820 + // the query has already been prepared if this is not an array
868 821 $query = 'SELECT * FROM ' . $wpdb->prefix . 'frm_forms' . FrmDb::prepend_and_or_where( ' WHERE ', $where ) . FrmDb::esc_order( $order_by ) . FrmDb::esc_limit( $limit );
869 822 $results = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
870 823 }
871 824
@@ -875,9 +828,9 @@
875 828 FrmAppHelper::unserialize_or_decode( $result->options );
876 829 }
877 830 }
878 831
879 - if ( $limit === ' LIMIT 1' || $limit == 1 ) {
832 + if ( $limit == ' LIMIT 1' || $limit == 1 ) {
880 833 // return the first form object if we are only getting one form
881 834 $results = reset( $results );
882 835 }
883 836
@@ -896,9 +849,9 @@
896 849 */
897 850 public static function get_published_forms( $query = array(), $limit = 999, $inc_children = 'exclude' ) {
898 851 $query['is_template'] = 0;
899 852 $query['status'] = array( null, '', 'published' );
900 - if ( $inc_children === 'exclude' ) {
853 + if ( $inc_children == 'exclude' ) {
901 854 $query['parent_form_id'] = array( null, 0 );
902 855 }
903 856
904 857 $forms = self::getAll( $query, 'name', $limit );
@@ -934,18 +887,18 @@
934 887
935 888 foreach ( $results as $row ) {
936 889 if ( 'trash' != $row->status ) {
937 890 if ( $row->is_template ) {
938 - ++$counts['template'];
891 + $counts['template'] ++;
939 892 } else {
940 - ++$counts['published'];
893 + $counts['published'] ++;
941 894 }
942 895 } else {
943 - ++$counts['trash'];
896 + $counts['trash'] ++;
944 897 }
945 898
946 899 if ( 'draft' == $row->status ) {
947 - ++$counts['draft'];
900 + $counts['draft'] ++;
948 901 }
949 902
950 903 unset( $row );
951 904 }
@@ -1011,11 +964,11 @@
1011 964 $values['posted_form_id'] = FrmAppHelper::get_param( 'form', '', 'get', 'absint' );
1012 965 }
1013 966
1014 967 if ( $form->id == $values['posted_form_id'] ) {
1015 - // If there are two forms on the same page, make sure not to submit both.
968 + //if there are two forms on the same page, make sure not to submit both
1016 969 foreach ( $default_values as $var => $default ) {
1017 - if ( $var === 'action' ) {
970 + if ( $var == 'action' ) {
1018 971 $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' );
1019 972 } else {
1020 973 $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' );
1021 974 }
@@ -1083,9 +1036,9 @@
1083 1036 return $values;
1084 1037 }
1085 1038
1086 1039 public static function get_current_form_id( $default_form = 'none' ) {
1087 - if ( 'first' === $default_form ) {
1040 + if ( 'first' == $default_form ) {
1088 1041 $form = self::get_current_form();
1089 1042 } else {
1090 1043 $form = self::maybe_get_current_form();
1091 1044 }
@@ -1096,9 +1049,9 @@
1096 1049
1097 1050 public static function maybe_get_current_form( $form_id = 0 ) {
1098 1051 global $frm_vars;
1099 1052
1100 - if ( ! empty( $frm_vars['current_form'] ) && ( ! $form_id || $form_id == $frm_vars['current_form']->id ) ) {
1053 + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && ( ! $form_id || $form_id == $frm_vars['current_form']->id ) ) {
1101 1054 return $frm_vars['current_form'];
1102 1055 }
1103 1056
1104 1057 $form_id = FrmAppHelper::get_param( 'form', $form_id, 'get', 'absint' );
@@ -1145,9 +1098,9 @@
1145 1098 $global_load = true;
1146 1099 $frm_vars['load_css'] = true;
1147 1100 }
1148 1101
1149 - return empty( $frm_vars['css_loaded'] ) && $global_load;
1102 + return ( ( ! isset( $frm_vars['css_loaded'] ) || ! $frm_vars['css_loaded'] ) && $global_load );
1150 1103 }
1151 1104
1152 1105 /**
1153 1106 * @since 4.06.03
@@ -1162,21 +1115,13 @@
1162 1115 } else {
1163 1116 $visible = true;
1164 1117 }
1165 1118
1166 - /**
1167 - * @since 6.25
1168 - *
1169 - * @param bool $visible
1170 - * @param object $form
1171 - */
1172 - $visible = (bool) apply_filters( 'frm_form_is_visible', $visible, $form );
1173 -
1174 1119 return $visible;
1175 1120 }
1176 1121
1177 1122 public static function show_submit( $form ) {
1178 - $show = ( ! $form->is_template && $form->status === 'published' && ! FrmAppHelper::is_admin() );
1123 + $show = ( ! $form->is_template && $form->status == 'published' && ! FrmAppHelper::is_admin() );
1179 1124 $show = apply_filters( 'frm_show_submit_button', $show, $form );
1180 1125
1181 1126 return $show;
1182 1127 }
@@ -1184,12 +1129,12 @@
1184 1129 /**
1185 1130 * @since 2.3
1186 1131 */
1187 1132 public static function get_option( $atts ) {
1188 - $form = $atts['form'];
1189 - $default = $atts['default'] ?? '';
1133 + $form = $atts['form'];
1134 + $default = isset( $atts['default'] ) ? $atts['default'] : '';
1190 1135
1191 - return $form->options[ $atts['option'] ] ?? $default;
1136 + return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default;
1192 1137 }
1193 1138
1194 1139 /**
1195 1140 * Get the link to edit this form.
@@ -1213,50 +1158,8 @@
1213 1158 return ! empty( $form->options['ajax_submit'] );
1214 1159 }
1215 1160
1216 1161 /**
1217 - * Get the latest form available.
1218 - *
1219 - * @since 6.8
1220 - * @return object
1221 - */
1222 - public static function get_latest_form() {
1223 -
1224 - $args = array(
1225 - array(
1226 - 'or' => 1,
1227 - 'parent_form_id' => null,
1228 - 'parent_form_id <' => 1,
1229 - ),
1230 - 'is_template' => 0,
1231 - 'status !' => 'trash',
1232 - );
1233 -
1234 - return self::getAll( $args, 'created_at desc', 1 );
1235 - }
1236 -
1237 - /**
1238 - * Count and return total forms.
1239 - *
1240 - * @since 6.8
1241 - * @return int
1242 - */
1243 - public static function get_forms_count() {
1244 -
1245 - $args = array(
1246 - array(
1247 - 'or' => 1,
1248 - 'parent_form_id' => null,
1249 - 'parent_form_id <' => 1,
1250 - ),
1251 - 'is_template' => 0,
1252 - 'status !' => 'trash',
1253 - );
1254 -
1255 - return FrmDb::get_count( 'frm_forms', $args );
1256 - }
1257 -
1258 - /**
1259 1162 * @deprecated 2.03.05 This is still referenced in a few add ons (API, locations).
1260 1163 * @codeCoverageIgnore
1261 1164 *
1262 1165 * @param string $key
@@ -1270,9 +1173,9 @@
1270 1173 /**
1271 1174 * @deprecated 2.03.05 This is still referenced in the API add on as of v1.13.
1272 1175 * @codeCoverageIgnore
1273 1176 *
1274 - * @param int|string $id
1177 + * @param string|int $id
1275 1178 * @return string
1276 1179 */
1277 1180 public static function getKeyById( $id ) {
1278 1181 _deprecated_function( __FUNCTION__, '2.03.05', 'FrmForm::get_key_by_id' );