diff --git a/_test/cases/inc/common_obfuscate.test.php b/_test/cases/inc/common_obfuscate.test.php new file mode 100644 index 0000000000000000000000000000000000000000..60042ac19d12523d03713bcef545b143982a6bd6 --- /dev/null +++ b/_test/cases/inc/common_obfuscate.test.php @@ -0,0 +1,29 @@ +<?php + +require_once DOKU_INC.'inc/common.php'; + +class common_obfuscate_test extends UnitTestCase { + + function test_none(){ + global $conf; + $conf['mailguard'] = 'none'; + $this->assertEqual(obfuscate('jon-doe@example.com'), 'jon-doe@example.com'); + } + + function test_hex(){ + global $conf; + $conf['mailguard'] = 'hex'; +print obfuscate('andi@foobar.com'); + $this->assertEqual(obfuscate('jon-doe@example.com'), + 'jon-doe@example.com'); + } + + function test_visible(){ + global $conf; + $conf['mailguard'] = 'visible'; + $this->assertEqual(obfuscate('jon-doe@example.com'), 'jon [dash] doe [at] example [dot] com'); + } + + +} +//Setup VIM: ex: et ts=4 enc=utf-8 : diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index d1e7a2354317620995f9f9c5eed1c4f44cd83806..d0f24d26f67d9059e83d06033a9f8013bcc56af3 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -671,9 +671,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //we just test for image here - we need to encode the title our self $this->_getLinkTitle($name, $address, $isImage); if ( !$isImage ) { - $link['class']='mail'; + $link['class']='mail JSnocheck'; } else { - $link['class']='media'; + $link['class']='media JSnocheck'; } $address = $this->_xmlEntities($address); @@ -684,8 +684,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer { }else{ $name = $this->_xmlEntities($name); } - - $link['url'] = 'mailto:'.rawurlencode($address); + + if($conf['mailguard'] == 'visible') $address = rawurlencode($address); + + $link['url'] = 'mailto:'.$address; $link['name'] = $name; $link['title'] = $title;