Completed
Push — master ( bf2930...494091 )
by David
07:08 queued 03:26
created
lib/Dwoo/Data.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -24,241 +24,241 @@
 block discarded – undo
24 24
  */
25 25
 class Data implements IDataProvider
26 26
 {
27
-    /**
28
-     * Data array.
29
-     *
30
-     * @var array
31
-     */
32
-    protected $data = array();
27
+	/**
28
+	 * Data array.
29
+	 *
30
+	 * @var array
31
+	 */
32
+	protected $data = array();
33 33
 
34
-    /**
35
-     * Returns the data array.
36
-     *
37
-     * @return array
38
-     */
39
-    public function getData()
40
-    {
41
-        return $this->data;
42
-    }
34
+	/**
35
+	 * Returns the data array.
36
+	 *
37
+	 * @return array
38
+	 */
39
+	public function getData()
40
+	{
41
+		return $this->data;
42
+	}
43 43
 
44
-    /**
45
-     * Clears a the entire data or only the given key.
46
-     *
47
-     * @param array|string $name clears only one value if you give a name, multiple values if
48
-     *                           you give an array of names, or the entire data if left null
49
-     */
50
-    public function clear($name = null)
51
-    {
52
-        if ($name === null) {
53
-            $this->data = array();
54
-        } elseif (is_array($name)) {
55
-            foreach ($name as $index) {
56
-                unset($this->data[$index]);
57
-            }
58
-        } else {
59
-            unset($this->data[$name]);
60
-        }
61
-    }
44
+	/**
45
+	 * Clears a the entire data or only the given key.
46
+	 *
47
+	 * @param array|string $name clears only one value if you give a name, multiple values if
48
+	 *                           you give an array of names, or the entire data if left null
49
+	 */
50
+	public function clear($name = null)
51
+	{
52
+		if ($name === null) {
53
+			$this->data = array();
54
+		} elseif (is_array($name)) {
55
+			foreach ($name as $index) {
56
+				unset($this->data[$index]);
57
+			}
58
+		} else {
59
+			unset($this->data[$name]);
60
+		}
61
+	}
62 62
 
63
-    /**
64
-     * Overwrites the entire data with the given array.
65
-     *
66
-     * @param array $data the new data array to use
67
-     */
68
-    public function setData(array $data)
69
-    {
70
-        $this->data = $data;
71
-    }
63
+	/**
64
+	 * Overwrites the entire data with the given array.
65
+	 *
66
+	 * @param array $data the new data array to use
67
+	 */
68
+	public function setData(array $data)
69
+	{
70
+		$this->data = $data;
71
+	}
72 72
 
73
-    /**
74
-     * merges the given array(s) with the current data with array_merge.
75
-     *
76
-     * @param array $data  the array to merge
77
-     */
78
-    public function mergeData(array $data)
79
-    {
80
-        $args = func_get_args();
81
-        while (list(, $v) = each($args)) {
82
-            if (is_array($v)) {
83
-                $this->data = array_merge($this->data, $v);
84
-            }
85
-        }
86
-    }
73
+	/**
74
+	 * merges the given array(s) with the current data with array_merge.
75
+	 *
76
+	 * @param array $data  the array to merge
77
+	 */
78
+	public function mergeData(array $data)
79
+	{
80
+		$args = func_get_args();
81
+		while (list(, $v) = each($args)) {
82
+			if (is_array($v)) {
83
+				$this->data = array_merge($this->data, $v);
84
+			}
85
+		}
86
+	}
87 87
 
88
-    /**
89
-     * Assigns a value or an array of values to the data object.
90
-     *
91
-     * @param array|string $name an associative array of multiple (index=>value) or a string
92
-     *                           that is the index to use, i.e. a value assigned to "foo" will be
93
-     *                           accessible in the template through {$foo}
94
-     * @param mixed        $val  the value to assign, or null if $name was an array
95
-     */
96
-    public function assign($name, $val = null)
97
-    {
98
-        if (is_array($name)) {
99
-            reset($name);
100
-            while (list($k, $v) = each($name)) {
101
-                $this->data[$k] = $v;
102
-            }
103
-        } else {
104
-            $this->data[$name] = $val;
105
-        }
106
-    }
88
+	/**
89
+	 * Assigns a value or an array of values to the data object.
90
+	 *
91
+	 * @param array|string $name an associative array of multiple (index=>value) or a string
92
+	 *                           that is the index to use, i.e. a value assigned to "foo" will be
93
+	 *                           accessible in the template through {$foo}
94
+	 * @param mixed        $val  the value to assign, or null if $name was an array
95
+	 */
96
+	public function assign($name, $val = null)
97
+	{
98
+		if (is_array($name)) {
99
+			reset($name);
100
+			while (list($k, $v) = each($name)) {
101
+				$this->data[$k] = $v;
102
+			}
103
+		} else {
104
+			$this->data[$name] = $val;
105
+		}
106
+	}
107 107
 
108
-    /**
109
-     * Allows to assign variables using the object syntax.
110
-     *
111
-     * @param string $name  the variable name
112
-     * @param string $value the value to assign to it
113
-     */
114
-    public function __set($name, $value)
115
-    {
116
-        $this->assign($name, $value);
117
-    }
108
+	/**
109
+	 * Allows to assign variables using the object syntax.
110
+	 *
111
+	 * @param string $name  the variable name
112
+	 * @param string $value the value to assign to it
113
+	 */
114
+	public function __set($name, $value)
115
+	{
116
+		$this->assign($name, $value);
117
+	}
118 118
 
119
-    /**
120
-     * Assigns a value by reference to the data object.
121
-     *
122
-     * @param string $name the index to use, i.e. a value assigned to "foo" will be
123
-     *                     accessible in the template through {$foo}
124
-     * @param mixed  $val  the value to assign by reference
125
-     */
126
-    public function assignByRef($name, &$val)
127
-    {
128
-        $this->data[$name] = &$val;
129
-    }
119
+	/**
120
+	 * Assigns a value by reference to the data object.
121
+	 *
122
+	 * @param string $name the index to use, i.e. a value assigned to "foo" will be
123
+	 *                     accessible in the template through {$foo}
124
+	 * @param mixed  $val  the value to assign by reference
125
+	 */
126
+	public function assignByRef($name, &$val)
127
+	{
128
+		$this->data[$name] = &$val;
129
+	}
130 130
 
131
-    /**
132
-     * Appends values or an array of values to the data object.
133
-     *
134
-     * @param array|string $name  an associative array of multiple (index=>value) or a string
135
-     *                            that is the index to use, i.e. a value assigned to "foo" will be
136
-     *                            accessible in the template through {$foo}
137
-     * @param mixed        $val   the value to assign, or null if $name was an array
138
-     * @param bool         $merge true to merge data or false to append, defaults to false
139
-     */
140
-    public function append($name, $val = null, $merge = false)
141
-    {
142
-        if (is_array($name)) {
143
-            foreach ($name as $key => $val) {
144
-                if (isset($this->data[$key]) && !is_array($this->data[$key])) {
145
-                    settype($this->data[$key], 'array');
146
-                }
131
+	/**
132
+	 * Appends values or an array of values to the data object.
133
+	 *
134
+	 * @param array|string $name  an associative array of multiple (index=>value) or a string
135
+	 *                            that is the index to use, i.e. a value assigned to "foo" will be
136
+	 *                            accessible in the template through {$foo}
137
+	 * @param mixed        $val   the value to assign, or null if $name was an array
138
+	 * @param bool         $merge true to merge data or false to append, defaults to false
139
+	 */
140
+	public function append($name, $val = null, $merge = false)
141
+	{
142
+		if (is_array($name)) {
143
+			foreach ($name as $key => $val) {
144
+				if (isset($this->data[$key]) && !is_array($this->data[$key])) {
145
+					settype($this->data[$key], 'array');
146
+				}
147 147
 
148
-                if ($merge === true && is_array($val)) {
149
-                    $this->data[$key] = $val + $this->data[$key];
150
-                } else {
151
-                    $this->data[$key][] = $val;
152
-                }
153
-            }
154
-        } elseif ($val !== null) {
155
-            if (isset($this->data[$name]) && !is_array($this->data[$name])) {
156
-                settype($this->data[$name], 'array');
157
-            } elseif (!isset($this->data[$name])) {
158
-                $this->data[$name] = array();
159
-            }
148
+				if ($merge === true && is_array($val)) {
149
+					$this->data[$key] = $val + $this->data[$key];
150
+				} else {
151
+					$this->data[$key][] = $val;
152
+				}
153
+			}
154
+		} elseif ($val !== null) {
155
+			if (isset($this->data[$name]) && !is_array($this->data[$name])) {
156
+				settype($this->data[$name], 'array');
157
+			} elseif (!isset($this->data[$name])) {
158
+				$this->data[$name] = array();
159
+			}
160 160
 
161
-            if ($merge === true && is_array($val)) {
162
-                $this->data[$name] = $val + $this->data[$name];
163
-            } else {
164
-                $this->data[$name][] = $val;
165
-            }
166
-        }
167
-    }
161
+			if ($merge === true && is_array($val)) {
162
+				$this->data[$name] = $val + $this->data[$name];
163
+			} else {
164
+				$this->data[$name][] = $val;
165
+			}
166
+		}
167
+	}
168 168
 
169
-    /**
170
-     * Appends a value by reference to the data object.
171
-     *
172
-     * @param string $name  the index to use, i.e. a value assigned to "foo" will be
173
-     *                      accessible in the template through {$foo}
174
-     * @param mixed  $val   the value to append by reference
175
-     * @param bool   $merge true to merge data or false to append, defaults to false
176
-     */
177
-    public function appendByRef($name, &$val, $merge = false)
178
-    {
179
-        if (isset($this->data[$name]) && !is_array($this->data[$name])) {
180
-            settype($this->data[$name], 'array');
181
-        }
169
+	/**
170
+	 * Appends a value by reference to the data object.
171
+	 *
172
+	 * @param string $name  the index to use, i.e. a value assigned to "foo" will be
173
+	 *                      accessible in the template through {$foo}
174
+	 * @param mixed  $val   the value to append by reference
175
+	 * @param bool   $merge true to merge data or false to append, defaults to false
176
+	 */
177
+	public function appendByRef($name, &$val, $merge = false)
178
+	{
179
+		if (isset($this->data[$name]) && !is_array($this->data[$name])) {
180
+			settype($this->data[$name], 'array');
181
+		}
182 182
 
183
-        if ($merge === true && is_array($val)) {
184
-            foreach ($val as $key => &$value) {
185
-                $this->data[$name][$key] = &$value;
186
-            }
187
-        } else {
188
-            $this->data[$name][] = &$val;
189
-        }
190
-    }
183
+		if ($merge === true && is_array($val)) {
184
+			foreach ($val as $key => &$value) {
185
+				$this->data[$name][$key] = &$value;
186
+			}
187
+		} else {
188
+			$this->data[$name][] = &$val;
189
+		}
190
+	}
191 191
 
192
-    /**
193
-     * Returns true if the variable has been assigned already, false otherwise.
194
-     *
195
-     * @param string $name the variable name
196
-     *
197
-     * @return bool
198
-     */
199
-    public function isAssigned($name)
200
-    {
201
-        return isset($this->data[$name]);
202
-    }
192
+	/**
193
+	 * Returns true if the variable has been assigned already, false otherwise.
194
+	 *
195
+	 * @param string $name the variable name
196
+	 *
197
+	 * @return bool
198
+	 */
199
+	public function isAssigned($name)
200
+	{
201
+		return isset($this->data[$name]);
202
+	}
203 203
 
204
-    /**
205
-     * Supports calls to isset($dwoo->var).
206
-     *
207
-     * @param string $name the variable name
208
-     *
209
-     * @return bool
210
-     */
211
-    public function __isset($name)
212
-    {
213
-        return isset($this->data[$name]);
214
-    }
204
+	/**
205
+	 * Supports calls to isset($dwoo->var).
206
+	 *
207
+	 * @param string $name the variable name
208
+	 *
209
+	 * @return bool
210
+	 */
211
+	public function __isset($name)
212
+	{
213
+		return isset($this->data[$name]);
214
+	}
215 215
 
216
-    /**
217
-     * Unassigns/removes a variable.
218
-     *
219
-     * @param string $name the variable name
220
-     */
221
-    public function unassign($name)
222
-    {
223
-        unset($this->data[$name]);
224
-    }
216
+	/**
217
+	 * Unassigns/removes a variable.
218
+	 *
219
+	 * @param string $name the variable name
220
+	 */
221
+	public function unassign($name)
222
+	{
223
+		unset($this->data[$name]);
224
+	}
225 225
 
226
-    /**
227
-     * Supports unsetting variables using the object syntax.
228
-     *
229
-     * @param string $name the variable name
230
-     */
231
-    public function __unset($name)
232
-    {
233
-        unset($this->data[$name]);
234
-    }
226
+	/**
227
+	 * Supports unsetting variables using the object syntax.
228
+	 *
229
+	 * @param string $name the variable name
230
+	 */
231
+	public function __unset($name)
232
+	{
233
+		unset($this->data[$name]);
234
+	}
235 235
 
236
-    /**
237
-     * Returns a variable if it was assigned.
238
-     *
239
-     * @param string $name the variable name
240
-     *
241
-     * @return mixed
242
-     */
243
-    public function get($name)
244
-    {
245
-        return $this->__get($name);
246
-    }
236
+	/**
237
+	 * Returns a variable if it was assigned.
238
+	 *
239
+	 * @param string $name the variable name
240
+	 *
241
+	 * @return mixed
242
+	 */
243
+	public function get($name)
244
+	{
245
+		return $this->__get($name);
246
+	}
247 247
 
248
-    /**
249
-     * Allows to read variables using the object syntax.
250
-     *
251
-     * @param string $name the variable name
252
-     *
253
-     * @return mixed
254
-     * @throws Exception
255
-     */
256
-    public function __get($name)
257
-    {
258
-        if (isset($this->data[$name])) {
259
-            return $this->data[$name];
260
-        } else {
261
-            throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
262
-        }
263
-    }
248
+	/**
249
+	 * Allows to read variables using the object syntax.
250
+	 *
251
+	 * @param string $name the variable name
252
+	 *
253
+	 * @return mixed
254
+	 * @throws Exception
255
+	 */
256
+	public function __get($name)
257
+	{
258
+		if (isset($this->data[$name])) {
259
+			return $this->data[$name];
260
+		} else {
261
+			throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"');
262
+		}
263
+	}
264 264
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugin.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -25,81 +25,81 @@
 block discarded – undo
25 25
  */
26 26
 abstract class Plugin
27 27
 {
28
-    /**
29
-     * The dwoo instance that runs this plugin.
30
-     *
31
-     * @var Core
32
-     */
33
-    protected $core;
28
+	/**
29
+	 * The dwoo instance that runs this plugin.
30
+	 *
31
+	 * @var Core
32
+	 */
33
+	protected $core;
34 34
 
35
-    /**
36
-     * Constructor, if you override it, call parent::__construct($core); or assign
37
-     * the dwoo instance yourself if you need it.
38
-     *
39
-     * @param Core $core the dwoo instance that runs this plugin
40
-     */
41
-    public function __construct(Core $core)
42
-    {
43
-        $this->core = $core;
44
-    }
35
+	/**
36
+	 * Constructor, if you override it, call parent::__construct($core); or assign
37
+	 * the dwoo instance yourself if you need it.
38
+	 *
39
+	 * @param Core $core the dwoo instance that runs this plugin
40
+	 */
41
+	public function __construct(Core $core)
42
+	{
43
+		$this->core = $core;
44
+	}
45 45
 
46
-    // plugins should always implement :
47
-    // public function process($arg, $arg, ...)
48
-    // or for block plugins :
49
-    // public function init($arg, $arg, ...)
46
+	// plugins should always implement :
47
+	// public function process($arg, $arg, ...)
48
+	// or for block plugins :
49
+	// public function init($arg, $arg, ...)
50 50
 
51
-    // this could be enforced with :
52
-    // abstract public function process(...);
53
-    // if my feature request gets enough interest one day
54
-    // see => http://bugs.php.net/bug.php?id=44043
51
+	// this could be enforced with :
52
+	// abstract public function process(...);
53
+	// if my feature request gets enough interest one day
54
+	// see => http://bugs.php.net/bug.php?id=44043
55 55
 
56
-    /**
57
-     * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag
58
-     * attributes. this is to be used in preProcessing or postProcessing functions, example :
59
-     *  $p = $compiler->getCompiledParams($params);
60
-     *  // get only the rest array as attributes
61
-     *  $attributes = Plugin::paramsToAttributes($p['*']);
62
-     *  // get all the parameters as attributes (if there is a rest array, it will be included)
63
-     *  $attributes = Plugin::paramsToAttributes($p);
64
-     *
65
-     * @param array    $params   an array of attributeName=>value items that will be compiled to be ready for inclusion in a php string
66
-     *                                inclusion in a php string
67
-     * @param string   $delim    the string delimiter you want to use (defaults to ')
68
-     * @param Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper escaping behavior)
69
-     *                                escaping behavior)
70
-     *
71
-     * @return string
72
-     */
73
-    public static function paramsToAttributes(array $params, $delim = '\'', Compiler $compiler = null)
74
-    {
75
-        if (isset($params['*'])) {
76
-            $params = array_merge($params, $params['*']);
77
-            unset($params['*']);
78
-        }
56
+	/**
57
+	 * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag
58
+	 * attributes. this is to be used in preProcessing or postProcessing functions, example :
59
+	 *  $p = $compiler->getCompiledParams($params);
60
+	 *  // get only the rest array as attributes
61
+	 *  $attributes = Plugin::paramsToAttributes($p['*']);
62
+	 *  // get all the parameters as attributes (if there is a rest array, it will be included)
63
+	 *  $attributes = Plugin::paramsToAttributes($p);
64
+	 *
65
+	 * @param array    $params   an array of attributeName=>value items that will be compiled to be ready for inclusion in a php string
66
+	 *                                inclusion in a php string
67
+	 * @param string   $delim    the string delimiter you want to use (defaults to ')
68
+	 * @param Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper escaping behavior)
69
+	 *                                escaping behavior)
70
+	 *
71
+	 * @return string
72
+	 */
73
+	public static function paramsToAttributes(array $params, $delim = '\'', Compiler $compiler = null)
74
+	{
75
+		if (isset($params['*'])) {
76
+			$params = array_merge($params, $params['*']);
77
+			unset($params['*']);
78
+		}
79 79
 
80
-        $out = '';
81
-        foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
83
-            if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
85
-            } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
87
-            } else {
88
-                if (!$compiler) {
89
-                    // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91
-                } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92
-                    // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94
-                } else {
95
-                    // print as is
96
-                    $escapedVal = '.' . $val . '.';
97
-                }
80
+		$out = '';
81
+		foreach ($params as $attr => $val) {
82
+			$out .= ' ' . $attr . '=';
83
+			if (trim($val, '"\'') == '' || $val == 'null') {
84
+				$out .= str_replace($delim, '\\' . $delim, '""');
85
+			} elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
+				$out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
87
+			} else {
88
+				if (!$compiler) {
89
+					// disable double encoding since it can not be determined if it was encoded
90
+					$escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91
+				} elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92
+					// escape if auto escaping is disabled, or there was no variable in the string
93
+					$escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94
+				} else {
95
+					// print as is
96
+					$escapedVal = '.' . $val . '.';
97
+				}
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
100
-            }
101
-        }
99
+				$out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
100
+			}
101
+		}
102 102
 
