| @@ -356,29 +356,29 @@ | ||
| 356 | 356 | |
| 357 | 357 | // if we want just unprotected link | 
| 358 | 358 |          if (!$protected) { | 
| 359 | - return $link ? '<a href="mailto:' . $email . '">' . $linkText . '</a>' : $linkText; | |
| 359 | + return $link ? '<a href="mailto:'.$email.'">'.$linkText.'</a>' : $linkText; | |
| 360 | 360 | } | 
| 361 | 361 | |
| 362 | 362 | // turn on protection | 
| 363 | 363 | $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; | 
| 364 | 364 | $key = str_shuffle($character_set); | 
| 365 | 365 | $cipher_text = ''; | 
| 366 | - $id = 'e' . rand(1, 999999999); | |
| 366 | + $id = 'e'.rand(1, 999999999); | |
| 367 | 367 | for ($i = 0; $i < strlen($email); $i += 1) $cipher_text .= $key[strpos($character_set, $email[$i])]; | 
| 368 | -        $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";'; | |
| 368 | +        $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d="";'; | |
| 369 | 369 | $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; | 
| 370 | 370 | $script .= 'var y = d;'; | 
| 371 | 371 |          if ($text !== null) { | 
| 372 | 372 | $script .= 'var y = "'.$text.'";'; | 
| 373 | 373 | } | 
| 374 | 374 |          if ($link) { | 
| 375 | -            $script .= 'document.getElementById("' . $id . '").innerHTML="<a href=\\"mailto:"+d+"\\">"+y+"</a>"'; | |
| 375 | +            $script .= 'document.getElementById("'.$id.'").innerHTML="<a href=\\"mailto:"+d+"\\">"+y+"</a>"'; | |
| 376 | 376 |          } else { | 
| 377 | -            $script .= 'document.getElementById("' . $id . '").innerHTML=y'; | |
| 377 | +            $script .= 'document.getElementById("'.$id.'").innerHTML=y'; | |
| 378 | 378 | } | 
| 379 | -        $script = "eval(\"" . str_replace(array("\\", '"'), array("\\\\", '\"'), $script) . "\")"; | |
| 380 | - $script = '<script type="text/javascript">/*<![CDATA[*/' . $script . '/*]]>*/</script>'; | |
| 379 | +        $script = "eval(\"".str_replace(array("\\", '"'), array("\\\\", '\"'), $script)."\")"; | |
| 380 | + $script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>'; | |
| 381 | 381 | |
| 382 | - return '<span id="' . $id . '">[javascript protected email address]</span>' . $script; | |
| 382 | + return '<span id="'.$id.'">[javascript protected email address]</span>'.$script; | |
| 383 | 383 | } | 
| 384 | 384 | } | 
| @@ -378,7 +378,9 @@ | ||
| 378 | 378 | $key = str_shuffle($character_set); | 
| 379 | 379 | $cipher_text = ''; | 
| 380 | 380 | $id = 'e' . rand(1, 999999999); | 
| 381 | - for ($i = 0; $i < strlen($email); $i += 1) $cipher_text .= $key[strpos($character_set, $email[$i])]; | |
| 381 | +        for ($i = 0; $i < strlen($email); $i += 1) { | |
| 382 | + $cipher_text .= $key[strpos($character_set, $email[$i])]; | |
| 383 | + } | |
| 382 | 384 |          $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";'; | 
| 383 | 385 | $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; | 
| 384 | 386 | $script .= 'var y = d;'; | 
| @@ -1,7 +1,5 @@ | ||
| 1 | 1 | <?php namespace VojtaSvoboda\TwigExtensions; | 
| 2 | 2 | |
| 3 | -use App; | |
| 4 | -use Backend; | |
| 5 | 3 | use Carbon\Carbon; | 
| 6 | 4 | use Snilius\Twig\SortByFieldExtension; | 
| 7 | 5 | use System\Classes\PluginBase; | 
| @@ -7,11 +7,11 @@ | ||
| 7 | 7 |  { | 
| 8 | 8 | public function trans($id, array $parameters = [], $domain = 'messages', $locale = null) | 
| 9 | 9 |      { | 
| 10 | -        return $this->get('vojtasvoboda.twigextensions::lang.' . $id, $parameters, $locale); | |
| 10 | +        return $this->get('vojtasvoboda.twigextensions::lang.'.$id, $parameters, $locale); | |
| 11 | 11 | } | 
| 12 | 12 | |
| 13 | 13 | public function transChoice($id, $number, array $parameters = [], $domain = 'messages', $locale = null) | 
| 14 | 14 |      { | 
| 15 | -        return $this->choice('vojtasvoboda.twigextensions::lang.' . $id, $number, $parameters, $locale); | |
| 15 | +        return $this->choice('vojtasvoboda.twigextensions::lang.'.$id, $number, $parameters, $locale); | |
| 16 | 16 | } | 
| 17 | 17 | } | 
| @@ -9,7 +9,7 @@ discard block | ||
| 9 | 9 | use Twig_Environment; | 
| 10 | 10 | use VojtaSvoboda\TwigExtensions\Classes\TimeDiffTranslator; | 
| 11 | 11 | |
| 12 | -require_once __DIR__ . '/../vendor/autoload.php'; | |
| 12 | +require_once __DIR__.'/../vendor/autoload.php'; | |
| 13 | 13 | |
| 14 | 14 | class PluginTest extends PluginTestCase | 
| 15 | 15 |  { | 
| @@ -116,7 +116,7 @@ discard block | ||
| 116 | 116 | $twig = $this->getTwig(); | 
| 117 | 117 | |
| 118 | 118 | $now = Carbon::now()->subMinute(); | 
| 119 | -        $template = "{{ '" . $now->format('Y-m-d H:i:s') . "' | time_diff }}"; | |
| 119 | +        $template = "{{ '".$now->format('Y-m-d H:i:s')."' | time_diff }}"; | |
| 120 | 120 | |
| 121 | 121 | // this test fails at TravisCI and I don't know why | 
| 122 | 122 | $twigTemplate = $twig->createTemplate($template); | 
| @@ -316,7 +316,7 @@ discard block | ||
| 316 | 316 | $key = 'app.custom.key'; | 
| 317 | 317 | $value = 'test value'; | 
| 318 | 318 | Config::set($key, $value); | 
| 319 | -        $template = "{{ config('" . $key . "') }}"; | |
| 319 | +        $template = "{{ config('".$key."') }}"; | |
| 320 | 320 | |
| 321 | 321 | $twigTemplate = $twig->createTemplate($template); | 
| 322 | 322 | $this->assertEquals($twigTemplate->render([]), $value); |