Browse Source

update yggverse/net version

main
yggverse 8 months ago
parent
commit
982d1f1246
  1. 4
      composer.json
  2. 24
      src/cli/document/crawl.php

4
composer.json

@ -20,7 +20,7 @@
"jdenticon/jdenticon": "^1.0", "jdenticon/jdenticon": "^1.0",
"yggverse/ftp": "^1.0", "yggverse/ftp": "^1.0",
"gregwar/captcha": "^1.2", "gregwar/captcha": "^1.2",
"yggverse/net": "^1.2", "yggverse/net": "^1.3",
"yggverse/yo-tools": "^0.1.0" "yggverse/yo-tools": "dev-main"
} }
} }

24
src/cli/document/crawl.php

@ -498,15 +498,23 @@ foreach($index->search('')
if ($url = $value->attr($settings->attribute)) if ($url = $value->attr($settings->attribute))
{ {
//Make relative links absolute // Convert relative links to absolute
$url = \Yggverse\YoTools\Link::relative2absolute( $address = new \Yggverse\Net\Address(
$document->get('url'), $url
$url,
$scheme,
$host,
$port,
); );
if ($address->isRelative())
{
$base = new \Yggverse\Net\Address(
$document->get('url')
);
if ($absolute = $address->getAbsolute($base))
{
$url = $absolute;
}
}
// Regex rules // Regex rules
if (!preg_match($settings->regex, $url)) if (!preg_match($settings->regex, $url))
{ {
@ -514,7 +522,7 @@ foreach($index->search('')
} }
// External host rules // External host rules
if (!$settings->external && parse_url($url, PHP_URL_HOST) != $host) if (!$settings->external && parse_url($url, PHP_URL_HOST) != $address->getHost())
{ {
continue; continue;
} }

Loading…
Cancel
Save