Adhere to WP code standards
This commit is contained in:
parent
cdc0efed75
commit
7f3b67272a
|
@ -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'] ) ) {
|
||||
|
|
Loading…
Reference in New Issue