Completed
Branch master (b65d76)
by David
04:29
created
lib/Dwoo/Plugins/Functions/PluginMailto.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -36,93 +36,93 @@
 block discarded – undo
36 36
  */
37 37
 function PluginMailto(Core $dwoo, $address, $text = null, $subject = null, $encode = null, $cc = null, $bcc = null, $newsgroups = null, $followupto = null, $extra = null)
38 38
 {
39
-    if (empty($address)) {
40
-        return '';
41
-    }
42
-    if (empty($text)) {
43
-        $text = $address;
44
-    }
45
-
46
-    // build address string
47
-    $address .= '?';
48
-
49
-    if (!empty($subject)) {
50
-        $address .= 'subject=' . rawurlencode($subject) . '&';
51
-    }
52
-    if (!empty($cc)) {
53
-        $address .= 'cc=' . rawurlencode($cc) . '&';
54
-    }
55
-    if (!empty($bcc)) {
56
-        $address .= 'bcc=' . rawurlencode($bcc) . '&';
57
-    }
58
-    if (!empty($newsgroups)) {
59
-        $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&';
60
-    }
61
-    if (!empty($followupto)) {
62
-        $address .= 'followupto=' . rawurlencode($followupto) . '&';
63
-    }
64
-
65
-    $address = rtrim($address, '?&');
66
-
67
-    // output
68
-    switch ($encode) {
69
-
70
-        case 'none':
71
-        case null:
72
-            return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
73
-
74
-        case 'js':
75
-        case 'javascript':
76
-            $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
77
-            $len = strlen($str);
78
-
79
-            $out = '';
80
-            for ($i = 0; $i < $len; ++ $i) {
81
-                $out .= '%' . bin2hex($str[$i]);
82
-            }
83
-
84
-            return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
85
-
86
-            break;
87
-        case 'javascript_charcode':
88
-        case 'js_charcode':
89
-        case 'jscharcode':
90
-        case 'jschar':
91
-            $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
92
-            $len = strlen($str);
93
-
94
-            $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode(";
95
-            for ($i = 0; $i < $len; ++ $i) {
96
-                $out .= ord($str[$i]) . ',';
97
-            }
98
-
99
-            return rtrim($out, ',') . "));\n-->\n</script>\n";
100
-
101
-            break;
102
-
103
-        case 'hex':
104
-            if (strpos($address, '?') !== false) {
105
-                $dwoo->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
106
-            }
107
-
108
-            $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
109
-            $len = strlen($address);
110
-            for ($i = 0; $i < $len; ++ $i) {
111
-                if (preg_match('#\w#', $address[$i])) {
112
-                    $out .= '%' . bin2hex($address[$i]);
113
-                } else {
114
-                    $out .= $address[$i];
115
-                }
116
-            }
117
-            $out .= '" ' . $extra . '>';
118
-            $len = strlen($text);
119
-            for ($i = 0; $i < $len; ++ $i) {
120
-                $out .= '&#x' . bin2hex($text[$i]);
121
-            }
122
-
123
-            return $out . '</a>';
124
-
125
-        default:
126
-            $dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
127
-    }
39
+	if (empty($address)) {
40
+		return '';
41
+	}
42
+	if (empty($text)) {
43
+		$text = $address;
44
+	}
45
+
46
+	// build address string
47
+	$address .= '?';
48
+
49
+	if (!empty($subject)) {
50
+		$address .= 'subject=' . rawurlencode($subject) . '&';
51
+	}
52
+	if (!empty($cc)) {
53
+		$address .= 'cc=' . rawurlencode($cc) . '&';
54
+	}
55
+	if (!empty($bcc)) {
56
+		$address .= 'bcc=' . rawurlencode($bcc) . '&';
57
+	}
58
+	if (!empty($newsgroups)) {
59
+		$address .= 'newsgroups=' . rawurlencode($newsgroups) . '&';
60
+	}
61
+	if (!empty($followupto)) {
62
+		$address .= 'followupto=' . rawurlencode($followupto) . '&';
63
+	}
64
+
65
+	$address = rtrim($address, '?&');
66
+
67
+	// output
68
+	switch ($encode) {
69
+
70
+		case 'none':
71
+		case null:
72
+			return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
73
+
74
+		case 'js':
75
+		case 'javascript':
76
+			$str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
77
+			$len = strlen($str);
78
+
79
+			$out = '';
80
+			for ($i = 0; $i < $len; ++ $i) {
81
+				$out .= '%' . bin2hex($str[$i]);
82
+			}
83
+
84
+			return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
85
+
86
+			break;
87
+		case 'javascript_charcode':
88
+		case 'js_charcode':
89
+		case 'jscharcode':
90
+		case 'jschar':
91
+			$str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
92
+			$len = strlen($str);
93
+
94
+			$out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode(";
95
+			for ($i = 0; $i < $len; ++ $i) {
96
+				$out .= ord($str[$i]) . ',';
97
+			}
98
+
99
+			return rtrim($out, ',') . "));\n-->\n</script>\n";
100
+
101
+			break;
102
+
103
+		case 'hex':
104
+			if (strpos($address, '?') !== false) {
105
+				$dwoo->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
106
+			}
107
+
108
+			$out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
109
+			$len = strlen($address);
110
+			for ($i = 0; $i < $len; ++ $i) {
111
+				if (preg_match('#\w#', $address[$i])) {
112
+					$out .= '%' . bin2hex($address[$i]);
113
+				} else {
114
+					$out .= $address[$i];
115
+				}
116
+			}
117
+			$out .= '" ' . $extra . '>';
118
+			$len = strlen($text);
119
+			for ($i = 0; $i < $len; ++ $i) {
120
+				$out .= '&#x' . bin2hex($text[$i]);
121
+			}
122
+
123
+			return $out . '</a>';
124
+
125
+		default:
126
+			$dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING);
127
+	}
128 128
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginUpperCompile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,5 +28,5 @@
 block discarded – undo
28 28
  */
29 29
 function PluginUpperCompile(Compiler $compiler, $value)
30 30
 {
31
-    return 'mb_strtoupper((string) ' . $value . ', $this->charset)';
31
+	return 'mb_strtoupper((string) ' . $value . ', $this->charset)';
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginSafeCompile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,5 +28,5 @@
 block discarded – undo
28 28
  */
29 29
 function PluginSafeCompile(Compiler $compiler, $var)
30 30
 {
31
-    return preg_replace('#\(is_string\(\$tmp=(.+)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $var);
31
+	return preg_replace('#\(is_string\(\$tmp=(.+)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $var);
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginOptionalCompile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,5 +28,5 @@
 block discarded – undo
28 28
  */
29 29
 function PluginOptionalCompile(Compiler $compiler, $value)
30 30
 {
31
-    return $value;
31
+	return $value;
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginDump.php 1 patch
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -29,156 +29,156 @@
 block discarded – undo
29 29
  */
30 30
 class PluginDump extends Plugin
31 31
 {
32
-    protected $outputObjects;
33
-    protected $outputMethods;
34
-
35
-    public function process($var = '$', $show_methods = false)
36
-    {
37
-        $this->outputMethods = $show_methods;
38
-        if ($var === '$') {
39
-            $var = $this->core->getData();
40
-            $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">data';
41
-        } else {
42
-            $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">dump';
43
-        }
44
-
45
-        $this->outputObjects = array();
46
-
47
-        if (!is_array($var)) {
48
-            if (is_object($var)) {
49
-                return $this->exportObj('', $var);
50
-            } else {
51
-                return $this->exportVar('', $var);
52
-            }
53
-        }
54
-
55
-        $scope = $this->core->getScope();
56
-
57
-        if ($var === $scope) {
58
-            $out .= ' (current scope): <div style="background:#ccc;">';
59
-        } else {
60
-            $out .= ':<div style="padding-left:20px;">';
61
-        }
62
-
63
-        $out .= $this->export($var, $scope);
64
-
65
-        return $out . '</div></div>';
66
-    }
67
-
68
-    protected function export($var, $scope)
69
-    {
70
-        $out = '';
71
-        foreach ($var as $i => $v) {
72
-            if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
73
-                $out .= $i . ' (' . (is_array($v) ? 'array' : 'object: ' . get_class($v)) . ')';
74
-                if ($v === $scope) {
75
-                    $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">' . $this->export($v, $scope) . '</div>';
76
-                } else {
77
-                    $out .= ':<div style="padding-left:20px;">' . $this->export($v, $scope) . '</div>';
78
-                }
79
-            } elseif (is_object($v)) {
80
-                $out .= $this->exportObj($i . ' (object: ' . get_class($v) . '):', $v);
81
-            } else {
82
-                $out .= $this->exportVar($i . ' = ', $v);
83
-            }
84
-        }
85
-
86
-        return $out;
87
-    }
88
-
89
-    protected function exportVar($i, $v)
90
-    {
91
-        if (is_string($v) || is_bool($v) || is_numeric($v)) {
92
-            return $i . htmlentities(var_export($v, true)) . '<br />';
93
-        } elseif (is_null($v)) {
94
-            return $i . 'null<br />';
95
-        } elseif (is_resource($v)) {
96
-            return $i . 'resource(' . get_resource_type($v) . ')<br />';
97
-        } else {
98
-            return $i . htmlentities(var_export($v, true)) . '<br />';
99
-        }
100
-    }
101
-
102
-    protected function exportObj($i, $obj)
103
-    {
104
-        if (array_search($obj, $this->outputObjects, true) !== false) {
105
-            return $i . ' [recursion, skipped]<br />';
106
-        }
107
-
108
-        $this->outputObjects[] = $obj;
109
-
110
-        $list = (array)$obj;
111
-
112
-        $protectedLength = strlen(get_class($obj)) + 2;
113
-
114
-        $out = array();
115
-
116
-        if ($this->outputMethods) {
117
-            $ref = new ReflectionObject($obj);
118
-
119
-            foreach ($ref->getMethods() as $method) {
120
-                if (!$method->isPublic()) {
121
-                    continue;
122
-                }
123
-
124
-                if (empty($out['method'])) {
125
-                    $out['method'] = '';
126
-                }
127
-
128
-                $params = array();
129
-                foreach ($method->getParameters() as $param) {
130
-                    $params[] = ($param->isPassedByReference() ? '&' : '') . '$' . $param->getName() . ($param->isOptional() ? ' = ' . var_export($param->getDefaultValue(), true) : '');
131
-                }
132
-
133
-                $out['method'] .= '(method) ' . $method->getName() . '(' . implode(', ', $params) . ')<br />';
134
-            }
135
-        }
136
-
137
-        foreach ($list as $attributeName => $attributeValue) {
138
-            if (property_exists($obj, $attributeName)) {
139
-                $key = 'public';
140
-            } elseif (substr($attributeName, 0, 3) === "\0*\0") {
141
-                $key           = 'protected';
142
-                $attributeName = substr($attributeName, 3);
143
-            } else {
144
-                $key           = 'private';
145
-                $attributeName = substr($attributeName, $protectedLength);
146
-            }
147
-
148
-            if (empty($out[$key])) {
149
-                $out[$key] = '';
150
-            }
151
-
152
-            $out[$key] .= '(' . $key . ') ';
153
-
154
-            if (is_array($attributeValue)) {
155
-                $out[$key] .= $attributeName . ' (array):<br />
32
+	protected $outputObjects;
33
+	protected $outputMethods;
34
+
35
+	public function process($var = '$', $show_methods = false)
36
+	{
37
+		$this->outputMethods = $show_methods;
38
+		if ($var === '$') {
39
+			$var = $this->core->getData();
40
+			$out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">data';
41
+		} else {
42
+			$out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">dump';
43
+		}
44
+
45
+		$this->outputObjects = array();
46
+
47
+		if (!is_array($var)) {
48
+			if (is_object($var)) {
49
+				return $this->exportObj('', $var);
50
+			} else {
51
+				return $this->exportVar('', $var);
52
+			}
53
+		}
54
+
55
+		$scope = $this->core->getScope();
56
+
57
+		if ($var === $scope) {
58
+			$out .= ' (current scope): <div style="background:#ccc;">';
59
+		} else {
60
+			$out .= ':<div style="padding-left:20px;">';
61
+		}
62
+
63
+		$out .= $this->export($var, $scope);
64
+
65
+		return $out . '</div></div>';
66
+	}
67
+
68
+	protected function export($var, $scope)
69
+	{
70
+		$out = '';
71
+		foreach ($var as $i => $v) {
72
+			if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
73
+				$out .= $i . ' (' . (is_array($v) ? 'array' : 'object: ' . get_class($v)) . ')';
74
+				if ($v === $scope) {
75
+					$out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">' . $this->export($v, $scope) . '</div>';
76
+				} else {
77
+					$out .= ':<div style="padding-left:20px;">' . $this->export($v, $scope) . '</div>';
78
+				}
79
+			} elseif (is_object($v)) {
80
+				$out .= $this->exportObj($i . ' (object: ' . get_class($v) . '):', $v);
81
+			} else {
82
+				$out .= $this->exportVar($i . ' = ', $v);
83
+			}
84
+		}
85
+
86
+		return $out;
87
+	}
88
+
89
+	protected function exportVar($i, $v)
90
+	{
91
+		if (is_string($v) || is_bool($v) || is_numeric($v)) {
92
+			return $i . htmlentities(var_export($v, true)) . '<br />';
93
+		} elseif (is_null($v)) {
94
+			return $i . 'null<br />';
95
+		} elseif (is_resource($v)) {
96
+			return $i . 'resource(' . get_resource_type($v) . ')<br />';
97
+		} else {
98
+			return $i . htmlentities(var_export($v, true)) . '<br />';
99
+		}
100
+	}
101
+
102
+	protected function exportObj($i, $obj)
103
+	{
104
+		if (array_search($obj, $this->outputObjects, true) !== false) {
105
+			return $i . ' [recursion, skipped]<br />';
106
+		}
107
+
108
+		$this->outputObjects[] = $obj;
109
+
110
+		$list = (array)$obj;
111
+
112
+		$protectedLength = strlen(get_class($obj)) + 2;
113
+
114
+		$out = array();
115
+
116
+		if ($this->outputMethods) {
117
+			$ref = new ReflectionObject($obj);
118
+
119
+			foreach ($ref->getMethods() as $method) {
120
+				if (!$method->isPublic()) {
121
+					continue;
122
+				}
123
+
124
+				if (empty($out['method'])) {
125
+					$out['method'] = '';
126
+				}
127
+
128
+				$params = array();
129
+				foreach ($method->getParameters() as $param) {
130
+					$params[] = ($param->isPassedByReference() ? '&' : '') . '$' . $param->getName() . ($param->isOptional() ? ' = ' . var_export($param->getDefaultValue(), true) : '');
131
+				}
132
+
133
+				$out['method'] .= '(method) ' . $method->getName() . '(' . implode(', ', $params) . ')<br />';
134
+			}
135
+		}
136
+
137
+		foreach ($list as $attributeName => $attributeValue) {
138
+			if (property_exists($obj, $attributeName)) {
139
+				$key = 'public';
140
+			} elseif (substr($attributeName, 0, 3) === "\0*\0") {
141
+				$key           = 'protected';
142
+				$attributeName = substr($attributeName, 3);
143
+			} else {
144
+				$key           = 'private';
145
+				$attributeName = substr($attributeName, $protectedLength);
146
+			}
147
+
148
+			if (empty($out[$key])) {
149
+				$out[$key] = '';
150
+			}
151
+
152
+			$out[$key] .= '(' . $key . ') ';
153
+
154
+			if (is_array($attributeValue)) {
155
+				$out[$key] .= $attributeName . ' (array):<br />
156 156
 							<div style="padding-left:20px;">' . $this->export($attributeValue, false) . '</div>';
157
-            } elseif (is_object($attributeValue)) {
158
-                $out[$key] .= $this->exportObj($attributeName . ' (object: ' . get_class($attributeValue) . '):', $attributeValue);
159
-            } else {
160
-                $out[$key] .= $this->exportVar($attributeName . ' = ', $attributeValue);
161
-            }
162
-        }
157
+			} elseif (is_object($attributeValue)) {
158
+				$out[$key] .= $this->exportObj($attributeName . ' (object: ' . get_class($attributeValue) . '):', $attributeValue);
159
+			} else {
160
+				$out[$key] .= $this->exportVar($attributeName . ' = ', $attributeValue);
161
+			}
162
+		}
163 163
 
164
-        $return = $i . '<br /><div style="padding-left:20px;">';
164
+		$return = $i . '<br /><div style="padding-left:20px;">';
165 165
 
166
-        if (!empty($out['method'])) {
167
-            $return .= $out['method'];
168
-        }
166
+		if (!empty($out['method'])) {
167
+			$return .= $out['method'];
168
+		}
169 169
 
170
-        if (!empty($out['public'])) {
171
-            $return .= $out['public'];
172
-        }
170
+		if (!empty($out['public'])) {
171
+			$return .= $out['public'];
172
+		}
173 173
 
174
-        if (!empty($out['protected'])) {
175
-            $return .= $out['protected'];
176
-        }
174
+		if (!empty($out['protected'])) {
175
+			$return .= $out['protected'];
176
+		}
177 177
 
178
-        if (!empty($out['private'])) {
179
-            $return .= $out['private'];
180
-        }
178
+		if (!empty($out['private'])) {
179
+			$return .= $out['private'];
180
+		}
181 181
 
182
-        return $return . '</div>';
183
-    }
182
+		return $return . '</div>';
183
+	}
184 184
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCounter.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,61 +34,61 @@
 block discarded – undo
34 34
  */
35 35
 class PluginCounter extends Plugin
36 36
 {
37
-    protected $counters = array();
37
+	protected $counters = array();
38 38
 
39
-    /**
40
-     * @param string $name
41
-     * @param null   $start
42
-     * @param null   $skip
43
-     * @param null   $direction
44
-     * @param null   $print
45
-     * @param null   $assign
46
-     *
47
-     * @return mixed
48
-     */
49
-    public function process($name = 'default', $start = null, $skip = null, $direction = null, $print = null, $assign = null)
50
-    {
51
-        // init counter
52
-        if (!isset($this->counters[$name])) {
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,
59
-            );
60
-        } // increment
61
-        else {
62
-            // override setting if present
63
-            if ($skip !== null) {
64
-                $this->counters[$name]['skip'] = (int)$skip;
65
-            }
39
+	/**
40
+	 * @param string $name
41
+	 * @param null   $start
42
+	 * @param null   $skip
43
+	 * @param null   $direction
44
+	 * @param null   $print
45
+	 * @param null   $assign
46
+	 *
47
+	 * @return mixed
48
+	 */
49
+	public function process($name = 'default', $start = null, $skip = null, $direction = null, $print = null, $assign = null)
50
+	{
51
+		// init counter
52
+		if (!isset($this->counters[$name])) {
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,
59
+			);
60
+		} // increment
61
+		else {
62
+			// override setting if present
63
+			if ($skip !== null) {
64
+				$this->counters[$name]['skip'] = (int)$skip;
65
+			}
66 66
 
67
-            if ($direction !== null) {
68
-                $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? - 1 : 1;
69
-            }
67
+			if ($direction !== null) {
68
+				$this->counters[$name]['direction'] = strtolower($direction) === 'down' ? - 1 : 1;
69
+			}
70 70
 
71
-            if ($print !== null) {
72
-                $this->counters[$name]['print'] = (bool)$print;
73
-            }
71
+			if ($print !== null) {
72
+				$this->counters[$name]['print'] = (bool)$print;
73
+			}
74 74
 
75
-            if ($assign !== null) {
76
-                $this->counters[$name]['assign'] = (string)$assign;
77
-            }
75
+			if ($assign !== null) {
76
+				$this->counters[$name]['assign'] = (string)$assign;
77
+			}
78 78
 
79
-            if ($start !== null) {
80
-                $this->counters[$name]['count'] = (int)$start;
81
-            } else {
82
-                $this->counters[$name]['count'] += ($this->counters[$name]['skip'] * $this->counters[$name]['direction']);
83
-            }
84
-        }
79
+			if ($start !== null) {
80
+				$this->counters[$name]['count'] = (int)$start;
81
+			} else {
82
+				$this->counters[$name]['count'] += ($this->counters[$name]['skip'] * $this->counters[$name]['direction']);
83
+			}
84
+		}
85 85
 
86
-        $out = $this->counters[$name]['count'];
86
+		$out = $this->counters[$name]['count'];
87 87
 
88
-        if ($this->counters[$name]['assign'] !== null) {
89
-            $this->core->assignInScope($out, $this->counters[$name]['assign']);
90
-        } elseif ($this->counters[$name]['print'] === true) {
91
-            return $out;
92
-        }
93
-    }
88
+		if ($this->counters[$name]['assign'] !== null) {
89
+			$this->core->assignInScope($out, $this->counters[$name]['assign']);
90
+		} elseif ($this->counters[$name]['print'] === true) {
91
+			return $out;
92
+		}
93
+	}
94 94
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginRegexReplace.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,22 +30,22 @@
 block discarded – undo
30 30
  */
31 31
 function PluginRegexReplace(Core $dwoo, $value, $search, $replace)
32 32
 {
33
-    $search = (array)$search;
34
-    $cnt    = count($search);
33
+	$search = (array)$search;
34
+	$cnt    = count($search);
35 35
 
36
-    for ($i = 0; $i < $cnt; ++ $i) {
37
-        // Credits for this to Monte Ohrt who made smarty's regex_replace modifier
38
-        if (($pos = strpos($search[$i], "\0")) !== false) {
39
-            $search[$i] = substr($search[$i], 0, $pos);
40
-        }
36
+	for ($i = 0; $i < $cnt; ++ $i) {
37
+		// Credits for this to Monte Ohrt who made smarty's regex_replace modifier
38
+		if (($pos = strpos($search[$i], "\0")) !== false) {
39
+			$search[$i] = substr($search[$i], 0, $pos);
40
+		}
41 41
 
42
-        if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) {
43
-            $search[$i] = substr($search[$i], 0, - strlen($m[0])) . str_replace(array(
44
-                    'e',
45
-                    ' '
46
-                ), '', $m[0]);
47
-        }
48
-    }
42
+		if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) {
43
+			$search[$i] = substr($search[$i], 0, - strlen($m[0])) . str_replace(array(
44
+					'e',
45
+					' '
46
+				), '', $m[0]);
47
+		}
48
+	}
49 49
 
50
-    return preg_replace($search, $replace, $value);
50
+	return preg_replace($search, $replace, $value);
51 51
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginDateFormat.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -30,52 +30,52 @@
 block discarded – undo
30 30
  */
31 31
 function PluginDateFormat(Core $dwoo, $value, $format = '%b %e, %Y', $default = null)
32 32
 {
33
-    if (!empty($value)) {
34
-        // convert if it's not a valid unix timestamp
35
-        if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
36
-            $value = strtotime($value);
37
-        }
38
-    } elseif (!empty($default)) {
39
-        // convert if it's not a valid unix timestamp
40
-        if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
41
-            $value = strtotime($default);
42
-        } else {
43
-            $value = $default;
44
-        }
45
-    } else {
46
-        return '';
47
-    }
33
+	if (!empty($value)) {
34
+		// convert if it's not a valid unix timestamp
35
+		if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
36
+			$value = strtotime($value);
37
+		}
38
+	} elseif (!empty($default)) {
39
+		// convert if it's not a valid unix timestamp
40
+		if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
41
+			$value = strtotime($default);
42
+		} else {
43
+			$value = $default;
44
+		}
45
+	} else {
46
+		return '';
47
+	}
48 48
 
49
-    // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
50
-    if (DIRECTORY_SEPARATOR == '\\') {
51
-        $_win_from = array(
52
-            '%D',
53
-            '%h',
54
-            '%n',
55
-            '%r',
56
-            '%R',
57
-            '%t',
58
-            '%T'
59
-        );
60
-        $_win_to   = array(
61
-            '%m/%d/%y',
62
-            '%b',
63
-            "\n",
64
-            '%I:%M:%S %p',
65
-            '%H:%M',
66
-            "\t",
67
-            '%H:%M:%S'
68
-        );
69
-        if (strpos($format, '%e') !== false) {
70
-            $_win_from[] = '%e';
71
-            $_win_to[]   = sprintf('%\' 2d', date('j', $value));
72
-        }
73
-        if (strpos($format, '%l') !== false) {
74
-            $_win_from[] = '%l';
75
-            $_win_to[]   = sprintf('%\' 2d', date('h', $value));
76
-        }
77
-        $format = str_replace($_win_from, $_win_to, $format);
78
-    }
49
+	// Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
50
+	if (DIRECTORY_SEPARATOR == '\\') {
51
+		$_win_from = array(
52
+			'%D',
53
+			'%h',
54
+			'%n',
55
+			'%r',
56
+			'%R',
57
+			'%t',
58
+			'%T'
59
+		);
60
+		$_win_to   = array(
61
+			'%m/%d/%y',
62
+			'%b',
63
+			"\n",
64
+			'%I:%M:%S %p',
65
+			'%H:%M',
66
+			"\t",
67
+			'%H:%M:%S'
68
+		);
69
+		if (strpos($format, '%e') !== false) {
70
+			$_win_from[] = '%e';
71
+			$_win_to[]   = sprintf('%\' 2d', date('j', $value));
72
+		}
73
+		if (strpos($format, '%l') !== false) {
74
+			$_win_from[] = '%l';
75
+			$_win_to[]   = sprintf('%\' 2d', date('h', $value));
76
+		}
77
+		$format = str_replace($_win_from, $_win_to, $format);
78
+	}
79 79
 
80
-    return strftime($format, $value);
80
+	return strftime($format, $value);
81 81
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Helpers/PluginArrayCompile.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@
 block discarded – undo
38 38
  */
39 39
 function PluginArrayCompile(Compiler $compiler, array $rest = array())
40 40
 {
41
-    $out = array();
42
-    foreach ($rest as $key => $value) {
43
-        if (!is_numeric($key) && !strstr($key, '$this->scope')) {
44
-            $key = "'" . $key . "'";
45
-        }
46
-        $out[] = $key . '=>' . $value;
47
-    }
41
+	$out = array();
42
+	foreach ($rest as $key => $value) {
43
+		if (!is_numeric($key) && !strstr($key, '$this->scope')) {
44
+			$key = "'" . $key . "'";
45
+		}
46
+		$out[] = $key . '=>' . $value;
47
+	}
48 48
 
49
-    return 'array(' . implode(', ', $out) . ')';
49
+	return 'array(' . implode(', ', $out) . ')';
50 50
 }
Please login to merge, or discard this patch.