Completed
Push — master ( bf2930...494091 )
by David
07:08 queued 03:26
created
lib/Dwoo/Plugins/Functions/PluginCountCharactersCompile.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
  */
30 30
 function PluginCountCharactersCompile(Compiler $compiler, $value, $count_spaces = false)
31 31
 {
32
-    if ($count_spaces === 'false') {
33
-        return 'preg_match_all(\'#[^\s\pZ]#u\', ' . $value . ', $tmp)';
34
-    } else {
35
-        return 'mb_strlen(' . $value . ', $this->charset)';
36
-    }
32
+	if ($count_spaces === 'false') {
33
+		return 'preg_match_all(\'#[^\s\pZ]#u\', ' . $value . ', $tmp)';
34
+	} else {
35
+		return 'mb_strlen(' . $value . ', $this->charset)';
36
+	}
37 37
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginExtends.php 1 patch
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -34,28 +34,28 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class PluginExtends extends Plugin implements ICompilable
36 36
 {
37
-    protected static $childSource;
38
-    protected static $regex;
39
-    protected static $l;
40
-    protected static $r;
41
-    protected static $lastReplacement;
42
-
43
-    public function process()
44
-    {
45
-    }
46
-
47
-    /**
48
-     * @param Compiler $compiler
49
-     * @param          $file
50
-     *
51
-     * @throws CompilationException
52
-     */
53
-    public static function compile(Compiler $compiler, $file)
54
-    {
55
-        list($l, $r) = $compiler->getDelimiters();
56
-        self::$l     = preg_quote($l, '/');
57
-        self::$r     = preg_quote($r, '/');
58
-        self::$regex = '/
37
+	protected static $childSource;
38
+	protected static $regex;
39
+	protected static $l;
40
+	protected static $r;
41
+	protected static $lastReplacement;
42
+
43
+	public function process()
44
+	{
45
+	}
46
+
47
+	/**
48
+	 * @param Compiler $compiler
49
+	 * @param          $file
50
+	 *
51
+	 * @throws CompilationException
52
+	 */
53
+	public static function compile(Compiler $compiler, $file)
54
+	{
55
+		list($l, $r) = $compiler->getDelimiters();
56
+		self::$l     = preg_quote($l, '/');
57
+		self::$r     = preg_quote($r, '/');
58
+		self::$regex = '/
59 59
 			' . self::$l . 'block\s(["\']?)(.+?)\1' . self::$r . '(?:\r?\n?)
60 60
 			((?:
61 61
 				(?R)
@@ -70,137 +70,137 @@  discard block
 block discarded – undo
70 70
 			' . self::$l . '\/block' . self::$r . '
71 71
 			/six';
72 72
 
73
-        if ($compiler->getLooseOpeningHandling()) {
74
-            self::$l .= '\s*';
75
-            self::$r = '\s*' . self::$r;
76
-        }
77
-        $inheritanceTree = array(array('source' => $compiler->getTemplateSource()));
78
-        $curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR;
79
-        $curTpl          = $compiler->getDwoo()->getTemplate();
80
-
81
-        while (!empty($file)) {
82
-            if ($file === '""' || $file === "''" || (substr($file, 0, 1) !== '"' && substr($file, 0, 1) !== '\'')) {
83
-                throw new CompilationException($compiler, 'Extends : The file name must be a non-empty string');
84
-            }
85
-
86
-            if (preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m)) {
87
-                // resource:identifier given, extract them
88
-                $resource   = $m[1];
89
-                $identifier = $m[2];
90
-            } else {
91
-                // get the current template's resource
92
-                $resource   = $curTpl->getResourceName();
93
-                $identifier = substr($file, 1, - 1);
94
-            }
95
-
96
-            try {
97
-                $parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98
-            }
99
-            catch (SecurityException $e) {
100
-                throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
101
-            }
102
-            catch (Exception $e) {
103
-                throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
104
-            }
105
-
106
-            if ($parent === null) {
107
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.');
108
-            } elseif ($parent === false) {
109
-                throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.');
110
-            }
111
-
112
-            $curTpl    = $parent;
113
-            $newParent = array(
114
-                'source'     => $parent->getSource(),
115
-                'resource'   => $resource,
116
-                'identifier' => $parent->getResourceIdentifier(),
117
-                'uid'        => $parent->getUid()
118
-            );
119
-            if (array_search($newParent, $inheritanceTree, true) !== false) {
120
-                throw new CompilationException($compiler, 'Extends : Recursive template inheritance detected');
121
-            }
122
-            $inheritanceTree[] = $newParent;
123
-
124
-            if (preg_match('/^' . self::$l . 'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?' . self::$r . '/i', $parent->getSource(), $match)) {
125
-                $curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
126
-                if (isset($match[2]) && $match[2] == '"') {
127
-                    $file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"';
128
-                } elseif (isset($match[2]) && $match[2] == "'") {
129
-                    $file = '"' . substr($match[1], 1, - 1) . '"';
130
-                } else {
131
-                    $file = '"' . $match[1] . '"';
132
-                }
133
-            } else {
134
-                $file = false;
135
-            }
136
-        }
137
-
138
-        while (true) {
139
-            $parent                = array_pop($inheritanceTree);
140
-            $child                 = end($inheritanceTree);
141
-            self::$childSource     = $child['source'];
142
-            self::$lastReplacement = count($inheritanceTree) === 1;
143
-            if (!isset($newSource)) {
144
-                $newSource = $parent['source'];
145
-            }
146
-            $newSource = preg_replace_callback(self::$regex, array(
147
-                'Dwoo\Plugins\Functions\PluginExtends',
148
-                'replaceBlock'
149
-            ), $newSource);
150
-            $newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource;
151
-
152
-            if (self::$lastReplacement) {
153
-                break;
154
-            }
155
-        }
156
-        $compiler->setTemplateSource($newSource);
157
-        $compiler->recompile();
158
-    }
159
-
160
-    /**
161
-     * @param array $matches
162
-     *
163
-     * @return mixed|string
164
-     */
165
-    protected static function replaceBlock(array $matches)
166
-    {
167
-        $matches[3] = self::removeTrailingNewline($matches[3]);
168
-
169
-        if (preg_match_all(self::$regex, self::$childSource, $override) && in_array($matches[2], $override[2])) {
170
-            $key      = array_search($matches[2], $override[2]);
171
-            $override = self::removeTrailingNewline($override[3][$key]);
172
-
173
-            $l = stripslashes(self::$l);
174
-            $r = stripslashes(self::$r);
175
-
176
-            if (self::$lastReplacement) {
177
-                return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override);
178
-            }
179
-
180
-            return $l . 'block ' . $matches[1] . $matches[2] . $matches[1] . $r . preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override) . $l . '/block' . $r;
181
-        }
182
-
183
-        if (preg_match(self::$regex, $matches[3])) {
184
-            return preg_replace_callback(self::$regex, array(
185
-                'Dwoo\Plugins\Functions\PluginExtends',
186
-                'replaceBlock'
187
-            ), $matches[3]);
188
-        }
189
-
190
-        if (self::$lastReplacement) {
191
-            return $matches[3];
192
-        }
193
-
194
-        return $matches[0];
195
-    }
196
-
197
-    /**
198
-     * @param $text
199
-     *
200
-     * @return string
201
-     */
202
-    protected static function removeTrailingNewline($text)
203
-    {
204
-        return substr($text, - 1) === "\n" ? substr($text, - 2, 1) === "\r" ? substr($text, 0, - 2) : substr($text, 0, - 1) : $text;
205
-    }
73
+		if ($compiler->getLooseOpeningHandling()) {
74
+			self::$l .= '\s*';
75
+			self::$r = '\s*' . self::$r;
76
+		}
77
+		$inheritanceTree = array(array('source' => $compiler->getTemplateSource()));
78
+		$curPath         = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR;
79
+		$curTpl          = $compiler->getDwoo()->getTemplate();
80
+
81
+		while (!empty($file)) {
82
+			if ($file === '""' || $file === "''" || (substr($file, 0, 1) !== '"' && substr($file, 0, 1) !== '\'')) {
83
+				throw new CompilationException($compiler, 'Extends : The file name must be a non-empty string');
84
+			}
85
+
86
+			if (preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m)) {
87
+				// resource:identifier given, extract them
88
+				$resource   = $m[1];
89
+				$identifier = $m[2];
90
+			} else {
91
+				// get the current template's resource
92
+				$resource   = $curTpl->getResourceName();
93
+				$identifier = substr($file, 1, - 1);
94
+			}
95
+
96
+			try {
97
+				$parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl);
98
+			}
99
+			catch (SecurityException $e) {
100
+				throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage());
101
+			}
102
+			catch (Exception $e) {
103
+				throw new CompilationException($compiler, 'Extends : ' . $e->getMessage());
104
+			}
105
+
106
+			if ($parent === null) {
107
+				throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.');
108
+			} elseif ($parent === false) {
109
+				throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.');
110
+			}
111
+
112
+			$curTpl    = $parent;
113
+			$newParent = array(
114
+				'source'     => $parent->getSource(),
115
+				'resource'   => $resource,
116
+				'identifier' => $parent->getResourceIdentifier(),
117
+				'uid'        => $parent->getUid()
118
+			);
119
+			if (array_search($newParent, $inheritanceTree, true) !== false) {
120
+				throw new CompilationException($compiler, 'Extends : Recursive template inheritance detected');
121
+			}
122
+			$inheritanceTree[] = $newParent;
123
+
124
+			if (preg_match('/^' . self::$l . 'extends(?:\(?\s*|\s+)(?:file=)?\s*((["\']).+?\2|\S+?)\s*\)?\s*?' . self::$r . '/i', $parent->getSource(), $match)) {
125
+				$curPath = dirname($identifier) . DIRECTORY_SEPARATOR;
126
+				if (isset($match[2]) && $match[2] == '"') {
127
+					$file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"';
128
+				} elseif (isset($match[2]) && $match[2] == "'") {
129
+					$file = '"' . substr($match[1], 1, - 1) . '"';
130
+				} else {
131
+					$file = '"' . $match[1] . '"';
132
+				}
133
+			} else {
134
+				$file = false;
135
+			}
136
+		}
137
+
138
+		while (true) {
139
+			$parent                = array_pop($inheritanceTree);
140
+			$child                 = end($inheritanceTree);
141
+			self::$childSource     = $child['source'];
142
+			self::$lastReplacement = count($inheritanceTree) === 1;
143
+			if (!isset($newSource)) {
144
+				$newSource = $parent['source'];
145
+			}
146
+			$newSource = preg_replace_callback(self::$regex, array(
147
+				'Dwoo\Plugins\Functions\PluginExtends',
148
+				'replaceBlock'
149
+			), $newSource);
150
+			$newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource;
151
+
152
+			if (self::$lastReplacement) {
153
+				break;
154
+			}
155
+		}
156
+		$compiler->setTemplateSource($newSource);
157
+		$compiler->recompile();
158
+	}
159
+
160
+	/**
161
+	 * @param array $matches
162
+	 *
163
+	 * @return mixed|string
164
+	 */
165
+	protected static function replaceBlock(array $matches)
166
+	{
167
+		$matches[3] = self::removeTrailingNewline($matches[3]);
168
+
169
+		if (preg_match_all(self::$regex, self::$childSource, $override) && in_array($matches[2], $override[2])) {
170
+			$key      = array_search($matches[2], $override[2]);
171
+			$override = self::removeTrailingNewline($override[3][$key]);
172
+
173
+			$l = stripslashes(self::$l);
174
+			$r = stripslashes(self::$r);
175
+
176
+			if (self::$lastReplacement) {
177
+				return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override);
178
+			}
179
+
180
+			return $l . 'block ' . $matches[1] . $matches[2] . $matches[1] . $r . preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override) . $l . '/block' . $r;
181
+		}
182
+
183
+		if (preg_match(self::$regex, $matches[3])) {
184
+			return preg_replace_callback(self::$regex, array(
185
+				'Dwoo\Plugins\Functions\PluginExtends',
186
+				'replaceBlock'
187
+			), $matches[3]);
188
+		}
189
+
190
+		if (self::$lastReplacement) {
191
+			return $matches[3];
192
+		}
193
+
194
+		return $matches[0];
195
+	}
196
+
197
+	/**
198
+	 * @param $text
199
+	 *
200
+	 * @return string
201
+	 */
202
+	protected static function removeTrailingNewline($text)
203
+	{
204
+		return substr($text, - 1) === "\n" ? substr($text, - 2, 1) === "\r" ? substr($text, 0, - 2) : substr($text, 0, - 1) : $text;
205
+	}
206 206
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginReturnCompile.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@
 block discarded – undo
