]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Utils.php
Working version before optimization
[github/shaarli/Shaarli.git] / application / Utils.php
index 925e1a22c909011a342b3dc3ced3c9f0f5d9a3da..4e97cddae26267f6e3c9b4e8a472c7a56aaf597b 100644 (file)
@@ -87,7 +87,7 @@ function endsWith($haystack, $needle, $case = true)
  *
  * @param mixed $input Data to escape: a single string or an array of strings.
  *
- * @return string escaped.
+ * @return string|array escaped.
  */
 function escape($input)
 {
@@ -159,10 +159,10 @@ function checkDateFormat($format, $string)
  */
 function generateLocation($referer, $host, $loopTerms = array())
 {
-    $finalReferer = '?';
+    $finalReferer = './?';
 
     // No referer if it contains any value in $loopCriteria.
-    foreach ($loopTerms as $value) {
+    foreach (array_filter($loopTerms) as $value) {
         if (strpos($referer, $value) !== false) {
             return $finalReferer;
         }