Bladeren bron

Instead of returning an empty array when the counts of urlList and tokenList arent equal the code is checking now if theres is an entry in the tokenList for every url from urlList. That makes it possible that there could be a least one working pair of url & token which leads to a working calendar.

Steven Günther 4 jaren geleden
bovenliggende
commit
925261b566
1 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 8 8
      api/functions/homepage-connect-functions.php

+ 8 - 8
api/functions/homepage-connect-functions.php

@@ -8,14 +8,14 @@ trait HomepageConnectFunctions
 		$list = array();
 		$urlList = explode(',', $url);
 		$tokenList = explode(',', $token);
-		if (count($urlList) == count($tokenList)) {
-			foreach ($urlList as $key => $value) {
-				$list[$key] = array(
-					'url' => $this->qualifyURL($value),
-					'token' => $tokenList[$key]
-				);
-			}
-		}
+        foreach ($urlList as $key => $value) {
+            if (isset($tokenList[$key])) {
+                $list[$key] = array(
+                    'url' => $this->qualifyURL($value),
+                    'token' => $tokenList[$key]
+                );
+            }
+        }
 		return $list;
 	}