@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | $this->cacheTime = $cacheTime; |
| 73 | 73 | |
| 74 | 74 | if ($compileId !== null) { |
| 75 | - $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 75 | + $this->compileId = str_replace('../', '__', strtr($compileId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | if ($cacheId !== null) { |
| 79 | - $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 79 | + $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | if (is_string($includePath)) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | protected function isValidCompiledFile($file) |
| 123 | 123 | { |
| 124 | - return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file); |
|
| 124 | + return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -159,14 +159,14 @@ discard block |
||
| 159 | 159 | } else { |
| 160 | 160 | foreach ($this->includePath as $path) { |
| 161 | 161 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
| 162 | - if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) { |
|
| 163 | - $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file; |
|
| 162 | + if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) { |
|
| 163 | + $this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file; |
|
| 164 | 164 | |
| 165 | 165 | return $this->resolvedPath; |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)'); |
|
| 169 | + throw new DwooException('Template "'.$this->file.'" could not be found in any of your include path(s)'); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function getUid() |
| 180 | 180 | { |
| 181 | - return (string)filemtime($this->getResourceIdentifier()); |
|
| 181 | + return (string) filemtime($this->getResourceIdentifier()); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)'); |
| 238 | 238 | } |
| 239 | 239 | } else { |
| 240 | - $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId; |
|
| 240 | + $resourceId = dirname($parentTemplate->getResourceIdentifier()).DIRECTORY_SEPARATOR.$resourceId; |
|
| 241 | 241 | if (file_exists($resourceId) === false) { |
| 242 | 242 | return null; |
| 243 | 243 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | if ($policy = $core->getSecurityPolicy()) { |
| 251 | 251 | while (true) { |
| 252 | 252 | if (preg_match('{^([a-z]+?)://}i', $resourceId)) { |
| 253 | - throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.'); |
|
| 253 | + throw new SecurityException('The security policy prevents you to read files from external sources : <em>'.$resourceId.'</em>.'); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | if ($includePath) { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | break 2; |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | - throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>'); |
|
| 267 | + throw new SecurityException('The security policy prevents you to read <em>'.$resourceId.'</em>'); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $this->compileId = str_replace('../', '__', strtr($this->getResourceIdentifier(), '\\:', '/-')); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - return $this->compileId . '.d' . Core::RELEASE_TAG . '.php'; |
|
| 294 | + return $this->compileId.'.d'.Core::RELEASE_TAG.'.php'; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -302,6 +302,6 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function getIsModifiedCode() |
| 304 | 304 | { |
| 305 | - return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')'; |
|
| 305 | + return '"'.$this->getUid().'" == filemtime('.var_export($this->getResourceIdentifier(), true).')'; |
|
| 306 | 306 | } |
| 307 | 307 | } |
@@ -124,11 +124,11 @@ 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 | } |
| 129 | 129 | |
| 130 | 130 | if ($cacheId !== null) { |
| 131 | - $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 131 | + $this->cacheId = str_replace('../', '__', strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) { |
| 277 | 277 | // already checked, return cache file |
| 278 | 278 | return $cachedFile; |
| 279 | - } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) { |
|
| 279 | + } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === - 1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($core))) { |
|
| 280 | 280 | // cache is still valid and can be loaded |
| 281 | 281 | self::$cache['cached'][$this->cacheId] = true; |
| 282 | 282 | |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | // thanks for his help on avoiding concurency issues |
| 305 | 305 | $temp = tempnam($cacheDir, 'temp'); |
| 306 | 306 | if (!($file = @fopen($temp, 'wb'))) { |
| 307 | - $temp = $cacheDir . uniqid('temp'); |
|
| 307 | + $temp = $cacheDir.uniqid('temp'); |
|
| 308 | 308 | if (!($file = @fopen($temp, 'wb'))) { |
| 309 | - trigger_error('Error writing temporary file \'' . $temp . '\'', E_USER_WARNING); |
|
| 309 | + trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING); |
|
| 310 | 310 | |
| 311 | 311 | return false; |
| 312 | 312 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | { |
| 343 | 343 | $cachedFile = $this->getCacheFilename($core); |
| 344 | 344 | |
| 345 | - return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile)); |
|
| 345 | + return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile)); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $this->compileId = $this->name; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - return $core->getCompileDir() . $this->compileId . '.d' . Core::RELEASE_TAG . '.php'; |
|
| 452 | + return $core->getCompileDir().$this->compileId.'.d'.Core::RELEASE_TAG.'.php'; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
@@ -467,17 +467,17 @@ discard block |
||
| 467 | 467 | if (isset($_SERVER['REQUEST_URI']) === true) { |
| 468 | 468 | $cacheId = $_SERVER['REQUEST_URI']; |
| 469 | 469 | } elseif (isset($_SERVER['SCRIPT_FILENAME']) && isset($_SERVER['argv'])) { |
| 470 | - $cacheId = $_SERVER['SCRIPT_FILENAME'] . '-' . implode('-', $_SERVER['argv']); |
|
| 470 | + $cacheId = $_SERVER['SCRIPT_FILENAME'].'-'.implode('-', $_SERVER['argv']); |
|
| 471 | 471 | } else { |
| 472 | 472 | $cacheId = ''; |
| 473 | 473 | } |
| 474 | 474 | // force compiled id generation |
| 475 | 475 | $this->getCompiledFilename($core); |
| 476 | 476 | |
| 477 | - $this->cacheId = str_replace('../', '__', $this->compileId . strtr($cacheId, '\\%?=!:;' . PATH_SEPARATOR, '/-------')); |
|
| 477 | + $this->cacheId = str_replace('../', '__', $this->compileId.strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | - return $core->getCacheDir() . $this->cacheId . '.html'; |
|
| 480 | + return $core->getCacheDir().$this->cacheId.'.html'; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | $retries = 3; |
| 517 | - while ($retries --) { |
|
| 517 | + while ($retries--) { |
|
| 518 | 518 | @mkdir($path, $chmod, true); |
| 519 | 519 | if (is_dir($path)) { |
| 520 | 520 | break; |
@@ -527,9 +527,9 @@ discard block |
||
| 527 | 527 | $path = strtr(str_replace($baseDir, '', $path), '\\', '/'); |
| 528 | 528 | $folders = explode('/', trim($path, '/')); |
| 529 | 529 | foreach ($folders as $folder) { |
| 530 | - $baseDir .= $folder . DIRECTORY_SEPARATOR; |
|
| 530 | + $baseDir .= $folder.DIRECTORY_SEPARATOR; |
|
| 531 | 531 | if (!chmod($baseDir, $chmod)) { |
| 532 | - throw new Exception('Unable to chmod ' . "$baseDir to $chmod: " . print_r(error_get_last(), true)); |
|
| 532 | + throw new Exception('Unable to chmod '."$baseDir to $chmod: ".print_r(error_get_last(), true)); |
|
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | } |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $block = &$compiler->getCurrentBlock(); |
| 92 | - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; |
|
| 92 | + $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE; |
|
| 93 | 93 | |
| 94 | 94 | return ''; |
| 95 | 95 | } |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $block = &$compiler->getCurrentBlock(); |
| 92 | - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; |
|
| 92 | + $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE; |
|
| 93 | 93 | |
| 94 | 94 | return ''; |
| 95 | 95 | } |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $block = &$compiler->getCurrentBlock(); |
| 92 | - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; |
|
| 92 | + $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE; |
|
| 93 | 93 | |
| 94 | 94 | return ''; |
| 95 | 95 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
| 49 | 49 | |
| 50 | 50 | if ($tpl === null) { |
| 51 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
| 51 | + throw new CompilationException($compiler, 'Load Templates : Resource "'.$resource.':'.$identifier.'" not found.'); |
|
| 52 | 52 | } elseif ($tpl === false) { |
| 53 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
| 53 | + throw new CompilationException($compiler, 'Load Templates : Resource "'.$resource.'" does not support includes.'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $cmp = clone $compiler; |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | $compiler->addUsedPlugin($plugin, $type); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
| 65 | + $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n"; |
|
| 66 | 66 | |
| 67 | 67 | $modCheck = $tpl->getIsModifiedCode(); |
| 68 | 68 | |
| 69 | 69 | if ($modCheck) { |
| 70 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
| 70 | + $out .= 'if (!('.$modCheck.')) { ob_end_clean(); return false; }'; |
|
| 71 | 71 | } else { |
| 72 | 72 | $out .= 'try { |
| 73 | - $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
|
| 73 | + $tpl = $this->templateFactory("' . $resource.'", "'.$identifier.'"); |
|
| 74 | 74 | } catch (Dwoo\Exception $e) { |
| 75 | - $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
|
| 75 | + $this->triggerError(\'Load Templates : Resource <em>' . $resource.'</em> was not added to Dwoo, can not extend <em>'.$identifier.'</em>\', E_USER_WARNING); |
|
| 76 | 76 | } |
| 77 | 77 | if ($tpl === null) |
| 78 | - $this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING); |
|
| 78 | + $this->triggerError(\'Load Templates : Resource "' . $resource.':'.$identifier.'" was not found.\', E_USER_WARNING); |
|
| 79 | 79 | elseif ($tpl === false) |
| 80 | - $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
|
| 81 | -if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
|
| 80 | + $this->triggerError(\'Load Templates : Resource "' . $resource.'" does not support extends.\', E_USER_WARNING); |
|
| 81 | +if ($tpl->getUid() != "' . $tpl->getUid().'") { ob_end_clean(); return false; }'; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return $out; |