Skip to content

Commit

Permalink
[TASK] Latest adoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Aug 4, 2019
1 parent 90b7a53 commit 56e37f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions Classes/Hooks/LinkHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function isInLocalDomain($url)
$host = $parsedUrl['host'];

if (version_compare(TYPO3_version, '9.0', '<')) {
$result = $this->checkSysDomains($parsedUrl, $host);
$result = $this->checkSysDomains($parsedUrl);
} else {
try {
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
Expand All @@ -111,7 +111,7 @@ protected function isInLocalDomain($url)
}
}
} catch (SiteNotFoundException $e) {
$result = $this->checkSysDomains($parsedUrl, $host);
$result = $this->checkSysDomains($parsedUrl);
}
}
}
Expand All @@ -121,14 +121,15 @@ protected function isInLocalDomain($url)
}

/**
* @param string $parsedUrl
* @param array $parsedUrl
* @param string $host
* @return bool
*/
protected function checkSysDomains($parsedUrl, $host): bool
protected function checkSysDomains($parsedUrl): bool
{
$result = false;
// Removes the last path segment and slash sequences like /// (if given):
$path = preg_replace('#/+[^/]*$#', '', $parsedUrl['path'] ?? '');
$path = preg_replace('#/+[^/]*$#', '', $parsedUrl['host'] ?? '');

$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_domain');
$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
Expand All @@ -141,7 +142,7 @@ protected function checkSysDomains($parsedUrl, $host): bool
foreach ($localDomains as $localDomain) {
// strip trailing slashes (if given)
$domainName = rtrim($localDomain['domainName'], '/');
if (GeneralUtility::isFirstPartOfStr($host . $path . '/', $domainName . '/')) {
if ($domainName === $path) {
$result = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'author_email' => '[email protected]',
'state' => 'beta',
'clearCacheOnLoad' => true,
'version' => '0.1.0',
'version' => '1.0.0',
'constraints' => [
'depends' => [
'typo3' => '8.7.0-9.5.99'
Expand Down

0 comments on commit 56e37f5

Please sign in to comment.