Test Failed
Pull Request — 1.2 (#90)
by
unknown
05:25
created
lib/plugins/builtin/functions/count_words.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
  */
22 22
 function Dwoo_Plugin_count_words_compile(Dwoo_Compiler $compiler, $value)
23 23
 {
24
-    return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', '.$value.', $tmp)';
24
+	return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', '.$value.', $tmp)';
25 25
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/string_format.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,5 +22,5 @@
 block discarded – undo
22 22
  */
23 23
 function Dwoo_Plugin_string_format_compile(Dwoo_Compiler $compiler, $value, $format)
24 24
 {
25
-    return 'sprintf('.$format.','.$value.')';
25
+	return 'sprintf('.$format.','.$value.')';
26 26
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/cat.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
  */
22 22
 function Dwoo_Plugin_cat_compile(Dwoo_Compiler $compiler, $value, array $rest)
23 23
 {
24
-    return '('.$value.').('.implode(').(', $rest).')';
24
+	return '('.$value.').('.implode(').(', $rest).')';
25 25
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/fetch.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,32 +22,32 @@
 block discarded – undo
22 22
  */
23 23
 function Dwoo_Plugin_fetch(Dwoo_Core $dwoo, $file, $assign = null)
24 24
 {
25
-    if ($file === '') {
26
-        return '';
27
-    }
25
+	if ($file === '') {
26
+		return '';
27
+	}
28 28
 
29
-    if ($policy = $dwoo->getSecurityPolicy()) {
30
-        while (true) {
31
-            if (preg_match('{^([a-z]+?)://}i', $file)) {
32
-                $dwoo->triggerError('The security policy prevents you to read files from external sources.', E_USER_WARNING);
33
-            }
29
+	if ($policy = $dwoo->getSecurityPolicy()) {
30
+		while (true) {
31
+			if (preg_match('{^([a-z]+?)://}i', $file)) {
32
+				$dwoo->triggerError('The security policy prevents you to read files from external sources.', E_USER_WARNING);
33
+			}
34 34
 
35
-            $file = realpath($file);
36
-            $dirs = $policy->getAllowedDirectories();
37
-            foreach ($dirs as $dir => $dummy) {
38
-                if (strpos($file, $dir) === 0) {
39
-                    break 2;
40
-                }
41
-            }
42
-            $dwoo->triggerError('The security policy prevents you to read <em>'.$file.'</em>', E_USER_WARNING);
43
-        }
44
-    }
45
-    $file = str_replace(array("\t", "\n", "\r"), array('\\t', '\\n', '\\r'), $file);
35
+			$file = realpath($file);
36
+			$dirs = $policy->getAllowedDirectories();
37
+			foreach ($dirs as $dir => $dummy) {
38
+				if (strpos($file, $dir) === 0) {
39
+					break 2;
40
+				}
41
+			}
42
+			$dwoo->triggerError('The security policy prevents you to read <em>'.$file.'</em>', E_USER_WARNING);
43
+		}
44
+	}
45
+	$file = str_replace(array("\t", "\n", "\r"), array('\\t', '\\n', '\\r'), $file);
46 46
 
47
-    $out = file_get_contents($file);
47
+	$out = file_get_contents($file);
48 48
 
49
-    if ($assign === null) {
50
-        return $out;
51
-    }
52
-    $dwoo->assignInScope($out, $assign);
49
+	if ($assign === null) {
50
+		return $out;
51
+	}
52
+	$dwoo->assignInScope($out, $assign);
53 53
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/date_format.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -23,36 +23,36 @@
 block discarded – undo
23 23
  */
24 24
 function Dwoo_Plugin_date_format(Dwoo_Core $dwoo, $value, $format = '%b %e, %Y', $default = null)
25 25
 {
26
-    if (!empty($value)) {
27
-        // convert if it's not a valid unix timestamp
28
-        if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
29
-            $value = strtotime($value);
30
-        }
31
-    } elseif (!empty($default)) {
32
-        // convert if it's not a valid unix timestamp
33
-        if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
34
-            $value = strtotime($default);
35
-        } else {
36
-            $value = $default;
37
-        }
38
-    } else {
39
-        return '';
40
-    }
26
+	if (!empty($value)) {
27
+		// convert if it's not a valid unix timestamp
28
+		if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
29
+			$value = strtotime($value);
30
+		}
31
+	} elseif (!empty($default)) {
32
+		// convert if it's not a valid unix timestamp
33
+		if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
34
+			$value = strtotime($default);
35
+		} else {
36
+			$value = $default;
37
+		}
38
+	} else {
39
+		return '';
40
+	}
41 41
 
42
-    // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
43
-    if (DIRECTORY_SEPARATOR == '\\') {
44
-        $_win_from = array('%D',       '%h', '%n', '%r',          '%R',    '%t', '%T');
45
-        $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
46
-        if (strpos($format, '%e') !== false) {
47
-            $_win_from[] = '%e';
48
-            $_win_to[] = sprintf('%\' 2d', date('j', $value));
49
-        }
50
-        if (strpos($format, '%l') !== false) {
51
-            $_win_from[] = '%l';
52
-            $_win_to[] = sprintf('%\' 2d', date('h', $value));
53
-        }
54
-        $format = str_replace($_win_from, $_win_to, $format);
55
-    }
42
+	// Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
43
+	if (DIRECTORY_SEPARATOR == '\\') {
44
+		$_win_from = array('%D',       '%h', '%n', '%r',          '%R',    '%t', '%T');
45
+		$_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
46
+		if (strpos($format, '%e') !== false) {
47
+			$_win_from[] = '%e';
48
+			$_win_to[] = sprintf('%\' 2d', date('j', $value));
49
+		}
50
+		if (strpos($format, '%l') !== false) {
51
+			$_win_from[] = '%l';
52
+			$_win_to[] = sprintf('%\' 2d', date('h', $value));
53
+		}
54
+		$format = str_replace($_win_from, $_win_to, $format);
55
+	}
56 56
 
57
-    return strftime($format, $value);
57
+	return strftime($format, $value);
58 58
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/dump.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -22,156 +22,156 @@
 block discarded – undo
22 22
  */
23 23
 class Dwoo_Plugin_dump extends Dwoo_Plugin
24 24
 {
25
-    protected $outputObjects;
26
-    protected $outputMethods;
27
-
28
-    public function process($var = '$', $show_methods = false)
29
-    {
30
-        $this->outputMethods = $show_methods;
31
-        if ($var === '$') {
32
-            $var = $this->dwoo->getData();
33
-            $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">data';
34
-        } else {
35
-            $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">dump';
36
-        }
37
-
38
-        $this->outputObjects = array();
39
-
40
-        if (!is_array($var)) {
41
-            if (is_object($var)) {
42
-                return $this->exportObj('', $var);
43
-            } else {
44
-                return $this->exportVar('', $var);
45
-            }
46
-        }
47
-
48
-        $scope = $this->dwoo->getScope();
49
-
50
-        if ($var === $scope) {
51
-            $out .= ' (current scope): <div style="background:#ccc;">';
52
-        } else {
53
-            $out .= ':<div style="padding-left:20px;">';
54
-        }
55
-
56
-        $out .= $this->export($var, $scope);
57
-
58
-        return $out.'</div></div>';
59
-    }
60
-
61
-    protected function export($var, $scope)
62
-    {
63
-        $out = '';
64
-        foreach ($var as $i => $v) {
65
-            if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
66
-                $out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')';
67
-                if ($v === $scope) {
68
-                    $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>';
69
-                } else {
70
-                    $out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>';
71
-                }
72
-            } elseif (is_object($v)) {
73
-                $out .= $this->exportObj($i.' (object: '.get_class($v).'):', $v);
74
-            } else {
75
-                $out .= $this->exportVar($i.' = ', $v);
76
-            }
77
-        }
78
-
79
-        return $out;
80
-    }
81
-
82
-    protected function exportVar($i, $v)
83
-    {
84
-        if (is_string($v) || is_bool($v) || is_numeric($v)) {
85
-            return $i.htmlentities(var_export($v, true)).'<br />';
86
-        } elseif (is_null($v)) {
87
-            return $i.'null<br />';
88
-        } elseif (is_resource($v)) {
89
-            return $i.'resource('.get_resource_type($v).')<br />';
90
-        } else {
91
-            return $i.htmlentities(var_export($v, true)).'<br />';
92
-        }
93
-    }
94
-
95
-    protected function exportObj($i, $obj)
96
-    {
97
-        if (array_search($obj, $this->outputObjects, true) !== false) {
98
-            return $i.' [recursion, skipped]<br />';
99
-        }
100
-
101
-        $this->outputObjects[] = $obj;
102
-
103
-        $list = (array) $obj;
104
-
105
-        $protectedLength = strlen(get_class($obj)) + 2;
106
-
107
-        $out = array();
108
-
109
-        if ($this->outputMethods) {
110
-            $ref = new ReflectionObject($obj);
111
-
112
-            foreach ($ref->getMethods() as $method) {
113
-                if (!$method->isPublic()) {
114
-                    continue;
115
-                }
116
-
117
-                if (empty($out['method'])) {
118
-                    $out['method'] = '';
119
-                }
120
-
121
-                $params = array();
122
-                foreach ($method->getParameters() as $param) {
123
-                    $params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : '');
124
-                }
125
-
126
-                $out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />';
127
-            }
128
-        }
129
-
130
-        foreach ($list as $attributeName => $attributeValue) {
131
-            if (property_exists($obj, $attributeName)) {
132
-                $key = 'public';
133
-            } elseif (substr($attributeName, 0, 3) === "\0*\0") {
134
-                $key = 'protected';
135
-                $attributeName = substr($attributeName, 3);
136
-            } else {
137
-                $key = 'private';
138
-                $attributeName = substr($attributeName, $protectedLength);
139
-            }
140
-
141
-            if (empty($out[$key])) {
142
-                $out[$key] = '';
143
-            }
144
-
145
-            $out[$key] .= '('.$key.') ';
146
-
147
-            if (is_array($attributeValue)) {
148
-                $out[$key] .= $attributeName.' (array):<br />
25
+	protected $outputObjects;
26
+	protected $outputMethods;
27
+
28
+	public function process($var = '$', $show_methods = false)
29
+	{
30
+		$this->outputMethods = $show_methods;
31
+		if ($var === '$') {
32
+			$var = $this->dwoo->getData();
33
+			$out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">data';
34
+		} else {
35
+			$out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">dump';
36
+		}
37
+
38
+		$this->outputObjects = array();
39
+
40
+		if (!is_array($var)) {
41
+			if (is_object($var)) {
42
+				return $this->exportObj('', $var);
43
+			} else {
44
+				return $this->exportVar('', $var);
45
+			}
46
+		}
47
+
48
+		$scope = $this->dwoo->getScope();
49
+
50
+		if ($var === $scope) {
51
+			$out .= ' (current scope): <div style="background:#ccc;">';
52
+		} else {
53
+			$out .= ':<div style="padding-left:20px;">';
54
+		}
55
+
56
+		$out .= $this->export($var, $scope);
57
+
58
+		return $out.'</div></div>';
59
+	}
60
+
61
+	protected function export($var, $scope)
62
+	{
63
+		$out = '';
64
+		foreach ($var as $i => $v) {
65
+			if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
66
+				$out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')';
67
+				if ($v === $scope) {
68
+					$out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>';
69
+				} else {
70
+					$out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>';
71
+				}
72
+			} elseif (is_object($v)) {
73
+				$out .= $this->exportObj($i.' (object: '.get_class($v).'):', $v);
74
+			} else {
75
+				$out .= $this->exportVar($i.' = ', $v);
76
+			}
77
+		}
78
+
79
+		return $out;
80
+	}
81
+
82
+	protected function exportVar($i, $v)
83
+	{
84
+		if (is_string($v) || is_bool($v) || is_numeric($v)) {
85
+			return $i.htmlentities(var_export($v, true)).'<br />';
86
+		} elseif (is_null($v)) {
87
+			return $i.'null<br />';
88
+		} elseif (is_resource($v)) {
89
+			return $i.'resource('.get_resource_type($v).')<br />';
90
+		} else {
91
+			return $i.htmlentities(var_export($v, true)).'<br />';
92
+		}
93
+	}
94
+
95
+	protected function exportObj($i, $obj)
96
+	{
97
+		if (array_search($obj, $this->outputObjects, true) !== false) {
98
+			return $i.' [recursion, skipped]<br />';
99
+		}
100
+
101
+		$this->outputObjects[] = $obj;
102
+
103
+		$list = (array) $obj;
104
+
105
+		$protectedLength = strlen(get_class($obj)) + 2;
106
+
107
+		$out = array();
108
+
109
+		if ($this->outputMethods) {
110
+			$ref = new ReflectionObject($obj);
111
+
112
+			foreach ($ref->getMethods() as $method) {
113
+				if (!$method->isPublic()) {
114
+					continue;
115
+				}
116
+
117
+				if (empty($out['method'])) {
118
+					$out['method'] = '';
119
+				}
120
+
121
+				$params = array();
122
+				foreach ($method->getParameters() as $param) {
123
+					$params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : '');
124
+				}
125
+
126
+				$out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />';
127
+			}
128
+		}
129
+
130
+		foreach ($list as $attributeName => $attributeValue) {
131
+			if (property_exists($obj, $attributeName)) {
132
+				$key = 'public';
133
+			} elseif (substr($attributeName, 0, 3) === "\0*\0") {
134
+				$key = 'protected';
135
+				$attributeName = substr($attributeName, 3);
136
+			} else {
137
+				$key = 'private';
138
+				$attributeName = substr($attributeName, $protectedLength);
139
+			}
140
+
141
+			if (empty($out[$key])) {
142
+				$out[$key] = '';
143
+			}
144
+
145
+			$out[$key] .= '('.$key.') ';
146
+
147
+			if (is_array($attributeValue)) {
148
+				$out[$key] .= $attributeName.' (array):<br />
149 149
 							<div style="padding-left:20px;">'.$this->export($attributeValue, false).'</div>';
150
-            } elseif (is_object($attributeValue)) {
151
-                $out[$key] .= $this->exportObj($attributeName.' (object: '.get_class($attributeValue).'):', $attributeValue);
152
-            } else {
153
-                $out[$key] .= $this->exportVar($attributeName.' = ', $attributeValue);
154
-            }
155
-        }
150
+			} elseif (is_object($attributeValue)) {
151
+				$out[$key] .= $this->exportObj($attributeName.' (object: '.get_class($attributeValue).'):', $attributeValue);
152
+			} else {
153
+				$out[$key] .= $this->exportVar($attributeName.' = ', $attributeValue);
154
+			}
155
+		}
156 156
 
157
-        $return = $i.'<br /><div style="padding-left:20px;">';
157
+		$return = $i.'<br /><div style="padding-left:20px;">';
158 158
 
159
-        if (!empty($out['method'])) {
160
-            $return .= $out['method'];
161
-        }
159
+		if (!empty($out['method'])) {
160
+			$return .= $out['method'];
161
+		}
162 162
 
163
-        if (!empty($out['public'])) {
164
-            $return .= $out['public'];
165
-        }
163
+		if (!empty($out['public'])) {
164
+			$return .= $out['public'];
165
+		}
166 166
 
167
-        if (!empty($out['protected'])) {
168
-            $return .= $out['protected'];
169
-        }
167
+		if (!empty($out['protected'])) {
168
+			$return .= $out['protected'];
169
+		}
170 170
 
171
-        if (!empty($out['private'])) {
172
-            $return .= $out['private'];
173
-        }
171
+		if (!empty($out['private'])) {
172
+			$return .= $out['private'];
173
+		}
174 174
 
175
-        return $return.'</div>';
176
-    }
175
+		return $return.'</div>';
176
+	}
177 177
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/regex_replace.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@
 block discarded – undo
