Alternative implementation that takes into account the current site
as the root

@param type $link
@param type $cache
@return boolean
160760
static public function get_by_link($link, $cache = true) {
		$current = Multisites::inst()->getCurrentSiteId();
		
		if(trim($link, '/')) {
			$link = trim(Director::makeRelative($link), '/');
		} else {
			$link = RootURLController::get_homepage_link();
		}
		
		$parts = Convert::raw2sql(preg_split('|/+|', $link));
		
		// Grab the initial root level page to traverse down from.
		$URLSegment = array_shift($parts);
		
		$sitetree   = DataObject::get_one (
			SiteTree::class, "\"URLSegment\" = '$URLSegment' AND \"ParentID\" = " . $current, $cache
		);
		
		if (!$sitetree) {
			return false;
		}
		
		/// Fall back on a unique URLSegment for b/c.
		if(!$sitetree && self::nested_urls() && $page = DataObject::get(SiteTree::class, "\"URLSegment\" = '$URLSegment'")->First()) {
			return $page;
		}

		// Check if we have any more URL parts to parse.
		if(!count($parts)) return $sitetree;

		// Traverse down the remaining URL segments and grab the relevant SiteTree objects.
		foreach($parts as $segment) {
			$next = DataObject::get_one (
				SiteTree::class, "\"URLSegment\" = '$segment' AND \"ParentID\" = $sitetree->ID", $cache
			);
			
			if(!$next) {
				return false;
			}

			$sitetree->destroy();
			$sitetree = $next;
		}

		return $sitetree;
	}
1209518
public function foundLinkToBeScanned(Event $event, $link)
    {
        $this->io->verbose(__d('link-scanner', 'Link found: {0}', $link));

        return true;
    }
116654
protected function hasVersionedQuery($link)
    {
        // Find querystrings
        $parts = explode('?', $link, 2);
        if (count($parts) < 2) {
            return false;
        }

        // Parse args
        $readingMode = ReadingMode::fromQueryString($parts[1]);
        return !empty($readingMode);
    }
1249024
public function setCache(\Doctrine\Common\Cache\Cache $cache) {
		$this->cache = $cache;
		return $this;
	}
276629
public function Caching($Caching = NULL) {
      if (!is_null($Caching))
         $this->UseCaching = (bool)$Caching;
      return $this->UseCaching;
   }
1210714
protected function addLink(Request $request, Link $link)
    {
        if (!class_exists(AddLinkHeaderListener::class)) {
            throw new \LogicException('You can not use the "addLink" method if the WebLink component is not available. Try running "composer require symfony/web-link".');
        }

        if (null === $linkProvider = $request->attributes->get('_links')) {
            $request->attributes->set('_links', new GenericLinkProvider([$link]));

            return;
        }

        $request->attributes->set('_links', $linkProvider->withLink($link));
    }
354936
public function addLink(Link $link)
    {
        $name = $link->getName();

        if (isset($this->links[$name])) {
            throw new \LogicException(sprintf('A link name by "%s" is already exists.', $name));
        }

        $this->links[$name] = $link;
    }
199804
public function isValidCache($cache)
    {
        // Get the valid caches
        $caches = $this->getCaches();
        $cacheKeys = array_keys($caches);
        $cacheKeys[] = 'all';

        if (!in_array($cache, array_values($cacheKeys))) {
            return false;
        }

        return $cache;
    }
792694
public function isChanged($cache): bool
    {
        if ($this->reusable) {
            $hash = $this->generateReusableHash();
            if (!array_key_exists($hash, self::$_reusableData)) {
                self::$_reusableData[$hash] = $this->generateDependencyData($cache);
            }
            $data = self::$_reusableData[$hash];
        } else {
            $data = $this->generateDependencyData($cache);
        }

        return $data !== $this->data;
    }
420646
public function getLink($link)
    {
        if (isset($this->links->$link->redirectHref)) {
            return $this->links->$link->redirectHref;
        }

        if (isset($this->links->$link->href)) {
            return $this->links->$link->href;
        }

        return $this->links->$link;
    }
6932
public function isLinkAllowed(string $link): bool
	{
		$this->prepareLink($link);
		return $this->links[$link]->allowed;
	}
201966
public function addLink(Link $link)
    {
        if ( ! $this->links instanceof ArrayIterator) {
            $this->links = new ArrayIterator();
        }

        $this->links->push($link);

        return $this;
    }
864033
private static function checkLink(
        string $projectRootDirectory,
        array $link,
        string $file,
        array &$errors,
        int &$return
    ): void {
        $path = \trim($link[2]);
        if (0 === \strpos($path, '#')) {
            return;
        }
        if (1 === \preg_match('%^(http|//)%', $path)) {
            self::validateHttpLink($link, $errors, $return);

            return;
        }

        $path  = \current(\explode('#', $path, 2));
        $start = \rtrim($projectRootDirectory, '/');
        if ($path[0] !== '/' || 0 === \strpos($path, './')) {
            $relativeSubdirs = \preg_replace(
                '%^' . $projectRootDirectory . '%',
                '',
                \dirname($file)
            );
            if ($relativeSubdirs !== null) {
                $start           .= '/' . \rtrim($relativeSubdirs, '/');
            }
        }
        $realpath = \realpath($start . '/' . $path);
        if (false === $realpath) {
            $errors[] = \sprintf("\nBad link for \"%s\" to \"%s\"\n", $link[1], $link[2]);
            $return   = 1;
        }
    }
1248974
protected function setLink($link)
    {
        self::writeFullTag(
            $link,
            'link',
            false,
            'link',
            $this->validator,
            'validateLink',
            $this->exception,
            'Provided link is not a valid value.'
        );

        return $this;
    }
622644
public function addRef($link, $callback) : Reference
    {
        return $this->_hasReference($this->_default_seed_addRef, $link, $callback);
    }
1077435
public function setLink($link)
    {
        if (false === ValidatorTrait::validateLoc($link)) {
            throw new SitemapException('Value for setLink is not a valid URL');
        }

        $this->link = "<link>{$link}</link>";

        return $this;
    }
207613
public function hasLink( $link, &$linkDetail = null )
    {

        $links = $this->__get('links');

        if( isset($links[$link])) {
            $linkDetail = $links[$link];
            return $link;
        }

        foreach( $links as $via => $linkDetail ){
            if( in_array( $link, $linkDetail->foreignEntities ) ) {
                return $via;
            }
        }

        return false;

    }