Names: no_description, no_image, no_gallery, no_price, no_sku, no_buy_url, placeholder. */ public static function problems( array $product ): array { $found = array(); if ( '' === trim( wp_strip_all_tags( $product['content'] ) ) && '' === trim( wp_strip_all_tags( $product['excerpt'] ) ) ) { $found[] = 'no_description'; } if ( $product['image'] <= 0 ) { $found[] = 'no_image'; } elseif ( isset( $product['gallery'] ) && $product['gallery'] <= 0 ) { // Only with a main image, so a product without any image is reported once. $found[] = 'no_gallery'; } if ( '' === trim( $product['price'] ) && ! $product['variable'] ) { $found[] = 'no_price'; } if ( '' === trim( $product['sku'] ) && ! $product['variable'] ) { $found[] = 'no_sku'; } if ( ! empty( $product['external'] ) && '' === trim( $product['url'] ?? '' ) ) { $found[] = 'no_buy_url'; } if ( array() !== ContentRules::placeholders( $product['title'] . ' ' . $product['content'] . ' ' . $product['excerpt'] ) ) { $found[] = 'placeholder'; } return $found; } }