From 64ff22d2fd7f2b40b9b1f6e2cedac3d8fe95ace4 Mon Sep 17 00:00:00 2001
From: tom-dea <thomas.schwaerzler@uibk.ac.at>
Date: Fri, 11 Mar 2016 15:34:24 -0500
Subject: [PATCH] fixed translations of wiki redirect token. - checked for
 languages en de es fr it pt ru cs sv da sl si

---
 module/VuFind/src/VuFind/Connection/Wikipedia.php | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/module/VuFind/src/VuFind/Connection/Wikipedia.php b/module/VuFind/src/VuFind/Connection/Wikipedia.php
index b532cfaf3b4..c8b55e04ea1 100644
--- a/module/VuFind/src/VuFind/Connection/Wikipedia.php
+++ b/module/VuFind/src/VuFind/Connection/Wikipedia.php
@@ -361,11 +361,16 @@ class Wikipedia implements TranslatorAwareInterface
             $page = array_shift($page['revisions']);
             // Check for redirection
             $as_lines = explode("\n", $page['*']);
-            if (stristr($as_lines[0], '#REDIRECT')) {
-                preg_match('/\[\[(.*)\]\]/', $as_lines[0], $matches);
-                $redirectTo = $matches[1];
-            } else {
-                $redirectTo = false;
+            $redirectTo = false;
+            $redirectTokens = ['#REDIRECT', '#WEITERLEITUNG', '#OMDIRIGERING'];
+            foreach ($redirectTokens as $redirectToken) {
+                if (stristr($as_lines[0], $redirectToken)) {
+                    preg_match('/\[\[(.*)\]\]/', $as_lines[0], $matches);
+                    $redirectTo = $matches[1];
+                    break;
+                }
+            }
+            if (!$redirectTo) {
                 break;
             }
         }
-- 
GitLab