From 7999dfe998ba347bc07910eb3e32fe3485d16c5c Mon Sep 17 00:00:00 2001 From: Adam Currie Date: Mon, 2 Nov 2015 17:41:15 +0000 Subject: [PATCH] Add language --- src/Client.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 50ad676..af21c62 100755 --- a/src/Client.php +++ b/src/Client.php @@ -36,7 +36,8 @@ function SetSecret($consumerSecret) { $this->_consumerSecret = $consumerSecret; } - function SearchFood($query, $region = false) { + function SearchFood($query, $region = false, $language = false) { + $url = Client::$base . 'method=foods.search'; $url = $url . '&search_expression=' . urlencode($query); @@ -44,6 +45,10 @@ function SearchFood($query, $region = false) { if ($region !== false) { $url = $url . '®ion=' . urlencode($region); } + + if ($language !== false) { + $url = $url . '&language=' . urlencode($language); + } $oauth = new OAuthBase(); @@ -55,6 +60,7 @@ function SearchFood($query, $region = false) { $response = $this->GetQueryResponse($normalizedUrl, $normalizedRequestParameters . '&' . OAuthBase::$OAUTH_SIGNATURE . '=' . urlencode($signature)); return $response; + } function GetFood($foodId, $subCats = false, $flagDefaultServing = false) {