currency_symbol)) { return ''; } return html_entity_decode((string) $options->currency_symbol, ENT_QUOTES, 'UTF-8'); } /** * Resolve SQL match mode for a field. * * @param array $field Field definition. * @return string 'exact'|'like'|'contains'|'range' */ public static function get_field_match_mode(array $field) { if (! empty($field['match']) && is_string($field['match'])) { $m = $field['match']; if (in_array($m, [ 'exact', 'like', 'contains', 'range' ], true)) { return $m; } } $type = isset($field['type']) ? (string) $field['type'] : 'text'; if ('date_range' === $type) { return 'range'; } if ('country' === $type || 'select' === $type || 'date' === $type) { return 'exact'; } return 'like'; } /** * Supported comparison operators, keyed by GET value. * * The empty default keeps pre-2.1 URLs and saved presets behaving exactly as before: * with no operator present the field falls back to {@see get_field_match_mode()}. * * @return array */ public static function get_operators() { return [ 'is', 'is_not', 'contains', 'not_contains', 'is_empty', 'is_not_empty', 'is_one_of', 'after', 'before', 'between', 'in_last', 'not_in_last', 'at_least', 'at_most', ]; } /** * Operators offered for one field, by field type. * * Single source of truth for the operator `