103
-        return ltrim($out);
104
-    }
103
+		return ltrim($out);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
lib/Dwoo/IDataProvider.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
  */
24 24
 interface IDataProvider
25 25
 {
26
-    /**
27
-     * Returns the data as an associative array that will be used in the template.
28
-     *
29
-     * @return array
30
-     */
31
-    public function getData();
26
+	/**
27
+	 * Returns the data as an associative array that will be used in the template.
28
+	 *
29
+	 * @return array
30
+	 */
31
+	public function getData();
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Block/Plugin.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -28,92 +28,92 @@
 block discarded – undo
28 28
  */
29 29
 abstract class Plugin extends DwooPlugin
30 30
 {
31
-    /**
32
-     * Stores the contents of the block while it runs.
33
-     *
34
-     * @var string
35
-     */
36
-    protected $buffer = '';
31
+	/**
32
+	 * Stores the contents of the block while it runs.
33
+	 *
34
+	 * @var string
35
+	 */
36
+	protected $buffer = '';
37 37
 
38
-    /**
39
-     * Buffers input, override only if necessary.
40
-     *
41
-     * @var string the content that must be buffered
42
-     */
43
-    public function buffer($input)
44
-    {
45
-        $this->buffer .= $input;
46
-    }
38
+	/**
39
+	 * Buffers input, override only if necessary.
40
+	 *
41
+	 * @var string the content that must be buffered
42
+	 */
43
+	public function buffer($input)
44
+	{
45
+		$this->buffer .= $input;
46
+	}
47 47
 
48
-    // initialization code, receives the parameters from {block param1 param2}
49
-    // public function init($arg, $arg, ...);
48
+	// initialization code, receives the parameters from {block param1 param2}
49
+	// public function init($arg, $arg, ...);
50 50
 
51
-    /**
52
-     * Called when the block ends, this is most of the time followed right away by a call
53
-     * of <em>process()</em> but not always, so this should be used to do any shutdown operations on the
54
-     * block object, if required.
55
-     */
56
-    public function end()
57
-    {
58
-    }
51
+	/**
52
+	 * Called when the block ends, this is most of the time followed right away by a call
53
+	 * of <em>process()</em> but not always, so this should be used to do any shutdown operations on the
54
+	 * block object, if required.
55
+	 */
56
+	public function end()
57
+	{
58
+	}
59 59
 
60
-    /**
61
-     * Called when the block output is required by a parent block.
62
-     * this must read $this->buffer and return it processed
63
-     *
64
-     * @return string
65
-     */
66
-    public function process()
67
-    {
68
-        return $this->buffer;
69
-    }
60
+	/**
61
+	 * Called when the block output is required by a parent block.
62
+	 * this must read $this->buffer and return it processed
63
+	 *
64
+	 * @return string
65
+	 */
66
+	public function process()
67
+	{
68
+		return $this->buffer;
69
+	}
70 70
 
71
-    /**
72
-     * Called at compile time to define what the block should output in the compiled template code, happens when the
73
-     * block is declared basically this will replace the {block arg arg arg} tag in the template.
74
-     *
75
-     * @param DwooCompiler $compiler the compiler instance that calls this function
76
-     * @param array        $params   an array containing original and compiled parameters
77
-     * @param string       $prepend  that is just meant to allow a child class to call
78
-     *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
79
-     *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
80
-     *                               to add a command before the default commands are executed
81
-     * @param string       $append   that is just meant to allow a child class to call
82
-     *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
83
-     *                               the default commands are executed parent::postProcessing($compiler, $params, null,
84
-     *                               "foo();") to add a command after the default commands are executed
85
-     * @param string       $type     the type is the plugin class name used
86
-     *
87
-     * @return string
88
-     */
89
-    public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type)
90
-    {
91
-        return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE;
92
-    }
71
+	/**
72
+	 * Called at compile time to define what the block should output in the compiled template code, happens when the
73
+	 * block is declared basically this will replace the {block arg arg arg} tag in the template.
74
+	 *
75
+	 * @param DwooCompiler $compiler the compiler instance that calls this function
76
+	 * @param array        $params   an array containing original and compiled parameters
77
+	 * @param string       $prepend  that is just meant to allow a child class to call
78
+	 *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
79
+	 *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
80
+	 *                               to add a command before the default commands are executed
81
+	 * @param string       $append   that is just meant to allow a child class to call
82
+	 *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
83
+	 *                               the default commands are executed parent::postProcessing($compiler, $params, null,
84
+	 *                               "foo();") to add a command after the default commands are executed
85
+	 * @param string       $type     the type is the plugin class name used
86
+	 *
87
+	 * @return string
88
+	 */
89
+	public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type)
90
+	{
91
+		return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE;
92
+	}
93 93
 
