@@ -44,6 +44,6 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public static function compile(Compiler $compiler, $value, $length = 80, $break = "\n", $cut = false) |
| 46 | 46 | { |
| 47 | - return 'wordwrap(' . $value . ',' . $length . ',' . $break . ',' . $cut . ')'; |
|
| 47 | + return 'wordwrap('.$value.','.$length.','.$break.','.$cut.')'; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -43,10 +43,10 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public static function compile(Compiler $compiler, $value, $search, $replace, $case_sensitive = true) |
| 45 | 45 | { |
| 46 | - if ($case_sensitive == 'false' || (bool)$case_sensitive === false) { |
|
| 47 | - return 'str_ireplace(' . $search . ', ' . $replace . ', ' . $value . ')'; |
|
| 46 | + if ($case_sensitive == 'false' || (bool) $case_sensitive === false) { |
|
| 47 | + return 'str_ireplace('.$search.', '.$replace.', '.$value.')'; |
|
| 48 | 48 | } else { |
| 49 | - return 'str_replace(' . $search . ', ' . $replace . ', ' . $value . ')'; |
|
| 49 | + return 'str_replace('.$search.', '.$replace.', '.$value.')'; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function process($value, $search, $replace) |
| 41 | 41 | { |
| 42 | - $search = (array)$search; |
|
| 42 | + $search = (array) $search; |
|
| 43 | 43 | $cnt = count($search); |
| 44 | 44 | |
| 45 | 45 | for ($i = 0; $i < $cnt; ++ $i) { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) { |
| 52 | - $search[$i] = substr($search[$i], 0, - strlen($m[0])) . str_replace(array( |
|
| 52 | + $search[$i] = substr($search[$i], 0, - strlen($m[0])).str_replace(array( |
|
| 53 | 53 | 'e', |
| 54 | 54 | ' ' |
| 55 | 55 | ), |
@@ -40,6 +40,6 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public static function compile(Compiler $compiler, $value, $format) |
| 42 | 42 | { |
| 43 | - return 'sprintf(' . $format . ',' . $value . ')'; |
|
| 43 | + return 'sprintf('.$format.','.$value.')'; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | \ 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 '(preg_match_all(\'#[\r\n]+#\', ' . $value . ', $tmp)+1)'; |
|
| 41 | + return '(preg_match_all(\'#[\r\n]+#\', '.$value.', $tmp)+1)'; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | \ No newline at end of file |
@@ -49,34 +49,34 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | switch ($format) { |
| 51 | 51 | case 'html': |
| 52 | - return htmlspecialchars((string)$value, ENT_QUOTES, $charset); |
|
| 52 | + return htmlspecialchars((string) $value, ENT_QUOTES, $charset); |
|
| 53 | 53 | case 'htmlall': |
| 54 | - return htmlentities((string)$value, ENT_QUOTES, $charset); |
|
| 54 | + return htmlentities((string) $value, ENT_QUOTES, $charset); |
|
| 55 | 55 | case 'url': |
| 56 | - return rawurlencode((string)$value); |
|
| 56 | + return rawurlencode((string) $value); |
|
| 57 | 57 | case 'urlpathinfo': |
| 58 | - return str_replace('%2F', '/', rawurlencode((string)$value)); |
|
| 58 | + return str_replace('%2F', '/', rawurlencode((string) $value)); |
|
| 59 | 59 | case 'quotes': |
| 60 | - return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value); |
|
| 60 | + return preg_replace("#(?<!\\\\)'#", "\\'", (string) $value); |
|
| 61 | 61 | case 'hex': |
| 62 | 62 | $out = ''; |
| 63 | - $cnt = strlen((string)$value); |
|
| 63 | + $cnt = strlen((string) $value); |
|
| 64 | 64 | for ($i = 0; $i < $cnt; ++ $i) { |
| 65 | - $out .= '%' . bin2hex((string)$value[$i]); |
|
| 65 | + $out .= '%'.bin2hex((string) $value[$i]); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | return $out; |
| 69 | 69 | case 'hexentity': |
| 70 | 70 | $out = ''; |
| 71 | - $cnt = strlen((string)$value); |
|
| 71 | + $cnt = strlen((string) $value); |
|
| 72 | 72 | for ($i = 0; $i < $cnt; ++ $i) { |
| 73 | - $out .= '&#x' . bin2hex((string)$value[$i]) . ';'; |
|
| 73 | + $out .= '&#x'.bin2hex((string) $value[$i]).';'; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $out; |
| 77 | 77 | case 'javascript': |
| 78 | 78 | case 'js': |
| 79 | - return strtr((string)$value, |
|
| 79 | + return strtr((string) $value, |
|
| 80 | 80 | array( |
| 81 | 81 | '\\' => '\\\\', |
| 82 | 82 | "'" => "\\'", |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | ' (AT) ', |
| 95 | 95 | ' (DOT) ' |
| 96 | 96 | ), |
| 97 | - (string)$value); |
|
| 97 | + (string) $value); |
|
| 98 | 98 | default: |
| 99 | - $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.', |
|
| 99 | + $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "'.$format.'" given.', |
|
| 100 | 100 | E_USER_WARNING); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | $address .= '?'; |
| 63 | 63 | |
| 64 | 64 | if (!empty($subject)) { |
| 65 | - $address .= 'subject=' . rawurlencode($subject) . '&'; |
|
| 65 | + $address .= 'subject='.rawurlencode($subject).'&'; |
|
| 66 | 66 | } |
| 67 | 67 | if (!empty($cc)) { |
| 68 | - $address .= 'cc=' . rawurlencode($cc) . '&'; |
|
| 68 | + $address .= 'cc='.rawurlencode($cc).'&'; |
|
| 69 | 69 | } |
| 70 | 70 | if (!empty($bcc)) { |
| 71 | - $address .= 'bcc=' . rawurlencode($bcc) . '&'; |
|
| 71 | + $address .= 'bcc='.rawurlencode($bcc).'&'; |
|
| 72 | 72 | } |
| 73 | 73 | if (!empty($newsgroups)) { |
| 74 | - $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&'; |
|
| 74 | + $address .= 'newsgroups='.rawurlencode($newsgroups).'&'; |
|
| 75 | 75 | } |
| 76 | 76 | if (!empty($followupto)) { |
| 77 | - $address .= 'followupto=' . rawurlencode($followupto) . '&'; |
|
| 77 | + $address .= 'followupto='.rawurlencode($followupto).'&'; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $address = rtrim($address, '?&'); |
@@ -84,34 +84,34 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | case 'none': |
| 86 | 86 | case null: |
| 87 | - return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
| 87 | + return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; |
|
| 88 | 88 | |
| 89 | 89 | case 'js': |
| 90 | 90 | case 'javascript': |
| 91 | - $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; |
|
| 91 | + $str = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');'; |
|
| 92 | 92 | $len = strlen($str); |
| 93 | 93 | |
| 94 | 94 | $out = ''; |
| 95 | 95 | for ($i = 0; $i < $len; ++ $i) { |
| 96 | - $out .= '%' . bin2hex($str[$i]); |
|
| 96 | + $out .= '%'.bin2hex($str[$i]); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>'; |
|
| 99 | + return '<script type="text/javascript">eval(unescape(\''.$out.'\'));</script>'; |
|
| 100 | 100 | |
| 101 | 101 | break; |
| 102 | 102 | case 'javascript_charcode': |
| 103 | 103 | case 'js_charcode': |
| 104 | 104 | case 'jscharcode': |
| 105 | 105 | case 'jschar': |
| 106 | - $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
| 106 | + $str = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; |
|
| 107 | 107 | $len = strlen($str); |
| 108 | 108 | |
| 109 | - $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode("; |
|
| 109 | + $out = '<script type="text/javascript">'."\n<!--\ndocument.write(Str.fromCharCode("; |
|
| 110 | 110 | for ($i = 0; $i < $len; ++ $i) { |
| 111 | - $out .= ord($str[$i]) . ','; |
|
| 111 | + $out .= ord($str[$i]).','; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - return rtrim($out, ',') . "));\n-->\n</script>\n"; |
|
| 114 | + return rtrim($out, ',')."));\n-->\n</script>\n"; |
|
| 115 | 115 | |
| 116 | 116 | break; |
| 117 | 117 | |
@@ -124,18 +124,18 @@ discard block |
||
| 124 | 124 | $len = strlen($address); |
| 125 | 125 | for ($i = 0; $i < $len; ++ $i) { |
| 126 | 126 | if (preg_match('#\w#', $address[$i])) { |
| 127 | - $out .= '%' . bin2hex($address[$i]); |
|
| 127 | + $out .= '%'.bin2hex($address[$i]); |
|
| 128 | 128 | } else { |
| 129 | 129 | $out .= $address[$i]; |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - $out .= '" ' . $extra . '>'; |
|
| 132 | + $out .= '" '.$extra.'>'; |
|
| 133 | 133 | $len = strlen($text); |
| 134 | 134 | for ($i = 0; $i < $len; ++ $i) { |
| 135 | - $out .= '&#x' . bin2hex($text[$i]); |
|
| 135 | + $out .= '&#x'.bin2hex($text[$i]); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return $out . '</a>'; |
|
| 138 | + return $out.'</a>'; |
|
| 139 | 139 | |
| 140 | 140 | default: |
| 141 | 141 | $this->core->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING); |
@@ -68,17 +68,17 @@ discard block |
||
| 68 | 68 | $include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id); |
| 69 | 69 | } |
| 70 | 70 | catch (SecurityException $e) { |
| 71 | - $this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING); |
|
| 71 | + $this->core->triggerError('Include : Security restriction : '.$e->getMessage(), E_USER_WARNING); |
|
| 72 | 72 | } |
| 73 | 73 | catch (Exception $e) { |
| 74 | - $this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING); |
|
| 74 | + $this->core->triggerError('Include : '.$e->getMessage(), E_USER_WARNING); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if ($include === null) { |
| 78 | - $this->core->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.', |
|
| 78 | + $this->core->triggerError('Include : Resource "'.$resource.':'.$identifier.'" not found.', |
|
| 79 | 79 | E_USER_WARNING); |
| 80 | 80 | } elseif ($include === false) { |
| 81 | - $this->core->triggerError('Include : Resource "' . $resource . '" does not support includes.', |
|
| 81 | + $this->core->triggerError('Include : Resource "'.$resource.'" does not support includes.', |
|
| 82 | 82 | E_USER_WARNING); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if (count($rest)) { |
| 92 | - $vars = $rest + $vars; |
|
| 92 | + $vars = $rest+$vars; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $clone = clone $this->core; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public static function compile(Compiler $compiler, array $rest, array $tokens) |
| 48 | 48 | { |
| 49 | 49 | // load if plugin |
| 50 | - if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) { |
|
| 50 | + if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS.'PluginIf')) { |
|
| 51 | 51 | try { |
| 52 | 52 | $compiler->getDwoo()->getLoader()->loadPlugin('if'); |
| 53 | 53 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } elseif (trim(end($rest), '"\'') === '?' || count($rest) === 1) { |
| 70 | 70 | if ($falseResult === '?' || $falseResult === ':') { |
| 71 | 71 | throw new CompilationException($compiler, |
| 72 | - 'Tif: incomplete tif statement, value missing after ' . $falseResult); |
|
| 72 | + 'Tif: incomplete tif statement, value missing after '.$falseResult); |
|
| 73 | 73 | } |
| 74 | 74 | // there was in fact no false result provided, so we move it to be the true result instead |
| 75 | 75 | $trueResult = $falseResult; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // parse condition |
| 100 | 100 | $condition = PluginIf::replaceKeywords($rest, $tokens, $compiler); |
| 101 | 101 | |
| 102 | - return '((' . implode(' ', $condition) . ') ? ' . ($trueResult === true ? implode(' ', |
|
| 103 | - $condition) : $trueResult) . ' : ' . $falseResult . ')'; |
|
| 102 | + return '(('.implode(' ', $condition).') ? '.($trueResult === true ? implode(' ', |
|
| 103 | + $condition) : $trueResult).' : '.$falseResult.')'; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | \ No newline at end of file |