Completed
Branch 1.2 (459185)
by David
04:06
created
lib/Dwoo/Core.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1538,8 +1538,9 @@
 block discarded – undo
1538 1538
                 array_pop($this->scopeTree);
1539 1539
                 $this->scope =& $this->data;
1540 1540
                 $cnt = count($this->scopeTree);
1541
-                for ($i=0;$i<$cnt;$i++)
1542
-                    $this->scope =& $this->scope[$this->scopeTree[$i]];
1541
+                for ($i=0;$i<$cnt;$i++) {
1542
+                                    $this->scope =& $this->scope[$this->scopeTree[$i]];
1543
+                }
1543 1544
             } elseif ($bit === '__' || $bit === '_root') {
1544 1545
                 $this->scope =& $this->data;
1545 1546
                 $this->scopeTree = array();
Please login to merge, or discard this patch.
lib/Dwoo/Smarty/Adapter.php 1 patch
Braces   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -297,9 +297,10 @@  discard block
 block discarded – undo
297 297
 
298 298
 	public function unregister_prefilter($callback)
299 299
 	{
300
-		foreach ($this->_filters['pre'] as $index => $processor)
301
-			if ($processor->callback === $callback) {
300
+		foreach ($this->_filters['pre'] as $index => $processor) {
301
+					if ($processor->callback === $callback) {
302 302
 				$this->compiler->removePostProcessor($processor);
303
+		}
303 304
 				unset($this->_filters['pre'][$index]);
304 305
 			}
305 306
 	}
@@ -314,9 +315,10 @@  discard block
 block discarded – undo
314 315
 
315 316
 	public function unregister_postfilter($callback)
316 317
 	{
317
-		foreach ($this->_filters['post'] as $index => $processor)
318
-			if ($processor->callback === $callback) {
318
+		foreach ($this->_filters['post'] as $index => $processor) {
319
+					if ($processor->callback === $callback) {
319 320
 				$this->compiler->removePostProcessor($processor);
321
+		}
320 322
 				unset($this->_filters['post'][$index]);
321 323
 			}
322 324
 	}
@@ -331,9 +333,10 @@  discard block
 block discarded – undo
331 333
 
332 334
 	public function unregister_outputfilter($callback)
333 335
 	{
334
-		foreach ($this->_filters['output'] as $index => $filter)
335
-			if ($filter->callback === $callback) {
336
+		foreach ($this->_filters['output'] as $index => $filter) {
337
+					if ($filter->callback === $callback) {
336 338
 				$this->removeOutputFilter($filter);
339
+		}
337 340
 				unset($this->_filters['output'][$index]);
338 341
 			}
339 342
 	}
@@ -419,10 +422,11 @@  discard block
 block discarded – undo
419 422
 		}
420 423
 
421 424
 		$data = $this->dataProvider->getData();
422
-   		if ($name === null)
423
-   			return $data;
424
-   		elseif (isset($data[$name]))
425
-   			return $data[$name];
425
+   		if ($name === null) {
426
+   		   			return $data;
427
+   		} elseif (isset($data[$name])) {
428
+   		   			return $data[$name];
429
+   		}
426 430
    		return null;
427 431
    	}
428 432
 
@@ -450,8 +454,9 @@  discard block
 block discarded – undo
450 454
 
451 455
 	protected function makeTemplate($file, $cacheId, $compileId)
452 456
 	{
453
-   		if ($compileId === null)
454
-   			$compileId = $this->compile_id;
457
+   		if ($compileId === null) {
458
+   		   			$compileId = $this->compile_id;
459
+   		}
455 460
 
456 461
 		$hash = bin2hex(md5($file.$cacheId.$compileId, true));
457 462
 		if (!isset(self::$tplCache[$hash])) {
@@ -511,8 +516,7 @@  discard block
 block discarded – undo
511 516
 {
512 517
 	interface Smarty {}
513 518
 	class Dwoo_Smarty_Adapter extends Dwoo_Smarty__Adapter implements Smarty {}
514
-}
515
-else
519
+} else
516 520
 {
517 521
 	class Dwoo_Smarty_Adapter extends Dwoo_Smarty__Adapter {}
518 522
 }
Please login to merge, or discard this patch.
lib/Dwoo/Security/Policy.php 1 patch
Braces   +30 added lines, -24 removed lines patch added patch discarded remove patch
@@ -100,11 +100,12 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function allowPhpFunction($func)
102 102
 	{
103
-		if (is_array($func))
104
-			foreach ($func as $fname)
103
+		if (is_array($func)) {
104
+					foreach ($func as $fname)
105 105
 				$this->allowedPhpFunctions[strtolower($fname)] = true;
106
-		else
107
-			$this->allowedPhpFunctions[strtolower($func)] = true;
106
+		} else {
107
+					$this->allowedPhpFunctions[strtolower($func)] = true;
108
+		}
108 109
 	}
109 110
 
110 111
 	/**
@@ -114,11 +115,12 @@  discard block
 block discarded – undo
114 115
 	 */
115 116
 	public function disallowPhpFunction($func)
116 117
 	{
117
-		if (is_array($func))
118
-			foreach ($func as $fname)
118
+		if (is_array($func)) {
119
+					foreach ($func as $fname)
119 120
 				unset($this->allowedPhpFunctions[strtolower($fname)]);
120
-		else
121
-			unset($this->allowedPhpFunctions[strtolower($func)]);
121
+		} else {
122
+					unset($this->allowedPhpFunctions[strtolower($func)]);
123
+		}
122 124
 	}
123 125
 
124 126
 	/**
@@ -142,11 +144,12 @@  discard block
 block discarded – undo
142 144
 	 */
143 145
 	public function allowMethod($class, $method = null)
144 146
 	{
145
-		if (is_array($class))
146
-			foreach ($class as $elem)
147
+		if (is_array($class)) {
148
+					foreach ($class as $elem)
147 149
 				$this->allowedMethods[strtolower($elem[0])][strtolower($elem[1])] = true;
148
-		else
149
-			$this->allowedMethods[strtolower($class)][strtolower($method)] = true;
150
+		} else {
151
+					$this->allowedMethods[strtolower($class)][strtolower($method)] = true;
152
+		}
150 153
 	}
151 154
 
152 155
 	/**
@@ -157,11 +160,12 @@  discard block
 block discarded – undo
157 160
 	 */
158 161
 	public function disallowMethod($class, $method = null)
159 162
 	{
160
-		if (is_array($class))
161
-			foreach ($class as $elem)
163
+		if (is_array($class)) {
164
+					foreach ($class as $elem)
162 165
 				unset($this->allowedMethods[strtolower($elem[0])][strtolower($elem[1])]);
163
-		else
164
-			unset($this->allowedMethods[strtolower($class)][strtolower($method)]);
166
+		} else {
167
+					unset($this->allowedMethods[strtolower($class)][strtolower($method)]);
168
+		}
165 169
 	}
166 170
 
167 171
 	/**
@@ -185,11 +189,12 @@  discard block
 block discarded – undo
185 189
 	 */
186 190
 	public function allowDirectory($path)
187 191
 	{
188
-		if (is_array($path))
189
-			foreach ($path as $dir)
192
+		if (is_array($path)) {
193
+					foreach ($path as $dir)
190 194
 				$this->allowedDirectories[realpath($dir)] = true;
191
-		else
192
-			$this->allowedDirectories[realpath($path)] = true;
195
+		} else {
196
+					$this->allowedDirectories[realpath($path)] = true;
197
+		}
193 198
 	}
194 199
 
195 200
 	/**
@@ -199,11 +204,12 @@  discard block
 block discarded – undo
199 204
 	 */
200 205
 	public function disallowDirectory($path)
201 206
 	{
202
-		if (is_array($path))
203
-			foreach ($path as $dir)
207
+		if (is_array($path)) {
208
+					foreach ($path as $dir)
204 209
 				unset($this->allowedDirectories[realpath($dir)]);
205
-		else
206
-			unset($this->allowedDirectories[realpath($path)]);
210
+		} else {
211
+					unset($this->allowedDirectories[realpath($path)]);
212
+		}
207 213
 	}
208 214
 
209 215
 	/**
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/CodeIgniter/libraries/Dwootemplate.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 require "dwoo/dwooAutoload.php";
4 6
 
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/CodeIgniter/config/dwootemplate.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
1
+<?php  if (!defined('BASEPATH')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 // The name of the directory where templates are located.
4 6
 $config['template_dir'] = dirname(FCPATH) . '/../application/views/';
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/View.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -248,8 +248,7 @@  discard block
 block discarded – undo
248 248
 		//
249 249
 		elseif (is_subclass_of($engine, 'Dwoo') || 'Dwoo' === $engine) {
250 250
 			$this->_engine = new $engine();
251
-		}
252
-		else {
251
+		} else {
253 252
 			throw new Dwoo_Exception("Custom engine must be a subclass of Dwoo");
254 253
 		}
255 254
 	}
@@ -277,11 +276,9 @@  discard block
 block discarded – undo
277 276
 	{
278 277
 		if ($data instanceof Dwoo_IDataProvider) {
279 278
 			$this->_dataProvider = $data;
280
-		}
281
-		elseif (is_subclass_of($data, 'Dwoo_Data') || 'Dwoo_Data' == $data) {
279
+		} elseif (is_subclass_of($data, 'Dwoo_Data') || 'Dwoo_Data' == $data) {
282 280
 			$this->_dataProvider = new $data();
283
-		}
284
-		else {
281
+		} else {
285 282
 			throw new Dwoo_Exception("Custom data provider must be a subclass of Dwoo_Data or instance of Dwoo_IDataProvider");
286 283
 		}
287 284
 	}
@@ -320,8 +317,7 @@  discard block
 block discarded – undo
320 317
 		// if param given as a string
321 318
 		elseif (is_subclass_of($compiler, 'Dwoo_Compiler') || 'Dwoo_Compiler' == $compiler) {
322 319
 			$this->_compiler = new $compiler;
323
-		}
324
-		else {
320
+		} else {
325 321
 			throw new Dwoo_Exception("Custom compiler must be a subclass of Dwoo_Compiler or instance of Dwoo_ICompiler");
326 322
 		}
327 323
 	}
Please login to merge, or discard this patch.
lib/Dwoo/Data.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 		if ($name === null) {
46 46
 			$this->data = array();
47 47
 		} elseif (is_array($name)) {
48
-			foreach ($name as $index)
49
-				unset($this->data[$index]);
48
+			foreach ($name as $index) {
49
+							unset($this->data[$index]);
50
+			}
50 51
 		} else {
51 52
 			unset($this->data[$name]);
52 53
 		}
@@ -90,8 +91,9 @@  discard block
 block discarded – undo
90 91
 	{
91 92
 		if (is_array($name)) {
92 93
 			reset($name);
93
-			while (list($k,$v) = each($name))
94
-				$this->data[$k] = $v;
94
+			while (list($k,$v) = each($name)) {
95
+							$this->data[$k] = $v;
96
+			}
95 97
 		} else {
96 98
 			$this->data[$name] = $val;
97 99
 		}
Please login to merge, or discard this patch.
lib/plugins/builtin/blocks/foreach.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,12 +105,24 @@
 block discarded – undo
105 105
 		// adds foreach properties
106 106
 		if ($usesAny) {
107 107
 			$pre .= "\n".'$this->globals["foreach"]['.$name.'] = array'."\n(";
108
-			if ($usesIndex) $pre .="\n\t".'"index"		=> 0,';
109
-			if ($usesIteration) $pre .="\n\t".'"iteration"		=> 1,';
110
-			if ($usesFirst) $pre .="\n\t".'"first"		=> null,';
111
-			if ($usesLast) $pre .="\n\t".'"last"		=> null,';
112
-			if ($usesShow) $pre .="\n\t".'"show"		=> $this->isArray($_fh'.$cnt.'_data, true),';
113
-			if ($usesTotal) $pre .="\n\t".'"total"		=> $this->count($_fh'.$cnt.'_data),';
108
+			if ($usesIndex) {
109
+				$pre .="\n\t".'"index"		=> 0,';
110
+			}
111
+			if ($usesIteration) {
112
+				$pre .="\n\t".'"iteration"		=> 1,';
113
+			}
114
+			if ($usesFirst) {
115
+				$pre .="\n\t".'"first"		=> null,';
116
+			}
117
+			if ($usesLast) {
118
+				$pre .="\n\t".'"last"		=> null,';
119
+			}
120
+			if ($usesShow) {
121
+				$pre .="\n\t".'"show"		=> $this->isArray($_fh'.$cnt.'_data, true),';
122
+			}
123
+			if ($usesTotal) {
124
+				$pre .="\n\t".'"total"		=> $this->count($_fh'.$cnt.'_data),';
125
+			}
114 126
 			$pre.="\n);\n".'$_fh'.$cnt.'_glob =& $this->globals["foreach"]['.$name.'];';
115 127
 		}
116 128
 		// checks if foreach must be looped
Please login to merge, or discard this patch.
lib/plugins/builtin/blocks/for.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -74,12 +74,24 @@
 block discarded – undo
74 74
 		// adds for properties
75 75
 		if ($usesAny) {
76 76
 			$out .= "\n".'$this->globals["for"]['.$name.'] = array'."\n(";
77
-			if ($usesIndex) $out .="\n\t".'"index"		=> 0,';
78
-			if ($usesIteration) $out .="\n\t".'"iteration"		=> 1,';
79
-			if ($usesFirst) $out .="\n\t".'"first"		=> null,';
80
-			if ($usesLast) $out .="\n\t".'"last"		=> null,';
81
-			if ($usesShow) $out .="\n\t".'"show"		=> $tmp_shows,';
82
-			if ($usesTotal) $out .="\n\t".'"total"		=> $this->isArray($_for'.$cnt.'_from) ? floor($this->count($_for'.$cnt.'_from) / $_for'.$cnt.'_step) : (is_numeric($_for'.$cnt.'_from) ? abs(($_for'.$cnt.'_to + 1 - $_for'.$cnt.'_from)/$_for'.$cnt.'_step) : 0),';
77
+			if ($usesIndex) {
78
+				$out .="\n\t".'"index"		=> 0,';
79
+			}
80
+			if ($usesIteration) {
81
+				$out .="\n\t".'"iteration"		=> 1,';
82
+			}
83
+			if ($usesFirst) {
84
+				$out .="\n\t".'"first"		=> null,';
85
+			}
86
+			if ($usesLast) {
87
+				$out .="\n\t".'"last"		=> null,';
88
+			}
89
+			if ($usesShow) {
90
+				$out .="\n\t".'"show"		=> $tmp_shows,';
91
+			}
92
+			if ($usesTotal) {
93
+				$out .="\n\t".'"total"		=> $this->isArray($_for'.$cnt.'_from) ? floor($this->count($_for'.$cnt.'_from) / $_for'.$cnt.'_step) : (is_numeric($_for'.$cnt.'_from) ? abs(($_for'.$cnt.'_to + 1 - $_for'.$cnt.'_from)/$_for'.$cnt.'_step) : 0),';
94
+			}
83 95
 			$out.="\n);\n".'$_for'.$cnt.'_glob =& $this->globals["for"]['.$name.'];';
84 96
 		}
85 97
 		// checks if for must be looped
Please login to merge, or discard this patch.