34 34
  */
35 35
 function PluginReturnCompile(Compiler $compiler, array $rest = array())
36 36
 {
37
-    $out = array();
38
-    foreach ($rest as $var => $val) {
39
-        $out[] = '$this->setReturnValue(' . var_export($var, true) . ', ' . $val . ')';
40
-    }
37
+	$out = array();
38
+	foreach ($rest as $var => $val) {
39
+		$out[] = '$this->setReturnValue(' . var_export($var, true) . ', ' . $val . ')';
40
+	}
41 41
 
42
-    return '(' . implode('.', $out) . ')';
42
+	return '(' . implode('.', $out) . ')';
43 43
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginNl2brCompile.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 PluginNl2brCompile(Compiler $compiler, $value)
30 30
 {
31
-    return 'nl2br((string) ' . $value . ')';
31
+	return 'nl2br((string) ' . $value . ')';
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginStripTagsCompile.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
  */
37 37
 function PluginStripTagsCompile(Compiler $compiler, $value, $addspace = true)
38 38
 {
39
-    if ($addspace === 'true') {
40
-        return "preg_replace('#<[^>]*>#', ' ', $value)";
41
-    } else {
42
-        return "strip_tags($value)";
43
-    }
39
+	if ($addspace === 'true') {
40
+		return "preg_replace('#<[^>]*>#', ' ', $value)";
41
+	} else {
42
+		return "strip_tags($value)";
43
+	}
44 44
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginReverse.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@
 block discarded – undo
29 29
  */
30 30
 function PluginReverse(Core $dwoo, $value, $preserve_keys = false)
31 31
 {
32
-    if (is_array($value)) {
33
-        return array_reverse($value, $preserve_keys);
34
-    } elseif (($charset = $dwoo->getCharset()) === 'iso-8859-1') {
35
-        return strrev((string)$value);
36
-    } else {
37
-        $strlen = mb_strlen($value);
38
-        $out    = '';
39
-        while ($strlen --) {
40
-            $out .= mb_substr($value, $strlen, 1, $charset);
41
-        }
32
+	if (is_array($value)) {
33
+		return array_reverse($value, $preserve_keys);
34
+	} elseif (($charset = $dwoo->getCharset()) === 'iso-8859-1') {
35
+		return strrev((string)$value);
36
+	} else {
37
+		$strlen = mb_strlen($value);
38
+		$out    = '';
39
+		while ($strlen --) {
40
+			$out .= mb_substr($value, $strlen, 1, $charset);
41
+		}
42 42
 
43
-        return $out;
44
-    }
43
+		return $out;
44
+	}
45 45
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCatCompile.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 PluginCatCompile(Compiler $compiler, $value, array $rest)
30 30
 {
31
-    return '(' . $value . ').(' . implode(').(', $rest) . ')';
31
+	return '(' . $value . ').(' . implode(').(', $rest) . ')';
32 32
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginCycle.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -34,56 +34,56 @@
 block discarded – undo
34 34
  */
35 35
 class PluginCycle extends Plugin
36 36
 {
37
-    protected $cycles = array();
37
+	protected $cycles = array();
38 38
 
39
-    /**
40
-     * @param string $name
41
-     * @param null   $values
42
-     * @param bool   $print
43
-     * @param bool   $advance
44
-     * @param string $delimiter
45
-     * @param null   $assign
46
-     * @param bool   $reset
47
-     *
48
-     * @return null
49
-     */
50
-    public function process($name = 'default', $values = null, $print = true, $advance = true, $delimiter = ',', $assign = null, $reset = false)
51
-    {
52
-        if ($values !== null) {
53
-            if (is_string($values)) {
54
-                $values = explode($delimiter, $values);
55
-            }
39
+	/**
40
+	 * @param string $name
41
+	 * @param null   $values
42
+	 * @param bool   $print
43
+	 * @param bool   $advance
44
+	 * @param string $delimiter
45
+	 * @param null   $assign
46
+	 * @param bool   $reset
47
+	 *
48
+	 * @return null
49
+	 */
50
+	public function process($name = 'default', $values = null, $print = true, $advance = true, $delimiter = ',', $assign = null, $reset = false)
51
+	{
52
+		if ($values !== null) {
53
+			if (is_string($values)) {
54
+				$values = explode($delimiter, $values);
55
+			}
56 56
 
57
-            if (!isset($this->cycles[$name]) || $this->cycles[$name]['values'] !== $values) {
58
-                $this->cycles[$name]['index'] = 0;
59
-            }
57
+			if (!isset($this->cycles[$name]) || $this->cycles[$name]['values'] !== $values) {
58
+				$this->cycles[$name]['index'] = 0;
59
+			}
60 60
 
61
-            $this->cycles[$name]['values'] = array_values($values);
62
-        } elseif (isset($this->cycles[$name])) {
63
-            $values = $this->cycles[$name]['values'];
64
-        }
61
+			$this->cycles[$name]['values'] = array_values($values);
62
+		} elseif (isset($this->cycles[$name])) {
63
+			$values = $this->cycles[$name]['values'];
64
+		}
65 65
 
66
-        if ($reset) {
67
-            $this->cycles[$name]['index'] = 0;
68
-        }
66
+		if ($reset) {
67
+			$this->cycles[$name]['index'] = 0;
68
+		}
69 69
 
70
-        if ($print) {
71
-            $out = $values[$this->cycles[$name]['index']];
72
-        } else {
73
-            $out = null;
74
-        }
70
+		if ($print) {
71
+			$out = $values[$this->cycles[$name]['index']];
72
+		} else {
73
+			$out = null;
74
+		}
75 75
 
76
-        if ($advance) {
77
-            if ($this->cycles[$name]['index'] >= count($values) - 1) {
78
-                $this->cycles[$name]['index'] = 0;
79
-            } else {
80
-                ++ $this->cycles[$name]['index'];
81
-            }
82
-        }
76
+		if ($advance) {
77
+			if ($this->cycles[$name]['index'] >= count($values) - 1) {
78
+				$this->cycles[$name]['index'] = 0;
79
+			} else {
80
+				++ $this->cycles[$name]['index'];
81
+			}
82
+		}
83 83
 
84
-        if ($assign === null) {
85
-            return $out;
86
-        }
87
-        $this->core->assignInScope($out, $assign);
88
-    }
84
+		if ($assign === null) {
85
+			return $out;
86
+		}
87
+		$this->core->assignInScope($out, $assign);
88
+	}
89 89
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginExtendsCheckCompile.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,26 +26,26 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function PluginExtendsCheckCompile(Compiler $compiler, $file)
28 28
 {
29
-    preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m);
30
-    $resource   = $m[1];
31
-    $identifier = $m[2];
29
+	preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m);
30
+	$resource   = $m[1];
31
+	$identifier = $m[2];
32 32
 
33
-    $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier);
33
+	$tpl = $compiler->getDwoo()->templateFactory($resource, $identifier);
34 34
 
35
-    if ($tpl === null) {
36
-        throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.');
37
-    } elseif ($tpl === false) {
38
-        throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.');
39
-    }
35
+	if ($tpl === null) {
36
+		throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.');
37
+	} elseif ($tpl === false) {
38
+		throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.');
39
+	}
40 40
 
41
-    $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n";
41
+	$out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n";
42 42
 
43
-    $modCheck = $tpl->getIsModifiedCode();
43
+	$modCheck = $tpl->getIsModifiedCode();
44 44
 
45
-    if ($modCheck) {
46
-        $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }';
47
-    } else {
48
-        $out .= 'try {
45
+	if ($modCheck) {
46
+		$out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }';
47
+	} else {
48
+		$out .= 'try {
49 49
 	$tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '");
50 50
 } catch (Dwoo\Exception $e) {
51 51
 	$this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 elseif ($tpl === false)
56 56
 	$this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING);
57 57
 if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }';
58
-    }
58
+	}
59 59
 
60
-    return $out;
60
+	return $out;
61 61
 }
Please login to merge, or discard this patch.