@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | if (array_key_exists($p, $this->compat['properties']) !== false) { |
| 65 | 65 | if ($this->show_compat_errors) { |
| 66 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 66 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 67 | 67 | } |
| 68 | 68 | $this->compat['properties'][$p] = $v; |
| 69 | 69 | } else { |
| 70 | 70 | if ($this->show_compat_errors) { |
| 71 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 71 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | if (array_key_exists($p, $this->compat['properties']) !== false) { |
| 84 | 84 | if ($this->show_compat_errors) { |
| 85 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 85 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $this->compat['properties'][$p]; |
| 89 | 89 | } else { |
| 90 | 90 | if ($this->show_compat_errors) { |
| 91 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 91 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | ); |
| 111 | 111 | } elseif ($this->show_compat_errors) { |
| 112 | 112 | if (array_search($m, $this->compat['methods']) !== false) { |
| 113 | - $this->triggerError('Method ' . $m . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 113 | + $this->triggerError('Method '.$m.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 114 | 114 | } else { |
| 115 | - $this->triggerError('Method ' . $m . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 115 | + $this->triggerError('Method '.$m.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | if (isset($data[$name]) && is_object($data[$name])) { |
| 526 | 526 | return $data[$name]; |
| 527 | 527 | } else { |
| 528 | - trigger_error('Dwoo_Compiler: object "' . $name . '" was not registered or is not an object', E_USER_ERROR); |
|
| 528 | + trigger_error('Dwoo_Compiler: object "'.$name.'" was not registered or is not an object', E_USER_ERROR); |
|
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
@@ -537,10 +537,10 @@ discard block |
||
| 537 | 537 | public function template_exists($filename) |
| 538 | 538 | { |
| 539 | 539 | if (!is_array($this->template_dir)) { |
| 540 | - return file_exists($this->template_dir . DIRECTORY_SEPARATOR . $filename); |
|
| 540 | + return file_exists($this->template_dir.DIRECTORY_SEPARATOR.$filename); |
|
| 541 | 541 | } else { |
| 542 | 542 | foreach ($this->template_dir as $tpl_dir) { |
| 543 | - if (file_exists($tpl_dir . DIRECTORY_SEPARATOR . $filename)) { |
|
| 543 | + if (file_exists($tpl_dir.DIRECTORY_SEPARATOR.$filename)) { |
|
| 544 | 544 | return true; |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $compileId = $this->compile_id; |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | - $hash = bin2hex(md5($file . $cacheId . $compileId, true)); |
|
| 672 | + $hash = bin2hex(md5($file.$cacheId.$compileId, true)); |
|
| 673 | 673 | if (!isset(self::$tplCache[$hash])) { |
| 674 | 674 | // abs path |
| 675 | 675 | if (substr($file, 0, 1) === '/' || substr($file, 1, 1) === ':') { |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | } elseif (is_string($this->template_dir) || is_array($this->template_dir)) { |
| 678 | 678 | self::$tplCache[$hash] = new TemplateFile($file, null, $cacheId, $compileId, $this->template_dir); |
| 679 | 679 | } else { |
| 680 | - throw new Exception('Unable to load "' . $file . '", check the template_dir'); |
|
| 680 | + throw new Exception('Unable to load "'.$file.'", check the template_dir'); |
|
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | |
@@ -693,6 +693,6 @@ discard block |
||
| 693 | 693 | if (is_object($this->template)) { |
| 694 | 694 | parent::triggerError($message, $level); |
| 695 | 695 | } |
| 696 | - trigger_error('Dwoo error : ' . $message, $level); |
|
| 696 | + trigger_error('Dwoo error : '.$message, $level); |
|
| 697 | 697 | } |
| 698 | 698 | } |
@@ -79,24 +79,24 @@ |
||
| 79 | 79 | |
| 80 | 80 | $out = ''; |
| 81 | 81 | foreach ($params as $attr => $val) { |
| 82 | - $out .= ' ' . $attr . '='; |
|
| 82 | + $out .= ' '.$attr.'='; |
|
| 83 | 83 | if (trim($val, '"\'') == '' || $val == 'null') { |
| 84 | - $out .= str_replace($delim, '\\' . $delim, '""'); |
|
| 84 | + $out .= str_replace($delim, '\\'.$delim, '""'); |
|
| 85 | 85 | } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) { |
| 86 | - $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"'); |
|
| 86 | + $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"'); |
|
| 87 | 87 | } else { |
| 88 | 88 | if (!$compiler) { |
| 89 | 89 | // disable double encoding since it can not be determined if it was encoded |
| 90 | - $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).'; |
|
| 90 | + $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).'; |
|
| 91 | 91 | } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) { |
| 92 | 92 | // escape if auto escaping is disabled, or there was no variable in the string |
| 93 | - $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).'; |
|
| 93 | + $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).'; |
|
| 94 | 94 | } else { |
| 95 | 95 | // print as is |
| 96 | - $escapedVal = '.' . $val . '.'; |
|
| 96 | + $escapedVal = '.'.$val.'.'; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"'); |
|
| 99 | + $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"'); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type) |
| 90 | 90 | { |
| 91 | - return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE; |
|
| 91 | + return DwooCompiler::PHP_OPEN.$prepend.'$this->addStack("'.$type.'", array('.DwooCompiler::implode_r($compiler->getCompiledParams($params)).'));'.$append.DwooCompiler::PHP_CLOSE; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -114,6 +114,6 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content) |
| 116 | 116 | { |
| 117 | - return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE; |
|
| 117 | + return $content.DwooCompiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.DwooCompiler::PHP_CLOSE; |
|
| 118 | 118 | } |
| 119 | 119 | } |
@@ -38,38 +38,38 @@ discard block |
||
| 38 | 38 | $rl = preg_quote($l, '/'); |
| 39 | 39 | $rr = preg_quote($r, '/'); |
| 40 | 40 | $sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*'; |
| 41 | - $input = preg_replace_callback('/' . $rl . '\s*section ' . str_repeat($sectionParam, 6) . '\s*' . $rr . '(.+?)(?:' . $rl . '\s*sectionelse\s*' . $rr . '(.+?))?' . $rl . '\s*\/section\s*' . $rr . '/is', array( |
|
| 41 | + $input = preg_replace_callback('/'.$rl.'\s*section '.str_repeat($sectionParam, 6).'\s*'.$rr.'(.+?)(?:'.$rl.'\s*sectionelse\s*'.$rr.'(.+?))?'.$rl.'\s*\/section\s*'.$rr.'/is', array( |
|
| 42 | 42 | $this, |
| 43 | 43 | 'convertSection' |
| 44 | 44 | ), $input); |
| 45 | - $input = str_replace('$smarty.section.', '$smarty.for.', $input); |
|
| 45 | + $input = str_replace('$smarty.section.', '$smarty.for.', $input); |
|
| 46 | 46 | |
| 47 | 47 | $smarty = array( |
| 48 | - '/' . $rl . '\s*ldelim\s*' . $rr . '/', |
|
| 49 | - '/' . $rl . '\s*rdelim\s*' . $rr . '/', |
|
| 50 | - '/' . $rl . '\s*\$smarty\.ldelim\s*' . $rr . '/', |
|
| 51 | - '/' . $rl . '\s*\$smarty\.rdelim\s*' . $rr . '/', |
|
| 48 | + '/'.$rl.'\s*ldelim\s*'.$rr.'/', |
|
| 49 | + '/'.$rl.'\s*rdelim\s*'.$rr.'/', |
|
| 50 | + '/'.$rl.'\s*\$smarty\.ldelim\s*'.$rr.'/', |
|
| 51 | + '/'.$rl.'\s*\$smarty\.rdelim\s*'.$rr.'/', |
|
| 52 | 52 | '/\$smarty\./', |
| 53 | - '/' . $rl . '\s*php\s*' . $rr . '/', |
|
| 54 | - '/' . $rl . '\s*\/php\s*' . $rr . '/', |
|
| 55 | - '/\|(@?)strip(\||' . $rr . ')/', |
|
| 56 | - '/' . $rl . '\s*sectionelse\s*' . $rr . '/', |
|
| 53 | + '/'.$rl.'\s*php\s*'.$rr.'/', |
|
| 54 | + '/'.$rl.'\s*\/php\s*'.$rr.'/', |
|
| 55 | + '/\|(@?)strip(\||'.$rr.')/', |
|
| 56 | + '/'.$rl.'\s*sectionelse\s*'.$rr.'/', |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | $dwoo = array( |
| 60 | - '\\' . $l, |
|
| 60 | + '\\'.$l, |
|
| 61 | 61 | $r, |
| 62 | - '\\' . $l, |
|
| 62 | + '\\'.$l, |
|
| 63 | 63 | $r, |
| 64 | 64 | '$dwoo.', |
| 65 | 65 | '<?php ', |
| 66 | 66 | ' ?>', |
| 67 | 67 | '|$1whitespace$2', |
| 68 | - $l . 'else' . $r, |
|
| 68 | + $l.'else'.$r, |
|
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) { |
| 72 | - trigger_error('The Smarty Compatibility Module has detected that you use |@' . $matches[1] . ' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE); |
|
| 72 | + trigger_error('The Smarty Compatibility Module has detected that you use |@'.$matches[1].' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return preg_replace($smarty, $dwoo, $input); |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | $params = array(); |
| 86 | 86 | $index = 1; |
| 87 | 87 | while (!empty($matches[$index]) && $index < 13) { |
| 88 | - $params[$matches[$index]] = $matches[$index + 1]; |
|
| 88 | + $params[$matches[$index]] = $matches[$index+1]; |
|
| 89 | 89 | $index += 2; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - return str_replace('[' . trim($params['name'], '"\'') . ']', '[$' . trim($params['name'], '"\'') . ']', $matches[0]); |
|
| 92 | + return str_replace('['.trim($params['name'], '"\'').']', '[$'.trim($params['name'], '"\'').']', $matches[0]); |
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -74,10 +74,10 @@ |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | if ($advance) { |
| 77 | - if ($this->cycles[$name]['index'] >= count($values) - 1) { |
|
| 77 | + if ($this->cycles[$name]['index'] >= count($values)-1) { |
|
| 78 | 78 | $this->cycles[$name]['index'] = 0; |
| 79 | 79 | } else { |
| 80 | - ++ $this->cycles[$name]['index']; |
|
| 80 | + ++$this->cycles[$name]['index']; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -51,35 +51,35 @@ |
||
| 51 | 51 | // init counter |
| 52 | 52 | if (!isset($this->counters[$name])) { |
| 53 | 53 | $this->counters[$name] = array( |
| 54 | - 'count' => $start === null ? 1 : (int)$start, |
|
| 55 | - 'skip' => $skip === null ? 1 : (int)$skip, |
|
| 56 | - 'print' => $print === null ? true : (bool)$print, |
|
| 57 | - 'assign' => $assign === null ? null : (string)$assign, |
|
| 58 | - 'direction' => strtolower($direction) === 'down' ? - 1 : 1, |
|
| 54 | + 'count' => $start === null ? 1 : (int) $start, |
|
| 55 | + 'skip' => $skip === null ? 1 : (int) $skip, |
|
| 56 | + 'print' => $print === null ? true : (bool) $print, |
|
| 57 | + 'assign' => $assign === null ? null : (string) $assign, |
|
| 58 | + 'direction' => strtolower($direction) === 'down' ? -1 : 1, |
|
| 59 | 59 | ); |
| 60 | 60 | } // increment |
| 61 | 61 | else { |
| 62 | 62 | // override setting if present |
| 63 | 63 | if ($skip !== null) { |
| 64 | - $this->counters[$name]['skip'] = (int)$skip; |
|
| 64 | + $this->counters[$name]['skip'] = (int) $skip; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if ($direction !== null) { |
| 68 | - $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? - 1 : 1; |
|
| 68 | + $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? -1 : 1; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | if ($print !== null) { |
| 72 | - $this->counters[$name]['print'] = (bool)$print; |
|
| 72 | + $this->counters[$name]['print'] = (bool) $print; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if ($assign !== null) { |
| 76 | - $this->counters[$name]['assign'] = (string)$assign; |
|
| 76 | + $this->counters[$name]['assign'] = (string) $assign; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if ($start !== null) { |
| 80 | - $this->counters[$name]['count'] = (int)$start; |
|
| 80 | + $this->counters[$name]['count'] = (int) $start; |
|
| 81 | 81 | } else { |
| 82 | - $this->counters[$name]['count'] += ($this->counters[$name]['skip'] * $this->counters[$name]['direction']); |
|
| 82 | + $this->counters[$name]['count'] += ($this->counters[$name]['skip']*$this->counters[$name]['direction']); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $block = &$compiler->getCurrentBlock(); |
| 69 | - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; |
|
| 69 | + $block['params']['hasElse'] = Compiler::PHP_OPEN."else {\n".Compiler::PHP_CLOSE.$content.Compiler::PHP_OPEN."\n}".Compiler::PHP_CLOSE; |
|
| 70 | 70 | |
| 71 | 71 | return ''; |
| 72 | 72 | } |
@@ -58,26 +58,26 @@ discard block |
||
| 58 | 58 | $callback = $customPlugins[$func]['callback']; |
| 59 | 59 | if (is_array($callback)) { |
| 60 | 60 | if (is_object($callback[0])) { |
| 61 | - $callback = '$this->customPlugins[\'' . $func . '\'][0]->' . $callback[1] . '('; |
|
| 61 | + $callback = '$this->customPlugins[\''.$func.'\'][0]->'.$callback[1].'('; |
|
| 62 | 62 | } else { |
| 63 | - $callback = '' . $callback[0] . '::' . $callback[1] . '('; |
|
| 63 | + $callback = ''.$callback[0].'::'.$callback[1].'('; |
|
| 64 | 64 | } |
| 65 | 65 | } else { |
| 66 | - $callback = $callback . '('; |
|
| 66 | + $callback = $callback.'('; |
|
| 67 | 67 | } |
| 68 | 68 | } else { |
| 69 | - $callback = 'smarty_block_' . $func . '('; |
|
| 69 | + $callback = 'smarty_block_'.$func.'('; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $paramsOut = ''; |
| 73 | 73 | foreach ($params as $i => $p) { |
| 74 | - $paramsOut .= var_export($i, true) . ' => ' . $p . ','; |
|
| 74 | + $paramsOut .= var_export($i, true).' => '.$p.','; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $curBlock = &$compiler->getCurrentBlock(); |
| 78 | - $curBlock['params']['postOut'] = Compiler::PHP_OPEN . ' $_block_content = ob_get_clean(); $_block_repeat=false; echo ' . $callback . '$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);' . Compiler::PHP_CLOSE; |
|
| 78 | + $curBlock['params']['postOut'] = Compiler::PHP_OPEN.' $_block_content = ob_get_clean(); $_block_repeat=false; echo '.$callback.'$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);'.Compiler::PHP_CLOSE; |
|
| 79 | 79 | |
| 80 | - return Compiler::PHP_OPEN . $prepend . ' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(' . $paramsOut . '); $_block_repeat=true; ' . $callback . '$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();' . Compiler::PHP_CLOSE; |
|
| 80 | + return Compiler::PHP_OPEN.$prepend.' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array('.$paramsOut.'); $_block_repeat=true; '.$callback.'$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();'.Compiler::PHP_CLOSE; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -91,6 +91,6 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) |
| 93 | 93 | { |
| 94 | - return $content . $params['postOut']; |
|
| 94 | + return $content.$params['postOut']; |
|
| 95 | 95 | } |
| 96 | 96 | } |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | catch (CompilationException $e) { |
| 69 | 69 | } |
| 70 | - $output = Compiler::PHP_OPEN . 'if($doCache) {' . "\n\t" . 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>' . str_replace('\'', '\\\'', $content) . '</dwoo:dynamic_\'.$dynamicId.\'>\';' . "\n} else {\n\t"; |
|
| 70 | + $output = Compiler::PHP_OPEN.'if($doCache) {'."\n\t".'echo \'<dwoo:dynamic_\'.$dynamicId.\'>'.str_replace('\'', '\\\'', $content).'</dwoo:dynamic_\'.$dynamicId.\'>\';'."\n} else {\n\t"; |
|
| 71 | 71 | if (substr($content, 0, strlen(Compiler::PHP_OPEN)) == Compiler::PHP_OPEN) { |
| 72 | 72 | $output .= substr($content, strlen(Compiler::PHP_OPEN)); |
| 73 | 73 | } else { |
| 74 | - $output .= Compiler::PHP_CLOSE . $content; |
|
| 74 | + $output .= Compiler::PHP_CLOSE.$content; |
|
| 75 | 75 | } |
| 76 | 76 | if (substr($output, - strlen(Compiler::PHP_CLOSE)) == Compiler::PHP_CLOSE) { |
| 77 | 77 | $output = substr($output, 0, - strlen(Compiler::PHP_CLOSE)); |
| 78 | 78 | } else { |
| 79 | 79 | $output .= Compiler::PHP_OPEN; |
| 80 | 80 | } |
| 81 | - $output .= "\n}" . Compiler::PHP_CLOSE; |
|
| 81 | + $output .= "\n}".Compiler::PHP_CLOSE; |
|
| 82 | 82 | |
| 83 | 83 | return $output; |
| 84 | 84 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public static function unescape($output, $dynamicId, $compiledFile) |
| 94 | 94 | { |
| 95 | - $output = preg_replace_callback('/<dwoo:dynamic_(' . $dynamicId . ')>(.+?)<\/dwoo:dynamic_' . $dynamicId . '>/s', array( |
|
| 95 | + $output = preg_replace_callback('/<dwoo:dynamic_('.$dynamicId.')>(.+?)<\/dwoo:dynamic_'.$dynamicId.'>/s', array( |
|
| 96 | 96 | 'self', |
| 97 | 97 | 'unescapePhp' |
| 98 | 98 | ), $output, - 1, $count); |
| 99 | 99 | // re-add the includes on top of the file |
| 100 | 100 | if ($count && preg_match('#/\* template head \*/(.+?)/\* end template head \*/#s', file_get_contents($compiledFile), $m)) { |
| 101 | - $output = '<?php ' . $m[1] . ' ?>' . $output; |
|
| 101 | + $output = '<?php '.$m[1].' ?>'.$output; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return $output; |
@@ -111,6 +111,6 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public static function unescapePhp($match) |
| 113 | 113 | { |
| 114 | - return preg_replace('{<\?php /\*' . $match[1] . '\*/ echo \'(.+?)\'; \?>}s', '$1', $match[2]); |
|
| 114 | + return preg_replace('{<\?php /\*'.$match[1].'\*/ echo \'(.+?)\'; \?>}s', '$1', $match[2]); |
|
| 115 | 115 | } |
| 116 | 116 | } |