Skip to content

Instantly share code, notes, and snippets.

@jimbocoder
Created March 27, 2013 18:18
Show Gist options
  • Save jimbocoder/5256721 to your computer and use it in GitHub Desktop.
Save jimbocoder/5256721 to your computer and use it in GitHub Desktop.
Me breaking all the rules.
// This function steganographically (kinda) encodes the iso language code into a gmail email address.
// dot characters are used because gmail ignores these when routing mail, but we can still write gmail filters based on them.
function langemailification($lang) {
global $multiplexer_email; // I'm so sorry. I learned it from watching YOU.
list($user,$host) = split('@', $multiplexer_email);
// Break the user part of the email address into two parts: the first character, and the remainder. Call them A and B.
// We'll insert our dots 1) between A and B, and 2) after B.
// Like so: A...B...@gmail.com
list($a,$b) = array(
substr($user,0,1),
substr($user,1)
);
// Example return for $lang == 'es':
// langua e gecsrs s @gmail.com
// return "l.....anguagecsrs...................@gmail.com";
return $a . abc_to_dots($lang[0]) . $b . abc_to_dots($lang[1]) . "@$host";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment