|
@@ -62,16 +62,16 @@ discard block |
|
|
block discarded – undo |
|
62
|
62
|
return $this->url; |
|
63
|
63
|
} |
|
64
|
64
|
|
|
65
|
|
- if (empty($thumbnail) && ! empty($headers) && strpos($headers[0], '200') === false) { |
|
|
65
|
+ if (empty($thumbnail) && !empty($headers) && strpos($headers[0], '200') === false) { |
|
66
|
66
|
return false; |
|
67
|
67
|
} |
|
68
|
68
|
|
|
69
|
69
|
// With curl, the thumb is extracted during the download |
|
70
|
|
- if ($this->webAccess instanceof WebAccessCUrl && ! empty($thumbnail)) { |
|
|
70
|
+ if ($this->webAccess instanceof WebAccessCUrl && !empty($thumbnail)) { |
|
71
|
71
|
return $thumbnail; |
|
72
|
72
|
} |
|
73
|
73
|
|
|
74
|
|
- return ! empty($content) ? self::extractMetaTag($content) : false; |
|
|
74
|
+ return !empty($content) ? self::extractMetaTag($content) : false; |
|
75
|
75
|
} |
|
76
|
76
|
|
|
77
|
77
|
/** |
|
@@ -144,10 +144,10 @@ discard block |
|
|
block discarded – undo |
|
144
|
144
|
{ |
|
145
|
145
|
$propertiesKey = ['property', 'name', 'itemprop']; |
|
146
|
146
|
// Try to retrieve OpenGraph image. |
|
147
|
|
- $ogRegex = '#<meta[^>]+(?:'. implode('|', $propertiesKey) .')=["\']?og:image["\'\s][^>]*content=["\']?(.*?)["\'\s>]#'; |
|
|
147
|
+ $ogRegex = '#<meta[^>]+(?:'.implode('|', $propertiesKey).')=["\']?og:image["\'\s][^>]*content=["\']?(.*?)["\'\s>]#'; |
|
148
|
148
|
// If the attributes are not in the order property => content (e.g. Github) |
|
149
|
149
|
// New regex to keep this readable... more or less. |
|
150
|
|
- $ogRegexReverse = '#<meta[^>]+content=["\']?([^"\'\s]+)[^>]+(?:'. implode('|', $propertiesKey) .')=["\']?og:image["\'\s/>]#'; |
|
|
150
|
+ $ogRegexReverse = '#<meta[^>]+content=["\']?([^"\'\s]+)[^>]+(?:'.implode('|', $propertiesKey).')=["\']?og:image["\'\s/>]#'; |
|
151
|
151
|
|
|
152
|
152
|
if (preg_match($ogRegex, $content, $matches) > 0 |
|
153
|
153
|
|| preg_match($ogRegexReverse, $content, $matches) > 0 |