/** * Extract all possible useful information from the given url. * * @param array $replacements Message replacements. * @param UrlInterface $url URL to extract data from. * * @return array */ public function extract(array $replacements, UrlInterface $url) { if (preg_match('#<title[^>]*>(.*?)</title>#is', $url->getBody(), $match)) { $replacements['%composed-title%'] = $replacements['%title%'] = preg_replace('/[\\s\\v]+/', ' ', trim(html_entity_decode($match[1], ENT_QUOTES | ENT_HTML5))); } return $replacements; }
/** * Extract all possible useful information from the given url. * * @param array $replacements Message replacements. * @param UrlInterface $url URL to extract data from. * * @return array */ public function extract(array $replacements, UrlInterface $url) { $size = @\getimagesize('data://application/octet-stream;base64,' . base64_encode($url->getBody())); if ($size) { $replacements = $this->extractIntoReplacements($replacements, $size); } return $replacements; }
public function extract($replacements, UrlInterface $url) { $headers = $url->getHeaders(); if ($url->getCode() == static::HTTP_STATUS_OK) { if (isset($headers['content-type'][0])) { foreach ($this->mimes as $mime) { if ($mime->matches($headers['content-type'][0])) { $replacements = $mime->extract($replacements, $url); } } } } return $replacements; }