94
-    /**
95
-     * Called at compile time to define what the block should output in the compiled template code, happens when the
96
-     * block is ended basically this will replace the {/block} tag in the template.
97
-     *
98
-     * @see preProcessing
99
-     *
100
-     * @param DwooCompiler $compiler the compiler instance that calls this function
101
-     * @param array        $params   an array containing original and compiled parameters, see preProcessing() for more
102
-     *                               details more details
103
-     * @param string       $prepend  that is just meant to allow a child class to call
104
-     *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
105
-     *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
106
-     *                               to add a command before the default commands are executed
107
-     * @param string       $append   that is just meant to allow a child class to call
108
-     *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
109
-     *                               the default commands are executed parent::postProcessing($compiler, $params, null,
110
-     *                               "foo();") to add a command after the default commands are executed
111
-     * @param string       $content  the entire content of the block being closed
112
-     *
113
-     * @return string
114
-     */
115
-    public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content)
116
-    {
117
-        return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE;
118
-    }
94
+	/**
95
+	 * Called at compile time to define what the block should output in the compiled template code, happens when the
96
+	 * block is ended basically this will replace the {/block} tag in the template.
97
+	 *
98
+	 * @see preProcessing
99
+	 *
100
+	 * @param DwooCompiler $compiler the compiler instance that calls this function
101
+	 * @param array        $params   an array containing original and compiled parameters, see preProcessing() for more
102
+	 *                               details more details
103
+	 * @param string       $prepend  that is just meant to allow a child class to call
104
+	 *                               parent::postProcessing($compiler, $params, "foo();") to add a command before the
105
+	 *                               default commands are executed parent::postProcessing($compiler, $params, "foo();")
106
+	 *                               to add a command before the default commands are executed
107
+	 * @param string       $append   that is just meant to allow a child class to call
108
+	 *                               parent::postProcessing($compiler, $params, null, "foo();") to add a command after
109
+	 *                               the default commands are executed parent::postProcessing($compiler, $params, null,
110
+	 *                               "foo();") to add a command after the default commands are executed
111
+	 * @param string       $content  the entire content of the block being closed
112
+	 *
113
+	 * @return string
114
+	 */
115
+	public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content)
116
+	{
117
+		return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE;
118
+	}
119 119
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Processors/PluginSmartyCompatible.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -26,69 +26,69 @@
 block discarded – undo
