Skip to content

Commit

Permalink
Fix whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Oct 11, 2023
1 parent f4efe0c commit b6b753f
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions classes/class-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,22 @@ public function query( $args ) {
*/
$where = apply_filters( 'wp_stream_db_query_where', $where );

/**
* Build the query but just to get the IDs
*/
$query = "SELECT ID
FROM $wpdb->stream
WHERE 1=1 {$where}
{$orderby}
{$limits}";
$ids = $wpdb->get_col( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

if ( $ids ) {
$where .= $wpdb->prepare( " AND $wpdb->stream.ID IN (%d" . str_repeat( ', %d', count( $ids ) - 1 ) . ')', $ids );
} else {
$where .= ' AND 0 = 1';
}
/**
* Build the query but just to get the IDs
*/
$query = "SELECT ID
FROM $wpdb->stream
WHERE 1=1 {$where}
{$orderby}
{$limits}";

$ids = $wpdb->get_col( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

if ( $ids ) {
$where .= $wpdb->prepare( " AND $wpdb->stream.ID IN (%d" . str_repeat( ', %d', count( $ids ) - 1 ) . ')', $ids );
} else {
$where .= ' AND 0 = 1';
}

/**
* BUILD THE FINAL QUERY
Expand Down Expand Up @@ -288,20 +288,20 @@ public function query( $args ) {

$items = array();
foreach ( $wpdb->get_results( $query ) as $item ) { // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
if ( ! isset( $items[ $item->ID ] ) ) {
$items[ $item->ID ] = clone $item;
$items[ $item->ID ]->meta = array();
unset( $items[ $item->ID ]->meta_key );
unset( $items[ $item->ID ]->meta_value );
}
if ( isset( $items[ $item->ID ]->meta[ $item->meta_key ] ) ) {
if ( ! is_array( $items[ $item->ID ]->meta[ $item->meta_key ] ) ) {
$items[ $item->ID ]->meta[ $item->meta_key ] = array( $items[ $item->ID ]->meta[ $item->meta_key ] );
}
$items[ $item->ID ]->meta[ $item->meta_key ][] = $item->meta_value;
} else {
$items[ $item->ID ]->meta[ $item->meta_key ] = $item->meta_value;
if ( ! isset( $items[ $item->ID ] ) ) {
$items[ $item->ID ] = clone $item;
$items[ $item->ID ]->meta = array();
unset( $items[ $item->ID ]->meta_key );
unset( $items[ $item->ID ]->meta_value );
}
if ( isset( $items[ $item->ID ]->meta[ $item->meta_key ] ) ) {
if ( ! is_array( $items[ $item->ID ]->meta[ $item->meta_key ] ) ) {
$items[ $item->ID ]->meta[ $item->meta_key ] = array( $items[ $item->ID ]->meta[ $item->meta_key ] );
}
$items[ $item->ID ]->meta[ $item->meta_key ][] = $item->meta_value;
} else {
$items[ $item->ID ]->meta[ $item->meta_key ] = $item->meta_value;
}
}
/**
* QUERY THE DATABASE FOR RESULTS
Expand Down

0 comments on commit b6b753f

Please sign in to comment.