23 23
  */
24 24
 function Dwoo_Plugin_regex_replace(Dwoo_Core $dwoo, $value, $search, $replace)
25 25
 {
26
-    $search = (array) $search;
27
-    $cnt = count($search);
26
+	$search = (array) $search;
27
+	$cnt = count($search);
28 28
 
29
-    for ($i = 0; $i < $cnt; ++$i) {
30
-        // Credits for this to Monte Ohrt who made smarty's regex_replace modifier
31
-        if (($pos = strpos($search[$i], "\0")) !== false) {
32
-            $search[$i] = substr($search[$i], 0, $pos);
33
-        }
29
+	for ($i = 0; $i < $cnt; ++$i) {
30
+		// Credits for this to Monte Ohrt who made smarty's regex_replace modifier
31
+		if (($pos = strpos($search[$i], "\0")) !== false) {
32
+			$search[$i] = substr($search[$i], 0, $pos);
33
+		}
34 34
 
35
-        if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) {
36
-            $search[$i] = substr($search[$i], 0, -strlen($m[0])).str_replace(array('e', ' '), '', $m[0]);
37
-        }
38
-    }
35
+		if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) {
36
+			$search[$i] = substr($search[$i], 0, -strlen($m[0])).str_replace(array('e', ' '), '', $m[0]);
37
+		}
38
+	}
39 39
 