26 26
  */
27 27
 class PluginSmartyCompatible extends Processor
28 28
 {
29
-    /**
30
-     * @param string $input
31
-     *
32
-     * @return mixed
33
-     */
34
-    public function process($input)
35
-    {
36
-        list($l, $r) = $this->compiler->getDelimiters();
29
+	/**
30
+	 * @param string $input
31
+	 *
32
+	 * @return mixed
33
+	 */
34
+	public function process($input)
35
+	{
36
+		list($l, $r) = $this->compiler->getDelimiters();
37 37
 
38
-        $rl           = preg_quote($l, '/');
39
-        $rr           = preg_quote($r, '/');
40
-        $sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
41
-        $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(
42
-            $this,
43
-            'convertSection'
44
-        ), $input);
45
-        $input        = str_replace('$smarty.section.', '$smarty.for.', $input);
38
+		$rl           = preg_quote($l, '/');
39
+		$rr           = preg_quote($r, '/');
40
+		$sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
41
+		$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(
42
+			$this,
43
+			'convertSection'
44
+		), $input);
45
+		$input        = str_replace('$smarty.section.', '$smarty.for.', $input);
46 46
 
47
-        $smarty = array(
48
-            '/' . $rl . '\s*ldelim\s*' . $rr . '/',
49
-            '/' . $rl . '\s*rdelim\s*' . $rr . '/',
50
-            '/' . $rl . '\s*\$smarty\.ldelim\s*' . $rr . '/',
51
-            '/' . $rl . '\s*\$smarty\.rdelim\s*' . $rr . '/',
52
-            '/\$smarty\./',
53
-            '/' . $rl . '\s*php\s*' . $rr . '/',
54
-            '/' . $rl . '\s*\/php\s*' . $rr . '/',
55
-            '/\|(@?)strip(\||' . $rr . ')/',
56
-            '/' . $rl . '\s*sectionelse\s*' . $rr . '/',
57
-        );
47
+		$smarty = array(
48
+			'/' . $rl . '\s*ldelim\s*' . $rr . '/',
49
+			'/' . $rl . '\s*rdelim\s*' . $rr . '/',
50
+			'/' . $rl . '\s*\$smarty\.ldelim\s*' . $rr . '/',
51
+			'/' . $rl . '\s*\$smarty\.rdelim\s*' . $rr . '/',
52
+			'/\$smarty\./',
53
+			'/' . $rl . '\s*php\s*' . $rr . '/',
54
+			'/' . $rl . '\s*\/php\s*' . $rr . '/',
55
+			'/\|(@?)strip(\||' . $rr . ')/',
56
+			'/' . $rl . '\s*sectionelse\s*' . $rr . '/',
57
+		);
58 58
 
59
-        $dwoo = array(
60
-            '\\' . $l,
61
-            $r,
62
-            '\\' . $l,
63
-            $r,
64
-            '$dwoo.',
65
-            '<?php ',
66
-            ' ?>',
67
-            '|$1whitespace$2',
68
-            $l . 'else' . $r,
69
-        );
59
+		$dwoo = array(
60
+			'\\' . $l,
61
+			$r,
62
+			'\\' . $l,
63
+			$r,
64
+			'$dwoo.',
65
+			'<?php ',
66
+			' ?>',
67
+			'|$1whitespace$2',
68
+			$l . 'else' . $r,
69
+		);
70 70
 
71
-        if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
72
-            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);
73
-        }
71
+		if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) {
72
+			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);
73
+		}
74 74
 
