@@ -20,8 +20,8 @@ |
||
20 | 20 | */ |
21 | 21 | public static function getDomain($url) |
22 | 22 | { |
23 | - if (! parse_url($url, PHP_URL_SCHEME)) { |
|
24 | - $url = 'http://' . $url; |
|
23 | + if (!parse_url($url, PHP_URL_SCHEME)) { |
|
24 | + $url = 'http://'.$url; |
|
25 | 25 | } |
26 | 26 | return strtolower(parse_url($url, PHP_URL_HOST)); |
27 | 27 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | if (empty($thumburl)) { |
116 | - $error = 'No thumbnail could be found using '. $this->finder->getName() .' finder: '. $this->url; |
|
116 | + $error = 'No thumbnail could be found using '.$this->finder->getName().' finder: '.$this->url; |
|
117 | 117 | throw new ThumbnailNotFoundException($error); |
118 | 118 | } |
119 | 119 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | protected function thumbnailStrictHotlink($thumburl) |
144 | 144 | { |
145 | - if (! $this->finder->isHotlinkAllowed()) { |
|
145 | + if (!$this->finder->isHotlinkAllowed()) { |
|
146 | 146 | throw new ThumbnailNotFoundException('Hotlink is not supported for this URL.'); |
147 | 147 | } |
148 | 148 | return $thumburl; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | protected function thumbnailHotlink($thumburl) |
164 | 164 | { |
165 | - if (! $this->finder->isHotlinkAllowed()) { |
|
165 | + if (!$this->finder->isHotlinkAllowed()) { |
|
166 | 166 | return $this->thumbnailDownload($thumburl); |
167 | 167 | } |
168 | 168 | return $thumburl; |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | |
216 | 216 | if (strpos($headers[0], '200') === false) { |
217 | 217 | throw new DownloadException( |
218 | - 'Unreachable thumbnail URL. HTTP '. $headers[0] .'.'. PHP_EOL . |
|
219 | - ' - thumbnail URL: '. $thumburl |
|
218 | + 'Unreachable thumbnail URL. HTTP '.$headers[0].'.'.PHP_EOL. |
|
219 | + ' - thumbnail URL: '.$thumburl |
|
220 | 220 | ); |
221 | 221 | } |
222 | 222 | |
223 | 223 | if (empty($data)) { |
224 | - throw new DownloadException('Couldn\'t download the thumbnail at '. $thumburl); |
|
224 | + throw new DownloadException('Couldn\'t download the thumbnail at '.$thumburl); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Resize and save it locally. |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $this->options[WebThumbnailer::CROP] |
234 | 234 | ); |
235 | 235 | |
236 | - if (! is_file($thumbPath)) { |
|
236 | + if (!is_file($thumbPath)) { |
|
237 | 237 | throw new ImageConvertException('Thumbnail was not generated.'); |
238 | 238 | } |
239 | 239 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | { |
323 | 323 | // Width |
324 | 324 | $width = 0; |
325 | - if (! empty($options[WebThumbnailer::MAX_WIDTH])) { |
|
325 | + if (!empty($options[WebThumbnailer::MAX_WIDTH])) { |
|
326 | 326 | if (SizeUtils::isMetaSize($options[WebThumbnailer::MAX_WIDTH])) { |
327 | 327 | $width = SizeUtils::getMetaSize($options[WebThumbnailer::MAX_WIDTH]); |
328 | 328 | } elseif (is_int($options[WebThumbnailer::MAX_WIDTH]) |
@@ -373,13 +373,13 @@ discard block |
||
373 | 373 | if (count(array_intersect($incompatibleFlags, $options)) > 1) { |
374 | 374 | $error = 'Only one of these flags can be set between: '; |
375 | 375 | foreach ($incompatibleFlags as $flag) { |
376 | - $error .= $flag .' '; |
|
376 | + $error .= $flag.' '; |
|
377 | 377 | } |
378 | 378 | throw new BadRulesException($error); |
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | - if (isset($options[WebThumbnailer::PATH_TYPE]) && ! in_array( |
|
382 | + if (isset($options[WebThumbnailer::PATH_TYPE]) && !in_array( |
|
383 | 383 | $options[WebThumbnailer::PATH_TYPE], |
384 | 384 | [WebThumbnailer::PATH_RELATIVE, WebThumbnailer::PATH_ABSOLUTE] |
385 | 385 | )) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Thumbnails image cache. |
28 | 28 | */ |
29 | - const TYPE_THUMB = 'thumb'; |
|
29 | + const TYPE_THUMB = 'thumb'; |
|
30 | 30 | /** |
31 | 31 | * Finder cache. |
32 | 32 | */ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | self::rebuildCacheFolders(); |
62 | 62 | return self::getCachePath($type, true); |
63 | 63 | } elseif (!$path) { |
64 | - throw new IOException('Cache folders are not writable: '. $cache); |
|
64 | + throw new IOException('Cache folders are not writable: '.$cache); |
|
65 | 65 | } |
66 | 66 | return $path; |
67 | 67 | } |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | self::createDomainThumbCacheFolder($domainHash, $type); |
95 | 95 | $domainFolder = FileUtils::getPath(self::getCachePath($type), $domainHash); |
96 | 96 | if ($type === self::TYPE_THUMB) { |
97 | - $suffix = $width . $height . ($crop ? '1' : '0') . (self::PATH_TYPE[$pathType]) .'.jpg'; |
|
97 | + $suffix = $width.$height.($crop ? '1' : '0').(self::PATH_TYPE[$pathType]).'.jpg'; |
|
98 | 98 | } else { |
99 | - $suffix = $width . $height; |
|
99 | + $suffix = $width.$height; |
|
100 | 100 | } |
101 | - return $domainFolder . self::getThumbFilename($url) . $suffix; |
|
101 | + return $domainFolder.self::getThumbFilename($url).$suffix; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public static function isCacheValid($cacheFile, $domain, $type) |
117 | 117 | { |
118 | 118 | $out = false; |
119 | - $cacheDuration = ConfigManager::get('settings.cache_duration', 3600*24*31); |
|
119 | + $cacheDuration = ConfigManager::get('settings.cache_duration', 3600 * 24 * 31); |
|
120 | 120 | |
121 | 121 | if (is_readable($cacheFile) |
122 | 122 | && ($cacheDuration < 0 || (time() - filemtime($cacheFile)) < $cacheDuration) |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected static function createDomainThumbCacheFolder($domain, $type) |
139 | 139 | { |
140 | - $domainFolder = self::getCachePath($type) . $domain; |
|
140 | + $domainFolder = self::getCachePath($type).$domain; |
|
141 | 141 | if (!file_exists($domainFolder)) { |
142 | 142 | mkdir($domainFolder, 0775, false); |
143 | - touch($domainFolder . '/' . self::$CLEAN_FILE); |
|
143 | + touch($domainFolder.'/'.self::$CLEAN_FILE); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | protected static function checkCacheType($type) |
168 | 168 | { |
169 | 169 | if ($type != self::TYPE_THUMB && $type != self::TYPE_FINDER) { |
170 | - throw new CacheException('Unknown cache type '. $type); |
|
170 | + throw new CacheException('Unknown cache type '.$type); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -177,19 +177,19 @@ discard block |
||
177 | 177 | protected static function rebuildCacheFolders() |
178 | 178 | { |
179 | 179 | $mainFolder = ConfigManager::get('settings.path.cache', 'cache/'); |
180 | - if (! is_dir($mainFolder)) { |
|
180 | + if (!is_dir($mainFolder)) { |
|
181 | 181 | mkdir($mainFolder, 0755); |
182 | 182 | } |
183 | - if (! is_dir($mainFolder.self::TYPE_THUMB)) { |
|
183 | + if (!is_dir($mainFolder.self::TYPE_THUMB)) { |
|
184 | 184 | mkdir($mainFolder.self::TYPE_THUMB, 0755); |
185 | 185 | } |
186 | - if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) { |
|
187 | - touch($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep'); |
|
186 | + if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) { |
|
187 | + touch($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep'); |
|
188 | 188 | } |
189 | - if (! is_dir($mainFolder.self::TYPE_FINDER)) { |
|
190 | - mkdir($mainFolder . self::TYPE_FINDER, 0755); |
|
189 | + if (!is_dir($mainFolder.self::TYPE_FINDER)) { |
|
190 | + mkdir($mainFolder.self::TYPE_FINDER, 0755); |
|
191 | 191 | } |
192 | - if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) { |
|
192 | + if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) { |
|
193 | 193 | touch($mainFolder.self::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep'); |
194 | 194 | } |
195 | 195 | } |