40
-    return preg_replace($search, $replace, $value);
40
+	return preg_replace($search, $replace, $value);
41 41
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/tif.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -23,55 +23,55 @@
 block discarded – undo
23 23
  */
24 24
 function Dwoo_Plugin_tif_compile(Dwoo_Compiler $compiler, array $rest, array $tokens)
25 25
 {
26
-    // load if plugin
27
-    if (!class_exists('Dwoo_Plugin_if', false)) {
28
-        try {
29
-            $compiler->getDwoo()->getLoader()->loadPlugin('if');
30
-        } catch (Exception $e) {
31
-            throw new Dwoo_Compilation_Exception($compiler, 'Tif: the if plugin is required to use Tif');
32
-        }
33
-    }
26
+	// load if plugin
27
+	if (!class_exists('Dwoo_Plugin_if', false)) {
28
+		try {
29
+			$compiler->getDwoo()->getLoader()->loadPlugin('if');
30
+		} catch (Exception $e) {
31
+			throw new Dwoo_Compilation_Exception($compiler, 'Tif: the if plugin is required to use Tif');
32
+		}
33
+	}
34 34
 
35
-    if (count($rest) == 1) {
36
-        return $rest[0];
37
-    }
35
+	if (count($rest) == 1) {
36
+		return $rest[0];
37
+	}
38 38
 
39
-    // fetch false result and remove the ":" if it was present
40
-    $falseResult = array_pop($rest);
39
+	// fetch false result and remove the ":" if it was present
40
+	$falseResult = array_pop($rest);
41 41
 
42
-    if (trim(end($rest), '"\'') === ':') {
43
-        // remove the ':' if present
44
-        array_pop($rest);
45
-    } elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
46
-        if ($falseResult === '?' || $falseResult === ':') {
47
-            throw new Dwoo_Compilation_Exception($compiler, 'Tif: incomplete tif statement, value missing after '.$falseResult);
48
-        }
49
-        // there was in fact no false result provided, so we move it to be the true result instead
50
-        $trueResult = $falseResult;
51
-        $falseResult = "''";
52
-    }
42
+	if (trim(end($rest), '"\'') === ':') {
43
+		// remove the ':' if present
44
+		array_pop($rest);
45
+	} elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) {
46
+		if ($falseResult === '?' || $falseResult === ':') {
47
+			throw new Dwoo_Compilation_Exception($compiler, 'Tif: incomplete tif statement, value missing after '.$falseResult);
48
+		}
49
+		// there was in fact no false result provided, so we move it to be the true result instead
50
+		$trueResult = $falseResult;
51
+		$falseResult = "''";
52
+	}
53 53
 
