@@ -30,9 +30,9 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | function PluginReplaceCompile(Compiler $compiler, $value, $search, $replace, $case_sensitive = true) |
| 32 | 32 | { |
| 33 | - if ($case_sensitive == 'false' || (bool)$case_sensitive === false) { |
|
| 34 | - return 'str_ireplace(' . $search . ', ' . $replace . ', ' . $value . ')'; |
|
| 33 | + if ($case_sensitive == 'false' || (bool) $case_sensitive === false) { |
|
| 34 | + return 'str_ireplace('.$search.', '.$replace.', '.$value.')'; |
|
| 35 | 35 | } else { |
| 36 | - return 'str_replace(' . $search . ', ' . $replace . ', ' . $value . ')'; |
|
| 36 | + return 'str_replace('.$search.', '.$replace.', '.$value.')'; |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | function PluginCountParagraphsCompile(Compiler $compiler, $value) |
| 30 | 30 | { |
| 31 | - return '(preg_match_all(\'#[\r\n]+#\', ' . $value . ', $tmp)+1)'; |
|
| 31 | + return '(preg_match_all(\'#[\r\n]+#\', '.$value.', $tmp)+1)'; |
|
| 32 | 32 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | break 2; |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | - $dwoo->triggerError('The security policy prevents you to read <em>' . $file . '</em>', E_USER_WARNING); |
|
| 50 | + $dwoo->triggerError('The security policy prevents you to read <em>'.$file.'</em>', E_USER_WARNING); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | $file = str_replace(array( |
@@ -29,5 +29,5 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | function PluginSpacifyCompile(Compiler $compiler, $value, $space_char = ' ') |
| 31 | 31 | { |
| 32 | - return 'implode(' . $space_char . ', str_split(' . $value . ', 1))'; |
|
| 32 | + return 'implode('.$space_char.', str_split('.$value.', 1))'; |
|
| 33 | 33 | } |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | function PluginLowerCompile(Compiler $compiler, $value) |
| 30 | 30 | { |
| 31 | - return 'mb_strtolower((string) ' . $value . ', $this->charset)'; |
|
| 31 | + return 'mb_strtolower((string) '.$value.', $this->charset)'; |
|
| 32 | 32 | } |
@@ -39,33 +39,33 @@ discard block |
||
| 39 | 39 | switch ($format) { |
| 40 | 40 | |
| 41 | 41 | case 'html': |
| 42 | - return htmlspecialchars((string)$value, ENT_QUOTES, $charset); |
|
| 42 | + return htmlspecialchars((string) $value, ENT_QUOTES, $charset); |
|
| 43 | 43 | case 'htmlall': |
| 44 | - return htmlentities((string)$value, ENT_QUOTES, $charset); |
|
| 44 | + return htmlentities((string) $value, ENT_QUOTES, $charset); |
|
| 45 | 45 | case 'url': |
| 46 | - return rawurlencode((string)$value); |
|
| 46 | + return rawurlencode((string) $value); |
|
| 47 | 47 | case 'urlpathinfo': |
| 48 | - return str_replace('%2F', '/', rawurlencode((string)$value)); |
|
| 48 | + return str_replace('%2F', '/', rawurlencode((string) $value)); |
|
| 49 | 49 | case 'quotes': |
| 50 | - return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value); |
|
| 50 | + return preg_replace("#(?<!\\\\)'#", "\\'", (string) $value); |
|
| 51 | 51 | case 'hex': |
| 52 | 52 | $out = ''; |
| 53 | - $cnt = strlen((string)$value); |
|
| 53 | + $cnt = strlen((string) $value); |
|
| 54 | 54 | for ($i = 0; $i < $cnt; ++ $i) { |
| 55 | - $out .= '%' . bin2hex((string)$value[$i]); |
|
| 55 | + $out .= '%'.bin2hex((string) $value[$i]); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $out; |
| 59 | 59 | case 'hexentity': |
| 60 | 60 | $out = ''; |
| 61 | - $cnt = strlen((string)$value); |
|
| 61 | + $cnt = strlen((string) $value); |
|
| 62 | 62 | for ($i = 0; $i < $cnt; ++ $i) { |
| 63 | - $out .= '&#x' . bin2hex((string)$value[$i]) . ';'; |
|
| 63 | + $out .= '&#x'.bin2hex((string) $value[$i]).';'; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | return $out; |
| 67 | 67 | case 'javascript': |
| 68 | - return strtr((string)$value, array( |
|
| 68 | + return strtr((string) $value, array( |
|
| 69 | 69 | '\\' => '\\\\', |
| 70 | 70 | "'" => "\\'", |
| 71 | 71 | '"' => '\\"', |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | ), array( |
| 81 | 81 | ' (AT) ', |
| 82 | 82 | ' (DOT) ' |
| 83 | - ), (string)$value); |
|
| 83 | + ), (string) $value); |
|
| 84 | 84 | default: |
| 85 | - $dwoo->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript or mail, "' . $format . '" given.', E_USER_WARNING); |
|
| 85 | + $dwoo->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript or mail, "'.$format.'" given.', E_USER_WARNING); |
|
| 86 | 86 | } |
| 87 | 87 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | ), $equation); |
| 106 | 106 | |
| 107 | 107 | $delim = $equation[0]; |
| 108 | - $open = $delim . '.'; |
|
| 109 | - $close = '.' . $delim; |
|
| 108 | + $open = $delim.'.'; |
|
| 109 | + $close = '.'.$delim; |
|
| 110 | 110 | $equation = substr($equation, 1, - 1); |
| 111 | 111 | $out = ''; |
| 112 | 112 | $ptr = 1; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $out .= $substr; |
| 124 | 124 | $equation = substr($equation, $ptr); |
| 125 | 125 | $ptr = 0; |
| 126 | - ++ $allowcomma; |
|
| 126 | + ++$allowcomma; |
|
| 127 | 127 | if ($allowcomma === 1) { |
| 128 | 128 | $allowed[] = ','; |
| 129 | 129 | } |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | $ptr = 0; |
| 135 | 135 | } elseif ($substr === $open) { |
| 136 | 136 | // pre-replaced variable |
| 137 | - preg_match('#.*\((?:[^()]*?|(?R))\)' . str_replace('.', '\\.', $close) . '#', substr($equation, 2), $m); |
|
| 137 | + preg_match('#.*\((?:[^()]*?|(?R))\)'.str_replace('.', '\\.', $close).'#', substr($equation, 2), $m); |
|
| 138 | 138 | if (empty($m)) { |
| 139 | - preg_match('#.*?' . str_replace('.', '\\.', $close) . '#', substr($equation, 2), $m); |
|
| 139 | + preg_match('#.*?'.str_replace('.', '\\.', $close).'#', substr($equation, 2), $m); |
|
| 140 | 140 | } |
| 141 | 141 | $out .= substr($m[0], 0, - 2); |
| 142 | - $equation = substr($equation, strlen($m[0]) + 2); |
|
| 142 | + $equation = substr($equation, strlen($m[0])+2); |
|
| 143 | 143 | $ptr = 0; |
| 144 | 144 | } elseif ($substr === '(') { |
| 145 | 145 | // opening parenthesis |
| 146 | 146 | if ($allowcomma > 0) { |
| 147 | - ++ $allowcomma; |
|
| 147 | + ++$allowcomma; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $out .= $substr; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } elseif ($substr === ')') { |
| 154 | 154 | // closing parenthesis |
| 155 | 155 | if ($allowcomma > 0) { |
| 156 | - -- $allowcomma; |
|
| 156 | + --$allowcomma; |
|
| 157 | 157 | if ($allowcomma === 0) { |
| 158 | 158 | array_pop($allowed); |
| 159 | 159 | } |
@@ -164,18 +164,18 @@ discard block |
||
| 164 | 164 | $ptr = 0; |
| 165 | 165 | } elseif ($ptr >= strlen($equation)) { |
| 166 | 166 | // parse error if we've consumed the entire equation without finding anything valid |
| 167 | - throw new CompilationException($compiler, 'Math : Syntax error or variable undefined in equation ' . $equationSrc . ' at ' . $substr); |
|
| 167 | + throw new CompilationException($compiler, 'Math : Syntax error or variable undefined in equation '.$equationSrc.' at '.$substr); |
|
| 168 | 168 | } else { |
| 169 | 169 | // nothing special, advance |
| 170 | - ++ $ptr; |
|
| 170 | + ++$ptr; |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | if ($format !== '\'\'') { |
| 174 | - $out = 'sprintf(' . $format . ', ' . $out . ')'; |
|
| 174 | + $out = 'sprintf('.$format.', '.$out.')'; |
|
| 175 | 175 | } |
| 176 | 176 | if ($assign !== '\'\'') { |
| 177 | - return '($this->assignInScope(' . $out . ', ' . $assign . '))'; |
|
| 177 | + return '($this->assignInScope('.$out.', '.$assign.'))'; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - return '(' . $out . ')'; |
|
| 180 | + return '('.$out.')'; |
|
| 181 | 181 | } |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | function PluginIssetCompile(Compiler $compiler, $var) |
| 30 | 30 | { |
| 31 | - return '(' . $var . ' !== null)'; |
|
| 31 | + return '('.$var.' !== null)'; |
|
| 32 | 32 | } |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
| 49 | 49 | |
| 50 | 50 | if ($tpl === null) { |
| 51 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
| 51 | + throw new CompilationException($compiler, 'Load Templates : Resource "'.$resource.':'.$identifier.'" not found.'); |
|
| 52 | 52 | } elseif ($tpl === false) { |
| 53 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
| 53 | + throw new CompilationException($compiler, 'Load Templates : Resource "'.$resource.'" does not support includes.'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $cmp = clone $compiler; |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | $compiler->addUsedPlugin($plugin, $type); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
| 65 | + $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n"; |
|
| 66 | 66 | |
| 67 | 67 | $modCheck = $tpl->getIsModifiedCode(); |
| 68 | 68 | |
| 69 | 69 | if ($modCheck) { |
| 70 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
| 70 | + $out .= 'if (!('.$modCheck.')) { ob_end_clean(); return false; }'; |
|
| 71 | 71 | } else { |
| 72 | 72 | $out .= 'try { |
| 73 | - $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
|
| 73 | + $tpl = $this->templateFactory("' . $resource.'", "'.$identifier.'"); |
|
| 74 | 74 | } catch (Dwoo\Exception $e) { |
| 75 | - $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
|
| 75 | + $this->triggerError(\'Load Templates : Resource <em>' . $resource.'</em> was not added to Dwoo, can not extend <em>'.$identifier.'</em>\', E_USER_WARNING); |
|
| 76 | 76 | } |
| 77 | 77 | if ($tpl === null) |
| 78 | - $this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING); |
|
| 78 | + $this->triggerError(\'Load Templates : Resource "' . $resource.':'.$identifier.'" was not found.\', E_USER_WARNING); |
|
| 79 | 79 | elseif ($tpl === false) |
| 80 | - $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
|
| 81 | -if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
|
| 80 | + $this->triggerError(\'Load Templates : Resource "' . $resource.'" does not support extends.\', E_USER_WARNING); |
|
| 81 | +if ($tpl->getUid() != "' . $tpl->getUid().'") { ob_end_clean(); return false; }'; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return $out; |