@@ -31,58 +31,58 @@ discard block |
||
31 | 31 | */ |
32 | 32 | class PluginLoadTemplates extends Plugin implements ICompilable |
33 | 33 | { |
34 | - /** |
|
35 | - * @param Compiler $compiler |
|
36 | - * @param string $file |
|
37 | - * |
|
38 | - * @return string |
|
39 | - * @throws CompilationException |
|
40 | - */ |
|
41 | - public static function compile(Compiler $compiler, $file) |
|
42 | - { |
|
43 | - $file = substr($file, 1, - 1); |
|
34 | + /** |
|
35 | + * @param Compiler $compiler |
|
36 | + * @param string $file |
|
37 | + * |
|
38 | + * @return string |
|
39 | + * @throws CompilationException |
|
40 | + */ |
|
41 | + public static function compile(Compiler $compiler, $file) |
|
42 | + { |
|
43 | + $file = substr($file, 1, - 1); |
|
44 | 44 | |
45 | - if ($file === '') { |
|
46 | - return ''; |
|
47 | - } |
|
45 | + if ($file === '') { |
|
46 | + return ''; |
|
47 | + } |
|
48 | 48 | |
49 | - if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) { |
|
50 | - // resource:identifier given, extract them |
|
51 | - $resource = $m[1]; |
|
52 | - $identifier = $m[2]; |
|
53 | - } else { |
|
54 | - // get the current template's resource |
|
55 | - $resource = $compiler->getDwoo()->getTemplate()->getResourceName(); |
|
56 | - $identifier = $file; |
|
57 | - } |
|
49 | + if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) { |
|
50 | + // resource:identifier given, extract them |
|
51 | + $resource = $m[1]; |
|
52 | + $identifier = $m[2]; |
|
53 | + } else { |
|
54 | + // get the current template's resource |
|
55 | + $resource = $compiler->getDwoo()->getTemplate()->getResourceName(); |
|
56 | + $identifier = $file; |
|
57 | + } |
|
58 | 58 | |
59 | - $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
|
59 | + $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
|
60 | 60 | |
61 | - if ($tpl === null) { |
|
62 | - throw new CompilationException($compiler, |
|
63 | - 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
64 | - } elseif ($tpl === false) { |
|
65 | - throw new CompilationException($compiler, |
|
66 | - 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
67 | - } |
|
61 | + if ($tpl === null) { |
|
62 | + throw new CompilationException($compiler, |
|
63 | + 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
64 | + } elseif ($tpl === false) { |
|
65 | + throw new CompilationException($compiler, |
|
66 | + 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
67 | + } |
|
68 | 68 | |
69 | - $cmp = clone $compiler; |
|
70 | - $cmp->compile($compiler->getDwoo(), $tpl); |
|
71 | - foreach ($cmp->getTemplatePlugins() as $template => $args) { |
|
72 | - $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']); |
|
73 | - } |
|
74 | - foreach ($cmp->getUsedPlugins() as $plugin => $type) { |
|
75 | - $compiler->addUsedPlugin($plugin, $type); |
|
76 | - } |
|
69 | + $cmp = clone $compiler; |
|
70 | + $cmp->compile($compiler->getDwoo(), $tpl); |
|
71 | + foreach ($cmp->getTemplatePlugins() as $template => $args) { |
|
72 | + $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']); |
|
73 | + } |
|
74 | + foreach ($cmp->getUsedPlugins() as $plugin => $type) { |
|
75 | + $compiler->addUsedPlugin($plugin, $type); |
|
76 | + } |
|
77 | 77 | |
78 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
78 | + $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
79 | 79 | |
80 | - $modCheck = $tpl->getIsModifiedCode(); |
|
80 | + $modCheck = $tpl->getIsModifiedCode(); |
|
81 | 81 | |
82 | - if ($modCheck) { |
|
83 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
84 | - } else { |
|
85 | - $out .= 'try { |
|
82 | + if ($modCheck) { |
|
83 | + $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
84 | + } else { |
|
85 | + $out .= 'try { |
|
86 | 86 | $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
87 | 87 | } catch (Dwoo\Exception $e) { |
88 | 88 | $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | elseif ($tpl === false) |
93 | 93 | $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
94 | 94 | if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - return $out; |
|
98 | - } |
|
97 | + return $out; |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | \ No newline at end of file |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | |
61 | 61 | if ($tpl === null) { |
62 | 62 | throw new CompilationException($compiler, |
63 | - 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
63 | + 'Load Templates : Resource "'.$resource.':'.$identifier.'" not found.'); |
|
64 | 64 | } elseif ($tpl === false) { |
65 | 65 | throw new CompilationException($compiler, |
66 | - 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
66 | + 'Load Templates : Resource "'.$resource.'" does not support includes.'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $cmp = clone $compiler; |
@@ -75,23 +75,23 @@ discard block |
||
75 | 75 | $compiler->addUsedPlugin($plugin, $type); |
76 | 76 | } |
77 | 77 | |
78 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
78 | + $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n"; |
|
79 | 79 | |
80 | 80 | $modCheck = $tpl->getIsModifiedCode(); |
81 | 81 | |
82 | 82 | if ($modCheck) { |
83 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
83 | + $out .= 'if (!('.$modCheck.')) { ob_end_clean(); return false; }'; |
|
84 | 84 | } else { |
85 | 85 | $out .= 'try { |
86 | - $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
|
86 | + $tpl = $this->templateFactory("' . $resource.'", "'.$identifier.'"); |
|
87 | 87 | } catch (Dwoo\Exception $e) { |
88 | - $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
|
88 | + $this->triggerError(\'Load Templates : Resource <em>' . $resource.'</em> was not added to Dwoo, can not extend <em>'.$identifier.'</em>\', E_USER_WARNING); |
|
89 | 89 | } |
90 | 90 | if ($tpl === null) |
91 | - $this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING); |
|
91 | + $this->triggerError(\'Load Templates : Resource "' . $resource.':'.$identifier.'" was not found.\', E_USER_WARNING); |
|
92 | 92 | elseif ($tpl === false) |
93 | - $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
|
94 | -if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
|
93 | + $this->triggerError(\'Load Templates : Resource "' . $resource.'" does not support extends.\', E_USER_WARNING); |
|
94 | +if ($tpl->getUid() != "' . $tpl->getUid().'") { ob_end_clean(); return false; }'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $out; |
@@ -30,14 +30,14 @@ |
||
30 | 30 | */ |
31 | 31 | class PluginCountSentences extends Plugin implements ICompilable |
32 | 32 | { |
33 | - /** |
|
34 | - * @param Compiler $compiler |
|
35 | - * @param string $value |
|
36 | - * |
|
37 | - * @return string |
|
38 | - */ |
|
39 | - public static function compile(Compiler $compiler, $value) |
|
40 | - { |
|
41 | - return "preg_match_all('#[\\w\\pL]\\.(?![\\w\\pL])#u', $value, \$tmp)"; |
|
42 | - } |
|
33 | + /** |
|
34 | + * @param Compiler $compiler |
|
35 | + * @param string $value |
|
36 | + * |
|
37 | + * @return string |
|
38 | + */ |
|
39 | + public static function compile(Compiler $compiler, $value) |
|
40 | + { |
|
41 | + return "preg_match_all('#[\\w\\pL]\\.(?![\\w\\pL])#u', $value, \$tmp)"; |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -32,16 +32,16 @@ |
||
32 | 32 | */ |
33 | 33 | class PluginIndent extends Plugin implements ICompilable |
34 | 34 | { |
35 | - /** |
|
36 | - * @param Compiler $compiler |
|
37 | - * @param string $value |
|
38 | - * @param int $by |
|
39 | - * @param string $char |
|
40 | - * |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - public static function compile(Compiler $compiler, $value, $by = 4, $char = ' ') |
|
44 | - { |
|
45 | - return "preg_replace('#^#m', '" . str_repeat(substr($char, 1, - 1), trim($by, '"\'')) . "', $value)"; |
|
46 | - } |
|
35 | + /** |
|
36 | + * @param Compiler $compiler |
|
37 | + * @param string $value |
|
38 | + * @param int $by |
|
39 | + * @param string $char |
|
40 | + * |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + public static function compile(Compiler $compiler, $value, $by = 4, $char = ' ') |
|
44 | + { |
|
45 | + return "preg_replace('#^#m', '" . str_repeat(substr($char, 1, - 1), trim($by, '"\'')) . "', $value)"; |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -42,6 +42,6 @@ |
||
42 | 42 | */ |
43 | 43 | public static function compile(Compiler $compiler, $value, $by = 4, $char = ' ') |
44 | 44 | { |
45 | - return "preg_replace('#^#m', '" . str_repeat(substr($char, 1, - 1), trim($by, '"\'')) . "', $value)"; |
|
45 | + return "preg_replace('#^#m', '".str_repeat(substr($char, 1, - 1), trim($by, '"\''))."', $value)"; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -33,37 +33,37 @@ |
||
33 | 33 | */ |
34 | 34 | class PluginTruncate extends Plugin |
35 | 35 | { |
36 | - /** |
|
37 | - * @param string $value |
|
38 | - * @param int $length |
|
39 | - * @param string $etc |
|
40 | - * @param bool $break |
|
41 | - * @param bool $middle |
|
42 | - * |
|
43 | - * @return mixed|string |
|
44 | - */ |
|
45 | - public function process($value, $length = 80, $etc = '...', $break = false, $middle = false) |
|
46 | - { |
|
47 | - if ($length == 0) { |
|
48 | - return ''; |
|
49 | - } |
|
36 | + /** |
|
37 | + * @param string $value |
|
38 | + * @param int $length |
|
39 | + * @param string $etc |
|
40 | + * @param bool $break |
|
41 | + * @param bool $middle |
|
42 | + * |
|
43 | + * @return mixed|string |
|
44 | + */ |
|
45 | + public function process($value, $length = 80, $etc = '...', $break = false, $middle = false) |
|
46 | + { |
|
47 | + if ($length == 0) { |
|
48 | + return ''; |
|
49 | + } |
|
50 | 50 | |
51 | - $value = (string)$value; |
|
52 | - $etc = (string)$etc; |
|
53 | - $length = (int)$length; |
|
51 | + $value = (string)$value; |
|
52 | + $etc = (string)$etc; |
|
53 | + $length = (int)$length; |
|
54 | 54 | |
55 | - if (strlen($value) < $length) { |
|
56 | - return $value; |
|
57 | - } |
|
55 | + if (strlen($value) < $length) { |
|
56 | + return $value; |
|
57 | + } |
|
58 | 58 | |
59 | - $length = max($length - strlen($etc), 0); |
|
60 | - if ($break === false && $middle === false) { |
|
61 | - $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1)); |
|
62 | - } |
|
63 | - if ($middle === false) { |
|
64 | - return substr($value, 0, $length) . $etc; |
|
65 | - } |
|
59 | + $length = max($length - strlen($etc), 0); |
|
60 | + if ($break === false && $middle === false) { |
|
61 | + $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1)); |
|
62 | + } |
|
63 | + if ($middle === false) { |
|
64 | + return substr($value, 0, $length) . $etc; |
|
65 | + } |
|
66 | 66 | |
67 | - return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2)); |
|
68 | - } |
|
67 | + return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2)); |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -48,22 +48,22 @@ |
||
48 | 48 | return ''; |
49 | 49 | } |
50 | 50 | |
51 | - $value = (string)$value; |
|
52 | - $etc = (string)$etc; |
|
53 | - $length = (int)$length; |
|
51 | + $value = (string) $value; |
|
52 | + $etc = (string) $etc; |
|
53 | + $length = (int) $length; |
|
54 | 54 | |
55 | 55 | if (strlen($value) < $length) { |
56 | 56 | return $value; |
57 | 57 | } |
58 | 58 | |
59 | - $length = max($length - strlen($etc), 0); |
|
59 | + $length = max($length-strlen($etc), 0); |
|
60 | 60 | if ($break === false && $middle === false) { |
61 | - $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1)); |
|
61 | + $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length+1)); |
|
62 | 62 | } |
63 | 63 | if ($middle === false) { |
64 | - return substr($value, 0, $length) . $etc; |
|
64 | + return substr($value, 0, $length).$etc; |
|
65 | 65 | } |
66 | 66 | |
67 | - return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2)); |
|
67 | + return substr($value, 0, ceil($length/2)).$etc.substr($value, - floor($length/2)); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -31,15 +31,15 @@ |
||
31 | 31 | */ |
32 | 32 | class PluginDefault extends Plugin implements ICompilable |
33 | 33 | { |
34 | - /** |
|
35 | - * @param Compiler $compiler |
|
36 | - * @param mixed $value |
|
37 | - * @param string $default |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public static function compile(Compiler $compiler, $value, $default = '') |
|
42 | - { |
|
43 | - return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)'; |
|
44 | - } |
|
34 | + /** |
|
35 | + * @param Compiler $compiler |
|
36 | + * @param mixed $value |
|
37 | + * @param string $default |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public static function compile(Compiler $compiler, $value, $default = '') |
|
42 | + { |
|
43 | + return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)'; |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -40,6 +40,6 @@ |
||
40 | 40 | */ |
41 | 41 | public static function compile(Compiler $compiler, $value, $default = '') |
42 | 42 | { |
43 | - return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)'; |
|
43 | + return '(($tmp = '.$value.')===null||$tmp===\'\' ? '.$default.' : $tmp)'; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -30,15 +30,15 @@ |
||
30 | 30 | */ |
31 | 31 | class PluginCat extends Plugin implements ICompilable |
32 | 32 | { |
33 | - /** |
|
34 | - * @param Compiler $compiler |
|
35 | - * @param string $value |
|
36 | - * @param array $rest |
|
37 | - * |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public static function compile(Compiler $compiler, $value, array $rest) |
|
41 | - { |
|
42 | - return '(' . $value . ').(' . implode(').(', $rest) . ')'; |
|
43 | - } |
|
33 | + /** |
|
34 | + * @param Compiler $compiler |
|
35 | + * @param string $value |
|
36 | + * @param array $rest |
|
37 | + * |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public static function compile(Compiler $compiler, $value, array $rest) |
|
41 | + { |
|
42 | + return '(' . $value . ').(' . implode(').(', $rest) . ')'; |
|
43 | + } |
|
44 | 44 | } |
@@ -39,6 +39,6 @@ |
||
39 | 39 | */ |
40 | 40 | public static function compile(Compiler $compiler, $value, array $rest) |
41 | 41 | { |
42 | - return '(' . $value . ').(' . implode(').(', $rest) . ')'; |
|
42 | + return '('.$value.').('.implode(').(', $rest).')'; |
|
43 | 43 | } |
44 | 44 | } |
@@ -31,19 +31,19 @@ |
||
31 | 31 | */ |
32 | 32 | class PluginCountCharacters extends Plugin implements ICompilable |
33 | 33 | { |
34 | - /** |
|
35 | - * @param Compiler $compiler |
|
36 | - * @param string $value |
|
37 | - * @param bool $count_spaces |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public static function compile(Compiler $compiler, $value, $count_spaces = false) |
|
42 | - { |
|
43 | - if ($count_spaces === 'false') { |
|
44 | - return 'preg_match_all(\'#[^\s\pZ]#u\', ' . $value . ', $tmp)'; |
|
45 | - } |
|
34 | + /** |
|
35 | + * @param Compiler $compiler |
|
36 | + * @param string $value |
|
37 | + * @param bool $count_spaces |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public static function compile(Compiler $compiler, $value, $count_spaces = false) |
|
42 | + { |
|
43 | + if ($count_spaces === 'false') { |
|
44 | + return 'preg_match_all(\'#[^\s\pZ]#u\', ' . $value . ', $tmp)'; |
|
45 | + } |
|
46 | 46 | |
47 | - return 'mb_strlen(' . $value . ', $this->charset)'; |
|
48 | - } |
|
47 | + return 'mb_strlen(' . $value . ', $this->charset)'; |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -41,9 +41,9 @@ |
||
41 | 41 | public static function compile(Compiler $compiler, $value, $count_spaces = false) |
42 | 42 | { |
43 | 43 | if ($count_spaces === 'false') { |
44 | - return 'preg_match_all(\'#[^\s\pZ]#u\', ' . $value . ', $tmp)'; |
|
44 | + return 'preg_match_all(\'#[^\s\pZ]#u\', '.$value.', $tmp)'; |
|
45 | 45 | } |
46 | 46 | |
47 | - return 'mb_strlen(' . $value . ', $this->charset)'; |
|
47 | + return 'mb_strlen('.$value.', $this->charset)'; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -28,37 +28,37 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class PluginExtendsCheck extends Plugin implements ICompilable |
30 | 30 | { |
31 | - /** |
|
32 | - * @param Compiler $compiler |
|
33 | - * @param $file |
|
34 | - * |
|
35 | - * @return string |
|
36 | - * @throws CompilationException |
|
37 | - */ |
|
38 | - public static function compile(Compiler $compiler, $file) |
|
39 | - { |
|
40 | - preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m); |
|
41 | - $resource = $m[1]; |
|
42 | - $identifier = $m[2]; |
|
31 | + /** |
|
32 | + * @param Compiler $compiler |
|
33 | + * @param $file |
|
34 | + * |
|
35 | + * @return string |
|
36 | + * @throws CompilationException |
|
37 | + */ |
|
38 | + public static function compile(Compiler $compiler, $file) |
|
39 | + { |
|
40 | + preg_match('#^["\']([a-z]{2,}):(.*?)["\']$#i', $file, $m); |
|
41 | + $resource = $m[1]; |
|
42 | + $identifier = $m[2]; |
|
43 | 43 | |
44 | - $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
|
44 | + $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
|
45 | 45 | |
46 | - if ($tpl === null) { |
|
47 | - throw new CompilationException($compiler, |
|
48 | - 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
49 | - } elseif ($tpl === false) { |
|
50 | - throw new CompilationException($compiler, |
|
51 | - 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
52 | - } |
|
46 | + if ($tpl === null) { |
|
47 | + throw new CompilationException($compiler, |
|
48 | + 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
49 | + } elseif ($tpl === false) { |
|
50 | + throw new CompilationException($compiler, |
|
51 | + 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
52 | + } |
|
53 | 53 | |
54 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
54 | + $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
55 | 55 | |
56 | - $modCheck = $tpl->getIsModifiedCode(); |
|
56 | + $modCheck = $tpl->getIsModifiedCode(); |
|
57 | 57 | |
58 | - if ($modCheck) { |
|
59 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
60 | - } else { |
|
61 | - $out .= 'try { |
|
58 | + if ($modCheck) { |
|
59 | + $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
60 | + } else { |
|
61 | + $out .= 'try { |
|
62 | 62 | $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
63 | 63 | } catch (Dwoo\Exception $e) { |
64 | 64 | $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | elseif ($tpl === false) |
69 | 69 | $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
70 | 70 | if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - return $out; |
|
74 | - } |
|
73 | + return $out; |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | \ No newline at end of file |
@@ -45,29 +45,29 @@ |
||
45 | 45 | |
46 | 46 | if ($tpl === null) { |
47 | 47 | throw new CompilationException($compiler, |
48 | - 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
48 | + 'Load Templates : Resource "'.$resource.':'.$identifier.'" not found.'); |
|
49 | 49 | } elseif ($tpl === false) { |
50 | 50 | throw new CompilationException($compiler, |
51 | - 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
51 | + 'Load Templates : Resource "'.$resource.'" does not support includes.'); |
|
52 | 52 | } |
53 | 53 | |
54 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
54 | + $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n"; |
|
55 | 55 | |
56 | 56 | $modCheck = $tpl->getIsModifiedCode(); |
57 | 57 | |
58 | 58 | if ($modCheck) { |
59 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
59 | + $out .= 'if (!('.$modCheck.')) { ob_end_clean(); return false; }'; |
|
60 | 60 | } else { |
61 | 61 | $out .= 'try { |
62 | - $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
|
62 | + $tpl = $this->templateFactory("' . $resource.'", "'.$identifier.'"); |
|
63 | 63 | } catch (Dwoo\Exception $e) { |
64 | - $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
|
64 | + $this->triggerError(\'Load Templates : Resource <em>' . $resource.'</em> was not added to Dwoo, can not extend <em>'.$identifier.'</em>\', E_USER_WARNING); |
|
65 | 65 | } |
66 | 66 | if ($tpl === null) |
67 | - $this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING); |
|
67 | + $this->triggerError(\'Load Templates : Resource "' . $resource.':'.$identifier.'" was not found.\', E_USER_WARNING); |
|
68 | 68 | elseif ($tpl === false) |
69 | - $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
|
70 | -if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
|
69 | + $this->triggerError(\'Load Templates : Resource "' . $resource.'" does not support extends.\', E_USER_WARNING); |
|
70 | +if ($tpl->getUid() != "' . $tpl->getUid().'") { ob_end_clean(); return false; }'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $out; |
@@ -30,14 +30,14 @@ |
||
30 | 30 | */ |
31 | 31 | class PluginNl2br extends Plugin implements ICompilable |
32 | 32 | { |
33 | - /** |
|
34 | - * @param Compiler $compiler |
|
35 | - * @param string $value |
|
36 | - * |
|
37 | - * @return string |
|
38 | - */ |
|
39 | - public static function compile(Compiler $compiler, $value) |
|
40 | - { |
|
41 | - return 'nl2br((string) ' . $value . ')'; |
|
42 | - } |
|
33 | + /** |
|
34 | + * @param Compiler $compiler |
|
35 | + * @param string $value |
|
36 | + * |
|
37 | + * @return string |
|
38 | + */ |
|
39 | + public static function compile(Compiler $compiler, $value) |
|
40 | + { |
|
41 | + return 'nl2br((string) ' . $value . ')'; |
|
42 | + } |
|
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -38,6 +38,6 @@ |
||
38 | 38 | */ |
39 | 39 | public static function compile(Compiler $compiler, $value) |
40 | 40 | { |
41 | - return 'nl2br((string) ' . $value . ')'; |
|
41 | + return 'nl2br((string) '.$value.')'; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |