@@ -406,7 +406,6 @@ |
||
| 406 | 406 | * |
| 407 | 407 | * See: https://github.com/vojtasvoboda/oc-twigextensions-plugin/issues/25 |
| 408 | 408 | * |
| 409 | - * @param string $filename Filename of the asset file |
|
| 410 | 409 | * |
| 411 | 410 | * @return string |
| 412 | 411 | */ |
@@ -420,13 +420,13 @@ |
||
| 420 | 420 | |
| 421 | 421 | if (file_exists($filename_)) |
| 422 | 422 | { |
| 423 | - $timestamp = filemtime($filename_); |
|
| 424 | - return $filename . "?" . date ("m.d.y.H.i.s", $timestamp); |
|
| 423 | + $timestamp = filemtime($filename_); |
|
| 424 | + return $filename . "?" . date ("m.d.y.H.i.s", $timestamp); |
|
| 425 | 425 | }else |
| 426 | 426 | { |
| 427 | - return $filename . "?"; |
|
| 427 | + return $filename . "?"; |
|
| 428 | 428 | } |
| 429 | 429 | }, |
| 430 | - ]; |
|
| 430 | + ]; |
|
| 431 | 431 | } |
| 432 | 432 | } |
@@ -373,30 +373,30 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | // if we want just unprotected link |
| 375 | 375 | if (!$protected) { |
| 376 | - return $link ? '<a href="mailto:' . $email . '">' . $linkText . '</a>' : $linkText; |
|
| 376 | + return $link ? '<a href="mailto:'.$email.'">'.$linkText.'</a>' : $linkText; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // turn on protection |
| 380 | 380 | $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; |
| 381 | 381 | $key = str_shuffle($character_set); |
| 382 | 382 | $cipher_text = ''; |
| 383 | - $id = 'e' . rand(1, 999999999); |
|
| 383 | + $id = 'e'.rand(1, 999999999); |
|
| 384 | 384 | for ($i = 0; $i < strlen($email); $i += 1) $cipher_text .= $key[strpos($character_set, $email[$i])]; |
| 385 | - $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";'; |
|
| 385 | + $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d="";'; |
|
| 386 | 386 | $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; |
| 387 | 387 | $script .= 'var y = d;'; |
| 388 | 388 | if ($text !== null) { |
| 389 | 389 | $script .= 'var y = "'.$text.'";'; |
| 390 | 390 | } |
| 391 | 391 | if ($link) { |
| 392 | - $script .= 'document.getElementById("' . $id . '").innerHTML="<a href=\\"mailto:"+d+"\\">"+y+"</a>"'; |
|
| 392 | + $script .= 'document.getElementById("'.$id.'").innerHTML="<a href=\\"mailto:"+d+"\\">"+y+"</a>"'; |
|
| 393 | 393 | } else { |
| 394 | - $script .= 'document.getElementById("' . $id . '").innerHTML=y'; |
|
| 394 | + $script .= 'document.getElementById("'.$id.'").innerHTML=y'; |
|
| 395 | 395 | } |
| 396 | - $script = "eval(\"" . str_replace(array("\\", '"'), array("\\\\", '\"'), $script) . "\")"; |
|
| 397 | - $script = '<script type="text/javascript">/*<![CDATA[*/' . $script . '/*]]>*/</script>'; |
|
| 396 | + $script = "eval(\"".str_replace(array("\\", '"'), array("\\\\", '\"'), $script)."\")"; |
|
| 397 | + $script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>'; |
|
| 398 | 398 | |
| 399 | - return '<span id="' . $id . '">[javascript protected email address]</span>' . $script; |
|
| 399 | + return '<span id="'.$id.'">[javascript protected email address]</span>'.$script; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -413,18 +413,18 @@ discard block |
||
| 413 | 413 | private function getFileVersion() |
| 414 | 414 | { |
| 415 | 415 | return [ |
| 416 | - 'fileversion' => function($filename){ |
|
| 416 | + 'fileversion' => function($filename) { |
|
| 417 | 417 | // Remove http/web address from the file name if there is one to load it locally |
| 418 | 418 | $prefix = url("/"); |
| 419 | - $filename_ = trim(preg_replace('/^' . preg_quote($prefix, '/') . '/', '', $filename), '/'); |
|
| 419 | + $filename_ = trim(preg_replace('/^'.preg_quote($prefix, '/').'/', '', $filename), '/'); |
|
| 420 | 420 | |
| 421 | 421 | if (file_exists($filename_)) |
| 422 | 422 | { |
| 423 | 423 | $timestamp = filemtime($filename_); |
| 424 | - return $filename . "?" . date ("m.d.y.H.i.s", $timestamp); |
|
| 425 | - }else |
|
| 424 | + return $filename."?".date("m.d.y.H.i.s", $timestamp); |
|
| 425 | + } else |
|
| 426 | 426 | { |
| 427 | - return $filename . "?"; |
|
| 427 | + return $filename."?"; |
|
| 428 | 428 | } |
| 429 | 429 | }, |
| 430 | 430 | ]; |
@@ -381,7 +381,9 @@ discard block |
||
| 381 | 381 | $key = str_shuffle($character_set); |
| 382 | 382 | $cipher_text = ''; |
| 383 | 383 | $id = 'e' . rand(1, 999999999); |
| 384 | - for ($i = 0; $i < strlen($email); $i += 1) $cipher_text .= $key[strpos($character_set, $email[$i])]; |
|
| 384 | + for ($i = 0; $i < strlen($email); $i += 1) { |
|
| 385 | + $cipher_text .= $key[strpos($character_set, $email[$i])]; |
|
| 386 | + } |
|
| 385 | 387 | $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d="";'; |
| 386 | 388 | $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; |
| 387 | 389 | $script .= 'var y = d;'; |
@@ -422,7 +424,7 @@ discard block |
||
| 422 | 424 | { |
| 423 | 425 | $timestamp = filemtime($filename_); |
| 424 | 426 | return $filename . "?" . date ("m.d.y.H.i.s", $timestamp); |
| 425 | - }else |
|
| 427 | + } else |
|
| 426 | 428 | { |
| 427 | 429 | return $filename . "?"; |
| 428 | 430 | } |