PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
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/FrmDb.php +56 -155 6.276.13 View file →
@@ -3,35 +3,11 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 class FrmDb {
7 -
8 - /**
9 - * The table name for Formidable Fields.
10 - *
11 - * @var string
12 - */
13 7 public $fields;
14 -
15 - /**
16 - * The table name for Formidable Forms.
17 - *
18 - * @var string
19 - */
20 8 public $forms;
21 -
22 - /**
23 - * The table name for Formidable Entries.
24 - *
25 - * @var string
26 - */
27 9 public $entries;
28 -
29 - /**
30 - * The table name for Formidable Entry Metas.
31 - *
32 - * @var string
33 - */
34 10 public $entry_metas;
35 11
36 12 public function __construct() {
37 13 if ( ! defined( 'ABSPATH' ) ) {
@@ -50,13 +26,12 @@
50 26 * Change array into format $wpdb->prepare can use
51 27 *
52 28 * @param array $args
53 29 * @param string $starts_with
54 - *
55 30 * @return void
56 31 */
57 32 public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) {
58 - if ( ! $args ) {
33 + if ( empty( $args ) ) {
59 34 // add an arg to prevent prepare from failing
60 35 $args = array(
61 36 'where' => $starts_with . '1=%d',
62 37 'values' => array( 1 ),
@@ -80,14 +55,11 @@
80 55 * @param array $args
81 56 * @param string $base_where
82 57 * @param string $where
83 58 * @param array $values
84 - *
85 - * @return void
86 59 */
87 60 public static function parse_where_from_array( $args, $base_where, &$where, &$values ) {
88 61 $condition = ' AND';
89 -
90 62 if ( isset( $args['or'] ) ) {
91 63 $condition = ' OR';
92 64 unset( $args['or'] );
93 65 }
@@ -92,16 +64,13 @@
92 64 unset( $args['or'] );
93 65 }
94 66
95 67 foreach ( $args as $key => $value ) {
96 - $where .= empty( $where ) ? $base_where : $condition;
97 - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
98 - $array_inc_null = ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value );
99 -
68 + $where .= empty( $where ) ? $base_where : $condition;
69 + $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) );
100 70 if ( is_numeric( $key ) || $array_inc_null ) {
101 71 $where .= ' ( ';
102 72 $nested_where = '';
103 -
104 73 if ( $array_inc_null ) {
105 74 foreach ( $value as $val ) {
106 75 $parse_where = array(
107 76 $key => $val,
@@ -111,14 +80,13 @@
111 80 }
112 81 } else {
113 82 self::parse_where_from_array( $value, '', $nested_where, $values );
114 83 }
115 -
116 84 $where .= $nested_where;
117 85 $where .= ' ) ';
118 86 } else {
119 87 self::interpret_array_to_sql( $key, $value, $where, $values );
120 - }//end if
88 + }
121 89 }//end foreach
122 90 }
123 91
124 92 /**
@@ -125,15 +93,14 @@
125 93 * @param string $key
126 94 * @param array|string $value
127 95 * @param string $where
128 96 * @param array $values
129 - *
130 97 * @return void
131 98 */
132 99 private static function interpret_array_to_sql( $key, $value, &$where, &$values ) {
133 100 $key = trim( $key );
134 101
135 - if ( str_contains( $key, 'created_at' ) || str_contains( $key, 'updated_at' ) ) {
102 + if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) {
136 103 $k = explode( ' ', $key );
137 104 $where .= ' CAST(' . reset( $k ) . ' as CHAR) ' . str_replace( reset( $k ), '', $key );
138 105 } else {
139 106 $where .= ' ' . $key;
@@ -143,29 +110,26 @@
143 110 $lowercase_key = end( $lowercase_key );
144 111
145 112 if ( is_array( $value ) ) {
146 113 // translate array of values to "in"
147 - if ( str_contains( $lowercase_key, 'like' ) ) {
114 + if ( strpos( $lowercase_key, 'like' ) !== false ) {
148 115 $where = preg_replace( '/' . $key . '$/', '', $where );
149 116 $where .= '(';
150 117 $start = true;
151 -
152 118 foreach ( $value as $v ) {
153 119 if ( ! $start ) {
154 120 $where .= ' OR ';
155 121 }
156 -
157 122 $start = false;
158 123 $where .= $key . ' %s';
159 124 $values[] = '%' . self::esc_like( $v ) . '%';
160 125 }
161 -
162 126 $where .= ')';
163 - } elseif ( $value ) {
127 + } elseif ( ! empty( $value ) ) {
164 128 $where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')';
165 129 $values = array_merge( $values, $value );
166 130 }
167 - } elseif ( str_contains( $lowercase_key, 'like' ) ) {
131 + } elseif ( strpos( $lowercase_key, 'like' ) !== false ) {
168 132 /**
169 133 * Allow string to start or end with the value
170 134 * If the key is like% then skip the first % for starts with
171 135 * If the key is %like then skip the last % for ends with
@@ -171,13 +135,12 @@
171 135 * If the key is %like then skip the last % for ends with
172 136 */
173 137 $start = '%';
174 138 $end = '%';
175 -
176 139 if ( $lowercase_key === 'like%' ) {
177 140 $start = '';
178 141 $where = rtrim( $where, '%' );
179 - } elseif ( $lowercase_key === '%like' ) {
142 + } elseif ( $lowercase_key == '%like' ) {
180 143 $end = '';
181 144 $where = rtrim( rtrim( $where, '%like' ), '%LIKE' );
182 145 $where .= 'like';
183 146 }
@@ -188,9 +151,9 @@
188 151 } elseif ( $value === null ) {
189 152 $where .= ' IS NULL';
190 153 } else {
191 154 // allow a - to prevent = from being added
192 - if ( str_ends_with( $key, '-' ) ) {
155 + if ( substr( $key, - 1 ) === '-' ) {
193 156 $where = rtrim( $where, '-' );
194 157 } else {
195 158 $where .= '=';
196 159 }
@@ -208,13 +171,11 @@
208 171 *
209 172 * @param string $key
210 173 * @param int|string $value
211 174 * @param string $where
212 - *
213 - * @return void
214 175 */
215 176 private static function add_query_placeholder( $key, $value, &$where ) {
216 - if ( is_numeric( $value ) && ( ! str_contains( $key, 'meta_value' ) || str_contains( $key, '+0' ) ) ) {
177 + if ( is_numeric( $value ) && ( strpos( $key, 'meta_value' ) === false || strpos( $key, '+0' ) !== false ) ) {
217 178 // Switch string to number.
218 179 $value = $value + 0;
219 180 $where .= is_float( $value ) ? '%f' : '%d';
220 181 } else {
@@ -230,8 +191,9 @@
230 191 * @return int
231 192 */
232 193 public static function get_count( $table, $where = array(), $args = array() ) {
233 194 $count = self::get_var( $table, $where, 'COUNT(*)', $args );
195 +
234 196 return (int) $count;
235 197 }
236 198
237 199 /**
@@ -247,17 +209,18 @@
247 209 public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) {
248 210 $group = '';
249 211 self::get_group_and_table_name( $table, $group );
250 212 self::convert_options_to_array( $args, '', $limit );
251 -
252 213 if ( $type === 'var' && ! isset( $args['limit'] ) ) {
253 214 $args['limit'] = 1;
254 215 }
255 216
256 - $query = self::generate_query_string_from_pieces( $field, $table, $where, $args );
217 + $query = self::generate_query_string_from_pieces( $field, $table, $where, $args );
218 +
257 219 $cache_key = self::generate_cache_key( $where, $args, $field, $type );
220 + $results = self::check_cache( $cache_key, $group, $query, 'get_' . $type );
258 221
259 - return self::check_cache( $cache_key, $group, $query, 'get_' . $type );
222 + return $results;
260 223 }
261 224
262 225 /**
263 226 * Generate a cache key from the where query, field, type, and other arguments
@@ -273,16 +236,15 @@
273 236 */
274 237 public static function generate_cache_key( $where, $args, $field, $type ) {
275 238 $cache_key = '';
276 239 $where = FrmAppHelper::array_flatten( $where );
277 -
278 240 foreach ( $where as $key => $value ) {
279 241 $cache_key .= $key . '_' . $value;
280 242 }
281 -
282 243 $cache_key .= implode( '_', $args ) . $field . '_' . $type;
244 + $cache_key = str_replace( array( ' ', ',' ), '_', $cache_key );
283 245
284 - return str_replace( array( ' ', ',' ), '_', $cache_key );
246 + return $cache_key;
285 247 }
286 248
287 249 /**
288 250 * @param string $table
@@ -290,9 +252,9 @@
290 252 * @param string $field
291 253 * @param array $args
292 254 * @param string $limit
293 255 *
294 - * @return array
256 + * @return mixed
295 257 */
296 258 public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) {
297 259 return self::get_var( $table, $where, $field, $args, $limit, 'col' );
298 260 }
@@ -308,8 +270,9 @@
308 270 * @return mixed
309 271 */
310 272 public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) {
311 273 $args['limit'] = 1;
274 +
312 275 return self::get_var( $table, $where, $fields, $args, '', 'row' );
313 276 }
314 277
315 278 /**
@@ -321,9 +284,9 @@
321 284 * @param array $where
322 285 * @param string $fields
323 286 * @param array $args
324 287 *
325 - * @return array
288 + * @return mixed
326 289 */
327 290 public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) {
328 291 return self::get_var( $table, $where, $fields, $args, '', 'results' );
329 292 }
@@ -350,9 +313,8 @@
350 313 '%like' => '%like',
351 314 );
352 315
353 316 $where_is = strtolower( $where_is );
354 -
355 317 if ( isset( $switch_to[ $where_is ] ) ) {
356 318 return ' ' . $switch_to[ $where_is ];
357 319 }
358 320
@@ -371,22 +333,20 @@
371 333 * Also add the wpdb->prefix to the table if it's missing
372 334 *
373 335 * @param string $table
374 336 * @param string $group
375 - *
376 - * @return void
377 337 */
378 338 private static function get_group_and_table_name( &$table, &$group ) {
379 - global $wpdb;
339 + global $wpdb, $wpmuBaseTablePrefix;
380 340
381 341 $table_parts = explode( ' ', $table );
382 342 $group = reset( $table_parts );
383 343 self::maybe_remove_prefix( $wpdb->prefix, $group );
384 344
385 - $prefix = $wpdb->base_prefix;
345 + $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix;
386 346 self::maybe_remove_prefix( $prefix, $group );
387 347
388 - if ( $group === $table ) {
348 + if ( $group == $table ) {
389 349 $table = $wpdb->prefix . $table;
390 350 }
391 351
392 352 // switch to singular group name
@@ -396,44 +356,30 @@
396 356 /**
397 357 * Only remove the db prefix when at the beginning.
398 358 *
399 359 * @since 4.04.02
400 - *
401 - * @param string $prefix Prefix to remove.
402 - * @param string $name Name to strip prefix from, passed by reference.
403 - *
404 - * @return void
405 360 */
406 361 private static function maybe_remove_prefix( $prefix, &$name ) {
407 - if ( str_starts_with( $name, $prefix ) ) {
362 + if ( substr( $name, 0, strlen( $prefix ) ) === $prefix ) {
408 363 $name = substr( $name, strlen( $prefix ) );
409 364 }
410 365 }
411 366
412 - /**
413 - * @param array|string $args
414 - * @param string $order_by
415 - * @param int|string $limit
416 - *
417 - * @return void
418 - */
419 367 private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) {
420 368 if ( ! is_array( $args ) ) {
421 369 $args = array( 'order_by' => $args );
422 370 }
423 371
424 - if ( $order_by ) {
372 + if ( ! empty( $order_by ) ) {
425 373 $args['order_by'] = $order_by;
426 374 }
427 375
428 - if ( $limit ) {
376 + if ( ! empty( $limit ) ) {
429 377 $args['limit'] = $limit;
430 378 }
431 379
432 380 $temp_args = $args;
433 -
434 381 foreach ( $temp_args as $k => $v ) {
435 - // phpcs:ignore Universal.Operators.StrictComparisons
436 382 if ( $v == '' ) {
437 383 unset( $args[ $k ] );
438 384 continue;
439 385 }
@@ -438,10 +384,9 @@
438 384 continue;
439 385 }
440 386
441 387 $db_name = strtoupper( str_replace( '_', ' ', $k ) );
442 -
443 - if ( ! str_contains( $v, $db_name ) ) {
388 + if ( strpos( $v, $db_name ) === false ) {
444 389 $args[ $k ] = $db_name . ' ' . $v;
445 390 }
446 391 }
447 392
@@ -467,12 +412,14 @@
467 412 public static function get_associative_array_results( $columns, $table, $where ) {
468 413 $group = '';
469 414 self::get_group_and_table_name( $table, $group );
470 415
471 - $query = self::generate_query_string_from_pieces( $columns, $table, $where );
416 + $query = self::generate_query_string_from_pieces( $columns, $table, $where );
417 +
472 418 $cache_key = str_replace( array( ' ', ',' ), '_', trim( implode( '_', FrmAppHelper::array_flatten( $where ) ) . $columns . '_results_ARRAY_A', ' WHERE' ) );
419 + $results = self::check_cache( $cache_key, $group, $query, 'get_associative_results' );
473 420
474 - return self::check_cache( $cache_key, $group, $query, 'get_associative_results' );
421 + return $results;
475 422 }
476 423
477 424 /**
478 425 * Combine the pieces of a query to form a full, prepared query
@@ -494,8 +441,15 @@
494 441 if ( is_array( $where ) || empty( $where ) ) {
495 442 self::get_where_clause_and_values( $where );
496 443 global $wpdb;
497 444 $query = $wpdb->prepare( $query . $where['where'] . ' ' . implode( ' ', $args ), $where['values'] ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
445 + } else {
446 + /**
447 + * Allow the $where to be prepared before we receive it here.
448 + * This is a fallback for reverse compatibility, but is not recommended
449 + */
450 + _deprecated_argument( 'where', '2.0', esc_html__( 'Use the query in an array format so it can be properly prepared.', 'formidable' ) );
451 + $query .= $where . ' ' . implode( ' ', $args );
498 452 }
499 453
500 454 return $query;
501 455 }
@@ -501,12 +455,8 @@
501 455 }
502 456
503 457 /**
504 458 * @since 2.05.07
505 - *
506 - * @param array $args Query arguments, passed by reference.
507 - *
508 - * @return void
509 459 */
510 460 private static function esc_query_args( &$args ) {
511 461 foreach ( $args as $param => $value ) {
512 462 if ( $param === 'order_by' ) {
@@ -514,9 +464,8 @@
514 464 } elseif ( $param === 'limit' ) {
515 465 $args[ $param ] = self::esc_limit( $value );
516 466 }
517 467
518 - // phpcs:ignore Universal.Operators.StrictComparisons
519 468 if ( $args[ $param ] == '' ) {
520 469 unset( $args[ $param ] );
521 470 }
522 471 }
@@ -532,8 +481,9 @@
532 481 * @return string The escaped value
533 482 */
534 483 public static function esc_like( $term ) {
535 484 global $wpdb;
485 +
536 486 return $wpdb->esc_like( $term );
537 487 }
538 488
539 489 /**
@@ -539,33 +489,29 @@
539 489 /**
540 490 * @since 2.05.06
541 491 *
542 492 * @param string $order_query
543 - *
544 - * @return string
545 493 */
546 494 public static function esc_order( $order_query ) {
547 - if ( ! $order_query ) {
495 + if ( empty( $order_query ) ) {
548 496 return '';
549 497 }
550 498
551 499 // Remove ORDER BY before sanitizing.
552 500 $order_query = strtolower( $order_query );
553 -
554 - if ( str_contains( $order_query, 'order by' ) ) {
501 + if ( strpos( $order_query, 'order by' ) !== false ) {
555 502 $order_query = str_replace( 'order by', '', $order_query );
556 503 }
557 504
558 505 $order_query = explode( ' ', trim( $order_query ) );
559 - $order = trim( reset( $order_query ) );
560 - $safe_order = array( 'count(*)' );
561 506
562 - if ( ! in_array( strtolower( $order ), $safe_order, true ) ) {
507 + $order = trim( reset( $order_query ) );
508 + $safe_order = array( 'count(*)' );
509 + if ( ! in_array( strtolower( $order ), $safe_order ) ) {
563 510 $order = preg_replace( '/[^a-zA-Z0-9\-\_\.\+]/', '', $order );
564 511 }
565 512
566 513 $order_by = '';
567 -
568 514 if ( count( $order_query ) > 1 ) {
569 515 $order_by = end( $order_query );
570 516 self::esc_order_by( $order_by );
571 517 }
@@ -576,16 +522,11 @@
576 522 /**
577 523 * Make sure this is ordering by either ASC or DESC
578 524 *
579 525 * @since 2.05.06
580 - *
581 - * @param string $order_by Sort direction, passed by reference.
582 - *
583 - * @return void
584 526 */
585 527 public static function esc_order_by( &$order_by ) {
586 528 $sort_options = array( 'asc', 'desc' );
587 -
588 529 if ( ! in_array( strtolower( $order_by ), $sort_options, true ) ) {
589 530 $order_by = 'asc';
590 531 }
591 532 }
@@ -591,26 +532,21 @@
591 532 }
592 533
593 534 /**
594 535 * @since 2.05.06
595 - *
596 536 * @param string $limit
597 - *
598 - * @return string
599 537 */
600 538 public static function esc_limit( $limit ) {
601 - if ( ! $limit ) {
539 + if ( empty( $limit ) ) {
602 540 return '';
603 541 }
604 542
605 543 $limit = trim( str_replace( 'limit ', '', strtolower( $limit ) ) );
606 -
607 544 if ( is_numeric( $limit ) ) {
608 545 return ' LIMIT ' . $limit;
609 546 }
610 547
611 548 $limit = explode( ',', trim( $limit ) );
612 -
613 549 foreach ( $limit as $k => $l ) {
614 550 if ( is_numeric( $l ) ) {
615 551 $limit[ $k ] = $l;
616 552 }
@@ -624,16 +560,12 @@
624 560 /**
625 561 * Get an array of values ready to go through $wpdb->prepare
626 562 *
627 563 * @since 2.05.06
628 - *
629 - * @param array $array Array of values.
630 - * @param string $type Placeholder type.
631 - *
632 - * @return string
633 564 */
634 565 public static function prepare_array_values( $array, $type = '%s' ) {
635 566 $placeholders = array_fill( 0, count( $array ), $type );
567 +
636 568 return implode( ', ', $placeholders );
637 569 }
638 570
639 571 /**
@@ -640,13 +572,12 @@
640 572 * @since 2.05.06
641 573 *
642 574 * @param string $starts_with
643 575 * @param array|string $where
644 - *
645 576 * @return string
646 577 */
647 578 public static function prepend_and_or_where( $starts_with = ' WHERE ', $where = '' ) {
648 - if ( ! $where ) {
579 + if ( empty( $where ) ) {
649 580 $where = '';
650 581 } elseif ( is_array( $where ) ) {
651 582 global $wpdb;
652 583 self::get_where_clause_and_values( $where, $starts_with );
@@ -669,12 +600,10 @@
669 600 /**
670 601 * Prepare and save settings in styles and actions
671 602 *
672 603 * @since 2.05.06
673 - *
674 - * @param array|object $settings
675 - * @param string $group
676 - *
604 + * @param array $settings
605 + * @param string $group
677 606 * @return int|WP_Error
678 607 */
679 608 public static function save_settings( $settings, $group ) {
680 609 $settings = (array) $settings;
@@ -699,14 +628,12 @@
699 628 *
700 629 * @since 2.05.06
701 630 *
702 631 * @param array $settings
703 - *
704 632 * @return int|WP_Error
705 633 */
706 634 public static function save_json_post( $settings ) {
707 635 global $wp_filter;
708 -
709 636 if ( isset( $wp_filter['content_save_pre'] ) ) {
710 637 $filters = $wp_filter['content_save_pre'];
711 638 }
712 639
@@ -731,23 +658,20 @@
731 658 * @param string $cache_key The unique name for this cache.
732 659 * @param string $group The name of the cache group.
733 660 * @param string $query If blank, don't run a db call.
734 661 * @param string $type The wpdb function to use with this query.
735 - * @param int $time Cache expiration time in seconds.
736 662 *
737 663 * @return mixed $results The cache or query results
738 664 */
739 665 public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) {
740 - $found = null;
741 - $results = wp_cache_get( $cache_key, $group, false, $found );
742 -
743 - if ( ( $found === true && $results !== false ) || empty( $query ) ) {
666 + $results = wp_cache_get( $cache_key, $group );
667 + if ( ! FrmAppHelper::is_empty_value( $results, false ) || empty( $query ) ) {
744 668 return $results;
745 669 }
746 670
747 - if ( 'get_posts' === $type ) {
671 + if ( 'get_posts' == $type ) {
748 672 $results = get_posts( $query );
749 - } elseif ( 'get_associative_results' === $type ) {
673 + } elseif ( 'get_associative_results' == $type ) {
750 674 global $wpdb;
751 675 $results = $wpdb->get_results( $query, OBJECT_K ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
752 676 } else {
753 677 global $wpdb;
@@ -760,15 +684,8 @@
760 684 }
761 685
762 686 /**
763 687 * @since 2.05.06
764 - *
765 - * @param string $cache_key The unique name for this cache.
766 - * @param mixed $results Cached results.
767 - * @param string $group The name of the cache group.
768 - * @param int $time Cache expiration time in seconds.
769 - *
770 - * @return void
771 688 */
772 689 public static function set_cache( $cache_key, $results, $group = '', $time = 300 ) {
773 690 if ( ! FrmAppHelper::prevent_caching() ) {
774 691 self::add_key_to_group_cache( $cache_key, $group );
@@ -780,13 +697,8 @@
780 697 * Keep track of the keys cached in each group so they can be deleted
781 698 * in Redis and Memcache
782 699 *
783 700 * @since 2.05.06
784 - *
785 - * @param string $key Cache key.
786 - * @param string $group Cache group name.
787 - *
788 - * @return void
789 701 */
790 702 public static function add_key_to_group_cache( $key, $group ) {
791 703 $cached = self::get_group_cached_keys( $group );
792 704 $cached[ $key ] = $key;
@@ -794,16 +706,11 @@
794 706 }
795 707
796 708 /**
797 709 * @since 2.05.06
798 - *
799 - * @param string $group Cache group name.
800 - *
801 - * @return array
802 710 */
803 711 public static function get_group_cached_keys( $group ) {
804 712 $cached = wp_cache_get( 'cached_keys', $group );
805 -
806 713 if ( ! $cached || ! is_array( $cached ) ) {
807 714 $cached = array();
808 715 }
809 716
@@ -812,12 +719,9 @@
812 719
813 720 /**
814 721 * @since 2.05.06
815 722 *
816 - * @param string $cache_key Cache key to delete.
817 - * @param string $group Cache group name.
818 - *
819 - * @return void
723 + * @param string $cache_key
820 724 */
821 725 public static function delete_cache_and_transient( $cache_key, $group = 'default' ) {
822 726 delete_transient( $cache_key );
823 727 wp_cache_delete( $cache_key, $group );
@@ -828,15 +732,13 @@
828 732 *
829 733 * @since 2.05.06
830 734 *
831 735 * @param string $group The name of the cache group.
832 - *
833 - * @return void
834 736 */
835 737 public static function cache_delete_group( $group ) {
836 738 $cached_keys = self::get_group_cached_keys( $group );
837 739
838 - if ( $cached_keys ) {
740 + if ( ! empty( $cached_keys ) ) {
839 741 foreach ( $cached_keys as $key ) {
840 742 wp_cache_delete( $key, $group );
841 743 }
842 744
@@ -850,9 +752,8 @@
850 752 * @since 6.7
851 753 *
852 754 * @param string $table Table name without `$wpdb->prefix`.
853 755 * @param string $column Column name.
854 - *
855 756 * @return bool
856 757 */
857 758 public static function db_column_exists( $table, $column ) {
858 759 global $wpdb;