@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | $this->cacheTime = $cacheTime; |
| 125 | 125 | |
| 126 | 126 | if ($compileId !== null) { |
| 127 | - $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 127 | + $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 128 | 128 | } else { |
| 129 | 129 | $this->compileId = $templateString; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | if ($cacheId !== null) { |
| 133 | - $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 133 | + $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) { |
| 278 | 278 | // already checked, return cache file |
| 279 | 279 | return $cachedFile; |
| 280 | - } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) { |
|
| 280 | + } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) { |
|
| 281 | 281 | // cache is still valid and can be loaded |
| 282 | 282 | self::$cache['cached'][$this->cacheId] = true; |
| 283 | 283 | |
@@ -305,9 +305,9 @@ discard block |
||
| 305 | 305 | // thanks for his help on avoiding concurency issues |
| 306 | 306 | $temp = tempnam($cacheDir, 'temp'); |
| 307 | 307 | if (!($file = @fopen($temp, 'wb'))) { |
| 308 | - $temp = $cacheDir . uniqid('temp'); |
|
| 308 | + $temp = $cacheDir.uniqid('temp'); |
|
| 309 | 309 | if (!($file = @fopen($temp, 'wb'))) { |
| 310 | - trigger_error('Error writing temporary file \'' . $temp . '\'', E_USER_WARNING); |
|
| 310 | + trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING); |
|
| 311 | 311 | |
| 312 | 312 | return false; |
| 313 | 313 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | { |
| 344 | 344 | $cachedFile = $this->getCacheFilename($core); |
| 345 | 345 | |
| 346 | - return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile)); |
|
| 346 | + return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile)); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | protected function getCompiledFilename(Core $core) |
| 448 | 448 | { |
| 449 | - return $core->getCompileDir() . hash('md4', $this->compileId) . '.d' . Core::RELEASE_TAG . '.php'; |
|
| 449 | + return $core->getCompileDir().hash('md4', $this->compileId).'.d'.Core::RELEASE_TAG.'.php'; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | if (isset($_SERVER['REQUEST_URI']) === true) { |
| 465 | 465 | $cacheId = $_SERVER['REQUEST_URI']; |
| 466 | 466 | } elseif (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['argv'])) { |
| 467 | - $cacheId = $_SERVER['SCRIPT_FILENAME'] . '-' . implode('-', $_SERVER['argv']); |
|
| 467 | + $cacheId = $_SERVER['SCRIPT_FILENAME'].'-'.implode('-', $_SERVER['argv']); |
|
| 468 | 468 | } else { |
| 469 | 469 | $cacheId = ''; |
| 470 | 470 | } |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | $this->getCompiledFilename($core); |
| 473 | 473 | |
| 474 | 474 | $this->cacheId = str_replace('../', '__', |
| 475 | - $this->compileId . strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 475 | + $this->compileId.strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - return $core->getCacheDir() . $this->cacheId . '.html'; |
|
| 478 | + return $core->getCacheDir().$this->cacheId.'.html'; |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | $retries = 3; |
| 515 | - while ($retries --) { |
|
| 515 | + while ($retries--) { |
|
| 516 | 516 | @mkdir($path, $chmod, true); |
| 517 | 517 | if (is_dir($path)) { |
| 518 | 518 | break; |
@@ -525,9 +525,9 @@ discard block |
||
| 525 | 525 | $path = strtr(str_replace($baseDir, '', $path), '\\', '/'); |
| 526 | 526 | $folders = explode('/', trim($path, '/')); |
| 527 | 527 | foreach ($folders as $folder) { |
| 528 | - $baseDir .= $folder . DIRECTORY_SEPARATOR; |
|
| 528 | + $baseDir .= $folder.DIRECTORY_SEPARATOR; |
|
| 529 | 529 | if (!chmod($baseDir, $chmod)) { |
| 530 | - throw new Exception('Unable to chmod ' . "$baseDir to $chmod: " . print_r(error_get_last(), true)); |
|
| 530 | + throw new Exception('Unable to chmod '."$baseDir to $chmod: ".print_r(error_get_last(), true)); |
|
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function isValidCompiledFile($file) |
| 113 | 113 | { |
| 114 | - return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file); |
|
| 114 | + return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | } else { |
| 150 | 150 | foreach ($this->getIncludePath() as $path) { |
| 151 | 151 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
| 152 | - if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) { |
|
| 153 | - return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file; |
|
| 152 | + if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) { |
|
| 153 | + return $this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file; |
|
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)'); |
|
| 157 | + throw new DwooException('Template "'.$this->file.'" could not be found in any of your include path(s)'); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function getUid() |
| 168 | 168 | { |
| 169 | - return (string)filemtime($this->getResourceIdentifier()); |
|
| 169 | + return (string) filemtime($this->getResourceIdentifier()); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)'); |
| 225 | 225 | } |
| 226 | 226 | } else { |
| 227 | - $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId; |
|
| 227 | + $resourceId = dirname($parentTemplate->getResourceIdentifier()).DIRECTORY_SEPARATOR.$resourceId; |
|
| 228 | 228 | if (file_exists($resourceId) === false) { |
| 229 | 229 | return null; |
| 230 | 230 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | if ($policy = $core->getSecurityPolicy()) { |
| 238 | 238 | while (true) { |
| 239 | 239 | if (preg_match('{^([a-z]+?)://}i', $resourceId)) { |
| 240 | - throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.'); |
|
| 240 | + throw new SecurityException('The security policy prevents you to read files from external sources : <em>'.$resourceId.'</em>.'); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if ($includePath) { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | break 2; |
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | - throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>'); |
|
| 254 | + throw new SecurityException('The security policy prevents you to read <em>'.$resourceId.'</em>'); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
@@ -271,6 +271,6 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function getIsModifiedCode() |
| 273 | 273 | { |
| 274 | - return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')'; |
|
| 274 | + return '"'.$this->getUid().'" == filemtime('.var_export($this->getResourceIdentifier(), true).')'; |
|
| 275 | 275 | } |
| 276 | 276 | } |