75
-        return preg_replace($smarty, $dwoo, $input);
76
-    }
75
+		return preg_replace($smarty, $dwoo, $input);
76
+	}
77 77
 
78
-    /**
79
-     * @param array $matches
80
-     *
81
-     * @return mixed
82
-     */
83
-    protected function convertSection(array $matches)
84
-    {
85
-        $params = array();
86
-        $index  = 1;
87
-        while (!empty($matches[$index]) && $index < 13) {
88
-            $params[$matches[$index]] = $matches[$index + 1];
89
-            $index += 2;
90
-        }
78
+	/**
79
+	 * @param array $matches
80
+	 *
81
+	 * @return mixed
82
+	 */
83
+	protected function convertSection(array $matches)
84
+	{
85
+		$params = array();
86
+		$index  = 1;
87
+		while (!empty($matches[$index]) && $index < 13) {
88
+			$params[$matches[$index]] = $matches[$index + 1];
89
+			$index += 2;
90
+		}
91 91
 
92
-        return str_replace('[' . trim($params['name'], '"\'') . ']', '[$' . trim($params['name'], '"\'') . ']', $matches[0]);
93
-    }
92
+		return str_replace('[' . trim($params['name'], '"\'') . ']', '[$' . trim($params['name'], '"\'') . ']', $matches[0]);
93
+	}
94 94
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginEolCompile.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,5 +25,5 @@
 block discarded – undo
