From a374febe8f930bc0a153b8ea36c39886a659e00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcelo=20Villela=20Gusm=C3=A3o?= Date: Mon, 13 Jun 2016 11:00:08 -0300 Subject: [PATCH] Permitindo busca de mais de um termo --- inc/class-mexp-resource-space-service.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/class-mexp-resource-space-service.php b/inc/class-mexp-resource-space-service.php index 388ea07..6d29a74 100644 --- a/inc/class-mexp-resource-space-service.php +++ b/inc/class-mexp-resource-space-service.php @@ -49,10 +49,14 @@ public function request( array $request ) { // Ensure that 'page' is never 0. This breaks things. $request['page'] = ( $request['page'] < 1 ) ? 1 : $request['page']; + // Get search term + $search_term = sanitize_text_field( $request['params']['q'] ); + $search_term = str_replace(' ', '%20', $search_term); + // Build the request URL. $api_url = add_query_arg( apply_filters( 'resourcespace_request_args', array( - 'search' => sanitize_text_field( $request['params']['q'] ), + 'search' => $search_term, 'key' => PJ_RESOURCE_SPACE_KEY, 'previewsize' => 'pre', 'prettyfieldnames' => true,