Fixed indentation / code style

This commit is contained in:
majortom731 2014-03-17 16:41:54 +01:00
parent 41722af86d
commit 5257701669
2 changed files with 48 additions and 48 deletions

View File

@ -88,7 +88,7 @@ class Helpers
* @var $args array * @var $args array
* @var $source string * @var $source string
*/ */
if( is_numeric($args) ) { if ( is_numeric($args) ) {
$tmp = $args; $tmp = $args;
} else { } else {
$tmp = $context->get($args); $tmp = $context->get($args);

View File

@ -277,22 +277,22 @@ class Template
$subexprs = array(); // will contain all subexpressions inside outermost brackets $subexprs = array(); // will contain all subexpressions inside outermost brackets
$lvl = 0; $lvl = 0;
$cur_start = 0; $cur_start = 0;
for( $i=0; $i < strlen($params[2]); $i++ ) { for ( $i=0; $i < strlen($params[2]); $i++ ) {
$cur = substr( $params[2], $i, 1 ); $cur = substr($params[2], $i, 1);
if( $cur == '(' ) { if ( $cur == '(' ) {
if( $lvl == 0 ) $cur_start = $i+1; if( $lvl == 0 ) $cur_start = $i+1;
$lvl++; $lvl++;
} }
if( $cur == ')' ) { if ( $cur == ')' ) {
$lvl--; $lvl--;
if( $lvl == 0 ) $subexprs[] = substr( $params[2], $cur_start, $i - $cur_start); if( $lvl == 0 ) $subexprs[] = substr($params[2], $cur_start, $i - $cur_start);
} }
} }
if( ! empty( $subexprs ) ) { if ( ! empty( $subexprs ) ) {
foreach( $subexprs as $expr ) { foreach ( $subexprs as $expr ) {
$cmd = explode( " ", $expr ); $cmd = explode(" ", $expr);
$name = trim( $cmd[0] ); $name = trim($cmd[0]);
// construct artificial section node // construct artificial section node
$section_node = array( $section_node = array(
Tokenizer::TYPE => Tokenizer::T_ESCAPED, Tokenizer::TYPE => Tokenizer::T_ESCAPED,
@ -300,12 +300,12 @@ class Template
Tokenizer::OTAG => $current[Tokenizer::OTAG], Tokenizer::OTAG => $current[Tokenizer::OTAG],
Tokenizer::CTAG => $current[Tokenizer::CTAG], Tokenizer::CTAG => $current[Tokenizer::CTAG],
Tokenizer::INDEX => $current[Tokenizer::INDEX], Tokenizer::INDEX => $current[Tokenizer::INDEX],
Tokenizer::ARGS => implode( " ", array_slice( $cmd, 1 ) ) Tokenizer::ARGS => implode(" ", array_slice( $cmd, 1 ))
); );
// resolve the node recursively // resolve the node recursively
$resolved = $this->_handlebarsStyleSection( $context, $section_node ); $resolved = $this->_handlebarsStyleSection($context, $section_node);
// replace original subexpression with result // replace original subexpression with result
$params[2] = str_replace( '('.$expr.')', $resolved, $params[2] ); $params[2] = str_replace('('.$expr.')', $resolved, $params[2]);
} }
} }