25 25
  */
26 26
 function PluginEolCompile(Compiler $compiler)
27 27
 {
28
-    return 'PHP_EOL';
28
+	return 'PHP_EOL';
29 29
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCapitalize.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
  */
30 30
 function PluginCapitalize(Core $dwoo, $value, $numwords = false)
31 31
 {
32
-    if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
33
-        return mb_convert_case((string)$value, MB_CASE_TITLE, $dwoo->getCharset());
34
-    } else {
35
-        $bits = explode(' ', (string)$value);
36
-        $out  = '';
37
-        while (list(, $v) = each($bits)) {
38
-            if (preg_match('#^[^0-9]+$#', $v)) {
39
-                $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset());
40
-            } else {
41
-                $out .= ' ' . $v;
42
-            }
43
-        }
32
+	if ($numwords || preg_match('#^[^0-9]+$#', $value)) {
33
+		return mb_convert_case((string)$value, MB_CASE_TITLE, $dwoo->getCharset());
34
+	} else {
35
+		$bits = explode(' ', (string)$value);
36
+		$out  = '';
37
+		while (list(, $v) = each($bits)) {
38
+			if (preg_match('#^[^0-9]+$#', $v)) {
39
+				$out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset());
40
+			} else {
41
+				$out .= ' ' . $v;
42
+			}
43
+		}
44 44
 
45
-        return substr($out, 1);
46
-    }
45
+		return substr($out, 1);
46
+	}
47 47
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginInclude.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -36,58 +36,58 @@
 block discarded – undo