54
-    // fetch true result if needed
55
-    if (!isset($trueResult)) {
56
-        $trueResult = array_pop($rest);
57
-        // no true result provided so we use the expression arg
58
-        if ($trueResult === '?') {
59
-            $trueResult = true;
60
-        }
61
-    }
54
+	// fetch true result if needed
55
+	if (!isset($trueResult)) {
56
+		$trueResult = array_pop($rest);
57
+		// no true result provided so we use the expression arg
58
+		if ($trueResult === '?') {
59
+			$trueResult = true;
60
+		}
61
+	}
62 62
 
63
-    // remove the '?' if present
64
-    if (trim(end($rest), '"\'') === '?') {
65
-        array_pop($rest);
66
-    }
63
+	// remove the '?' if present
64
+	if (trim(end($rest), '"\'') === '?') {
65
+		array_pop($rest);
66
+	}
67 67
 
68
-    // check params were correctly provided
69
-    if (empty($rest) || $trueResult === null || $falseResult === null) {
70
-        throw new Dwoo_Compilation_Exception($compiler, 'Tif: you must provide three parameters serving as <expression> ? <true value> : <false value>');
71
-    }
68
+	// check params were correctly provided
69
+	if (empty($rest) || $trueResult === null || $falseResult === null) {
70
+		throw new Dwoo_Compilation_Exception($compiler, 'Tif: you must provide three parameters serving as <expression> ? <true value> : <false value>');
71
+	}
72 72
 
