viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Slight tweaks to how WikiiMediaJob parses json to better handle plain strings, a=chris

Chris Pollett [2019-01-15 02:Jan:th]
Slight tweaks to how WikiiMediaJob parses json to better handle plain strings, a=chris
Filename
src/css/search.css
src/library/media_jobs/WikiMediaJob.php
diff --git a/src/css/search.css b/src/css/search.css
index 2643cf7fa..d2a828b36 100755
--- a/src/css/search.css
+++ b/src/css/search.css
@@ -2473,11 +2473,15 @@ div.group-result
 }
 .search-sources-table pre
 {
-    max-width: 4in;
+    max-width: 5in;
     overflow-wrap: break-word;
     text-overflow: ellipsis;
     white-space: pre-wrap;
 }
+.mobile .search-sources-table pre
+{
+    max-width: 300px;
+}
 td.instruct
 {
     max-width: 5in;
diff --git a/src/library/media_jobs/WikiMediaJob.php b/src/library/media_jobs/WikiMediaJob.php
index 0403c8142..59c3d5684 100644
--- a/src/library/media_jobs/WikiMediaJob.php
+++ b/src/library/media_jobs/WikiMediaJob.php
@@ -402,7 +402,9 @@ class WikiMediaJob extends MediaJob
         $url = false;
         if ($nodes === false) {
             $regex_json_parts = explode("json|", $xpath);
-            preg_match_all($regex_json_parts[0], $page, $matches);
+            set_error_handler(null);
+            @preg_match_all($regex_json_parts[0], $page, $matches);
+            set_error_handler(C\NS_CONFIGS . "yioop_error_handler");
             if (!empty($matches[1][0])) {
                 $url = $matches[1][0];
                 if (!empty($regex_json_parts[1])) {
@@ -414,6 +416,8 @@ class WikiMediaJob extends MediaJob
                         }
                     }
                     $url = $json_data;
+                } else if (isset($regex_json_parts[1]) && $url[0] == "\"") {
+                    $url = json_decode($url);
                 }
             }
         } else if ($nodes && $nodes->item(0)) {
ViewGit