36 36
  */
37 37
 function PluginInclude(Core $dwoo, $file, $cache_time = null, $cache_id = null, $compile_id = null, $data = '_root', $assign = null, array $rest = array())
38 38
 {
39
-    if ($file === '') {
40
-        return '';
41
-    }
39
+	if ($file === '') {
40
+		return '';
41
+	}
42 42
 
43
-    if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
44
-        // resource:identifier given, extract them
45
-        $resource   = $m[1];
46
-        $identifier = $m[2];
47
-    } else {
48
-        // get the current template's resource
49
-        $resource   = $dwoo->getTemplate()->getResourceName();
50
-        $identifier = $file;
51
-    }
43
+	if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) {
44
+		// resource:identifier given, extract them
45
+		$resource   = $m[1];
46
+		$identifier = $m[2];
47
+	} else {
48
+		// get the current template's resource
49
+		$resource   = $dwoo->getTemplate()->getResourceName();
50
+		$identifier = $file;
51
+	}
52 52
 
53
-    try {
54
-        $include = $dwoo->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
55
-    }
56
-    catch (SecurityException $e) {
57
-        $dwoo->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
58
-    }
59
-    catch (Exception $e) {
60
-        $dwoo->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
61
-    }
53
+	try {
54
+		$include = $dwoo->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id);
55
+	}
56
+	catch (SecurityException $e) {
57
+		$dwoo->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING);
58
+	}
59
+	catch (Exception $e) {
60
+		$dwoo->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING);
61
+	}
62 62
 
