java = TRUE; } else { $this->java = FALSE; } return $this->java; } /** * @name abstract_java() * @purpose prints out the js-check. */ function abstract_java($script){ echo ""; } /** * @name parse() * @purpose parses text with emails. */ function parse($text){ $this->text = $text; $this->text = $this->replace_uri($this->text); return $this->text; } /** * @name replace_uri() * @purpose searches for emails and returns them to a functions until it returns the parsed string */ function replace_uri($text) { define('SEARCH', 0); define('REPLACE', 1); $codes = array(); $codes[SEARCH][] = "/([\s])([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))/si"; $codes[SEARCH][] = "/^([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,}))/si"; $codes[REPLACE][] = "\\1[mail]\\2[/mail]"; $codes[REPLACE][] = "[mail]\\0[/mail]"; $text = preg_replace($codes[SEARCH], $codes[REPLACE], $text); print '
';
		print_r($codes);
		print '
'; $codes = array(); $codes[SEARCH][] = "#[mail](S+?)[/mail]#ie"; $codes[REPLACE][] = 'encrypt("$2",$this->java)'; print '
';
		print_r($codes);
		print '
'; $text = preg_replace($codes[SEARCH], $codes[REPLACE], $text); return $text; } /** * @name encrypt() * @purpose encrypts and returns a single link */ function encrypt($email,$java = FALSE){ $this->email = $email; $this->origin = explode('@',$email); $this->email = $this->encrypt_email($this->email); if($java == TRUE){ $this->email = $this->transformtojs($this->email,$this->origin); } else { $this->email = ''.$origin[0].'AT'.$origin[1].''; } return $this->email; } /** * @name transformtojs() * @purpose transforms an email to a js-link */ function transformtojs($email,$origin){ $email = "\n"; return $email; } /** * @name encrypt_email() * @purpose converts an email to hexcode + modifier */ function encrypt_email($email){ $encoded = bin2hex($email); $encoded = chunk_split($encoded, 2, '%'); $encoded = '%' . substr($encoded, 0, strlen($encoded) - 1); return $encoded; } } ?>