@@ -43,21 +43,19 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $this->ext = '.tpl'; |
| 45 | 45 | |
| 46 | - $this->_sv_template_dir = array |
|
| 47 | - ( |
|
| 48 | - VIEWS . $this->viewPath . DS . $this->subDir, |
|
| 49 | - VIEWS . $this->viewPath, |
|
| 46 | + $this->_sv_template_dir = array( |
|
| 47 | + VIEWS.$this->viewPath.DS.$this->subDir, |
|
| 48 | + VIEWS.$this->viewPath, |
|
| 50 | 49 | VIEWS |
| 51 | 50 | ); |
| 52 | 51 | |
| 53 | - $this->_sv_layout_dir = array |
|
| 54 | - ( |
|
| 55 | - LAYOUTS . $this->subDir, |
|
| 52 | + $this->_sv_layout_dir = array( |
|
| 53 | + LAYOUTS.$this->subDir, |
|
| 56 | 54 | VIEWS |
| 57 | 55 | ); |
| 58 | 56 | |
| 59 | - $this->_sv_compile_dir = TMP . 'dwoo' . DS . 'compile'; |
|
| 60 | - $this->_sv_cache_dir = TMP . 'dwoo' . DS . 'cache'; |
|
| 57 | + $this->_sv_compile_dir = TMP.'dwoo'.DS.'compile'; |
|
| 58 | + $this->_sv_cache_dir = TMP.'dwoo'.DS.'cache'; |
|
| 61 | 59 | |
| 62 | 60 | $this->_dwoo = new Dwoo_Core($this->_sv_compile_dir, $this->_sv_cache_dir); |
| 63 | 61 | |
@@ -74,13 +72,13 @@ discard block |
||
| 74 | 72 | */ |
| 75 | 73 | public function setTemplateDir($path = VIEW) { |
| 76 | 74 | $old = $this->_sv_template_dir; |
| 77 | - $this->_sv_template_dir = $path; |
|
| 75 | + $this->_sv_template_dir = $path; |
|
| 78 | 76 | |
| 79 | 77 | return $old; |
| 80 | 78 | } |
| 81 | 79 | |
| 82 | 80 | public function getTemplateDir() { |
| 83 | - return $this->_sv_template_dir ; |
|
| 81 | + return $this->_sv_template_dir; |
|
| 84 | 82 | } |
| 85 | 83 | |
| 86 | 84 | public function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true) |
@@ -88,7 +86,7 @@ discard block |
||
| 88 | 86 | // let's determine if this is a layout call or a template call |
| 89 | 87 | // and change the template dir accordingly |
| 90 | 88 | $layout = false; |
| 91 | - if(isset($___data_for_view['content_for_layout'])) { |
|
| 89 | + if (isset($___data_for_view['content_for_layout'])) { |
|
| 92 | 90 | $this->_sv_template_dir = $this->_sv_layout_dir; |
| 93 | 91 | $layout = true; |
| 94 | 92 | } |
@@ -103,7 +101,7 @@ discard block |
||
| 103 | 101 | $loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers); |
| 104 | 102 | |
| 105 | 103 | foreach (array_keys($loadedHelpers) as $helper) { |
| 106 | - $camelBackedHelper = strtolower(substr($helper, 0, 1)) . substr($helper, 1); |
|
| 104 | + $camelBackedHelper = strtolower(substr($helper, 0, 1)).substr($helper, 1); |
|
| 107 | 105 | |
| 108 | 106 | ${$camelBackedHelper} = $loadedHelpers[$helper]; |
| 109 | 107 | |
@@ -114,7 +112,7 @@ discard block |
||
| 114 | 112 | } |
| 115 | 113 | } |
| 116 | 114 | |
| 117 | - if(isset($this->passedArgs)) { |
|
| 115 | + if (isset($this->passedArgs)) { |
|
| 118 | 116 | ${$camelBackedHelper}->passedArgs = $this->passedArgs; |
| 119 | 117 | } |
| 120 | 118 | |
@@ -137,7 +135,7 @@ discard block |
||
| 137 | 135 | return $this->_dwoo->get($tpl, $data); |
| 138 | 136 | } |
| 139 | 137 | |
| 140 | - public function get(){ |
|
| 138 | + public function get() { |
|
| 141 | 139 | return $this->_dwoo; |
| 142 | 140 | } |
| 143 | 141 | } |
| 144 | 142 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type) |
| 24 | 24 | { |
| 25 | - $with =& $compiler->findBlock('for', true); |
|
| 25 | + $with = & $compiler->findBlock('for', true); |
|
| 26 | 26 | |
| 27 | 27 | $params['initialized'] = true; |
| 28 | 28 | $compiler->injectBlock($type, $params); |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | return ''; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - $block =& $compiler->getCurrentBlock(); |
|
| 40 | - $block['params']['hasElse'] = Dwoo_Compiler::PHP_OPEN."else {\n".Dwoo_Compiler::PHP_CLOSE . $content . Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE; |
|
| 39 | + $block = & $compiler->getCurrentBlock(); |
|
| 40 | + $block['params']['hasElse'] = Dwoo_Compiler::PHP_OPEN."else {\n".Dwoo_Compiler::PHP_CLOSE.$content.Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE; |
|
| 41 | 41 | return ''; |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | protected $indFirst; |
| 35 | 35 | protected $assign; |
| 36 | 36 | |
| 37 | - public function init($wrap=80, $wrap_char="\r\n", $wrap_cut=false, $indent=0, $indent_char=" ", $indent_first=0, $style="", $assign="") |
|
| 37 | + public function init($wrap = 80, $wrap_char = "\r\n", $wrap_cut = false, $indent = 0, $indent_char = " ", $indent_first = 0, $style = "", $assign = "") |
|
| 38 | 38 | { |
| 39 | 39 | if ($indent_char === 'tab') { |
| 40 | 40 | $indent_char = "\t"; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - switch($style) { |
|
| 43 | + switch ($style) { |
|
| 44 | 44 | |
| 45 | 45 | case 'email': |
| 46 | 46 | $wrap = 72; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | break; |
| 49 | 49 | case 'html': |
| 50 | 50 | $wrap_char = '<br />'; |
| 51 | - $indent_char = $indent_char == "\t" ? ' ':' '; |
|
| 51 | + $indent_char = $indent_char == "\t" ? ' ' : ' '; |
|
| 52 | 52 | break; |
| 53 | 53 | |
| 54 | 54 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->wrapCut = (bool) $wrap_cut; |
| 59 | 59 | $this->indent = (int) $indent; |
| 60 | 60 | $this->indChar = (string) $indent_char; |
| 61 | - $this->indFirst = (int) $indent_first + $this->indent; |
|
| 61 | + $this->indFirst = (int) $indent_first+$this->indent; |
|
| 62 | 62 | $this->assign = (string) $assign; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -76,19 +76,19 @@ discard block |
||
| 76 | 76 | $pgs[$i] = preg_replace(array('#\s+#', '#^\s*(.+?)\s*$#m'), array(' ', '$1'), str_replace("\n", '', $pgs[$i])); |
| 77 | 77 | |
| 78 | 78 | // wordwraps + indents lines |
| 79 | - $pgs[$i] = str_repeat($this->indChar, $this->indFirst) . |
|
| 79 | + $pgs[$i] = str_repeat($this->indChar, $this->indFirst). |
|
| 80 | 80 | wordwrap( |
| 81 | 81 | $pgs[$i], |
| 82 | - max($this->wrap - $this->indent, 1), |
|
| 83 | - $this->wrapChar . str_repeat($this->indChar, $this->indent), |
|
| 82 | + max($this->wrap-$this->indent, 1), |
|
| 83 | + $this->wrapChar.str_repeat($this->indChar, $this->indent), |
|
| 84 | 84 | $this->wrapCut |
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if ($this->assign !== '') { |
| 89 | - $this->dwoo->assignInScope(implode($this->wrapChar . $this->wrapChar, $pgs), $this->assign); |
|
| 89 | + $this->dwoo->assignInScope(implode($this->wrapChar.$this->wrapChar, $pgs), $this->assign); |
|
| 90 | 90 | } else { |
| 91 | - return implode($this->wrapChar . $this->wrapChar, $pgs); |
|
| 91 | + return implode($this->wrapChar.$this->wrapChar, $pgs); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Dwoo_Plugin_smartyinterface extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block |
| 18 | 18 | { |
| 19 | - public function init($__funcname, $__functype, array $rest=array()) {} |
|
| 19 | + public function init($__funcname, $__functype, array $rest = array()) {} |
|
| 20 | 20 | |
| 21 | 21 | public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type) |
| 22 | 22 | { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $paramsOut .= var_export($i, true).' => '.$p.','; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $curBlock =& $compiler->getCurrentBlock(); |
|
| 49 | + $curBlock = & $compiler->getCurrentBlock(); |
|
| 50 | 50 | $curBlock['params']['postOut'] = Dwoo_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);'.Dwoo_Compiler::PHP_CLOSE; |
| 51 | 51 | |
| 52 | 52 | return Dwoo_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();'.Dwoo_Compiler::PHP_CLOSE; |
@@ -54,6 +54,6 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
| 56 | 56 | { |
| 57 | - return $content . $params['postOut']; |
|
| 57 | + return $content.$params['postOut']; |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class Dwoo_Plugin_a extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block |
| 36 | 36 | { |
| 37 | - public function init($href, array $rest=array()) |
|
| 37 | + public function init($href, array $rest = array()) |
|
| 38 | 38 | { |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $p = $compiler->getCompiledParams($params); |
| 44 | 44 | |
| 45 | - $out = Dwoo_Compiler::PHP_OPEN . 'echo \'<a '.self::paramsToAttributes($p, "'", $compiler); |
|
| 45 | + $out = Dwoo_Compiler::PHP_OPEN.'echo \'<a '.self::paramsToAttributes($p, "'", $compiler); |
|
| 46 | 46 | |
| 47 | - return $out.'>\';' . Dwoo_Compiler::PHP_CLOSE; |
|
| 47 | + return $out.'>\';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | if ($content == "") { |
| 56 | 56 | // merge </a> into the href if href is a string |
| 57 | 57 | if (substr($p['href'], -1) === '"' || substr($p['href'], -1) === '\'') { |
| 58 | - return Dwoo_Compiler::PHP_OPEN . 'echo '.substr($p['href'], 0, -1).'</a>'.substr($p['href'], -1).';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 58 | + return Dwoo_Compiler::PHP_OPEN.'echo '.substr($p['href'], 0, -1).'</a>'.substr($p['href'], -1).';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 59 | 59 | } |
| 60 | 60 | // otherwise append |
| 61 | - return Dwoo_Compiler::PHP_OPEN . 'echo '.$p['href'].'.\'</a>\';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 61 | + return Dwoo_Compiler::PHP_OPEN.'echo '.$p['href'].'.\'</a>\';'.Dwoo_Compiler::PHP_CLOSE; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // return content |
| 65 | - return $content . '</a>'; |
|
| 65 | + return $content.'</a>'; |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -37,13 +37,13 @@ |
||
| 37 | 37 | switch ($mode) { |
| 38 | 38 | case 'js': |
| 39 | 39 | case 'javascript': |
| 40 | - $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s','', $content); |
|
| 40 | + $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s', '', $content); |
|
| 41 | 41 | |
| 42 | 42 | case 'default': |
| 43 | 43 | default: |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $content = preg_replace(array("/\n/","/\r/",'/(<\?(?:php)?|<%)\s*/'), array('','','$1 '), preg_replace('#^\s*(.+?)\s*$#m', '$1', $content)); |
|
| 46 | + $content = preg_replace(array("/\n/", "/\r/", '/(<\?(?:php)?|<%)\s*/'), array('', '', '$1 '), preg_replace('#^\s*(.+?)\s*$#m', '$1', $content)); |
|
| 47 | 47 | |
| 48 | 48 | return $content; |
| 49 | 49 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Dwoo_Plugin_section extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block, Dwoo_IElseable |
| 18 | 18 | { |
| 19 | - public static $cnt=0; |
|
| 19 | + public static $cnt = 0; |
|
| 20 | 20 | |
| 21 | 21 | public function init($name, $loop, $start = null, $step = null, $max = null, $show = true) |
| 22 | 22 | { |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | $output .= "\t\t".'$_section'.$cnt.'[\'first\'] = ($_section'.$cnt.'[\'iteration\'] == 1);'."\n"; |
| 119 | 119 | $output .= "\t\t".'$_section'.$cnt.'[\'last\'] = ($_section'.$cnt.'[\'iteration\'] == $_section'.$cnt.'[\'total\']);'."\n"; |
| 120 | 120 | |
| 121 | - $output .= Dwoo_Compiler::PHP_CLOSE . $content . Dwoo_Compiler::PHP_OPEN; |
|
| 121 | + $output .= Dwoo_Compiler::PHP_CLOSE.$content.Dwoo_Compiler::PHP_OPEN; |
|
| 122 | 122 | |
| 123 | - $output .= "\n\t}\n} " . Dwoo_Compiler::PHP_CLOSE; |
|
| 123 | + $output .= "\n\t}\n} ".Dwoo_Compiler::PHP_CLOSE; |
|
| 124 | 124 | |
| 125 | 125 | if (isset($params['hasElse'])) { |
| 126 | 126 | $output .= $params['hasElse']; |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | |
| 28 | 28 | public static function postProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $content) |
| 29 | 29 | { |
| 30 | - return $content . Dwoo_Compiler::PHP_OPEN.' /* end template body */'."\n".'return $this->buffer . ob_get_clean();'; |
|
| 30 | + return $content.Dwoo_Compiler::PHP_OPEN.' /* end template body */'."\n".'return $this->buffer . ob_get_clean();'; |
|
| 31 | 31 | } |
| 32 | 32 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $preContent = ''; |
| 27 | 27 | while (true) { |
| 28 | 28 | $preContent .= $compiler->removeTopBlock(); |
| 29 | - $block =& $compiler->getCurrentBlock(); |
|
| 29 | + $block = & $compiler->getCurrentBlock(); |
|
| 30 | 30 | $interfaces = class_implements($block['class'], false); |
| 31 | 31 | if (in_array('Dwoo_IElseable', $interfaces) !== false) { |
| 32 | 32 | break; |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | $tokens = $compiler->getParamTokens($params); |
| 48 | 48 | $params = $compiler->getCompiledParams($params); |
| 49 | 49 | |
| 50 | - $pre = Dwoo_Compiler::PHP_OPEN."elseif (".implode(' ', self::replaceKeywords($params['*'], $tokens['*'], $compiler)).") {\n" . Dwoo_Compiler::PHP_CLOSE; |
|
| 50 | + $pre = Dwoo_Compiler::PHP_OPEN."elseif (".implode(' ', self::replaceKeywords($params['*'], $tokens['*'], $compiler)).") {\n".Dwoo_Compiler::PHP_CLOSE; |
|
| 51 | 51 | $post = Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE; |
| 52 | 52 | |
| 53 | 53 | if (isset($params['hasElse'])) { |
| 54 | 54 | $post .= $params['hasElse']; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $block =& $compiler->getCurrentBlock(); |
|
| 58 | - $block['params']['hasElse'] = $pre . $content . $post; |
|
| 57 | + $block = & $compiler->getCurrentBlock(); |
|
| 58 | + $block['params']['hasElse'] = $pre.$content.$post; |
|
| 59 | 59 | return ''; |
| 60 | 60 | } |
| 61 | 61 | } |