From 7f3b67272af7f55d09a841a23a493a8fc1a871a7 Mon Sep 17 00:00:00 2001 From: Max Rice Date: Mon, 28 Jul 2014 19:34:41 -0400 Subject: [PATCH] Adhere to WP code standards --- includes/api/class-wc-api-resource.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/includes/api/class-wc-api-resource.php b/includes/api/class-wc-api-resource.php index 996d8d50379..e0368feeb0c 100644 --- a/includes/api/class-wc-api-resource.php +++ b/includes/api/class-wc-api-resource.php @@ -123,33 +123,40 @@ class WC_API_Resource { $args['date_query'] = array(); // resources created after specified date - if ( ! empty( $request_args['created_at_min'] ) ) + if ( ! empty( $request_args['created_at_min'] ) ) { $args['date_query'][] = array( 'column' => 'post_date_gmt', 'after' => $this->server->parse_datetime( $request_args['created_at_min'] ), 'inclusive' => true ); + } // resources created before specified date - if ( ! empty( $request_args['created_at_max'] ) ) + if ( ! empty( $request_args['created_at_max'] ) ) { $args['date_query'][] = array( 'column' => 'post_date_gmt', 'before' => $this->server->parse_datetime( $request_args['created_at_max'] ), 'inclusive' => true ); + } // resources updated after specified date - if ( ! empty( $request_args['updated_at_min'] ) ) + if ( ! empty( $request_args['updated_at_min'] ) ) { $args['date_query'][] = array( 'column' => 'post_modified_gmt', 'after' => $this->server->parse_datetime( $request_args['updated_at_min'] ), 'inclusive' => true ); + } // resources updated before specified date - if ( ! empty( $request_args['updated_at_max'] ) ) + if ( ! empty( $request_args['updated_at_max'] ) ) { $args['date_query'][] = array( 'column' => 'post_modified_gmt', 'before' => $this->server->parse_datetime( $request_args['updated_at_max'] ), 'inclusive' => true ); + } } // search - if ( ! empty( $request_args['q'] ) ) + if ( ! empty( $request_args['q'] ) ) { $args['s'] = $request_args['q']; + } // resources per response - if ( ! empty( $request_args['limit'] ) ) + if ( ! empty( $request_args['limit'] ) ) { $args['posts_per_page'] = $request_args['limit']; + } // resource offset - if ( ! empty( $request_args['offset'] ) ) + if ( ! empty( $request_args['offset'] ) ) { $args['offset'] = $request_args['offset']; + } // allow order change (ASC or DESC) if ( ! empty( $request_args['order'] ) ) {