@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use PluginTestCase; |
9 | 9 | use Twig_Environment; |
10 | 10 | |
11 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
11 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
12 | 12 | |
13 | 13 | class PluginTest extends PluginTestCase |
14 | 14 | { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $twig = $this->getTwig(); |
91 | 91 | |
92 | 92 | $now = Carbon::now()->subMinute(); |
93 | - $template = "{{ '" . $now->format('Y-m-d H:i:s') . "' | time_diff }}"; |
|
93 | + $template = "{{ '".$now->format('Y-m-d H:i:s')."' | time_diff }}"; |
|
94 | 94 | |
95 | 95 | $twigTemplate = $twig->createTemplate($template); |
96 | 96 | $this->assertEquals($twigTemplate->render([]), '1 minute ago'); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $key = 'app.custom.key'; |
224 | 224 | $value = 'test value'; |
225 | 225 | Config::set($key, $value); |
226 | - $template = "{{ config('" . $key . "') }}"; |
|
226 | + $template = "{{ config('".$key."') }}"; |
|
227 | 227 | |
228 | 228 | $twigTemplate = $twig->createTemplate($template); |
229 | 229 | $this->assertEquals($twigTemplate->render([]), $value); |
@@ -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 System\Classes\PluginBase; |
7 | 5 | use Twig_Extension_StringLoader; |
@@ -357,7 +357,9 @@ |
||
357 | 357 | $key = str_shuffle($character_set); |
358 | 358 | $cipher_text = ''; |
359 | 359 | $id = 'e' . rand(1, 999999999); |
360 | - for ($i = 0; $i < strlen($email); $i += 1) $cipher_text .= $key[strpos($character_set, $email[$i])]; |
|
360 | + for ($i = 0; $i < strlen($email); $i += 1) { |
|
361 | + $cipher_text .= $key[strpos($character_set, $email[$i])]; |
|
362 | + } |
|
361 | 363 | $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";'; |
362 | 364 | $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; |
363 | 365 | if ($link) { |
@@ -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 | } |