Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }