Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $units = array( 'hour', 'minute', 'second' );
- foreach ( $units as $key = $unit ) {
- $other_units = $units;
- unset( $other_units[$key] );
- $other_units = array_values( $other_units );
- if ( isset ( $$unit ) && ! isset( $other_units[0] ) && ! isset( $other_units[1] ) )
- return $wpdb->prepare( strtoupper( $unit ) . "( $column ) $compare %d", $$unit );
- }
- if ( isset( $hour ) && ! isset( $minute ) && ! isset( $second ) {
- return $wpdb->prepare( "HOUR( $column ) $compare %d", $hour );
- } elseif ( ! isset( $hour ) && isset( $minute ) && ! isset( $second ) {
- return $wpdb->prepare( "MINUTE( $column ) $compare %d", $minute );
- } elseif ( ! isset( $hour ) && ! isset( $minute ) && isset( $second ) {
- return $wpdb->prepare( "SECOND( $column ) $compare %d", $second );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement