Tribe__Repository::prepare_interval( string|array $values, string $format = '%s', string $operator = 'IN' )
Builds and escapes an interval of strings.
Contents
The return string includes opening and closing braces.
Parameters
- $values
-
(string|array) (Required) One or more values to use to build the interval .
- $format
-
(string) (Optional) The format that should be used to escape the values; default to '%s'.
Default value: '%s'
- $operator
-
(string) (Optional) The operator the interval is being prepared for; defaults to
IN.Default value: 'IN'
Return
(string)
Source
File: src/Tribe/Repository.php
public function prepare_interval( $values, $format = '%s' ) {
/** @var wpdb $wpdb */
global $wpdb;
$values = Tribe__Utils__Array::list_to_array( $values );
$prepared = array();
foreach ( $values as $value ) {
$prepared[] = $this->prepare_value( $value, $format );
}
return sprintf( '(' . $format . ')', implode( ',', $prepared ) );
}
Changelog
| Version | Description |
|---|---|
| 4.7.19 | Introduced. |