@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); |
2 | 2 | |
3 | 3 | // The name of the directory where templates are located. |
4 | -$config['template_dir'] = dirname(FCPATH) . '/../application/views/'; |
|
4 | +$config['template_dir'] = dirname(FCPATH).'/../application/views/'; |
|
5 | 5 | |
6 | 6 | // The directory where compiled templates are located |
7 | -$config['compileDir'] = dirname(FCPATH) . '/../compile/'; |
|
7 | +$config['compileDir'] = dirname(FCPATH).'/../compile/'; |
|
8 | 8 | |
9 | 9 | //This tells Dwoo whether or not to cache the output of the templates to the $cache_dir. |
10 | 10 | $config['caching'] = 0; |
11 | -$config['cacheDir'] = dirname(FCPATH) . '/../cache/'; |
|
11 | +$config['cacheDir'] = dirname(FCPATH).'/../cache/'; |
|
12 | 12 | $config['cacheTime'] = 0; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function compilerFactory() |
116 | 116 | { |
117 | 117 | if (class_exists('Dwoo_Compiler', false) === false) { |
118 | - include DWOO_DIRECTORY . 'Dwoo/Compiler.php'; |
|
118 | + include DWOO_DIRECTORY.'Dwoo/Compiler.php'; |
|
119 | 119 | } |
120 | 120 | $compiler = Dwoo_Compiler::compilerFactory(); |
121 | 121 | $compiler->setAutoEscape((bool) $this->getParameter('auto_escape', false)); |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function getEngine() |
131 | 131 | { |
132 | - if($this->dwoo) { |
|
132 | + if ($this->dwoo) { |
|
133 | 133 | return $this->dwoo; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // this triggers Agavi autoload |
137 | - if(!class_exists('Dwoo')) { |
|
137 | + if (!class_exists('Dwoo')) { |
|
138 | 138 | if (file_exists(dirname(__FILE__).'/../../../dwooAutoload.php')) { |
139 | 139 | // file was dropped with the entire dwoo package |
140 | 140 | require dirname(__FILE__).'/../../../dwooAutoload.php'; |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | |
147 | 147 | $parentMode = fileperms(AgaviConfig::get('core.cache_dir')); |
148 | 148 | |
149 | - $compileDir = AgaviConfig::get('core.cache_dir') . DIRECTORY_SEPARATOR . self::COMPILE_DIR . DIRECTORY_SEPARATOR . self::COMPILE_SUBDIR; |
|
149 | + $compileDir = AgaviConfig::get('core.cache_dir').DIRECTORY_SEPARATOR.self::COMPILE_DIR.DIRECTORY_SEPARATOR.self::COMPILE_SUBDIR; |
|
150 | 150 | AgaviToolkit::mkdir($compileDir, $parentMode, true); |
151 | 151 | |
152 | - $cacheDir = AgaviConfig::get('core.cache_dir') . DIRECTORY_SEPARATOR . self::CACHE_DIR; |
|
152 | + $cacheDir = AgaviConfig::get('core.cache_dir').DIRECTORY_SEPARATOR.self::CACHE_DIR; |
|
153 | 153 | AgaviToolkit::mkdir($cacheDir, $parentMode, true); |
154 | 154 | |
155 | 155 | $this->dwoo = new Dwoo_Core($compileDir, $cacheDir); |
@@ -180,23 +180,23 @@ discard block |
||
180 | 180 | $engine = $this->getEngine(); |
181 | 181 | |
182 | 182 | $data = array(); |
183 | - if($this->extractVars) { |
|
183 | + if ($this->extractVars) { |
|
184 | 184 | $data = $attributes; |
185 | 185 | } else { |
186 | 186 | $data[$this->varName] = &$attributes; |
187 | 187 | } |
188 | 188 | |
189 | - $data[$this->slotsVarName] =& $slots; |
|
189 | + $data[$this->slotsVarName] = & $slots; |
|
190 | 190 | |
191 | - foreach($this->assigns as $key => $getter) { |
|
191 | + foreach ($this->assigns as $key => $getter) { |
|
192 | 192 | $data[$key] = $this->getContext()->$getter(); |
193 | 193 | } |
194 | 194 | |
195 | - foreach($moreAssigns as $key => &$value) { |
|
196 | - if(isset($this->moreAssignNames[$key])) { |
|
195 | + foreach ($moreAssigns as $key => &$value) { |
|
196 | + if (isset($this->moreAssignNames[$key])) { |
|
197 | 197 | $key = $this->moreAssignNames[$key]; |
198 | 198 | } |
199 | - $data[$key] =& $value; |
|
199 | + $data[$key] = & $value; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $engine->get($layer->getResourceStreamIdentifier(), $data); |
@@ -31,9 +31,9 @@ |
||
31 | 31 | return $this->getPluginProxy()->view->$name; |
32 | 32 | } |
33 | 33 | $trace = debug_backtrace(); |
34 | - trigger_error('Undefined property via __get(): ' . $name . |
|
35 | - ' in ' . $trace[0]['file'] . |
|
36 | - ' on line ' . $trace[0]['line'], E_USER_NOTICE); |
|
34 | + trigger_error('Undefined property via __get(): '.$name. |
|
35 | + ' in '.$trace[0]['file']. |
|
36 | + ' on line '.$trace[0]['line'], E_USER_NOTICE); |
|
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | } |
40 | 40 | \ No newline at end of file |
@@ -97,26 +97,26 @@ discard block |
||
97 | 97 | |
98 | 98 | // Setting options to Dwoo objects... |
99 | 99 | foreach ($opt as $type => $settings) { |
100 | - if (!method_exists($this, 'set' . $type)) { |
|
100 | + if (!method_exists($this, 'set'.$type)) { |
|
101 | 101 | throw new Dwoo_Exception("Unknown type $type"); |
102 | 102 | } |
103 | 103 | |
104 | 104 | if (is_string($settings) || is_object($settings)) { |
105 | - call_user_func(array($this, 'set' . $type), $settings); |
|
105 | + call_user_func(array($this, 'set'.$type), $settings); |
|
106 | 106 | } elseif (is_array($settings)) { |
107 | 107 | // Set requested class |
108 | 108 | if (array_key_exists('type', $settings)) { |
109 | - call_user_func(array($this, 'set' . $type), $settings['type']); |
|
109 | + call_user_func(array($this, 'set'.$type), $settings['type']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if (in_array($type, $classes)) { |
113 | 113 | // Call get so that the class is initialized |
114 | - $rel = call_user_func(array($this, 'get' . $type)); |
|
114 | + $rel = call_user_func(array($this, 'get'.$type)); |
|
115 | 115 | |
116 | 116 | // Call set*() methods so that all the settings are set. |
117 | 117 | foreach ($settings as $method => $value) { |
118 | - if (method_exists($rel, 'set' . $method)) { |
|
119 | - call_user_func(array($rel, 'set' . $method), $value); |
|
118 | + if (method_exists($rel, 'set'.$method)) { |
|
119 | + call_user_func(array($rel, 'set'.$method), $value); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } elseif ('templateFile' == $type) { |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | foreach ($this->_templateFileSettings as $method => $value) { |
359 | - if (method_exists($dwooTemplateFile, 'set' . $method)) { |
|
360 | - call_user_func(array($dwooTemplateFile, 'set' . $method), $value); |
|
359 | + if (method_exists($dwooTemplateFile, 'set'.$method)) { |
|
360 | + call_user_func(array($dwooTemplateFile, 'set'.$method), $value); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @return string |
60 | 60 | */ |
61 | 61 | public function getCode($name, $params) { |
62 | - return '$this->getPluginProxy()->view->'. $name .'('.Dwoo_Compiler::implode_r($params).')'; |
|
62 | + return '$this->getPluginProxy()->view->'.$name.'('.Dwoo_Compiler::implode_r($params).')'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -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 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | if (is_array($name)) { |
92 | 92 | reset($name); |
93 | - while (list($k,$v) = each($name)) |
|
93 | + while (list($k, $v) = each($name)) |
|
94 | 94 | $this->data[$k] = $v; |
95 | 95 | } else { |
96 | 96 | $this->data[$name] = $val; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function assignByRef($name, &$val) |
119 | 119 | { |
120 | - $this->data[$name] =& $val; |
|
120 | + $this->data[$name] = & $val; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | if ($merge === true && is_array($val)) { |
141 | - $this->data[$key] = $val + $this->data[$key]; |
|
141 | + $this->data[$key] = $val+$this->data[$key]; |
|
142 | 142 | } else { |
143 | 143 | $this->data[$key][] = $val; |
144 | 144 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($merge === true && is_array($val)) { |
154 | - $this->data[$name] = $val + $this->data[$name]; |
|
154 | + $this->data[$name] = $val+$this->data[$name]; |
|
155 | 155 | } else { |
156 | 156 | $this->data[$name][] = $val; |
157 | 157 | } |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | |
175 | 175 | if ($merge === true && is_array($val)) { |
176 | 176 | foreach ($val as $key => &$val) { |
177 | - $this->data[$name][$key] =& $val; |
|
177 | + $this->data[$name][$key] = & $val; |
|
178 | 178 | } |
179 | 179 | } else { |
180 | - $this->data[$name][] =& $val; |
|
180 | + $this->data[$name][] = & $val; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 |
@@ -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 | } |