@@ -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;'; |
@@ -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 | /** |
@@ -411,15 +411,15 @@ discard block |
||
| 411 | 411 | private function getFileRevision() |
| 412 | 412 | { |
| 413 | 413 | return [ |
| 414 | - 'revision' => function ($filename, $format = null) { |
|
| 414 | + 'revision' => function($filename, $format = null) { |
|
| 415 | 415 | // Remove http/web address from the file name if there is one to load it locally |
| 416 | 416 | $prefix = url('/'); |
| 417 | - $filename_ = trim(preg_replace('/^' . preg_quote($prefix, '/') . '/', '', $filename), '/'); |
|
| 417 | + $filename_ = trim(preg_replace('/^'.preg_quote($prefix, '/').'/', '', $filename), '/'); |
|
| 418 | 418 | if (file_exists($filename_)) { |
| 419 | 419 | $timestamp = filemtime($filename_); |
| 420 | 420 | $prepend = ($format) ? date($format, $timestamp) : $timestamp; |
| 421 | 421 | |
| 422 | - return $filename . "?" . $prepend; |
|
| 422 | + return $filename."?".$prepend; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | return $filename; |