public function testObfuscate() { $emailAddress = '*****@*****.**'; $direction = Email::obfuscate($emailAddress, 'direction'); $visible = Email::obfuscate($emailAddress, 'visible'); $hex = Email::obfuscate($emailAddress, 'hex'); $this->assertEquals('<span class="codedirection">moc.elpmaxe@1-tset</span>', $direction, 'obfuscate() correctly reverses the email direction'); $this->assertEquals('test [dash] 1 [at] example [dot] com', $visible, 'obfuscate() correctly obfuscates email characters'); $this->assertEquals('test-1@examp' . 'le.com', $hex, 'obfuscate() correctly returns hex representation of email'); }
/** * Return the appropriate error content for the given status code * * @param int $statusCode * @return string Content in an appropriate format for the current request */ public function output($statusCode) { // TODO: Refactor into a content-type option if (Director::is_ajax()) { return $this->getTitle(); } $renderer = Debug::create_debug_view(); $output = $renderer->renderHeader(); $output .= $renderer->renderInfo("Website Error", $this->getTitle(), $this->getBody()); if (Email::config()->admin_email) { $mailto = Email::obfuscate(Email::config()->admin_email); $output .= $renderer->renderParagraph('Contact an administrator: ' . $mailto . ''); } $output .= $renderer->renderFooter(); return $output; }