@@ -30,8 +30,8 @@ |
||
30 | 30 | function PluginCountCharactersCompile(Compiler $compiler, $value, $count_spaces = false) |
31 | 31 | { |
32 | 32 | if ($count_spaces === 'false') { |
33 | - return 'preg_match_all(\'#[^\s\pZ]#u\', ' . $value . ', $tmp)'; |
|
33 | + return 'preg_match_all(\'#[^\s\pZ]#u\', '.$value.', $tmp)'; |
|
34 | 34 | } else { |
35 | - return 'mb_strlen(' . $value . ', $this->charset)'; |
|
35 | + return 'mb_strlen('.$value.', $this->charset)'; |
|
36 | 36 | } |
37 | 37 | } |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | self::$l = preg_quote($l, '/'); |
57 | 57 | self::$r = preg_quote($r, '/'); |
58 | 58 | self::$regex = '/ |
59 | - ' . self::$l . 'block\s(["\']?)(.+?)\1' . self::$r . '(?:\r?\n?) |
|
59 | + ' . self::$l.'block\s(["\']?)(.+?)\1'.self::$r.'(?:\r?\n?) |
|
60 | 60 | ((?: |
61 | 61 | (?R) |
62 | 62 | | |
63 | - [^' . self::$l . ']* |
|
63 | + [^' . self::$l.']* |
|
64 | 64 | (?: |
65 | - (?! ' . self::$l . '\/?block\b ) |
|
66 | - ' . self::$l . ' |
|
67 | - [^' . self::$l . ']*+ |
|
65 | + (?! ' . self::$l.'\/?block\b ) |
|
66 | + ' . self::$l.' |
|
67 | + [^' . self::$l.']*+ |
|
68 | 68 | )* |
69 | 69 | )*) |
70 | - ' . self::$l . '\/block' . self::$r . ' |
|
70 | + ' . self::$l.'\/block'.self::$r.' |
|
71 | 71 | /six'; |
72 | 72 | |
73 | 73 | if ($compiler->getLooseOpeningHandling()) { |
74 | 74 | self::$l .= '\s*'; |
75 | - self::$r = '\s*' . self::$r; |
|
75 | + self::$r = '\s*'.self::$r; |
|
76 | 76 | } |
77 | 77 | $inheritanceTree = array(array('source' => $compiler->getTemplateSource())); |
78 | - $curPath = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()) . DIRECTORY_SEPARATOR; |
|
78 | + $curPath = dirname($compiler->getDwoo()->getTemplate()->getResourceIdentifier()).DIRECTORY_SEPARATOR; |
|
79 | 79 | $curTpl = $compiler->getDwoo()->getTemplate(); |
80 | 80 | |
81 | 81 | while (!empty($file)) { |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | $parent = $compiler->getDwoo()->templateFactory($resource, $identifier, null, null, null, $curTpl); |
98 | 98 | } |
99 | 99 | catch (SecurityException $e) { |
100 | - throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage()); |
|
100 | + throw new CompilationException($compiler, 'Extends : Security restriction : '.$e->getMessage()); |
|
101 | 101 | } |
102 | 102 | catch (Exception $e) { |
103 | - throw new CompilationException($compiler, 'Extends : ' . $e->getMessage()); |
|
103 | + throw new CompilationException($compiler, 'Extends : '.$e->getMessage()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($parent === null) { |
107 | - throw new CompilationException($compiler, 'Extends : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
107 | + throw new CompilationException($compiler, 'Extends : Resource "'.$resource.':'.$identifier.'" not found.'); |
|
108 | 108 | } elseif ($parent === false) { |
109 | - throw new CompilationException($compiler, 'Extends : Resource "' . $resource . '" does not support extends.'); |
|
109 | + throw new CompilationException($compiler, 'Extends : Resource "'.$resource.'" does not support extends.'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $curTpl = $parent; |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | } |
122 | 122 | $inheritanceTree[] = $newParent; |
123 | 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; |
|
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 | 126 | if (isset($match[2]) && $match[2] == '"') { |
127 | - $file = '"' . str_replace('"', '\\"', substr($match[1], 1, - 1)) . '"'; |
|
127 | + $file = '"'.str_replace('"', '\\"', substr($match[1], 1, - 1)).'"'; |
|
128 | 128 | } elseif (isset($match[2]) && $match[2] == "'") { |
129 | - $file = '"' . substr($match[1], 1, - 1) . '"'; |
|
129 | + $file = '"'.substr($match[1], 1, - 1).'"'; |
|
130 | 130 | } else { |
131 | - $file = '"' . $match[1] . '"'; |
|
131 | + $file = '"'.$match[1].'"'; |
|
132 | 132 | } |
133 | 133 | } else { |
134 | 134 | $file = false; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'Dwoo\Plugins\Functions\PluginExtends', |
148 | 148 | 'replaceBlock' |
149 | 149 | ), $newSource); |
150 | - $newSource = $l . 'do extendsCheck(' . var_export($parent['resource'] . ':' . $parent['identifier'], true) . ')' . $r . $newSource; |
|
150 | + $newSource = $l.'do extendsCheck('.var_export($parent['resource'].':'.$parent['identifier'], true).')'.$r.$newSource; |
|
151 | 151 | |
152 | 152 | if (self::$lastReplacement) { |
153 | 153 | break; |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $r = stripslashes(self::$r); |
175 | 175 | |
176 | 176 | if (self::$lastReplacement) { |
177 | - return preg_replace('/' . self::$l . '\$dwoo\.parent' . self::$r . '/is', $matches[3], $override); |
|
177 | + return preg_replace('/'.self::$l.'\$dwoo\.parent'.self::$r.'/is', $matches[3], $override); |
|
178 | 178 | } |
179 | 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; |
|
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 | 181 | } |
182 | 182 | |
183 | 183 | if (preg_match(self::$regex, $matches[3])) { |
@@ -36,8 +36,8 @@ |
||
36 | 36 | { |
37 | 37 | $out = array(); |
38 | 38 | foreach ($rest as $var => $val) { |
39 | - $out[] = '$this->setReturnValue(' . var_export($var, true) . ', ' . $val . ')'; |
|
39 | + $out[] = '$this->setReturnValue('.var_export($var, true).', '.$val.')'; |
|
40 | 40 | } |
41 | 41 | |
42 | - return '(' . implode('.', $out) . ')'; |
|
42 | + return '('.implode('.', $out).')'; |
|
43 | 43 | } |
@@ -28,5 +28,5 @@ |
||
28 | 28 | */ |
29 | 29 | function PluginNl2brCompile(Compiler $compiler, $value) |
30 | 30 | { |
31 | - return 'nl2br((string) ' . $value . ')'; |
|
31 | + return 'nl2br((string) '.$value.')'; |
|
32 | 32 | } |
@@ -32,11 +32,11 @@ |
||
32 | 32 | if (is_array($value)) { |
33 | 33 | return array_reverse($value, $preserve_keys); |
34 | 34 | } elseif (($charset = $dwoo->getCharset()) === 'iso-8859-1') { |
35 | - return strrev((string)$value); |
|
35 | + return strrev((string) $value); |
|
36 | 36 | } else { |
37 | 37 | $strlen = mb_strlen($value); |
38 | 38 | $out = ''; |
39 | - while ($strlen --) { |
|
39 | + while ($strlen--) { |
|
40 | 40 | $out .= mb_substr($value, $strlen, 1, $charset); |
41 | 41 | } |
42 | 42 |
@@ -28,5 +28,5 @@ |
||
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 | } |
@@ -74,10 +74,10 @@ |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | if ($advance) { |
77 | - if ($this->cycles[$name]['index'] >= count($values) - 1) { |
|
77 | + if ($this->cycles[$name]['index'] >= count($values)-1) { |
|
78 | 78 | $this->cycles[$name]['index'] = 0; |
79 | 79 | } else { |
80 | - ++ $this->cycles[$name]['index']; |
|
80 | + ++$this->cycles[$name]['index']; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -31,5 +31,5 @@ |
||
31 | 31 | */ |
32 | 32 | function PluginWordwrapCompile(Compiler $compiler, $value, $length = 80, $break = "\n", $cut = false) |
33 | 33 | { |
34 | - return 'wordwrap(' . $value . ',' . $length . ',' . $break . ',' . $cut . ')'; |
|
34 | + return 'wordwrap('.$value.','.$length.','.$break.','.$cut.')'; |
|
35 | 35 | } |
@@ -37,21 +37,21 @@ |
||
37 | 37 | return ''; |
38 | 38 | } |
39 | 39 | |
40 | - $value = (string)$value; |
|
41 | - $etc = (string)$etc; |
|
42 | - $length = (int)$length; |
|
40 | + $value = (string) $value; |
|
41 | + $etc = (string) $etc; |
|
42 | + $length = (int) $length; |
|
43 | 43 | |
44 | 44 | if (strlen($value) < $length) { |
45 | 45 | return $value; |
46 | 46 | } |
47 | 47 | |
48 | - $length = max($length - strlen($etc), 0); |
|
48 | + $length = max($length-strlen($etc), 0); |
|
49 | 49 | if ($break === false && $middle === false) { |
50 | - $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length + 1)); |
|
50 | + $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length+1)); |
|
51 | 51 | } |
52 | 52 | if ($middle === false) { |
53 | - return substr($value, 0, $length) . $etc; |
|
53 | + return substr($value, 0, $length).$etc; |
|
54 | 54 | } |
55 | 55 | |
56 | - return substr($value, 0, ceil($length / 2)) . $etc . substr($value, - floor($length / 2)); |
|
56 | + return substr($value, 0, ceil($length/2)).$etc.substr($value, - floor($length/2)); |
|
57 | 57 | } |