PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8
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/FrmEntry.php +42 -23 6.56.8 View file →
@@ -20,9 +20,9 @@
20 20
21 21 /**
22 22 * Create a new entry with some differences depending on type
23 23 *
24 - * @param array $values
24 + * @param array $values
25 25 * @param string $type
26 26 *
27 27 * @return int | boolean $entry_id
28 28 */
@@ -116,9 +116,9 @@
116 116
117 117 if ( $is_duplicate ) {
118 118 break;
119 119 }
120 - }
120 + }//end foreach
121 121
122 122 $frm_vars['checking_duplicates'] = false;
123 123
124 124 return $is_duplicate;
@@ -150,9 +150,9 @@
150 150 *
151 151 * @since 2.0.23
152 152 *
153 153 * @param array $values
154 - * @param int $duplicate_entry_time
154 + * @param int $duplicate_entry_time
155 155 *
156 156 * @return bool
157 157 */
158 158 private static function is_duplicate_check_needed( $values, $duplicate_entry_time ) {
@@ -212,9 +212,9 @@
212 212
213 213 /**
214 214 * Update an entry (not via XML)
215 215 *
216 - * @param int $id
216 + * @param int $id
217 217 * @param array $values
218 218 *
219 219 * @return boolean|int $update_results
220 220 */
@@ -228,9 +228,9 @@
228 228 * Update an entry with some differences depending on the update type
229 229 *
230 230 * @since 2.0.16
231 231 *
232 - * @param int $id
232 + * @param int $id
233 233 * @param array $values
234 234 *
235 235 * @return boolean|int $query_results
236 236 */
@@ -260,9 +260,10 @@
260 260 public static function destroy( $id ) {
261 261 global $wpdb;
262 262 $id = (int) $id;
263 263
264 - $entry = self::getOne( $id, true ); // Item meta is required for conditional logic in actions with 'delete' events.
264 + // Item meta is required for conditional logic in actions with 'delete' events.
265 + $entry = self::getOne( $id, true );
265 266 if ( ! $entry ) {
266 267 $result = false;
267 268 return $result;
268 269 }
@@ -335,9 +336,9 @@
335 336
336 337 /**
337 338 * If $entry is numeric, get the entry object
338 339 *
339 - * @param int|object $entry by reference
340 + * @param int|object $entry By reference.
340 341 *
341 342 * @since 2.0.9
342 343 */
343 344 public static function maybe_get_entry( &$entry ) {
@@ -387,9 +388,10 @@
387 388 return;
388 389 }
389 390
390 391 FrmAppHelper::unserialize_or_decode( $entry->description );
391 - $entry = wp_unslash( $entry ); // TODO: Remove slashes on input only, not output.
392 + // TODO: Remove slashes on input only, not output.
393 + $entry = wp_unslash( $entry );
392 394 }
393 395
394 396 /**
395 397 * @since 4.02.03
@@ -498,9 +500,9 @@
498 500 $entries = $wpdb->get_results( $query, OBJECT_K ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
499 501 unset( $query );
500 502
501 503 FrmDb::set_cache( $cache_key, $entries, 'frm_entry' );
502 - }
504 + }//end if
503 505
504 506 if ( ! $meta || ! $entries ) {
505 507 self::prepare_entries( $entries );
506 508 return $entries;
@@ -577,13 +579,13 @@
577 579 }
578 580
579 581 // Pagination Methods
580 582 /**
581 - * @param int|array|string If int, use the form id.
583 + * @param int|array|string $where If int, use the form id.
582 584 */
583 585 public static function getRecordCount( $where = '' ) {
584 586 global $wpdb;
585 - $table_join = $wpdb->prefix . 'frm_items it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
587 + $table_join = $wpdb->prefix . 'frm_items it JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id';
586 588
587 589 if ( is_numeric( $where ) ) {
588 590 $table_join = 'frm_items';
589 591 $where = array( 'form_id' => $where );
@@ -617,9 +619,9 @@
617 619 * Prepare the data before inserting it into the database
618 620 *
619 621 * @since 2.0.16
620 622 *
621 - * @param array $values
623 + * @param array $values
622 624 * @param string $type
623 625 *
624 626 * @return array $new_values
625 627 */
@@ -661,9 +663,9 @@
661 663 * Sanitize the POST values before we use them
662 664 *
663 665 * @since 2.0
664 666 *
665 - * @param array $values The POST values by reference
667 + * @param array $values The POST values by reference.
666 668 */
667 669 public static function sanitize_entry_post( &$values ) {
668 670 $sanitize_method = array(
669 671 'form_id' => 'absint',
@@ -883,9 +885,9 @@
883 885 *
884 886 * @since 2.0.16
885 887 *
886 888 * @param array $values
887 - * @param int $entry_id
889 + * @param int $entry_id
888 890 * @return void
889 891 */
890 892 private static function maybe_add_entry_metas( $values, $entry_id ) {
891 893 if ( isset( $values['item_meta'] ) ) {
@@ -913,9 +915,10 @@
913 915 * Trigger frm_after_create_entry hooks
914 916 *
915 917 * @since 2.0.16
916 918 *
917 - * @param int $entry_id
919 + * @param int $entry_id
920 + * @param array $values
918 921 * @param array $new_values
919 922 */
920 923 private static function after_entry_created_actions( $entry_id, $values, $new_values ) {
921 924 // this is a child entry
@@ -931,9 +934,9 @@
931 934 * @since 2.0.16
932 935 *
933 936 * @param array $values
934 937 * @param array $new_values
935 - * @param int $entry_id
938 + * @param int $entry_id
936 939 */
937 940 private static function after_insert_entry_in_database( $values, $new_values, $entry_id ) {
938 941
939 942 self::add_new_entry_to_frm_vars( $entry_id );
@@ -949,10 +952,10 @@
949 952 * Perform some actions right before updating an entry
950 953 *
951 954 * @since 2.0.16
952 955 *
953 - * @param int $id
954 - * @param array $values
956 + * @param int $id
957 + * @param array $values
955 958 * @param string $update_type
956 959 *
957 960 * @return boolean $update
958 961 */
@@ -976,9 +979,9 @@
976 979 * Package the entry data for updating
977 980 *
978 981 * @since 2.0.16
979 982 *
980 - * @param int $id
983 + * @param int $id
981 984 * @param array $values
982 985 *
983 986 * @return array $new_values
984 987 */
@@ -1019,11 +1022,11 @@
1019 1022 *
1020 1023 * @since 2.0.16
1021 1024 *
1022 1025 * @param boolean|int $query_results
1023 - * @param int $id
1024 - * @param array $values
1025 - * @param array $new_values
1026 + * @param int $id
1027 + * @param array $values
1028 + * @param array $new_values
1026 1029 */
1027 1030 private static function after_update_entry( $query_results, $id, $values, $new_values ) {
1028 1031 if ( $query_results ) {
1029 1032 self::clear_cache();
@@ -1065,9 +1068,9 @@
1065 1068 * Certain actions aren't necessary when importing (like saving sub entries and modifying other vals)
1066 1069 *
1067 1070 * @since 2.0.16
1068 1071 *
1069 - * @param int $id
1072 + * @param int $id
1070 1073 * @param array $values
1071 1074 *
1072 1075 * @return int | boolean $updated
1073 1076 */
@@ -1085,6 +1088,22 @@
1085 1088 public static function get_id_by_key( $key ) {
1086 1089 $entry_id = FrmDb::get_var( 'frm_items', array( 'item_key' => sanitize_title( $key ) ) );
1087 1090
1088 1091 return (int) $entry_id;
1092 + }
1093 +
1094 + /**
1095 + * Get entries count.
1096 + *
1097 + * @since 6.8
1098 + *
1099 + * @return int
1100 + */
1101 + public static function get_entries_count() {
1102 + $args = array(
1103 + 'or' => 1,
1104 + 'parent_form_id' => null,
1105 + 'parent_form_id <' => 1,
1106 + );
1107 + return self::getRecordCount( $args );
1089 1108 }
1090 1109 }