63
-    if ($include === null) {
64
-        $dwoo->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.', E_USER_WARNING);
65
-    } elseif ($include === false) {
66
-        $dwoo->triggerError('Include : Resource "' . $resource . '" does not support includes.', E_USER_WARNING);
67
-    }
63
+	if ($include === null) {
64
+		$dwoo->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.', E_USER_WARNING);
65
+	} elseif ($include === false) {
66
+		$dwoo->triggerError('Include : Resource "' . $resource . '" does not support includes.', E_USER_WARNING);
67
+	}
68 68
 
69
-    if (is_string($data)) {
70
-        $vars = $dwoo->readVar($data);
71
-    } else {
72
-        $vars = $data;
73
-    }
69
+	if (is_string($data)) {
70
+		$vars = $dwoo->readVar($data);
71
+	} else {
72
+		$vars = $data;
73
+	}
74 74
 
75
-    if (count($rest)) {
76
-        $vars = $rest + $vars;
77
-    }
75
+	if (count($rest)) {
76
+		$vars = $rest + $vars;
77
+	}
78 78
 
79
-    $clone = clone $dwoo;
80
-    $out   = $clone->get($include, $vars);
79
+	$clone = clone $dwoo;
80
+	$out   = $clone->get($include, $vars);
81 81
 
82
-    if ($assign !== null) {
83
-        $dwoo->assignInScope($out, $assign);
84
-    }
82
+	if ($assign !== null) {
83
+		$dwoo->assignInScope($out, $assign);
84
+	}
85 85
 
86
-    foreach ($clone->getReturnValues() as $name => $value) {
87
-        $dwoo->assignInScope($value, $name);
88
-    }
86
+	foreach ($clone->getReturnValues() as $name => $value) {
87
+		$dwoo->assignInScope($value, $name);
88
+	}
89 89
 
90
-    if ($assign === null) {
91
-        return $out;
92
-    }
90
+	if ($assign === null) {
91
+		return $out;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCountWordsCompile.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 PluginCountWordsCompile(Compiler $compiler, $value)
30 30
 {
31
-    return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', ' . $value . ', $tmp)';
31
+	return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', ' . $value . ', $tmp)';
32 32
 }
Please login to merge, or discard this patch.