Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kminek committed Apr 3, 2016
1 parent 1303bce commit ae3019c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/EmailObfuscator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function obfuscate($email, $text = null, $options = [])
}
}
$vars = [];
foreach (['coded', 'key', 'link', 'text'] as $var) {
foreach (['coded', 'key', 'link', 'text', 'ltr'] as $var) {
do {
$rnd = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 10);
} while (in_array($rnd, array_values($vars)));
Expand All @@ -75,11 +75,11 @@ public static function obfuscate($email, $text = null, $options = [])
var {$vars['link']} = '';
for (var i=0; i < {$vars['coded']}.length; i++) {
if ({$vars['key']}.indexOf({$vars['coded']}.charAt(i)) == -1) {
var ltr = {$vars['coded']}.charAt(i);
{$vars['link']} += (ltr);
var {$vars['ltr']} = {$vars['coded']}.charAt(i);
{$vars['link']} += ({$vars['ltr']});
} else {
var ltr = ({$vars['key']}.indexOf({$vars['coded']}.charAt(i)) - {$vars['coded']}.length + {$vars['key']}.length) % {$vars['key']}.length;
{$vars['link']} += ({$vars['key']}.charAt(ltr));
var {$vars['ltr']} = ({$vars['key']}.indexOf({$vars['coded']}.charAt(i)) - {$vars['coded']}.length + {$vars['key']}.length) % {$vars['key']}.length;
{$vars['link']} += ({$vars['key']}.charAt({$vars['ltr']}));
}
}
{$text};
Expand Down

0 comments on commit ae3019c

Please sign in to comment.