summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/backend.php b/backend.php
index 0cbd6f4..9678fab 100644
--- a/backend.php
+++ b/backend.php
@@ -249,7 +249,13 @@
$url = "https://en.wiktionary.org/w/api.php?titles=${query}&action=query&prop=extracts&format=json&exlimit=1";
if ($resp = file_get_contents($url)) {
- print $resp;
+ $resp = json_decode($resp, true);
+
+ foreach ($resp['query']['pages'] as &$page) {
+ $page['extract'] = Sanitizer::sanitize($page['extract']);
+ }
+
+ print json_encode($resp);
}
break;