mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-04-11 01:00:11 +03:00
Fixed indentation / code style
This commit is contained in:
parent
41722af86d
commit
5257701669
@ -88,7 +88,7 @@ class Helpers
|
||||
* @var $args array
|
||||
* @var $source string
|
||||
*/
|
||||
if( is_numeric($args) ) {
|
||||
if ( is_numeric($args) ) {
|
||||
$tmp = $args;
|
||||
} else {
|
||||
$tmp = $context->get($args);
|
||||
|
@ -277,22 +277,22 @@ class Template
|
||||
$subexprs = array(); // will contain all subexpressions inside outermost brackets
|
||||
$lvl = 0;
|
||||
$cur_start = 0;
|
||||
for( $i=0; $i < strlen($params[2]); $i++ ) {
|
||||
$cur = substr( $params[2], $i, 1 );
|
||||
if( $cur == '(' ) {
|
||||
for ( $i=0; $i < strlen($params[2]); $i++ ) {
|
||||
$cur = substr($params[2], $i, 1);
|
||||
if ( $cur == '(' ) {
|
||||
if( $lvl == 0 ) $cur_start = $i+1;
|
||||
$lvl++;
|
||||
}
|
||||
if( $cur == ')' ) {
|
||||
if ( $cur == ')' ) {
|
||||
$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 ) ) {
|
||||
foreach( $subexprs as $expr ) {
|
||||
$cmd = explode( " ", $expr );
|
||||
$name = trim( $cmd[0] );
|
||||
if ( ! empty( $subexprs ) ) {
|
||||
foreach ( $subexprs as $expr ) {
|
||||
$cmd = explode(" ", $expr);
|
||||
$name = trim($cmd[0]);
|
||||
// construct artificial section node
|
||||
$section_node = array(
|
||||
Tokenizer::TYPE => Tokenizer::T_ESCAPED,
|
||||
@ -300,12 +300,12 @@ class Template
|
||||
Tokenizer::OTAG => $current[Tokenizer::OTAG],
|
||||
Tokenizer::CTAG => $current[Tokenizer::CTAG],
|
||||
Tokenizer::INDEX => $current[Tokenizer::INDEX],
|
||||
Tokenizer::ARGS => implode( " ", array_slice( $cmd, 1 ) )
|
||||
Tokenizer::ARGS => implode(" ", array_slice( $cmd, 1 ))
|
||||
);
|
||||
// resolve the node recursively
|
||||
$resolved = $this->_handlebarsStyleSection( $context, $section_node );
|
||||
$resolved = $this->_handlebarsStyleSection($context, $section_node);
|
||||
// replace original subexpression with result
|
||||
$params[2] = str_replace( '('.$expr.')', $resolved, $params[2] );
|
||||
$params[2] = str_replace('('.$expr.')', $resolved, $params[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user