@@ -62,16 +62,16 @@ discard block |
||
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 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return int|bool length of $data or false if we need to stop the download |
103 | 103 | */ |
104 | - return function (&$ch, $data) use ($url, &$content, &$thumbnail, &$isRedirected) { |
|
104 | + return function(&$ch, $data) use ($url, &$content, &$thumbnail, &$isRedirected) { |
|
105 | 105 | $content .= $data; |
106 | 106 | $responseCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); |
107 | 107 | if (!empty($responseCode) && in_array($responseCode, [301, 302])) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | // After a redirection, the content type will keep the previous request value |
115 | 115 | // until it finds the next content-type header. |
116 | - if (! $isRedirected || strpos(strtolower($data), 'content-type') !== false) { |
|
116 | + if (!$isRedirected || strpos(strtolower($data), 'content-type') !== false) { |
|
117 | 117 | $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); |
118 | 118 | } |
119 | 119 | // we look for image, and ignore application/octet-stream, |
@@ -155,10 +155,10 @@ discard block |
||
155 | 155 | $propertiesKey = ['property', 'name', 'itemprop']; |
156 | 156 | $properties = implode('|', $propertiesKey); |
157 | 157 | // Try to retrieve OpenGraph image. |
158 | - $ogRegex = '#<meta[^>]+(?:'. $properties .')=["\']?og:image["\'\s][^>]*content=["\']?(.*?)["\'\s>]#'; |
|
158 | + $ogRegex = '#<meta[^>]+(?:'.$properties.')=["\']?og:image["\'\s][^>]*content=["\']?(.*?)["\'\s>]#'; |
|
159 | 159 | // If the attributes are not in the order property => content (e.g. Github) |
160 | 160 | // New regex to keep this readable... more or less. |
161 | - $ogRegexReverse = '#<meta[^>]+content=["\']?([^"\'\s]+)[^>]+(?:'. $properties .')=["\']?og:image["\'\s/>]#'; |
|
161 | + $ogRegexReverse = '#<meta[^>]+content=["\']?([^"\'\s]+)[^>]+(?:'.$properties.')=["\']?og:image["\'\s/>]#'; |
|
162 | 162 | |
163 | 163 | if (preg_match($ogRegex, $content, $matches) > 0 |
164 | 164 | || preg_match($ogRegexReverse, $content, $matches) > 0 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | // With curl, the thumb is extracted during the download |
91 | - if ($this->webAccess instanceof WebAccessCUrl && ! empty($thumbnail)) { |
|
91 | + if ($this->webAccess instanceof WebAccessCUrl && !empty($thumbnail)) { |
|
92 | 92 | return $thumbnail; |
93 | 93 | } |
94 | 94 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return int|bool length of $data or false if we need to stop the download |
123 | 123 | */ |
124 | - return function (&$ch, $data) use (&$content, &$thumbnail, &$isRedirected) { |
|
124 | + return function(&$ch, $data) use (&$content, &$thumbnail, &$isRedirected) { |
|
125 | 125 | $content .= $data; |
126 | 126 | $responseCode = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); |
127 | 127 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | // After a redirection, the content type will keep the previous request value |
136 | 136 | // until it finds the next content-type header. |
137 | - if (! $isRedirected || strpos(strtolower($data), 'content-type') !== false) { |
|
137 | + if (!$isRedirected || strpos(strtolower($data), 'content-type') !== false) { |
|
138 | 138 | $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); |
139 | 139 | } |
140 | 140 | if (!empty($contentType) && strpos($contentType, 'text/html') === false) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if (preg_match($this->urlRegex, $content, $matches) !== 0) { |
164 | 164 | $total = count($matches); |
165 | 165 | for ($i = 1; $i < $total; $i++) { |
166 | - $thumbnailUrl = str_replace('${'. $i . '}', $matches[$i], $thumbnailUrl); |
|
166 | + $thumbnailUrl = str_replace('${'.$i.'}', $matches[$i], $thumbnailUrl); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Match only options (not ${number}) |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function checkRules($rules) |
184 | 184 | { |
185 | - if (! FinderUtils::checkMandatoryRules($rules, [ |
|
185 | + if (!FinderUtils::checkMandatoryRules($rules, [ |
|
186 | 186 | 'image_regex', |
187 | 187 | 'thumbnail_url' |
188 | 188 | ])) { |