@@ -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) |
@@ -138,10 +138,10 @@ discard block |
||
138 | 138 | protected static function createDomainThumbCacheFolder($domain, $type) |
139 | 139 | { |
140 | 140 | $cachePath = self::getCachePath($type); |
141 | - $domainFolder = $cachePath . $domain; |
|
141 | + $domainFolder = $cachePath.$domain; |
|
142 | 142 | if (!file_exists($domainFolder)) { |
143 | 143 | mkdir($domainFolder, 0775, false); |
144 | - touch($domainFolder . '/' . self::$CLEAN_FILE); |
|
144 | + touch($domainFolder.'/'.self::$CLEAN_FILE); |
|
145 | 145 | } |
146 | 146 | self::createHtaccessFile($cachePath, $type === self::TYPE_THUMB); |
147 | 147 | } |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | protected static function createHtaccessFile($path, $allowed = false) |
157 | 157 | { |
158 | 158 | $apacheVersion = ConfigManager::get('settings.apache_version', ''); |
159 | - $htaccessFile = $path . '.htaccess'; |
|
159 | + $htaccessFile = $path.'.htaccess'; |
|
160 | 160 | if (file_exists($htaccessFile)) { |
161 | 161 | return; |
162 | 162 | } |
163 | - $templateFile = file_exists(FileUtils::RESOURCES_PATH .'htaccess'. $apacheVersion .'_template') |
|
164 | - ? FileUtils::RESOURCES_PATH .'htaccess'. $apacheVersion .'_template' |
|
165 | - : FileUtils::RESOURCES_PATH .'htaccess_template'; |
|
163 | + $templateFile = file_exists(FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template') |
|
164 | + ? FileUtils::RESOURCES_PATH.'htaccess'.$apacheVersion.'_template' |
|
165 | + : FileUtils::RESOURCES_PATH.'htaccess_template'; |
|
166 | 166 | $template = new \Text_Template($templateFile); |
167 | 167 | $template->setVar([ |
168 | 168 | 'new_all' => $allowed ? 'granted' : 'denied', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | protected static function checkCacheType($type) |
196 | 196 | { |
197 | 197 | if ($type != self::TYPE_THUMB && $type != self::TYPE_FINDER) { |
198 | - throw new CacheException('Unknown cache type '. $type); |
|
198 | + throw new CacheException('Unknown cache type '.$type); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -205,19 +205,19 @@ discard block |
||
205 | 205 | protected static function rebuildCacheFolders() |
206 | 206 | { |
207 | 207 | $mainFolder = ConfigManager::get('settings.path.cache', 'cache/'); |
208 | - if (! is_dir($mainFolder)) { |
|
208 | + if (!is_dir($mainFolder)) { |
|
209 | 209 | mkdir($mainFolder, 0755); |
210 | 210 | } |
211 | - if (! is_dir($mainFolder.self::TYPE_THUMB)) { |
|
211 | + if (!is_dir($mainFolder.self::TYPE_THUMB)) { |
|
212 | 212 | mkdir($mainFolder.self::TYPE_THUMB, 0755); |
213 | 213 | } |
214 | - if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) { |
|
215 | - touch($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep'); |
|
214 | + if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) { |
|
215 | + touch($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep'); |
|
216 | 216 | } |
217 | - if (! is_dir($mainFolder.self::TYPE_FINDER)) { |
|
218 | - mkdir($mainFolder . self::TYPE_FINDER, 0755); |
|
217 | + if (!is_dir($mainFolder.self::TYPE_FINDER)) { |
|
218 | + mkdir($mainFolder.self::TYPE_FINDER, 0755); |
|
219 | 219 | } |
220 | - if (! is_readable($mainFolder . self::TYPE_THUMB . DIRECTORY_SEPARATOR . '.gitkeep')) { |
|
220 | + if (!is_readable($mainFolder.self::TYPE_THUMB.DIRECTORY_SEPARATOR.'.gitkeep')) { |
|
221 | 221 | touch($mainFolder.self::TYPE_FINDER.DIRECTORY_SEPARATOR.'.gitkeep'); |
222 | 222 | } |
223 | 223 | } |