@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) { |
| 268 | 268 | // already checked, return cache file |
| 269 | 269 | return $cachedFile; |
| 270 | - } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME'] - $cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) { |
|
| 270 | + } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > ($_SERVER['REQUEST_TIME']-$cacheLength)) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) { |
|
| 271 | 271 | // cache is still valid and can be loaded |
| 272 | 272 | self::$cache['cached'][$this->cacheId] = true; |
| 273 | 273 | return $cachedFile; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | // thanks for his help on avoiding concurency issues |
| 294 | 294 | $temp = tempnam($cacheDir, 'temp'); |
| 295 | 295 | if (!($file = @fopen($temp, 'wb'))) { |
| 296 | - $temp = $cacheDir . uniqid('temp'); |
|
| 296 | + $temp = $cacheDir.uniqid('temp'); |
|
| 297 | 297 | if (!($file = @fopen($temp, 'wb'))) { |
| 298 | 298 | trigger_error('Error writing temporary file \''.$temp.'\'', E_USER_WARNING); |
| 299 | 299 | return false; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | { |
| 330 | 330 | $cachedFile = $this->getCacheFilename($dwoo); |
| 331 | 331 | |
| 332 | - return !file_exists($cachedFile) || (filectime($cachedFile) < (time() - $olderThan) && unlink($cachedFile)); |
|
| 332 | + return !file_exists($cachedFile) || (filectime($cachedFile) < (time()-$olderThan) && unlink($cachedFile)); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -426,10 +426,10 @@ discard block |
||
| 426 | 426 | protected function getCompiledFilename(Dwoo_Core $dwoo) |
| 427 | 427 | { |
| 428 | 428 | // no compile id was provided, set default |
| 429 | - if ($this->compileId===null) { |
|
| 429 | + if ($this->compileId === null) { |
|
| 430 | 430 | $this->compileId = $this->name; |
| 431 | 431 | } |
| 432 | - return $dwoo->getCompileDir() . $this->compileId.'.d'.Dwoo_Core::RELEASE_TAG.'.php'; |
|
| 432 | + return $dwoo->getCompileDir().$this->compileId.'.d'.Dwoo_Core::RELEASE_TAG.'.php'; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -453,9 +453,9 @@ discard block |
||
| 453 | 453 | // force compiled id generation |
| 454 | 454 | $this->getCompiledFilename($dwoo); |
| 455 | 455 | |
| 456 | - $this->cacheId = str_replace('../', '__', $this->compileId . strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 456 | + $this->cacheId = str_replace('../', '__', $this->compileId.strtr($cacheId, '\\%?=!:;'.PATH_SEPARATOR, '/-------')); |
|
| 457 | 457 | } |
| 458 | - return $dwoo->getCacheDir() . $this->cacheId.'.html'; |
|
| 458 | + return $dwoo->getCacheDir().$this->cacheId.'.html'; |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $path = strtr(str_replace($baseDir, '', $path), '\\', '/'); |
| 505 | 505 | $folders = explode('/', trim($path, '/')); |
| 506 | 506 | foreach ($folders as $folder) { |
| 507 | - $baseDir .= $folder . DIRECTORY_SEPARATOR; |
|
| 507 | + $baseDir .= $folder.DIRECTORY_SEPARATOR; |
|
| 508 | 508 | if (!chmod($baseDir, $chmod)) |
| 509 | 509 | { |
| 510 | 510 | throw new Exception("Unable to chmod ". |
@@ -126,12 +126,12 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | protected function getEngine() |
| 128 | 128 | { |
| 129 | - if($this->dwoo) { |
|
| 129 | + if ($this->dwoo) { |
|
| 130 | 130 | return $this->dwoo; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // this triggers Agavi autoload |
| 134 | - if(!class_exists('Dwoo')) { |
|
| 134 | + if (!class_exists('Dwoo')) { |
|
| 135 | 135 | if (file_exists(dirname(__FILE__).'/../../../dwooAutoload.php')) { |
| 136 | 136 | // file was dropped with the entire dwoo package |
| 137 | 137 | require dirname(__FILE__).'/../../../dwooAutoload.php'; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $parentMode = fileperms(AgaviConfig::get('core.cache_dir')); |
| 145 | 145 | |
| 146 | - $compileDir = AgaviConfig::get('core.cache_dir') . DIRECTORY_SEPARATOR . self::COMPILE_DIR . DIRECTORY_SEPARATOR . self::COMPILE_SUBDIR; |
|
| 146 | + $compileDir = AgaviConfig::get('core.cache_dir').DIRECTORY_SEPARATOR.self::COMPILE_DIR.DIRECTORY_SEPARATOR.self::COMPILE_SUBDIR; |
|
| 147 | 147 | AgaviToolkit::mkdir($compileDir, $parentMode, true); |
| 148 | 148 | |
| 149 | - $cacheDir = AgaviConfig::get('core.cache_dir') . DIRECTORY_SEPARATOR . self::CACHE_DIR; |
|
| 149 | + $cacheDir = AgaviConfig::get('core.cache_dir').DIRECTORY_SEPARATOR.self::CACHE_DIR; |
|
| 150 | 150 | AgaviToolkit::mkdir($cacheDir, $parentMode, true); |
| 151 | 151 | |
| 152 | 152 | $this->dwoo = new Dwoo_Core($compileDir, $cacheDir); |
@@ -177,23 +177,23 @@ discard block |
||
| 177 | 177 | $engine = $this->getEngine(); |
| 178 | 178 | |
| 179 | 179 | $data = array(); |
| 180 | - if($this->extractVars) { |
|
| 180 | + if ($this->extractVars) { |
|
| 181 | 181 | $data = $attributes; |
| 182 | 182 | } else { |
| 183 | 183 | $data[$this->varName] = &$attributes; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $data[$this->slotsVarName] =& $slots; |
|
| 186 | + $data[$this->slotsVarName] = & $slots; |
|
| 187 | 187 | |
| 188 | - foreach($this->assigns as $key => $getter) { |
|
| 188 | + foreach ($this->assigns as $key => $getter) { |
|
| 189 | 189 | $data[$key] = $this->getContext()->$getter(); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - foreach($moreAssigns as $key => &$value) { |
|
| 193 | - if(isset($this->moreAssignNames[$key])) { |
|
| 192 | + foreach ($moreAssigns as $key => &$value) { |
|
| 193 | + if (isset($this->moreAssignNames[$key])) { |
|
| 194 | 194 | $key = $this->moreAssignNames[$key]; |
| 195 | 195 | } |
| 196 | - $data[$key] =& $value; |
|
| 196 | + $data[$key] = & $value; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | return $engine->get($layer->getResourceStreamIdentifier(), $data); |