remove spaces, new line and place comma in right position

This commit is contained in:
Jacson Passold 2018-07-09 18:19:53 -03:00
parent 5b9051d4a8
commit 5aa0ae4968
1 changed files with 5 additions and 5 deletions

View File

@ -32,17 +32,17 @@ class JSON_LD extends Type {
$this->contexts['@language'] = $this->get_locale($response->get_data());
$contexts = '';
foreach ($this->contexts as $slug => $url) {
if(strlen($contexts) > 0) $contexts .= ',\n';
if(strlen($contexts) > 0) $contexts .= ',';
$contexts .= '"'.$slug.'": "'.$url.'"';
}
$jsonld ='';
$jsonld ='
{
$jsonld =
'{
"@context":{
'.$contexts.'
}
},
'.$this->array_to_jsonld($response->get_data(), apply_filters('tainacan-exposer-jsonld', $jsonld)).'
},
}
' ;
$response->set_data($jsonld);
return $response;