Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CS: removing some temporary variables making debugging harder

  • Loading branch information...
commit 3c35e5f7ecfdf9bb83f33ff75a131997c751f58d 1 parent e858487
@patrickallaert patrickallaert authored
Showing with 22 additions and 31 deletions.
  1. +22 −31 kernel/common/ezobjectforwarder.php
View
53 kernel/common/ezobjectforwarder.php
@@ -81,7 +81,6 @@ function templateNodeTransformation( $functionName, &$node,
$viewName = false;
if ( $rule['use_views'] )
{
- $optionalViews = isset( $rule['optional_views'] ) ? $rule['optional_views'] : false;
$viewName = $rule['use_views'];
if ( isset( $parameters[$viewName] ) )
{
@@ -95,7 +94,7 @@ function templateNodeTransformation( $functionName, &$node,
}
else
{
- if ( !$optionalViews )
+ if ( !( isset( $rule['optional_views'] ) && $rule['optional_views'] ) )
{
return false;
}
@@ -120,8 +119,8 @@ function templateNodeTransformation( $functionName, &$node,
$parameterName == $outputName or
$parameterName == $viewName )
continue;
- $parameterData = $parameters[$parameterName];
- $newNodes[] = eZTemplateNodeTool::createVariableNode( false, $parameterData, false, array(),
+
+ $newNodes[] = eZTemplateNodeTool::createVariableNode( false, $parameters[$parameterName], false, array(),
array( $namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE, $parameterName ) );
$variableList[] = $parameterName;
}
@@ -147,20 +146,17 @@ function templateNodeTransformation( $functionName, &$node,
isset( $templateRoot['attributes'] ) and
isset( $templateRoot['matches'] ) )
{
- $rootAttributes = $templateRoot['attributes'];
$attributeAccessData = array();
$attributeAccessData[] = eZTemplateNodeTool::createVariableElement( $outputName, $namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE );
- foreach ( $rootAttributes as $rootAttributeName )
+ foreach ( $templateRoot['attributes'] as $rootAttributeName )
{
$attributeAccessData[] = eZTemplateNodeTool::createAttributeLookupElement( $rootAttributeName );
}
$newNodes[] = eZTemplateNodeTool::createVariableNode( false, $attributeAccessData, false,
array( 'spacing' => 0 ), 'templateRootMatch' );
- $rootMatches = $templateRoot['matches'];
$rootMatchCounter = 0;
- foreach ( $rootMatches as $rootMatch )
+ foreach ( $templateRoot['matches'] as $rootMatch )
{
- $rootMatchValue = $rootMatch[0];
$templateRoot = $rootMatch[1];
$resourceNodes = $this->resourceAcquisitionTransformation( $functionName, $node, $rule, $inputData,
@@ -172,7 +168,7 @@ function templateNodeTransformation( $functionName, &$node,
if ( $resourceNodes === false )
continue;
- $rootMatchValueText = eZPHPCreator::variableText( $rootMatchValue, 0, 0, false );
+ $rootMatchValueText = eZPHPCreator::variableText( $rootMatch[0], 0, 0, false );
$code = '';
if ( $rootMatchCounter > 0 )
{
@@ -220,8 +216,7 @@ function resourceAcquisitionTransformation( $functionName, &$node, $rule, $input
continue;
$path = $matchFile['template'];
- $subPath = substr( $path, 0, $startRootLength );
- if ( $subPath == $startRoot and
+ if ( substr( $path, 0, $startRootLength ) == $startRoot and
$path[$startRootLength] == '/' )
{
$matchFile['match_part'] = substr( $path, $startRootLength + 1 );
@@ -238,14 +233,13 @@ function resourceAcquisitionTransformation( $functionName, &$node, $rule, $input
"}", array( 'spacing' => $acquisitionSpacing ) );
if ( isset( $rule["attribute_keys"] ) )
{
- $attributeKeys = $rule["attribute_keys"];
$newNodes[] = eZTemplateNodeTool::createCodePieceNode( "if " . ( $resourceData['use-comments'] ? ( "/*OF:" . __LINE__ . "*/" ) : "" ) . "( !isset( \$" . $designKeysName . "Stack ) )\n" .
"{\n" .
" \$" . $designKeysName . "Stack = array();\n" .
"}\n" .
"\$" . $designKeysName . "Stack[] = \$$designKeysName;",
array( 'spacing' => $acquisitionSpacing ) );
- foreach ( $attributeKeys as $designKey => $attributeKeyArray )
+ foreach ( $rule["attribute_keys"] as $designKey => $attributeKeyArray )
{
$attributeAccessData = array();
$attributeAccessData[] = eZTemplateNodeTool::createVariableElement( $outputName, $namespaceValue, eZTemplate::NAMESPACE_SCOPE_RELATIVE );
@@ -314,9 +308,8 @@ function resourceAcquisitionTransformation( $functionName, &$node, $rule, $input
{
$customSpacing = $spacing + 4;
$defaultMatchSpacing = $spacing + 4;
- $customMatchList = $matchItem['custom_match'];
$matchCount = 0;
- foreach ( $customMatchList as $customMatch )
+ foreach ( $matchItem['custom_match'] as $customMatch )
{
$matchConditionCount = count( $customMatch['conditions'] );
$code = '';
@@ -478,9 +471,8 @@ function resourceAcquisitionTransformation( $functionName, &$node, $rule, $input
if ( isset( $viewFileMatch['custom_match'] ) )
{
$spacing = $mainSpacing + 4;
- $customMatchList = $viewFileMatch['custom_match'];
$matchCount = 0;
- foreach ( $customMatchList as $customMatch )
+ foreach ( $viewFileMatch['custom_match'] as $customMatch )
{
$matchConditionCount = count( $customMatch['conditions'] );
$code = '';
@@ -651,11 +643,9 @@ function process( $tpl, &$textElements, $functionName, $functionChildren, $funct
if ( isset( $rule['attribute_keys'] ) )
{
$resourceKeys = array();
- $attributeKeys = $rule['attribute_keys'];
- foreach( $attributeKeys as $attributeKey => $attributeSelection )
+ foreach( $rule['attribute_keys'] as $attributeKey => $attributeSelection )
{
- $keyValue = $tpl->variableAttribute( $input_var, $attributeSelection );
- $resourceKeys[] = array( $attributeKey, $keyValue );
+ $resourceKeys[] = array( $attributeKey, $tpl->variableAttribute( $input_var, $attributeSelection ) );
}
}
@@ -681,18 +671,16 @@ function process( $tpl, &$textElements, $functionName, $functionChildren, $funct
else
{
$templateRootValue = $tpl->variableAttribute( $input_var, $templateRoot['attributes'] );
- $templateRootMatches = $templateRoot['matches'];
- foreach ( $templateRootMatches as $templateRootMatch )
+ foreach ( $templateRoot['matches'] as $templateRootMatch )
{
if ( $templateRootMatch[0] == $templateRootValue )
{
$template_dir = $templateRootMatch[1];
if ( is_array( $template_dir ) )
{
- $templateDirAttributesList = $template_dir[1];
$template_dir = $template_dir[0];
$attributeValues = array();
- foreach ( $templateDirAttributesList as $templateDirAttributes )
+ foreach ( $template_dir[1] as $templateDirAttributes )
{
$attributeValues[] = $tpl->variableAttribute( $input_var, $templateDirAttributes );
}
@@ -709,7 +697,6 @@ function process( $tpl, &$textElements, $functionName, $functionChildren, $funct
}
$resourceData = null;
- $root = null;
if ( is_array( $attributeAccess ) )
{
foreach( $attributeAccess as $attributeAccessArray )
@@ -759,8 +746,13 @@ function process( $tpl, &$textElements, $functionName, $functionChildren, $funct
{
continue;
}
- $paramValue = $tpl->elementValue( $params[$paramName], $old_nspace, $currentNamespace, $functionPlacement );
- $tpl->setVariable( $paramName, $paramValue, $outCurrentNamespace, true );
+
+ $tpl->setVariable(
+ $paramName,
+ $tpl->elementValue( $params[$paramName], $old_nspace, $currentNamespace, $functionPlacement ),
+ $outCurrentNamespace,
+ true
+ );
$setVariableArray[] = $paramName;
}
// Set constant variables
@@ -786,8 +778,7 @@ function process( $tpl, &$textElements, $functionName, $functionChildren, $funct
if ( !$templateCompilationUsed and
$resourceData['root-node'] )
{
- $root = $resourceData['root-node'];
- $tpl->process( $root, $sub_text, $outCurrentNamespace, $outCurrentNamespace );
+ $tpl->process( $resourceData['root-node'], $sub_text, $outCurrentNamespace, $outCurrentNamespace );
$tpl->setIncludeOutput( $uri, $sub_text );
$textElements[] = $sub_text;
Please sign in to comment.
Something went wrong with that request. Please try again.