Inventory_Presser_Additional_Listings_Pages::is_valid_rule( array $rule )
True or false, a given additional listing page rule has settings that allow us to create the page. User might not provide the URL path, for example.
Parameters Parameters
- $rule
-
(array) (Required)
Return Return
(bool)
Source Source
File: includes/class-additional-listings-pages.php
public static function is_valid_rule( $rule ) { if ( empty( $rule ) ) { return false; } if ( empty( $rule['url_path'] ) ) { return false; } // We allow no filter at all. if ( '' === $rule['key'] ) { return true; } /** * If the operator is greater than or less than and there is no * comparison value or a comparison value that is not a number, you * might have a bad time. */ if ( ( empty( $rule['value'] ) || ! is_numeric( $rule['value'] ) ) && ( 'less_than' === $rule['operator'] || 'greater_than' === $rule['operator'] ) ) { return false; } /** * If the key points to a value that is not a number and the operator * is less than or greater than, you might have a bad time. */ if ( ! INVP::meta_value_is_number( apply_filters( 'invp_prefix_meta_key', $rule['key'] ) ) && ( 'less_than' === $rule['operator'] || 'greater_than' === $rule['operator'] ) ) { return false; } return true; }
Expand full source codeCollapse full source codeView on Github