Author: Derick Rethans
Date: 2007-05-04 14:40:58 +0200 (Fri, 04 May 2007)
New Revision: 5049
Log:
- Fixed CS automatically, but there are still *many* things that need fixing by
hand.
Modified:
trunk/Template/src/compiled_code.php
trunk/Template/src/configuration.php
trunk/Template/src/functions/functions.php
trunk/Template/src/interfaces/cache_manager.php
trunk/Template/src/parsers/ast_to_php/implementations/php_generator.php
trunk/Template/src/parsers/source_to_tst/implementations/cache.php
trunk/Template/src/parsers/source_to_tst/implementations/expression.php
trunk/Template/src/parsers/source_to_tst/implementations/function_call.php
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_cached_transformer.php
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_transformer.php
trunk/Template/src/parsers/tst_to_tst/implementations/cache_preparation.php
trunk/Template/src/template.php
Modified: trunk/Template/src/compiled_code.php
===================================================================
--- trunk/Template/src/compiled_code.php 2007-05-04 12:35:36 UTC (rev
5048)
+++ trunk/Template/src/compiled_code.php 2007-05-04 12:40:58 UTC (rev
5049)
@@ -197,9 +197,9 @@
}
// Check if caching is enabled
- if( isset( $compileFlags["disableCache"] ) )
+ if ( isset( $compileFlags["disableCache"] ) )
{
- if( $this->template->configuration->disableCache !=
$compileFlags["disableCache"] )
+ if ( $this->template->configuration->disableCache !=
$compileFlags["disableCache"] )
{
throw new ezcTemplateOutdatedCompilationException( "The
compileFlag 'disableCache' has been changed, will recompile." );
}
Modified: trunk/Template/src/configuration.php
===================================================================
--- trunk/Template/src/configuration.php 2007-05-04 12:35:36 UTC (rev
5048)
+++ trunk/Template/src/configuration.php 2007-05-04 12:40:58 UTC (rev
5049)
@@ -78,7 +78,7 @@
'compilePath' => ".",
'cachedTemplatesPath' => null,
'compiledTemplatesPath' => null,
- //'cacheSystem' => null,
+ // 'cacheSystem' => null,
'checkModifiedTemplates' => true,
'customBlocks' => array(),
'customFunctions' => array(),
@@ -166,7 +166,7 @@
case 'compiledTemplatesPath':
case 'sourceCharset':
case 'targetCharset':
- //case 'cacheSystem':
+ // case 'cacheSystem':
case 'checkModifiedTemplates':
case 'customBlocks':
case 'customFunctions':
@@ -201,7 +201,7 @@
case 'compilePath':
case 'cachedTemplatesPath':
case 'compiledTemplatesPath':
- //case 'cacheSystem':
+ // case 'cacheSystem':
case 'checkModifiedTemplates':
return isset( $this->properties[$name] );
@@ -231,7 +231,7 @@
$this->properties["cachedTemplatesPath"] = "cached_templates";
$this->properties["compiledTemplatesPath"] = "compiled_templates";
- //$this->properties["cacheSystem"] = new ezcTemplateCacheFilesystem(
$this );
+ // $this->properties["cacheSystem"] = new ezcTemplateCacheFilesystem(
$this );
$this->properties['context'] = ( $context == null ? new
ezcTemplateXhtmlContext() : $context );
}
Modified: trunk/Template/src/functions/functions.php
===================================================================
--- trunk/Template/src/functions/functions.php 2007-05-04 12:35:36 UTC (rev
5048)
+++ trunk/Template/src/functions/functions.php 2007-05-04 12:40:58 UTC (rev
5049)
@@ -376,25 +376,25 @@
{
// A bug in the Reflection classes again.
// Need to check the current PHP version and create a different
behavior.
- if( version_compare( PHP_VERSION, "5.2", "<") )
+ if ( version_compare( PHP_VERSION, "5.2", "<") )
{
return;
}
- if( !isset( $definition->parameters ) || $definition->parameters ===
false) return;
+ if ( !isset( $definition->parameters ) || $definition->parameters ===
false) return;
$i = 0;
$foundOptionalParameter = false;
foreach ( $definition->parameters as $p )
{
- if( !isset($reflectionParameters[$i]) )
+ if ( !isset($reflectionParameters[$i]) )
{
throw new ezcTemplateException(
sprintf(ezcTemplateSourceToTstErrorMessages::MSG_INVALID_DEFINITION_PARAMETER_DOES_NOT_EXIST,
$i + 1));
}
if ( $p[0] == "[" )
{
- if( !$reflectionParameters[$i]->isOptional() )
+ if ( !$reflectionParameters[$i]->isOptional() )
{
throw new
ezcTemplateException(sprintf(ezcTemplateSourceToTstErrorMessages::MSG_INVALID_DEFINITION_PARAMETER_OPTIONAL,
$i + 1));
}
@@ -403,7 +403,7 @@
}
else
{
- if($foundOptionalParameter)
+ if ($foundOptionalParameter)
{
throw new
ezcTemplateException(ezcTemplateSourceToTstErrorMessages::MSG_INVALID_DEFINITION_EXPECT_OPTIONAL_PARAMETER);
}
@@ -417,25 +417,25 @@
{
$requiredParameters = 0;
- if( version_compare( PHP_VERSION, "5.2", "<") )
+ if ( version_compare( PHP_VERSION, "5.2", "<") )
{
- if( !isset( $definition->parameters ) || $definition->parameters
=== false)
+ if ( !isset( $definition->parameters ) || $definition->parameters
=== false)
{
throw new ezcTemplateException("PHP 5.2 is needed when the
parameter definition is omitted in the CustomFunction definition.");
}
- foreach($definition->parameters as $p)
+ foreach ($definition->parameters as $p)
{
- if( $p[0] !== '[' ) $requiredParameters++;
+ if ( $p[0] !== '[' ) $requiredParameters++;
}
return $requiredParameters;
}
else
{
- foreach($reflectionParameters as $p)
+ foreach ($reflectionParameters as $p)
{
- if( !$p->isOptional()) $requiredParameters++;
+ if ( !$p->isOptional()) $requiredParameters++;
}
return $requiredParameters;
@@ -444,9 +444,9 @@
protected function countTotalParameters($definition, $reflectionParameters)
{
- if( version_compare( PHP_VERSION, "5.2", "<") )
+ if ( version_compare( PHP_VERSION, "5.2", "<") )
{
- if( !isset( $definition->parameters ) || $definition->parameters
=== false)
+ if ( !isset( $definition->parameters ) || $definition->parameters
=== false)
{
throw new ezcTemplateException("PHP 5.2 is needed when the
parameter definition is omitted in the CustomFunction definition.");
}
@@ -484,16 +484,16 @@
$maxNr = 0;
// Named parameters.
- foreach($parameters as $name => $value)
+ foreach ($parameters as $name => $value)
{
if (!is_int($name))
{
$found = false;
$nr = 0;
- foreach( $reflectionParameters as $rp)
+ foreach ( $reflectionParameters as $rp)
{
- if( $rp->getName() === $name )
+ if ( $rp->getName() === $name )
{
$found = true;
break;
@@ -502,7 +502,7 @@
$nr++;
}
- if( !$found)
+ if ( !$found)
{
throw new ezcTemplateException( sprintf(
ezcTemplateSourceToTstErrorMessages::MSG_NAMED_PARAMETER_NOT_FOUND, $name,
$functionName ) );
}
@@ -514,11 +514,11 @@
ksort($newParameters, SORT_NUMERIC);
$i = 0;
- foreach($parameters as $name => $value)
+ foreach ($parameters as $name => $value)
{
if (is_int($name))
{
- while( isset($newParameters[$i])) $i++;
+ while ( isset($newParameters[$i])) $i++;
$newParameters[$i] = $value;
}
@@ -529,9 +529,9 @@
// Search for 'holes'.
for($i = 0; $i < $maxNr; $i++)
{
- if( !isset( $newParameters[$i]) )
+ if ( !isset( $newParameters[$i]) )
{
- if( !$reflectionParameters[$i]->isDefaultValueAvailable() )
+ if ( !$reflectionParameters[$i]->isDefaultValueAvailable() )
{
throw new ezcTemplateException( sprintf("Parameter %s is
not given and has not a default value.", $i + 1) );
}
@@ -548,7 +548,7 @@
protected function getReflectionParameters( $definition )
{
- if( !isset($definition->class) || $definition->class === false )
+ if ( !isset($definition->class) || $definition->class === false )
{
$rm = new ReflectionFunction( $definition->method );
}
@@ -593,7 +593,7 @@
$a = new ezcTemplateFunctionCallAstNode( ( $def->class ? (
$def->class . "::" ) : "" ) . $def->method);
$a->checkAndSetTypeHint();
- if( isset($def->sendTemplateObject) && $def->sendTemplateObject )
+ if ( isset($def->sendTemplateObject) && $def->sendTemplateObject )
{
array_shift($reflectionParameters);
$a->appendParameter( new
ezcTemplateVariableAstNode("this->template") );
@@ -606,7 +606,7 @@
- foreach( $parameters as $p)
+ foreach ( $parameters as $p)
{
$a->appendParameter( $p );
}
Modified: trunk/Template/src/interfaces/cache_manager.php
===================================================================
--- trunk/Template/src/interfaces/cache_manager.php 2007-05-04 12:35:36 UTC
(rev 5048)
+++ trunk/Template/src/interfaces/cache_manager.php 2007-05-04 12:40:58 UTC
(rev 5049)
@@ -171,7 +171,7 @@
* // One result and make sure the query is terminated.
* $r = $q->fetchAll();
*
- * if( sizeof( $r ) > 0 ) // Do we have any results?
+ * if ( sizeof( $r ) > 0 ) // Do we have any results?
* {
* // Unexpire the cache_file.
* $s = $db->prepare( "UPDATE cache_files SET expired=0 WHERE id =
:id" );
@@ -258,7 +258,7 @@
*
* $r = $q->fetchAll(); // Expect 0 or 1 result
*
- * if( count($r) == 0 || $r[0]["expired"] == 1 )
+ * if ( count($r) == 0 || $r[0]["expired"] == 1 )
* {
* return false;
* }
@@ -270,9 +270,9 @@
* $q->execute();
*
* $r = $q->fetchAll();
- * foreach( $r as $a )
+ * foreach ( $r as $a )
* {
- * if( filemtime( $a["value"] ) > filemtime( $cacheName ) )
+ * if ( filemtime( $a["value"] ) > filemtime( $cacheName ) )
* {
* return false;
* }
@@ -352,7 +352,7 @@
* registers all the included templates and relates them to the cache file
in creation.
*
* <code>
- * if( $this->depth >= 0 )
+ * if ( $this->depth >= 0 )
* {
* $db = ezcDbInstance::get();
* $id = $this->keys[ $this->depth ]["cache_id"];
@@ -388,7 +388,7 @@
* $q->execute();
* $rows = $q->fetchAll();
*
- * foreach($rows as $r)
+ * foreach ($rows as $r)
* {
* unlink( $r["cache"] );
* }
Modified:
trunk/Template/src/parsers/ast_to_php/implementations/php_generator.php
===================================================================
--- trunk/Template/src/parsers/ast_to_php/implementations/php_generator.php
2007-05-04 12:35:36 UTC (rev 5048)
+++ trunk/Template/src/parsers/ast_to_php/implementations/php_generator.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -316,7 +316,7 @@
"\\r",
"\\n" );
- if( $this->escapeSingleQuote )
+ if ( $this->escapeSingleQuote )
{
$search[] = "'";
$replace[] = "\\'";
Modified: trunk/Template/src/parsers/source_to_tst/implementations/cache.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/cache.php
2007-05-04 12:35:36 UTC (rev 5048)
+++ trunk/Template/src/parsers/source_to_tst/implementations/cache.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -39,7 +39,7 @@
protected function parseCurrent( ezcTemplateCursor $cursor )
{
// Disable caching.
- //return false;
+ // return false;
if ( $cursor->match( "dynamic" ) )
{
@@ -68,12 +68,12 @@
$cacheNode = new ezcTemplateCacheTstNode( $this->parser->source,
$this->startCursor, $cursor );
$cacheNode->type = ezcTemplateCacheTstNode::TYPE_CACHE_TEMPLATE;
}
- ////////// HERE
+ // //////// HERE
elseif ($cursor->match( "cache_block" ) )
{
$this->parser->hasCacheBlocks = true;
$cacheNode = new ezcTemplateCacheBlockTstNode(
$this->parser->source, $this->startCursor, $cursor );
- //$cacheNode->type = ezcTemplateCacheTstNode::TYPE_CACHE_BLOCK;
+ // $cacheNode->type = ezcTemplateCacheTstNode::TYPE_CACHE_BLOCK;
if ( $this->block->isClosingBlock )
{
@@ -90,7 +90,7 @@
return true;
}
}
- /////////// ENDHERE
+ // ///////// ENDHERE
else
{
return false;
Modified:
trunk/Template/src/parsers/source_to_tst/implementations/expression.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/expression.php
2007-05-04 12:35:36 UTC (rev 5048)
+++ trunk/Template/src/parsers/source_to_tst/implementations/expression.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -232,7 +232,7 @@
{
$this->findNextElement();
- if( !$res[1] ) break;
+ if ( !$res[1] ) break;
}
$parsedType = "Variable";
@@ -500,7 +500,7 @@
$this->findNextElement();
- //$operator = $this->lastParser->value;
+ // $operator = $this->lastParser->value;
}
return $operator !== null;
}
Modified:
trunk/Template/src/parsers/source_to_tst/implementations/function_call.php
===================================================================
--- trunk/Template/src/parsers/source_to_tst/implementations/function_call.php
2007-05-04 12:35:36 UTC (rev 5048)
+++ trunk/Template/src/parsers/source_to_tst/implementations/function_call.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -172,17 +172,17 @@
$startCursor = clone $cursor;
$namedParameter = $cursor->pregMatch( "#^[a-zA-Z_][a-zA-Z0-9_]*#" );
- if( $namedParameter !== false )
+ if ( $namedParameter !== false )
{
$this->findNextElement();
- if( !$cursor->match("=") )
+ if ( !$cursor->match("=") )
{
$namedParameter = false;
}
}
- if( $namedParameter === false)
+ if ( $namedParameter === false)
{
$cursor->copy($startCursor);
}
@@ -208,15 +208,15 @@
throw new ezcTemplateParserException( $this->parser->source,
$this->startCursor, $this->currentCursor, sprintf(
ezcTemplateSourceToTstErrorMessages::MSG_PARAMETER_CANNOT_BE_MODIFYING_BLOCK,
$this->parameterCount ) );
}
- if( $namedParameter !== false )
+ if ( $namedParameter !== false )
{
- if( version_compare( PHP_VERSION, "5.2", "<") )
+ if ( version_compare( PHP_VERSION, "5.2", "<") )
{
throw new ezcTemplateParserException( $this->parser->source,
$this->startCursor, $this->currentCursor, "Named parameters are not supported
in PHP versions lower than 5.2" );
}
- if( isset( $this->functionCall->parameters[$namedParameter] ) )
+ if ( isset( $this->functionCall->parameters[$namedParameter] ) )
{
throw new ezcTemplateParserException( $this->parser->source,
$this->startCursor, $this->currentCursor,
sprintf(ezcTemplateSourceToTstErrorMessages::MSG_NAMED_PARAMETER_ALREADY_ASSIGNED,
$namedParameter ) );
}
Modified:
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_cached_transformer.php
===================================================================
---
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_cached_transformer.php
2007-05-04 12:35:36 UTC (rev 5048)
+++
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_cached_transformer.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -229,7 +229,7 @@
*/
protected function notFileExistsCache()
{
- if( $this->template->usedConfiguration->cacheManager !== false )
+ if ( $this->template->usedConfiguration->cacheManager !== false )
{
// !$this->template->usedConfiguration->cacheManager->isValid(
$cacheName ) || !file_exist()
$a = new ezcTemplateLogicalNegationOperatorAstNode( new
ezcTemplateFunctionCallAstNode(
"\$this->template->usedConfiguration->cacheManager->isValid", array( new
ezcTemplateVariableAstNode( "this->template"), new ezcTemplateLiteralAstNode(
$this->parser->template->stream ), new ezcTemplateVariableAstNode(
"_ezcTemplateCache" ) ) ) );
@@ -253,7 +253,7 @@
$k = $value->accept($this);
$type = $this->parser->symbolTable->retrieve($k->name);
- if( substr( $k->name, 0, 12) == "this->send->")
+ if ( substr( $k->name, 0, 12) == "this->send->")
{
$cacheKeys[str_replace( "this->send->", "use:" , $k->name )] =
$k->name;
}
@@ -292,7 +292,7 @@
protected function startCaching( $cb )
{
- /// startCaching();
+ // / startCaching();
$cplen = strlen(
$this->parser->template->usedConfiguration->compilePath );
if ($this->template->usedConfiguration->cacheManager !== false )
{
@@ -309,7 +309,7 @@
// TEST VERSION for cacheblock.
protected function startCachingCacheBlock( $cb )
{
- /// startCaching();
+ // / startCaching();
$cplen = strlen(
$this->parser->template->usedConfiguration->compilePath );
if ($this->template->usedConfiguration->cacheManager !== false )
{
@@ -319,7 +319,7 @@
$cb->appendStatement( $this->_fopenCacheFileWriteMode() ); // $fp =
fopen( $this->cache, "w" );
$cb->appendStatement( $this->_fwritePhpOpen() ); //
fwrite( $fp, "<" . "?php\n" );
- //$cb->appendStatement( $this->_assignEmptyString("total") ); //
$total = ""
+ // $cb->appendStatement( $this->_assignEmptyString("total") ); //
$total = ""
$cb->appendStatement( $this->_assignVariable(self::INTERNAL_PREFIX .
"output", "total".$this->cacheLevel) );
$cb->appendStatement( $this->_assignEmptyString(
self::INTERNAL_PREFIX. "output") );
@@ -371,7 +371,7 @@
{
$use = $useVariable->accept($this);
- if( is_array( $use ) )
+ if ( is_array( $use ) )
{
foreach ( $use as $u )
{
@@ -463,7 +463,7 @@
$hasCacheKey = true;
}
- if( $hasCacheKey )
+ if ( $hasCacheKey )
{
$code = '$_ezcTemplateCache = \'' . $this->getCacheBaseName() .
$cacheBlock ."'" ;
foreach ( $cacheKeys as $key => $value )
@@ -648,7 +648,7 @@
$k = $key->accept($this);
- if( $this->parser->symbolTable->retrieve($key->name) !==
ezcTemplateSymbolTable::IMPORT)
+ if ( $this->parser->symbolTable->retrieve($key->name) !==
ezcTemplateSymbolTable::IMPORT)
{
throw new ezcTemplateParserException( $type->source,
$type->endCursor, $type->endCursor,
ezcTemplateSourceToTstErrorMessages::MSG_EXPECT_USE_VARIABLE );
@@ -667,7 +667,7 @@
}
else
{
- //$cb = new ezcTemplateCacheBlockAstNode(
$type->elements->accept($this) );
+ // $cb = new ezcTemplateCacheBlockAstNode(
$type->elements->accept($this) );
return $cb;
}
@@ -730,7 +730,7 @@
$statements->appendStatement( $if );
// RETURN STATEMENT outside..
- //$statements->appendStatement( new ezcTemplateReturnAstNode(
$this->outputVariable->getAst()) );
+ // $statements->appendStatement( new ezcTemplateReturnAstNode(
$this->outputVariable->getAst()) );
$this->cacheLevel--;
Modified:
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_transformer.php
===================================================================
---
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_transformer.php
2007-05-04 12:35:36 UTC (rev 5048)
+++
trunk/Template/src/parsers/tst_to_ast/implementations/tst_to_ast_transformer.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -605,7 +605,7 @@
$params->value[] = $value->accept($this);
}
- if( $def->hasCloseTag && $def->isStatic )
+ if ( $def->hasCloseTag && $def->isStatic )
{
throw new ezcTemplateParserException($type->source,
$type->startCursor, $type->startCursor, "The *static* CustomBlock cannot have a
open and close tag.");
}
@@ -652,14 +652,14 @@
else
{
// If static.
- if( $def->isStatic )
+ if ( $def->isStatic )
{
$p = array();
// Check whether all values are static.
for( $i = 0; $i < sizeof( $params->value ); $i++)
{
- if( !($params->value[$i] instanceof
ezcTemplateLiteralAstNode ) )
+ if ( !($params->value[$i] instanceof
ezcTemplateLiteralAstNode ) )
{
throw new ezcTemplateParserException($type->source,
$type->startCursor, $type->startCursor, "The *static* CustomBlock needs static
parameters.");
}
Modified:
trunk/Template/src/parsers/tst_to_tst/implementations/cache_preparation.php
===================================================================
--- trunk/Template/src/parsers/tst_to_tst/implementations/cache_preparation.php
2007-05-04 12:35:36 UTC (rev 5048)
+++ trunk/Template/src/parsers/tst_to_tst/implementations/cache_preparation.php
2007-05-04 12:40:58 UTC (rev 5049)
@@ -31,7 +31,7 @@
if ( $symbolTable->retrieve( $node->variable->name ) ==
ezcTemplateSymbolTable::IMPORT )
{
- $this->useVariableTst[] =
$this->nodePath[0]->elements[$this->statements[0] + $this->offset[0]];
//$this->nodePath[0]->elements[0];
+ $this->useVariableTst[] =
$this->nodePath[0]->elements[$this->statements[0] + $this->offset[0]]; //
$this->nodePath[0]->elements[0];
array_splice( $this->nodePath[0]->elements, $this->statements[0] +
$this->offset[0], 1 );
$this->offset[0] -= 1;
}
Modified: trunk/Template/src/template.php
===================================================================
--- trunk/Template/src/template.php 2007-05-04 12:35:36 UTC (rev 5048)
+++ trunk/Template/src/template.php 2007-05-04 12:40:58 UTC (rev 5049)
@@ -265,7 +265,7 @@
$this->properties["astTree"] = false;
$this->properties["stream"] = $location;
- if( $location instanceof ezcTemplateLocationInterface)
+ if ( $location instanceof ezcTemplateLocationInterface)
{
$this->properties["file"] = $location;
$this->properties["stream"] = $location->getPath();
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components