@@ -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 | } |
@@ -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 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | protected function isValidCompiledFile($file) |
| 111 | 111 | { |
| 112 | - return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file); |
|
| 112 | + return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | } else { |
| 148 | 148 | foreach ($this->getIncludePath() as $path) { |
| 149 | 149 | $path = rtrim($path, DIRECTORY_SEPARATOR); |
| 150 | - if (file_exists($path . DIRECTORY_SEPARATOR . $this->file) === true) { |
|
| 151 | - return $this->resolvedPath = $path . DIRECTORY_SEPARATOR . $this->file; |
|
| 150 | + if (file_exists($path.DIRECTORY_SEPARATOR.$this->file) === true) { |
|
| 151 | + return $this->resolvedPath = $path.DIRECTORY_SEPARATOR.$this->file; |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - throw new DwooException('Template "' . $this->file . '" could not be found in any of your include path(s)'); |
|
| 155 | + throw new DwooException('Template "'.$this->file.'" could not be found in any of your include path(s)'); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function getUid() |
| 166 | 166 | { |
| 167 | - return (string)filemtime($this->getResourceIdentifier()); |
|
| 167 | + return (string) filemtime($this->getResourceIdentifier()); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | throw new DwooException('When using an include path you can not reference a template into a parent directory (using ../)'); |
| 224 | 224 | } |
| 225 | 225 | } else { |
| 226 | - $resourceId = dirname($parentTemplate->getResourceIdentifier()) . DIRECTORY_SEPARATOR . $resourceId; |
|
| 226 | + $resourceId = dirname($parentTemplate->getResourceIdentifier()).DIRECTORY_SEPARATOR.$resourceId; |
|
| 227 | 227 | if (file_exists($resourceId) === false) { |
| 228 | 228 | return null; |
| 229 | 229 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | if ($policy = $core->getSecurityPolicy()) { |
| 237 | 237 | while (true) { |
| 238 | 238 | if (preg_match('{^([a-z]+?)://}i', $resourceId)) { |
| 239 | - throw new SecurityException('The security policy prevents you to read files from external sources : <em>' . $resourceId . '</em>.'); |
|
| 239 | + throw new SecurityException('The security policy prevents you to read files from external sources : <em>'.$resourceId.'</em>.'); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if ($includePath) { |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | break 2; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | - throw new SecurityException('The security policy prevents you to read <em>' . $resourceId . '</em>'); |
|
| 253 | + throw new SecurityException('The security policy prevents you to read <em>'.$resourceId.'</em>'); |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $this->compileId = str_replace('../', '__', strtr($this->getResourceIdentifier(), '\\:', '/-')); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - return $this->compileId . '.d' . Core::RELEASE_TAG . '.php'; |
|
| 280 | + return $this->compileId.'.d'.Core::RELEASE_TAG.'.php'; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -288,6 +288,6 @@ discard block |
||
| 288 | 288 | */ |
| 289 | 289 | public function getIsModifiedCode() |
| 290 | 290 | { |
| 291 | - return '"' . $this->getUid() . '" == filemtime(' . var_export($this->getResourceIdentifier(), true) . ')'; |
|
| 291 | + return '"'.$this->getUid().'" == filemtime('.var_export($this->getResourceIdentifier(), true).')'; |
|
| 292 | 292 | } |
| 293 | 293 | } |
@@ -38,6 +38,6 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public static function compile(Compiler $compiler, $var) |
| 40 | 40 | { |
| 41 | - return '(' . $var . ' !== null)'; |
|
| 41 | + return '('.$var.' !== null)'; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | '%t', |
| 68 | 68 | '%T' |
| 69 | 69 | ); |
| 70 | - $_win_to = array( |
|
| 70 | + $_win_to = array( |
|
| 71 | 71 | '%m/%d/%y', |
| 72 | 72 | '%b', |
| 73 | 73 | "\n", |
@@ -46,9 +46,9 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $out = array(); |
| 48 | 48 | foreach ($rest as $var => $val) { |
| 49 | - $out[] = '$this->setReturnValue(' . var_export($var, true) . ', ' . $val . ')'; |
|
| 49 | + $out[] = '$this->setReturnValue('.var_export($var, true).', '.$val.')'; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return '(' . implode('.', $out) . ')'; |
|
| 52 | + return '('.implode('.', $out).')'; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | \ No newline at end of file |
@@ -32,6 +32,6 @@ |
||
| 32 | 32 | { |
| 33 | 33 | public static function compile(Compiler $compiler, $value) |
| 34 | 34 | { |
| 35 | - return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', ' . $value . ', $tmp)'; |
|
| 35 | + return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', '.$value.', $tmp)'; |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -40,12 +40,12 @@ |
||
| 40 | 40 | if (is_array($value)) { |
| 41 | 41 | return array_reverse($value, $preserve_keys); |
| 42 | 42 | } elseif (($charset = $this->core->getCharset()) === 'iso-8859-1') { |
| 43 | - return strrev((string)$value); |
|
| 43 | + return strrev((string) $value); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $strlen = mb_strlen($value); |
| 47 | 47 | $out = ''; |
| 48 | - while ($strlen --) { |
|
| 48 | + while ($strlen--) { |
|
| 49 | 49 | $out .= mb_substr($value, $strlen, 1, $charset); |
| 50 | 50 | } |
| 51 | 51 | |