/** * Adds a link to the LinkFinder-internal link-cache * * @param string $link_raw The link like it was found * @param string $link_code The html-code of the link like it was found (i.e. <a href="the_link.html">Link</a>) * @param string $link_text The linktext like it was found * @param bool $is_redirect_url Flag indicatin whether the found URL is target of an HTTP-redirect */ protected function addLinkToCache($link_raw, $link_code, $link_text = "", $is_redirect_url = false) { //PHPCrawlerBenchmark::start("preparing_link_for_cache"); // If liks already was found and processed -> skip this link if (isset($this->found_links_map[$link_raw])) { return; } // Rebuild URL from link $url_rebuild = PHPCrawlerUtils::buildURLFromLink($link_raw, $this->baseUrlParts); // If link coulnd't be rebuild if ($url_rebuild == null) { return; } // Create an PHPCrawlerURLDescriptor-object with URL-data $url_link_depth = $this->SourceUrl->url_link_depth + 1; $UrlDescriptor = new PHPCrawlerURLDescriptor($url_rebuild, $link_raw, $link_code, $link_text, $this->SourceUrl->url_rebuild, $url_link_depth); // Is redirect-URL? if ($is_redirect_url == true) { $UrlDescriptor->is_redirect_url = true; } // Add the PHPCrawlerURLDescriptor-object to LinkCache $this->LinkCache->addURL($UrlDescriptor); // Add the PHPCrawlerURLDescriptor-object to found-links-array $map_key = $link_raw; $this->found_links_map[$map_key] = true; //PHPCrawlerBenchmark::stop("preparing_link_for_cache"); }