73
-    // parse condition
74
-    $condition = Dwoo_Plugin_if::replaceKeywords($rest, $tokens, $compiler);
73
+	// parse condition
74
+	$condition = Dwoo_Plugin_if::replaceKeywords($rest, $tokens, $compiler);
75 75
 
76
-    return '(('.implode(' ', $condition).') ? '.($trueResult === true ? implode(' ', $condition) : $trueResult).' : '.$falseResult.')';
76
+	return '(('.implode(' ', $condition).') ? '.($trueResult === true ? implode(' ', $condition) : $trueResult).' : '.$falseResult.')';
77 77
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/processors/pre.smarty_compat.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,56 +20,56 @@
 block discarded – undo
20 20
  */
21 21
 class Dwoo_Processor_smarty_compat extends Dwoo_Processor
22 22
 {
23
-    public function process($input)
24
-    {
25
-        list($l, $r) = $this->compiler->getDelimiters();
23
+	public function process($input)
24
+	{
25
+		list($l, $r) = $this->compiler->getDelimiters();
26 26
 
27
-        $rl = preg_quote($l, '/');
28
-        $rr = preg_quote($r, '/');
29
-        $sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
30
-        $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($this, 'convertSection'), $input);
31
-        $input = str_replace('$smarty.section.', '$smarty.for.', $input);
27
+		$rl = preg_quote($l, '/');
28
+		$rr = preg_quote($r, '/');
29
+		$sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
30
+		$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($this, 'convertSection'), $input);
31
+		$input = str_replace('$smarty.section.', '$smarty.for.', $input);
32 32
 
33
-        $smarty = array(
34
-            '/'.$rl.'\s*ldelim\s*'.$rr.'/',
35
-            '/'.$rl.'\s*rdelim\s*'.$rr.'/',
36
-            '/'.$rl.'\s*\$smarty\.ldelim\s*'.$rr.'/',
37
-            '/'.$rl.'\s*\$smarty\.rdelim\s*'.$rr.'/',
38
-            '/\$smarty\./',
39
-            '/'.$rl.'\s*php\s*'.$rr.'/',
40
-            '/'.$rl.'\s*\/php\s*'.$rr.'/',
41
-            '/\|(@?)strip(\||'.$rr.')/',
42
-            '/'.$rl.'\s*sectionelse\s*'.$rr.'/',
43
-        );
33
+		$smarty = array(
34
+			'/'.$rl.'\s*ldelim\s*'.$rr.'/',
35
+			'/'.$rl.'\s*rdelim\s*'.$rr.'/',
36
+			'/'.$rl.'\s*\$smarty\.ldelim\s*'.$rr.'/',
37
+			'/'.$rl.'\s*\$smarty\.rdelim\s*'.$rr.'/',
38
+			'/\$smarty\./',
39
+			'/'.$rl.'\s*php\s*'.$rr.'/',
40
+			'/'.$rl.'\s*\/php\s*'.$rr.'/',
41
+			'/\|(@?)strip(\||'.$rr.')/',
42
+			'/'.$rl.'\s*sectionelse\s*'.$rr.'/',
43
+		);
44 44
 
45
-        $dwoo = array(
46
-            '\\'.$l,
47
-            $r,
48
-            '\\'.$l,
49
-            $r,
50
-            '$dwoo.',
51
-            '<?php ',
52
-            ' ?>',
53
-            '|$1whitespace$2',
54
-            $l.'else'.$r,
55
-        );
45
+		$dwoo = array(
46
+			'\\'.$l,
47
+			$r,
48
+			'\\'.$l,
49
+			$r,
50
+			'$dwoo.',
51
+			'<?php ',
52
+			' ?>',
53
+			'|$1whitespace$2',
54
+			$l.'else'.$r,
55
+		);
56 56
 
57
-        if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
58
-            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);
59
-        }
57
+		if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
58
+			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);
59
+		}
60 60
 
61
-        return preg_replace($smarty, $dwoo, $input);
62
-    }
61
+		return preg_replace($smarty, $dwoo, $input);
62
+	}
63 63
 
64
-    protected function convertSection(array $matches)
65
-    {
66
-        $params = array();
67
-        $index = 1;
68
-        while (!empty($matches[$index]) && $index < 13) {
69
-            $params[$matches[$index]] = $matches[$index + 1];
70
-            $index += 2;
71
-        }
64
+	protected function convertSection(array $matches)
65
+	{
66
+		$params = array();
67
+		$index = 1;
68
+		while (!empty($matches[$index]) && $index < 13) {
69
+			$params[$matches[$index]] = $matches[$index + 1];
70
+			$index += 2;
71
+		}
72 72
 
73
-        return str_replace('['.trim($params['name'], '"\'').']', '[$'.trim($params['name'], '"\'').']', $matches[0]);
74
-    }
73
+		return str_replace('['.trim($params['name'], '"\'').']', '[$'.trim($params['name'], '"\'').']', $matches[0]);
74
+	}
75 75
 }
Please login to merge, or discard this patch.