Skip to content

Commit

Permalink
Merge pull request #32 from oveleon/develop
Browse files Browse the repository at this point in the history
Fixed an issue with relative urls not working in contao 4.13
  • Loading branch information
zoglo authored Sep 11, 2023
2 parents 1edd85c + 96fb244 commit 78d58d6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion contao/classes/Glossary.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function generateUrl(GlossaryItemModel $objItem, bool $blnAbsolute
{
$url = $objItem->url;

if (Validator::isRelativeUrl($url))
if (self::isRelativeUrl($url))
{
$url = Environment::get('path') . '/' . $url;
}
Expand Down Expand Up @@ -320,4 +320,17 @@ public static function transliterateAscii(string $string): string
{
return (string) u($string)->ascii();
}

/**
* ToDo: Remove when Contao 4.13 support ends
* Valid relative URL
*
* @param mixed $varValue The value to be validated
*
* @return boolean True if the value is a relative URL
*/
private static function isRelativeUrl($varValue)
{
return Validator::isUrl($varValue) && !preg_match('(^([0-9a-z+.-]+:|#|/|\{\{))i', $varValue);
}
}

0 comments on commit 78d58d6

Please sign in to comment.