/var/www/vhosts/ihelp.ro/httpdocs/vendor/mirko-pagliai/php-tools/src
NameSizeModeActions
Event/-0755rm
Exception/-0755rm
TestSuite/-0755rm
array_functions.php48230644editdlrm
BodyParser.php25580644editdlrm
debug_functions.php23200644editdlrm
deprecation_functions.php15630644editdlrm
Entity.php53690644editdlrm
Exceptionist.php158640644editdlrm
Filesystem.php130930644editdlrm
global_functions.php69880644editdlrm
network_functions.php32640644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/mirko-pagliai/php-tools/src/BodyParser.php (2558B)
*/ protected array $extractedLinks = []; /** * HTML tags that may contain links and therefore need to be scanned. * * Array with tag names as keys and attribute names as values. * @var array */ protected const TAGS = [ 'a' => 'href', 'area' => 'href', 'audio' => 'src', 'embed' => 'src', 'frame' => 'src', 'iframe' => 'src', 'img' => 'src', 'link' => 'href', 'script' => 'src', 'source' => 'src', 'track' => 'src', 'video' => 'src', ]; /** * Reference url. Used to determine the relative links * @var string */ protected string $url; /** * Constructor * @param string|\Psr\Http\Message\StreamInterface $body Body * @param string $url Reference url. Used to determine the relative links */ public function __construct($body, string $url) { $this->body = (string)$body; $this->url = $url; } /** * Extracts links from body * @return array Array of links */ public function extractLinks(): array { if ($this->extractedLinks) { return $this->extractedLinks; } if (!is_html($this->body)) { return []; } $crawler = new Crawler($this->body); foreach (self::TAGS as $tag => $attribute) { foreach ($crawler->filterXPath('//' . $tag)->extract([$attribute]) as $link) { if ($link) { $links[] = clean_url(url_to_absolute($this->url, $link), true, true); } } } return $this->extractedLinks = array_unique($links ?? []); } }